shader: Implement early Z tests
This commit is contained in:
parent
09165ae189
commit
a83579b50a
|
@ -178,6 +178,9 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) {
|
||||||
if (program.info.stores_frag_depth) {
|
if (program.info.stores_frag_depth) {
|
||||||
ctx.AddExecutionMode(main, spv::ExecutionMode::DepthReplacing);
|
ctx.AddExecutionMode(main, spv::ExecutionMode::DepthReplacing);
|
||||||
}
|
}
|
||||||
|
if (ctx.profile.force_early_z) {
|
||||||
|
ctx.AddExecutionMode(main, spv::ExecutionMode::EarlyFragmentTests);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw NotImplementedException("Stage {}", program.stage);
|
throw NotImplementedException("Stage {}", program.stage);
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct Profile {
|
||||||
|
|
||||||
std::array<AttributeType, 32> generic_input_types{};
|
std::array<AttributeType, 32> generic_input_types{};
|
||||||
bool convert_depth_mode{};
|
bool convert_depth_mode{};
|
||||||
|
bool force_early_z{};
|
||||||
|
|
||||||
InputTopology input_topology{};
|
InputTopology input_topology{};
|
||||||
|
|
||||||
|
|
|
@ -934,6 +934,7 @@ Shader::Profile PipelineCache::MakeProfile(const GraphicsPipelineCacheKey& key,
|
||||||
profile.input_topology = Shader::InputTopology::TrianglesAdjacency;
|
profile.input_topology = Shader::InputTopology::TrianglesAdjacency;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
profile.force_early_z = key.state.early_z != 0;
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue