Add cull mode to command (flutter/engine#13)
This commit is contained in:
committed by
Dan Field
parent
6fa7495680
commit
75460b68be
@@ -116,6 +116,18 @@ constexpr MTLIndexType ToMTLIndexType(IndexType type) {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr MTLCullMode ToMTLCullMode(CullMode mode) {
|
||||
switch (mode) {
|
||||
case CullMode::kNone:
|
||||
return MTLCullModeNone;
|
||||
case CullMode::kBackFace:
|
||||
return MTLCullModeBack;
|
||||
case CullMode::kFrontFace:
|
||||
return MTLCullModeFront;
|
||||
}
|
||||
return MTLCullModeNone;
|
||||
}
|
||||
|
||||
constexpr MTLBlendOperation ToMTLBlendOperation(BlendOperation type) {
|
||||
switch (type) {
|
||||
case BlendOperation::kAdd:
|
||||
|
||||
@@ -426,7 +426,7 @@ bool RenderPassMTL::EncodeCommands(Allocator& allocator,
|
||||
[encoder setFrontFacingWinding:command.winding == WindingOrder::kClockwise
|
||||
? MTLWindingClockwise
|
||||
: MTLWindingCounterClockwise];
|
||||
[encoder setCullMode:MTLCullModeNone];
|
||||
[encoder setCullMode:ToMTLCullMode(command.cull_mode)];
|
||||
[encoder setStencilReferenceValue:command.stencil_reference];
|
||||
if (command.viewport.has_value()) {
|
||||
auto v = command.viewport.value();
|
||||
|
||||
@@ -70,6 +70,7 @@ struct Command {
|
||||
std::string label;
|
||||
PrimitiveType primitive_type = PrimitiveType::kTriangle;
|
||||
WindingOrder winding = WindingOrder::kClockwise;
|
||||
CullMode cull_mode = CullMode::kNone;
|
||||
uint32_t stencil_reference = 0u;
|
||||
//----------------------------------------------------------------------------
|
||||
/// The viewport coordinates that the rasterizer linearly maps normalized
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#include "flutter/fml/hash_combine.h"
|
||||
#include "flutter/fml/macros.h"
|
||||
#include "impeller/geometry/color.h"
|
||||
#include "impeller/geometry/rect.h"
|
||||
#include "impeller/geometry/scalar.h"
|
||||
#include "impeller/geometry/color.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
@@ -135,6 +135,12 @@ enum class WindingOrder {
|
||||
kCounterClockwise,
|
||||
};
|
||||
|
||||
enum class CullMode {
|
||||
kNone,
|
||||
kFrontFace,
|
||||
kBackFace,
|
||||
};
|
||||
|
||||
enum class IndexType {
|
||||
kUnknown,
|
||||
k16bit,
|
||||
|
||||
Reference in New Issue
Block a user