Add-support-for-SPV_NV_compute_shader_derivatives
This commit is contained in:
@@ -1300,6 +1300,17 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
|
||||
glslangIntermediate->getLocalSize(1),
|
||||
glslangIntermediate->getLocalSize(2));
|
||||
#ifdef NV_EXTENSIONS
|
||||
if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) {
|
||||
builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV);
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV);
|
||||
builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives);
|
||||
} else if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupLinear) {
|
||||
builder.addCapability(spv::CapabilityComputeDerivativeGroupLinearNV);
|
||||
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupLinearNV);
|
||||
builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -4093,7 +4104,13 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
|
||||
if (cracked.lod) {
|
||||
params.lod = arguments[2 + extraArgs];
|
||||
++extraArgs;
|
||||
} else if (glslangIntermediate->getStage() != EShLangFragment) {
|
||||
} else if (glslangIntermediate->getStage() != EShLangFragment
|
||||
#ifdef NV_EXTENSIONS
|
||||
// NV_compute_shader_derivatives layout qualifiers allow for implicit LODs
|
||||
&& !(glslangIntermediate->getStage() == EShLangCompute &&
|
||||
(glslangIntermediate->getLayoutDerivativeModeNone() != glslang::LayoutDerivativeNone))
|
||||
#endif
|
||||
) {
|
||||
// we need to invent the default lod for an explicit lod instruction for a non-fragment stage
|
||||
noImplicitLod = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user