forked from gfx-rs/wgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix glsl backend errors regarding samplerCubeArrayShadow (gfx-rs#5171)
* add GL_EXT_texture_shadow_lod feature detection * allow more cases of cube depth texture sampling in glsl * add test for sampling a cubemap array depth texture with lod * add test for chosing GL_EXT_texture_shadow_lod over the grad workaround if instructed * add changelog entry for GL_EXT_texture_shadow_lod * fix criteria for requiring and using TEXTURE_SHADOW_LOD * require gles 320 for textureSampling over cubeArrayShadow * prevent false positives in TEXTURE_SHADOW_LOD in checks * make workaround_lod_with_grad usecase selection less context dependant * move 3d array texture error into the validator * correct ImageSample logic errors
- Loading branch information
1 parent
091d786
commit 7bc7220
Showing
11 changed files
with
190 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
( | ||
glsl: ( | ||
writer_flags: ("TEXTURE_SHADOW_LOD"), | ||
version: Embedded( | ||
version: 320, | ||
is_webgl: false | ||
), | ||
binding_map: {}, | ||
zero_initialize_workgroup_memory: true, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// see https://github.com/gfx-rs/wgpu/issues/4455 | ||
|
||
@group(0) @binding(0) var texture: texture_depth_cube_array; | ||
@group(0) @binding(1) var texture_sampler: sampler_comparison; | ||
|
||
@fragment | ||
fn main() -> @location(0) f32 { | ||
let pos = vec3<f32>(0.0); | ||
let array_index: i32 = 0; | ||
let depth: f32 = 0.0; | ||
return textureSampleCompareLevel(texture, texture_sampler, pos, array_index, depth); | ||
} |
11 changes: 11 additions & 0 deletions
11
naga/tests/in/use-gl-ext-over-grad-workaround-if-instructed.param.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
( | ||
glsl: ( | ||
writer_flags: ("TEXTURE_SHADOW_LOD"), | ||
version: Embedded( | ||
version: 320, | ||
is_webgl: false | ||
), | ||
binding_map: {}, | ||
zero_initialize_workgroup_memory: true, | ||
), | ||
) |
12 changes: 12 additions & 0 deletions
12
naga/tests/in/use-gl-ext-over-grad-workaround-if-instructed.wgsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// see https://github.com/gfx-rs/wgpu/pull/5171 | ||
|
||
@group(0) @binding(0) var texture: texture_depth_2d_array; | ||
@group(0) @binding(1) var texture_sampler: sampler_comparison; | ||
|
||
@fragment | ||
fn main() -> @location(0) f32 { | ||
let pos = vec2<f32>(0.0); | ||
let array_index: i32 = 0; | ||
let depth: f32 = 0.0; | ||
return textureSampleCompareLevel(texture, texture_sampler, pos, array_index, depth); | ||
} |
18 changes: 18 additions & 0 deletions
18
naga/tests/out/glsl/sample-cube-array-depth-lod.main.Fragment.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#version 320 es | ||
#extension GL_EXT_texture_cube_map_array : require | ||
#extension GL_EXT_texture_shadow_lod : require | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
uniform highp samplerCubeArrayShadow _group_0_binding_0_fs; | ||
|
||
layout(location = 0) out float _fs2p_location0; | ||
|
||
void main() { | ||
vec3 pos = vec3(0.0); | ||
float _e6 = textureLod(_group_0_binding_0_fs, vec4(pos, 0), 0.0, 0.0); | ||
_fs2p_location0 = _e6; | ||
return; | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
naga/tests/out/glsl/use-gl-ext-over-grad-workaround-if-instructed.main.Fragment.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#version 320 es | ||
#extension GL_EXT_texture_shadow_lod : require | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
uniform highp sampler2DArrayShadow _group_0_binding_0_fs; | ||
|
||
layout(location = 0) out float _fs2p_location0; | ||
|
||
void main() { | ||
vec2 pos = vec2(0.0); | ||
float _e6 = textureLod(_group_0_binding_0_fs, vec4(pos, 0, 0.0), 0.0); | ||
_fs2p_location0 = _e6; | ||
return; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters