mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-07 13:39:55 +00:00
fix(shader): group compute derivatives by four consecutive lanes
A compute shader with an LOD query was emitted with DerivativeGroupQuadsKHR, which needs both workgroup dimensions even. A guest workgroup of N x 1 lanes failed SPIR-V validation (VUID-StandaloneSpirv-DerivativeGroupQuadsKHR-10151), which agc_driver_waterfall_images hits on every device. GFX10 forms a compute quad from four consecutive lanes, which is DerivativeGroupLinearKHR. The wave64 path no longer reshapes its workgroup to 2 x N, which only made the 2D quads match consecutive lanes.
This commit is contained in:
1 parent
9a3e2ac4da
commit
1ef97e517c
1 file changed
+2
-6
@@ -137,7 +137,7 @@ void DefineModule(SpirvEmitterState& state) {
|
||||
state.module.EmitCapability(spv::CapabilityGroupNonUniformShuffle);
|
||||
}
|
||||
if (state.requirements.computeDerivatives && StageOf(state) == IrShaderStage::Compute) {
|
||||
state.module.EmitCapability(spv::CapabilityComputeDerivativeGroupQuadsKHR);
|
||||
state.module.EmitCapability(spv::CapabilityComputeDerivativeGroupLinearKHR);
|
||||
state.module.EmitExtension("SPV_KHR_compute_shader_derivatives");
|
||||
}
|
||||
const bool fragmentBarycentric = StageOf(state) == IrShaderStage::Pixel && std::any_of(state.inputs.begin(), state.inputs.end(), [](const SpirvInputBinding& input) {
|
||||
@@ -170,10 +170,6 @@ void DefineModule(SpirvEmitterState& state) {
|
||||
localX = ((localX * localY * localZ + 63u) / 64u) * 32u;
|
||||
localY = 1u;
|
||||
localZ = 1u;
|
||||
if (state.requirements.computeDerivatives) {
|
||||
localY = localX / 2u;
|
||||
localX = 2u;
|
||||
}
|
||||
}
|
||||
state.module.AddExecutionMode(state.mainFunc, spv::ExecutionModeLocalSize, localX, localY, localZ);
|
||||
}
|
||||
@@ -210,7 +206,7 @@ void DefineModule(SpirvEmitterState& state) {
|
||||
}
|
||||
}
|
||||
if (state.requirements.computeDerivatives && StageOf(state) == IrShaderStage::Compute) {
|
||||
state.module.AddExecutionMode(state.mainFunc, spv::ExecutionModeDerivativeGroupQuadsKHR);
|
||||
state.module.AddExecutionMode(state.mainFunc, spv::ExecutionModeDerivativeGroupLinearKHR);
|
||||
}
|
||||
state.module.AddName(state.mainFunc, "main");
|
||||
if (state.requirements.functionLds) {
|
||||
|
||||
Reference in new issue
Block a user