Skip to content

Commit

Permalink
Clean the implementation of GL_EXT_texture_shadow_lod.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pmistryNV authored Oct 2, 2023
1 parent 3f02132 commit 5ff0c04
Show file tree
Hide file tree
Showing 15 changed files with 443 additions and 92 deletions.
149 changes: 149 additions & 0 deletions Test/baseResults/glsl.es320.extTextureShadowLod.frag.out
Original file line number Diff line number Diff line change
@@ -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 changes: 160 additions & 0 deletions Test/baseResults/glsl.ext.textureShadowLod.frag.out
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions Test/baseResults/spv.ext.textureShadowLod.error.frag.out
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 0 additions & 6 deletions Test/baseResults/spv.ext.texture_shadow_lod.error.frag.out

This file was deleted.

22 changes: 22 additions & 0 deletions Test/glsl.es320.extTextureShadowLod.frag
Original file line number Diff line number Diff line change
@@ -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 changes: 32 additions & 0 deletions Test/glsl.ext.textureShadowLod.frag
Original file line number Diff line number Diff line change
@@ -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));
}

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5ff0c04

Please sign in to comment.