ESSL: Fix #1823: Conditions for when derivatives are in compute shader.

This commit is contained in:
John Kessenich 2019-07-15 01:20:18 -06:00
parent 1a6e8534ce
commit 33081e01d3
3 changed files with 91 additions and 26 deletions

View File

@ -1,5 +1,17 @@
#version 320 es
float fX;
float fY;
void main()
{
dFdx(fX);
dFdy(fY);
fwidth(fX);
dFdxCoarse(fX);
dFdyCoarse(fY);
fwidthCoarse(fX);
dFdxFine(fX);
dFdyFine(fY);
fwidthFine(fX);
}

View File

@ -1,10 +1,43 @@
320.comp
ERROR: 0:8: 'dFdx' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:9: 'dFdy' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:10: 'fwidth' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:11: 'dFdxCoarse' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:12: 'dFdyCoarse' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:13: 'fwidthCoarse' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:14: 'dFdxFine' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:15: 'dFdyFine' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 0:16: 'fwidthFine' : required extension not requested: GL_NV_compute_shader_derivatives
ERROR: 9 compilation errors. No code generated.
Shader version: 320
local_size = (1, 1, 1)
0:? Sequence
0:3 Function Definition: main( ( global void)
0:3 Function Parameters:
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
0:6 Function Parameters:
0:8 Sequence
0:8 dPdx ( global highp float)
0:8 'fX' ( global highp float)
0:9 dPdy ( global highp float)
0:9 'fY' ( global highp float)
0:10 fwidth ( global highp float)
0:10 'fX' ( global highp float)
0:11 dPdxCoarse ( global highp float)
0:11 'fX' ( global highp float)
0:12 dPdyCoarse ( global highp float)
0:12 'fY' ( global highp float)
0:13 fwidthCoarse ( global highp float)
0:13 'fX' ( global highp float)
0:14 dPdxFine ( global highp float)
0:14 'fX' ( global highp float)
0:15 dPdyFine ( global highp float)
0:15 'fY' ( global highp float)
0:16 fwidthFine ( global highp float)
0:16 'fX' ( global highp float)
0:? Linker Objects
0:? 'fX' ( global highp float)
0:? 'fY' ( global highp float)
Linked compute stage:
@ -12,8 +45,29 @@ Linked compute stage:
Shader version: 320
local_size = (1, 1, 1)
0:? Sequence
0:3 Function Definition: main( ( global void)
0:3 Function Parameters:
ERROR: node is still EOpNull!
0:6 Function Definition: main( ( global void)
0:6 Function Parameters:
0:8 Sequence
0:8 dPdx ( global highp float)
0:8 'fX' ( global highp float)
0:9 dPdy ( global highp float)
0:9 'fY' ( global highp float)
0:10 fwidth ( global highp float)
0:10 'fX' ( global highp float)
0:11 dPdxCoarse ( global highp float)
0:11 'fX' ( global highp float)
0:12 dPdyCoarse ( global highp float)
0:12 'fY' ( global highp float)
0:13 fwidthCoarse ( global highp float)
0:13 'fX' ( global highp float)
0:14 dPdxFine ( global highp float)
0:14 'fX' ( global highp float)
0:15 dPdyFine ( global highp float)
0:15 'fY' ( global highp float)
0:16 fwidthFine ( global highp float)
0:16 'fX' ( global highp float)
0:? Linker Objects
0:? 'fX' ( global highp float)
0:? 'fY' ( global highp float)

View File

@ -5144,14 +5144,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}
//E_SPV_NV_compute_shader_derivatives
stageBuiltins[EShLangCompute].append(derivatives);
stageBuiltins[EShLangCompute].append(derivativeControls);
stageBuiltins[EShLangCompute].append("\n");
if (profile == EEsProfile && version >= 320 || profile != EEsProfile && version >= 450) {
stageBuiltins[EShLangCompute].append(derivatives);
stageBuiltins[EShLangCompute].append(derivativeControls);
stageBuiltins[EShLangCompute].append("\n");
}
if (profile != EEsProfile && version >= 450) {
stageBuiltins[EShLangCompute].append(derivativesAndControl16bits);
stageBuiltins[EShLangCompute].append(derivativesAndControl64bits);
stageBuiltins[EShLangCompute].append("\n");
@ -8443,19 +8441,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable);
BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable);
}
if (((profile != EEsProfile && version >= 450) ||
(profile == EEsProfile && version >= 320)) &&
language == EShLangCompute) {
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
}
#endif
if ((profile != EEsProfile && version >= 450) ||
@ -8774,6 +8759,20 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("coopMatStoreNV", 1, &E_GL_NV_cooperative_matrix);
symbolTable.setFunctionExtensions("coopMatMulAddNV", 1, &E_GL_NV_cooperative_matrix);
#ifdef NV_EXTENSIONS
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
}
#endif
break;
#ifdef NV_EXTENSIONS
case EShLangRayGenNV: