VideoBackends:Metal: Use BitField for stuffing bits in pipeline ids
Also removes cullmode all handling, it's handled in CPU and DX11 backend doesn't specially handle it either
This commit is contained in:
parent
1eb3aaa548
commit
ee692abbe1
|
@ -220,7 +220,7 @@ static MTLCullMode Convert(CullMode cull)
|
||||||
switch (cull)
|
switch (cull)
|
||||||
{
|
{
|
||||||
case CullMode::None:
|
case CullMode::None:
|
||||||
case CullMode::All: // Handled by disabling rasterization
|
case CullMode::All: // Handled by VertexLoaderManager::RunVertices
|
||||||
return MTLCullModeNone;
|
return MTLCullModeNone;
|
||||||
case CullMode::Front:
|
case CullMode::Front:
|
||||||
return MTLCullModeFront;
|
return MTLCullModeFront;
|
||||||
|
@ -328,15 +328,13 @@ public:
|
||||||
blend.subtractAlpha = cfg.blending_state.subtractAlpha.Value();
|
blend.subtractAlpha = cfg.blending_state.subtractAlpha.Value();
|
||||||
// clang-format on
|
// clang-format on
|
||||||
}
|
}
|
||||||
// Throw extras in bits we don't otherwise use
|
|
||||||
if (cfg.rasterization_state.cullmode == CullMode::All)
|
|
||||||
blend.hex |= 1 << 29;
|
|
||||||
if (cfg.usage != AbstractPipelineUsage::GXUber)
|
if (cfg.usage != AbstractPipelineUsage::GXUber)
|
||||||
{
|
{
|
||||||
if (cfg.rasterization_state.primitive == PrimitiveType::Points)
|
if (cfg.rasterization_state.primitive == PrimitiveType::Points)
|
||||||
blend.hex |= 1 << 30;
|
is_points = true;
|
||||||
else if (cfg.rasterization_state.primitive == PrimitiveType::Lines)
|
else if (cfg.rasterization_state.primitive == PrimitiveType::Lines)
|
||||||
blend.hex |= 1 << 31;
|
is_lines = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PipelineID() { memset(this, 0, sizeof(*this)); }
|
PipelineID() { memset(this, 0, sizeof(*this)); }
|
||||||
|
@ -363,7 +361,13 @@ public:
|
||||||
VertexAttribute v_posmtx;
|
VertexAttribute v_posmtx;
|
||||||
const Shader* vertex_shader;
|
const Shader* vertex_shader;
|
||||||
const Shader* fragment_shader;
|
const Shader* fragment_shader;
|
||||||
BlendingState blend;
|
union
|
||||||
|
{
|
||||||
|
BlendingState blend;
|
||||||
|
// Throw extras in bits we don't otherwise use
|
||||||
|
BitField<30, 1, bool, u32> is_points;
|
||||||
|
BitField<31, 1, bool, u32> is_lines;
|
||||||
|
};
|
||||||
FramebufferState framebuffer;
|
FramebufferState framebuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -392,8 +396,6 @@ public:
|
||||||
RasterizationState rs = config.rasterization_state;
|
RasterizationState rs = config.rasterization_state;
|
||||||
if (config.usage != AbstractPipelineUsage::GXUber)
|
if (config.usage != AbstractPipelineUsage::GXUber)
|
||||||
[desc setInputPrimitiveTopology:GetClass(rs.primitive)];
|
[desc setInputPrimitiveTopology:GetClass(rs.primitive)];
|
||||||
if (rs.cullmode == CullMode::All)
|
|
||||||
[desc setRasterizationEnabled:NO];
|
|
||||||
MTLRenderPipelineColorAttachmentDescriptor* color0 =
|
MTLRenderPipelineColorAttachmentDescriptor* color0 =
|
||||||
[[desc colorAttachments] objectAtIndexedSubscript:0];
|
[[desc colorAttachments] objectAtIndexedSubscript:0];
|
||||||
BlendingState bs = config.blending_state;
|
BlendingState bs = config.blending_state;
|
||||||
|
|
Loading…
Reference in New Issue