mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
Clean the implementation of GL_EXT_texture_shadow_lod.
Move the parameter verifictation to a centralized place where all the builtins are verified for correctness. Add verification for the new builtins with version and extension check These builtins are supported on GLSL since version 130 and GLES since version 300.
This commit is contained in:
parent
3f02132668
commit
5ff0c048b7
149
Test/baseResults/glsl.es320.extTextureShadowLod.frag.out
Normal file
149
Test/baseResults/glsl.es320.extTextureShadowLod.frag.out
Normal file
@ -0,0 +1,149 @@
|
||||
glsl.es320.extTextureShadowLod.frag
|
||||
Shader version: 320
|
||||
Requested GL_EXT_texture_shadow_lod
|
||||
0:? Sequence
|
||||
0:12 Function Definition: main( ( global void)
|
||||
0:12 Function Parameters:
|
||||
0:14 Sequence
|
||||
0:14 move second child to first child ( temp lowp float)
|
||||
0:14 'c' ( out lowp float)
|
||||
0:14 texture ( global lowp float)
|
||||
0:14 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:14 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:14 Constant:
|
||||
0:14 0.000000
|
||||
0:15 move second child to first child ( temp lowp float)
|
||||
0:15 'c' ( out lowp float)
|
||||
0:15 texture ( global lowp float)
|
||||
0:15 'sca' ( uniform lowp samplerCubeArrayShadow)
|
||||
0:15 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:15 Constant:
|
||||
0:15 0.000000
|
||||
0:15 Constant:
|
||||
0:15 0.000000
|
||||
0:16 move second child to first child ( temp lowp float)
|
||||
0:16 'c' ( out lowp float)
|
||||
0:16 textureOffset ( global lowp float)
|
||||
0:16 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:16 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:16 Constant:
|
||||
0:16 0 (const int)
|
||||
0:16 0 (const int)
|
||||
0:16 Constant:
|
||||
0:16 0.000000
|
||||
0:17 move second child to first child ( temp lowp float)
|
||||
0:17 'c' ( out lowp float)
|
||||
0:17 textureLod ( global lowp float)
|
||||
0:17 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:17 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:17 Constant:
|
||||
0:17 0.000000
|
||||
0:18 move second child to first child ( temp lowp float)
|
||||
0:18 'c' ( out lowp float)
|
||||
0:18 textureLod ( global lowp float)
|
||||
0:18 'sc' ( uniform lowp samplerCubeShadow)
|
||||
0:18 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:18 Constant:
|
||||
0:18 0.000000
|
||||
0:19 move second child to first child ( temp lowp float)
|
||||
0:19 'c' ( out lowp float)
|
||||
0:19 textureLod ( global lowp float)
|
||||
0:19 'sca' ( uniform lowp samplerCubeArrayShadow)
|
||||
0:19 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:19 Constant:
|
||||
0:19 0.000000
|
||||
0:19 Constant:
|
||||
0:19 0.000000
|
||||
0:20 move second child to first child ( temp lowp float)
|
||||
0:20 'c' ( out lowp float)
|
||||
0:20 textureLodOffset ( global lowp float)
|
||||
0:20 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:20 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:20 Constant:
|
||||
0:20 0.000000
|
||||
0:20 Constant:
|
||||
0:20 0 (const int)
|
||||
0:20 0 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:? 'sca' ( uniform lowp samplerCubeArrayShadow)
|
||||
0:? 'sc' ( uniform lowp samplerCubeShadow)
|
||||
0:? 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:? 'c' ( out lowp float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 320
|
||||
Requested GL_EXT_texture_shadow_lod
|
||||
0:? Sequence
|
||||
0:12 Function Definition: main( ( global void)
|
||||
0:12 Function Parameters:
|
||||
0:14 Sequence
|
||||
0:14 move second child to first child ( temp lowp float)
|
||||
0:14 'c' ( out lowp float)
|
||||
0:14 texture ( global lowp float)
|
||||
0:14 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:14 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:14 Constant:
|
||||
0:14 0.000000
|
||||
0:15 move second child to first child ( temp lowp float)
|
||||
0:15 'c' ( out lowp float)
|
||||
0:15 texture ( global lowp float)
|
||||
0:15 'sca' ( uniform lowp samplerCubeArrayShadow)
|
||||
0:15 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:15 Constant:
|
||||
0:15 0.000000
|
||||
0:15 Constant:
|
||||
0:15 0.000000
|
||||
0:16 move second child to first child ( temp lowp float)
|
||||
0:16 'c' ( out lowp float)
|
||||
0:16 textureOffset ( global lowp float)
|
||||
0:16 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:16 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:16 Constant:
|
||||
0:16 0 (const int)
|
||||
0:16 0 (const int)
|
||||
0:16 Constant:
|
||||
0:16 0.000000
|
||||
0:17 move second child to first child ( temp lowp float)
|
||||
0:17 'c' ( out lowp float)
|
||||
0:17 textureLod ( global lowp float)
|
||||
0:17 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:17 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:17 Constant:
|
||||
0:17 0.000000
|
||||
0:18 move second child to first child ( temp lowp float)
|
||||
0:18 'c' ( out lowp float)
|
||||
0:18 textureLod ( global lowp float)
|
||||
0:18 'sc' ( uniform lowp samplerCubeShadow)
|
||||
0:18 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:18 Constant:
|
||||
0:18 0.000000
|
||||
0:19 move second child to first child ( temp lowp float)
|
||||
0:19 'c' ( out lowp float)
|
||||
0:19 textureLod ( global lowp float)
|
||||
0:19 'sca' ( uniform lowp samplerCubeArrayShadow)
|
||||
0:19 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:19 Constant:
|
||||
0:19 0.000000
|
||||
0:19 Constant:
|
||||
0:19 0.000000
|
||||
0:20 move second child to first child ( temp lowp float)
|
||||
0:20 'c' ( out lowp float)
|
||||
0:20 textureLodOffset ( global lowp float)
|
||||
0:20 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:20 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:20 Constant:
|
||||
0:20 0.000000
|
||||
0:20 Constant:
|
||||
0:20 0 (const int)
|
||||
0:20 0 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 's2da' ( uniform lowp sampler2DArrayShadow)
|
||||
0:? 'sca' ( uniform lowp samplerCubeArrayShadow)
|
||||
0:? 'sc' ( uniform lowp samplerCubeShadow)
|
||||
0:? 'tc' ( smooth in lowp 4-component vector of float)
|
||||
0:? 'c' ( out lowp float)
|
||||
|
160
Test/baseResults/glsl.ext.textureShadowLod.frag.out
Normal file
160
Test/baseResults/glsl.ext.textureShadowLod.frag.out
Normal file
@ -0,0 +1,160 @@
|
||||
glsl.ext.textureShadowLod.frag
|
||||
ERROR: 0:24: 'texture(..., float bias)' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 0:25: 'texture(..., float bias)' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 0:26: 'textureOffset for sampler2DArrayShadow' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 0:27: 'textureLod(..., float lod)' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 0:28: 'textureLod(..., float lod)' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 0:29: 'textureLod(..., float lod)' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 0:30: 'textureLodOffset for sampler2DArrayShadow' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 7 compilation errors. No code generated.
|
||||
|
||||
|
||||
Shader version: 450
|
||||
Requested GL_EXT_texture_shadow_lod
|
||||
ERROR: node is still EOpNull!
|
||||
0:11 Function Definition: pass( ( global void)
|
||||
0:11 Function Parameters:
|
||||
0:12 Sequence
|
||||
0:12 move second child to first child ( temp float)
|
||||
0:12 'c' ( out float)
|
||||
0:12 texture ( global float)
|
||||
0:12 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:12 'tc' ( smooth in 4-component vector of float)
|
||||
0:12 Constant:
|
||||
0:12 0.000000
|
||||
0:13 move second child to first child ( temp float)
|
||||
0:13 'c' ( out float)
|
||||
0:13 texture ( global float)
|
||||
0:13 'sca' ( uniform samplerCubeArrayShadow)
|
||||
0:13 'tc' ( smooth in 4-component vector of float)
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:13 Constant:
|
||||
0:13 0.000000
|
||||
0:14 move second child to first child ( temp float)
|
||||
0:14 'c' ( out float)
|
||||
0:14 textureOffset ( global float)
|
||||
0:14 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:14 'tc' ( smooth in 4-component vector of float)
|
||||
0:14 Constant:
|
||||
0:14 0 (const int)
|
||||
0:14 0 (const int)
|
||||
0:14 Constant:
|
||||
0:14 0.000000
|
||||
0:15 move second child to first child ( temp float)
|
||||
0:15 'c' ( out float)
|
||||
0:15 textureLod ( global float)
|
||||
0:15 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:15 'tc' ( smooth in 4-component vector of float)
|
||||
0:15 Constant:
|
||||
0:15 0.000000
|
||||
0:16 move second child to first child ( temp float)
|
||||
0:16 'c' ( out float)
|
||||
0:16 textureLod ( global float)
|
||||
0:16 'sc' ( uniform samplerCubeShadow)
|
||||
0:16 'tc' ( smooth in 4-component vector of float)
|
||||
0:16 Constant:
|
||||
0:16 0.000000
|
||||
0:17 move second child to first child ( temp float)
|
||||
0:17 'c' ( out float)
|
||||
0:17 textureLod ( global float)
|
||||
0:17 'sca' ( uniform samplerCubeArrayShadow)
|
||||
0:17 'tc' ( smooth in 4-component vector of float)
|
||||
0:17 Constant:
|
||||
0:17 0.000000
|
||||
0:17 Constant:
|
||||
0:17 0.000000
|
||||
0:18 move second child to first child ( temp float)
|
||||
0:18 'c' ( out float)
|
||||
0:18 textureLodOffset ( global float)
|
||||
0:18 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:18 'tc' ( smooth in 4-component vector of float)
|
||||
0:18 Constant:
|
||||
0:18 0.000000
|
||||
0:18 Constant:
|
||||
0:18 0 (const int)
|
||||
0:18 0 (const int)
|
||||
0:22 Function Definition: fail( ( global void)
|
||||
0:22 Function Parameters:
|
||||
0:24 Sequence
|
||||
0:24 move second child to first child ( temp float)
|
||||
0:24 'c' ( out float)
|
||||
0:24 texture ( global float)
|
||||
0:24 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:24 'tc' ( smooth in 4-component vector of float)
|
||||
0:24 Constant:
|
||||
0:24 0.000000
|
||||
0:25 move second child to first child ( temp float)
|
||||
0:25 'c' ( out float)
|
||||
0:25 texture ( global float)
|
||||
0:25 'sca' ( uniform samplerCubeArrayShadow)
|
||||
0:25 'tc' ( smooth in 4-component vector of float)
|
||||
0:25 Constant:
|
||||
0:25 0.000000
|
||||
0:25 Constant:
|
||||
0:25 0.000000
|
||||
0:26 move second child to first child ( temp float)
|
||||
0:26 'c' ( out float)
|
||||
0:26 textureOffset ( global float)
|
||||
0:26 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:26 'tc' ( smooth in 4-component vector of float)
|
||||
0:26 Constant:
|
||||
0:26 0 (const int)
|
||||
0:26 0 (const int)
|
||||
0:26 Constant:
|
||||
0:26 0.000000
|
||||
0:27 move second child to first child ( temp float)
|
||||
0:27 'c' ( out float)
|
||||
0:27 textureLod ( global float)
|
||||
0:27 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:27 'tc' ( smooth in 4-component vector of float)
|
||||
0:27 Constant:
|
||||
0:27 0.000000
|
||||
0:28 move second child to first child ( temp float)
|
||||
0:28 'c' ( out float)
|
||||
0:28 textureLod ( global float)
|
||||
0:28 'sc' ( uniform samplerCubeShadow)
|
||||
0:28 'tc' ( smooth in 4-component vector of float)
|
||||
0:28 Constant:
|
||||
0:28 0.000000
|
||||
0:29 move second child to first child ( temp float)
|
||||
0:29 'c' ( out float)
|
||||
0:29 textureLod ( global float)
|
||||
0:29 'sca' ( uniform samplerCubeArrayShadow)
|
||||
0:29 'tc' ( smooth in 4-component vector of float)
|
||||
0:29 Constant:
|
||||
0:29 0.000000
|
||||
0:29 Constant:
|
||||
0:29 0.000000
|
||||
0:30 move second child to first child ( temp float)
|
||||
0:30 'c' ( out float)
|
||||
0:30 textureLodOffset ( global float)
|
||||
0:30 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:30 'tc' ( smooth in 4-component vector of float)
|
||||
0:30 Constant:
|
||||
0:30 0.000000
|
||||
0:30 Constant:
|
||||
0:30 0 (const int)
|
||||
0:30 0 (const int)
|
||||
0:? Linker Objects
|
||||
0:? 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:? 'sca' ( uniform samplerCubeArrayShadow)
|
||||
0:? 'sc' ( uniform samplerCubeShadow)
|
||||
0:? 'c' ( out float)
|
||||
0:? 'tc' ( smooth in 4-component vector of float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
|
||||
|
||||
Shader version: 450
|
||||
Requested GL_EXT_texture_shadow_lod
|
||||
ERROR: node is still EOpNull!
|
||||
0:? Linker Objects
|
||||
0:? 's2da' ( uniform sampler2DArrayShadow)
|
||||
0:? 'sca' ( uniform samplerCubeArrayShadow)
|
||||
0:? 'sc' ( uniform samplerCubeShadow)
|
||||
0:? 'c' ( out float)
|
||||
0:? 'tc' ( smooth in 4-component vector of float)
|
||||
|
6
Test/baseResults/spv.ext.textureShadowLod.error.frag.out
Normal file
6
Test/baseResults/spv.ext.textureShadowLod.error.frag.out
Normal file
@ -0,0 +1,6 @@
|
||||
spv.ext.textureShadowLod.error.frag
|
||||
ERROR: 0:11: 'textureLod(..., float lod)' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 1 compilation errors. No code generated.
|
||||
|
||||
|
||||
SPIR-V is not generated for failed compile or link
|
@ -1,4 +1,4 @@
|
||||
spv.ext.texture_shadow_lod.frag
|
||||
spv.ext.textureShadowLod.frag
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000b
|
||||
// Id's are bound by 55
|
@ -1,6 +0,0 @@
|
||||
spv.ext.texture_shadow_lod.error.frag
|
||||
ERROR: 0:11: 'textureLod' : required extension not requested: GL_EXT_texture_shadow_lod
|
||||
ERROR: 1 compilation errors. No code generated.
|
||||
|
||||
|
||||
SPIR-V is not generated for failed compile or link
|
22
Test/glsl.es320.extTextureShadowLod.frag
Normal file
22
Test/glsl.es320.extTextureShadowLod.frag
Normal file
@ -0,0 +1,22 @@
|
||||
#version 320 es
|
||||
|
||||
#extension GL_EXT_texture_shadow_lod : enable
|
||||
|
||||
|
||||
uniform lowp sampler2DArrayShadow s2da;
|
||||
uniform lowp samplerCubeArrayShadow sca;
|
||||
uniform lowp samplerCubeShadow sc;
|
||||
|
||||
in lowp vec4 tc;
|
||||
out lowp float c;
|
||||
void main()
|
||||
{
|
||||
c = texture(s2da, tc, 0.0);
|
||||
c = texture(sca, tc, 0.0, 0.0);
|
||||
c = textureOffset(s2da, tc, ivec2(0.0), 0.0);
|
||||
c = textureLod(s2da, tc, 0.0);
|
||||
c = textureLod(sc, tc, 0.0);
|
||||
c = textureLod(sca, tc, 0.0, 0.0);
|
||||
c = textureLodOffset(s2da, tc, 0.0, ivec2(0.0));
|
||||
|
||||
}
|
32
Test/glsl.ext.textureShadowLod.frag
Normal file
32
Test/glsl.ext.textureShadowLod.frag
Normal file
@ -0,0 +1,32 @@
|
||||
#version 450
|
||||
#extension GL_EXT_texture_shadow_lod : enable
|
||||
|
||||
uniform sampler2DArrayShadow s2da;
|
||||
uniform samplerCubeArrayShadow sca;
|
||||
uniform samplerCubeShadow sc;
|
||||
|
||||
out float c;
|
||||
in vec4 tc;
|
||||
|
||||
void pass() {
|
||||
c = texture(s2da, tc, 0.0);
|
||||
c = texture(sca, tc, 0.0, 0.0);
|
||||
c = textureOffset(s2da, tc, ivec2(0.0), 0.0);
|
||||
c = textureLod(s2da, tc, 0.0);
|
||||
c = textureLod(sc, tc, 0.0);
|
||||
c = textureLod(sca, tc, 0.0, 0.0);
|
||||
c = textureLodOffset(s2da, tc, 0.0, ivec2(0.0));
|
||||
}
|
||||
|
||||
#extension GL_EXT_texture_shadow_lod : disable
|
||||
void fail() {
|
||||
// All these builtins should fail to compile
|
||||
c = texture(s2da, tc, 0.0);
|
||||
c = texture(sca, tc, 0.0, 0.0);
|
||||
c = textureOffset(s2da, tc, ivec2(0.0), 0.0);
|
||||
c = textureLod(s2da, tc, 0.0);
|
||||
c = textureLod(sc, tc, 0.0);
|
||||
c = textureLod(sca, tc, 0.0, 0.0);
|
||||
c = textureLodOffset(s2da, tc, 0.0, ivec2(0.0));
|
||||
}
|
||||
|
@ -52,9 +52,6 @@
|
||||
//
|
||||
|
||||
#include "Initialize.h"
|
||||
#include "../Include/intermediate.h"
|
||||
#include "ScanContext.h"
|
||||
#include "preprocessor/PpContext.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
@ -324,32 +321,6 @@ const CustomFunction CustomFunctions[] = {
|
||||
{ EOpNull }
|
||||
};
|
||||
|
||||
// Creates a parser that is separate from the main parsing context and meant for temporary use
|
||||
struct TempParser {
|
||||
TempParser(const TString& str, EShLanguage language, int version, EProfile profile, SpvVersion spvVersion)
|
||||
: interm(language), parseContext(table, interm, false, version, profile, spvVersion, language, sink, true,
|
||||
EShMsgDefault, &dummyEntryPoint),
|
||||
inputStr(str.data()), stringSize(str.size())
|
||||
{
|
||||
table.push();
|
||||
parseContext.setScanContext(&scanContext);
|
||||
parseContext.setPpContext(&context);
|
||||
parseContext.parseShaderStrings(context, input, false);
|
||||
}
|
||||
|
||||
TSymbolTable table;
|
||||
TIntermediate interm;
|
||||
TInfoSink sink;
|
||||
TString dummyEntryPoint;
|
||||
TParseContext parseContext;
|
||||
TShader::ForbidIncluder includer;
|
||||
TPpContext context{parseContext, "", includer};
|
||||
TScanContext scanContext{parseContext};
|
||||
const char* inputStr;
|
||||
size_t stringSize;
|
||||
TInputScanner input{1, &inputStr, &stringSize};
|
||||
};
|
||||
|
||||
// For the given table of functions, add all the indicated prototypes for each
|
||||
// one, to be returned in the passed in decls.
|
||||
void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
|
||||
@ -4137,6 +4108,19 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"\n");
|
||||
}
|
||||
|
||||
// Builtins for GL_EXT_texture_shadow_lod
|
||||
if ((profile == EEsProfile && version >= 300) || ((profile != EEsProfile && version >= 130))) {
|
||||
commonBuiltins.append(
|
||||
"float texture(sampler2DArrayShadow, vec4, float);"
|
||||
"float texture(samplerCubeArrayShadow, vec4, float, float);"
|
||||
"float textureLod(sampler2DArrayShadow, vec4, float);"
|
||||
"float textureLod(samplerCubeShadow, vec4, float);"
|
||||
"float textureLod(samplerCubeArrayShadow, vec4, float, float);"
|
||||
"float textureLodOffset(sampler2DArrayShadow, vec4, float, ivec2);"
|
||||
"float textureOffset(sampler2DArrayShadow, vec4 , ivec2, float);"
|
||||
"\n");
|
||||
}
|
||||
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
stageBuiltins[EShLangFragment].append(derivativesAndControl64bits);
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
@ -4863,32 +4847,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
|
||||
}
|
||||
|
||||
// GL_EXT_texture_shadow_lod overloads
|
||||
if (profile == EEsProfile) { // ES
|
||||
if (version >= 300) {
|
||||
textureShadowLodFunctions += "float texture(sampler2DArrayShadow, vec4, float);"
|
||||
"float textureOffset(sampler2DArrayShadow, vec4, ivec2, float);"
|
||||
"float textureLod(sampler2DArrayShadow, vec4, float);"
|
||||
"float textureLodOffset(sampler2DArrayShadow, vec4, float, ivec2);"
|
||||
"\n";
|
||||
}
|
||||
if (version >= 320) {
|
||||
textureShadowLodFunctions += "float texture(samplerCubeArrayShadow, vec4, float, float);"
|
||||
"float textureLod(samplerCubeShadow, vec4, float);"
|
||||
"float textureLod(samplerCubeArrayShadow, vec4, float, float);"
|
||||
"\n";
|
||||
}
|
||||
} else if (version >= 130) { // Desktop
|
||||
textureShadowLodFunctions += "float texture(sampler2DArrayShadow, vec4, float);"
|
||||
"float texture(samplerCubeArrayShadow, vec4, float, float);"
|
||||
"float textureOffset(sampler2DArrayShadow, vec4, ivec2, float);"
|
||||
"float textureLod(sampler2DArrayShadow, vec4, float);"
|
||||
"float textureLod(samplerCubeShadow, vec4, float);"
|
||||
"float textureLod(samplerCubeArrayShadow, vec4, float, float);"
|
||||
"float textureLodOffset(sampler2DArrayShadow, vec4, float, ivec2);"
|
||||
"\n";
|
||||
}
|
||||
commonBuiltins.append(textureShadowLodFunctions);
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
@ -8816,13 +8774,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setFunctionExtensions("textureBlockMatchSADQCOM", 1, &E_GL_QCOM_image_processing);
|
||||
symbolTable.setFunctionExtensions("textureBlockMatchSSDQCOM", 1, &E_GL_QCOM_image_processing);
|
||||
}
|
||||
|
||||
{
|
||||
TempParser parser(textureShadowLodFunctions, language, version, profile, spvVersion);
|
||||
parser.table.processAllSymbols([&symbolTable](TSymbol* sym) {
|
||||
symbolTable.setSingleFunctionExtensions(sym->getMangledName().data(), 1, &E_GL_EXT_texture_shadow_lod);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case EShLangCompute:
|
||||
|
@ -105,11 +105,6 @@ protected:
|
||||
const char* postfixes[5];
|
||||
const char* prefixes[EbtNumTypes];
|
||||
int dimMap[EsdNumDims];
|
||||
|
||||
private:
|
||||
// Holds the function declarations for GL_EXT_texture_shadow_lod
|
||||
// This extension is somewhat unique in the sense it defines overloads for built-in functions, rather than new functions.
|
||||
TString textureShadowLodFunctions;
|
||||
};
|
||||
|
||||
// change this back to false if depending on textual spellings of texturing calls when consuming the AST
|
||||
|
@ -2172,6 +2172,37 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EOpTexture:
|
||||
case EOpTextureLod:
|
||||
{
|
||||
if ((fnCandidate.getParamCount() > 2) && ((*argp)[1]->getAsTyped()->getType().getBasicType() == EbtFloat) &&
|
||||
((*argp)[1]->getAsTyped()->getType().getVectorSize() == 4) && fnCandidate[0].type->getSampler().shadow) {
|
||||
featureString = fnCandidate.getName();
|
||||
if (callNode.getOp() == EOpTexture)
|
||||
featureString += "(..., float bias)";
|
||||
else
|
||||
featureString += "(..., float lod)";
|
||||
feature = featureString.c_str();
|
||||
|
||||
if ((fnCandidate[0].type->getSampler().dim == Esd2D && fnCandidate[0].type->getSampler().arrayed) || //2D Array Shadow
|
||||
(fnCandidate[0].type->getSampler().dim == EsdCube && fnCandidate[0].type->getSampler().arrayed && fnCandidate.getParamCount() > 3) || // Cube Array Shadow
|
||||
(fnCandidate[0].type->getSampler().dim == EsdCube && callNode.getOp() == EOpTextureLod)) { // Cube Shadow
|
||||
requireExtensions(loc, 1, &E_GL_EXT_texture_shadow_lod, feature);
|
||||
if (isEsProfile()) {
|
||||
if (version < 320 &&
|
||||
!extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
|
||||
error(loc, "GL_EXT_texture_shadow_lod not supported for this ES version", feature, "");
|
||||
else
|
||||
profileRequires(loc, EEsProfile, 320, nullptr, feature);
|
||||
} else { // Desktop
|
||||
profileRequires(loc, ~EEsProfile, 130, nullptr, feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EOpSparseTextureGather:
|
||||
case EOpSparseTextureGatherOffset:
|
||||
case EOpSparseTextureGatherOffsets:
|
||||
@ -2286,12 +2317,36 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
||||
if (callNode.getOp() == EOpTextureOffset) {
|
||||
TSampler s = arg0->getType().getSampler();
|
||||
if (s.is2D() && s.isArrayed() && s.isShadow()) {
|
||||
if (isEsProfile())
|
||||
if (
|
||||
((*argp)[1]->getAsTyped()->getType().getBasicType() == EbtFloat) &&
|
||||
((*argp)[1]->getAsTyped()->getType().getVectorSize() == 4) &&
|
||||
(fnCandidate.getParamCount() == 4)) {
|
||||
featureString = fnCandidate.getName() + " for sampler2DArrayShadow";
|
||||
feature = featureString.c_str();
|
||||
requireExtensions(loc, 1, &E_GL_EXT_texture_shadow_lod, feature);
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
||||
profileRequires(loc, ~EEsProfile, 130, nullptr, feature);
|
||||
}
|
||||
else if (isEsProfile())
|
||||
error(loc, "TextureOffset does not support sampler2DArrayShadow : ", "sampler", "ES Profile");
|
||||
else if (version <= 420)
|
||||
error(loc, "TextureOffset does not support sampler2DArrayShadow : ", "sampler", "version <= 420");
|
||||
}
|
||||
}
|
||||
|
||||
if (callNode.getOp() == EOpTextureLodOffset) {
|
||||
TSampler s = arg0->getType().getSampler();
|
||||
if (s.is2D() && s.isArrayed() && s.isShadow() &&
|
||||
((*argp)[1]->getAsTyped()->getType().getBasicType() == EbtFloat) &&
|
||||
((*argp)[1]->getAsTyped()->getType().getVectorSize() == 4) &&
|
||||
(fnCandidate.getParamCount() == 4)) {
|
||||
featureString = fnCandidate.getName() + " for sampler2DArrayShadow";
|
||||
feature = featureString.c_str();
|
||||
profileRequires(loc, EEsProfile, 300, nullptr, feature);
|
||||
profileRequires(loc, ~EEsProfile, 130, nullptr, feature);
|
||||
requireExtensions(loc, 1, &E_GL_EXT_texture_shadow_lod, feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -492,12 +492,6 @@ public:
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
template <typename ProcSymFn> void processAllSymbols(ProcSymFn procSym) const
|
||||
{
|
||||
for (auto itr : level)
|
||||
procSym(itr.second);
|
||||
}
|
||||
|
||||
void findFunctionNameList(const TString& name, TVector<const TFunction*>& list)
|
||||
{
|
||||
size_t parenAt = name.find_first_of('(');
|
||||
@ -807,15 +801,6 @@ public:
|
||||
return symbol;
|
||||
}
|
||||
|
||||
template <typename ProcSymFn> void processAllSymbols(ProcSymFn procSym)
|
||||
{
|
||||
int level = currentLevel();
|
||||
do {
|
||||
table[level]->processAllSymbols(procSym);
|
||||
--level;
|
||||
} while (level >= 0);
|
||||
}
|
||||
|
||||
void retargetSymbol(const TString& from, const TString& to) {
|
||||
int level = currentLevel();
|
||||
table[level]->retargetSymbol(from, to);
|
||||
|
@ -281,6 +281,8 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
"glsl.es320.subgroupShuffleRelative.comp",
|
||||
"glsl.es320.subgroupQuad.comp",
|
||||
"glsl.es320.subgroupVote.comp",
|
||||
"glsl.es320.extTextureShadowLod.frag",
|
||||
"glsl.ext.textureShadowLod.frag",
|
||||
"terminate.frag",
|
||||
"terminate.vert",
|
||||
"negativeWorkGroupSize.comp",
|
||||
|
@ -537,8 +537,8 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
"spv.atomicAdd.bufferReference.comp",
|
||||
"spv.fragmentShaderBarycentric3.frag",
|
||||
"spv.fragmentShaderBarycentric4.frag",
|
||||
"spv.ext.texture_shadow_lod.frag",
|
||||
"spv.ext.texture_shadow_lod.error.frag",
|
||||
"spv.ext.textureShadowLod.frag",
|
||||
"spv.ext.textureShadowLod.error.frag",
|
||||
"spv.floatFetch.frag",
|
||||
"spv.atomicRvalue.error.vert",
|
||||
})),
|
||||
|
Loading…
Reference in New Issue
Block a user