From 81e2b006e1e968029cb85de5a1fc127f16625a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Capucho?= Date: Tue, 7 Jun 2022 15:31:18 +0100 Subject: [PATCH] glsl-in: Add test for nested depth texture calls Co-authored-by: Jasper St. Pierre --- tests/in/glsl/sampler-functions.frag | 16 +++++++++ tests/out/wgsl/sampler-functions-frag.wgsl | 41 ++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/in/glsl/sampler-functions.frag create mode 100644 tests/out/wgsl/sampler-functions-frag.wgsl diff --git a/tests/in/glsl/sampler-functions.frag b/tests/in/glsl/sampler-functions.frag new file mode 100644 index 0000000000..0d868780bf --- /dev/null +++ b/tests/in/glsl/sampler-functions.frag @@ -0,0 +1,16 @@ +#version 440 +precision mediump float; + +float CalcShadowPCF1(texture2D T_P_t_TextureDepth, samplerShadow S_P_t_TextureDepth, in vec3 t_ProjCoord) { + float t_Res = 0.0f; + t_Res += texture(sampler2DShadow(T_P_t_TextureDepth, S_P_t_TextureDepth), t_ProjCoord.xyz) * (1.0 / 5.0); + return t_Res; +} + +float CalcShadowPCF(texture2D T_P_t_TextureDepth, samplerShadow S_P_t_TextureDepth, in vec3 t_ProjCoord, in float t_Bias) { + t_ProjCoord.z += t_Bias; + return CalcShadowPCF1(T_P_t_TextureDepth, S_P_t_TextureDepth, t_ProjCoord.xyz); +} + +void main() { +} diff --git a/tests/out/wgsl/sampler-functions-frag.wgsl b/tests/out/wgsl/sampler-functions-frag.wgsl new file mode 100644 index 0000000000..e9e4830eea --- /dev/null +++ b/tests/out/wgsl/sampler-functions-frag.wgsl @@ -0,0 +1,41 @@ +fn CalcShadowPCF1_(T_P_t_TextureDepth: texture_depth_2d, S_P_t_TextureDepth: sampler_comparison, t_ProjCoord: vec3) -> f32 { + var t_ProjCoord_1: vec3; + var t_Res: f32 = 0.0; + + t_ProjCoord_1 = t_ProjCoord; + let _e6 = t_Res; + let _e7 = t_ProjCoord_1; + _ = _e7.xyz; + let _e9 = t_ProjCoord_1; + let _e10 = _e9.xyz; + let _e13 = textureSampleCompare(T_P_t_TextureDepth, S_P_t_TextureDepth, _e10.xy, _e10.z); + t_Res = (_e6 + (_e13 * (1.0 / 5.0))); + let _e19 = t_Res; + return _e19; +} + +fn CalcShadowPCF(T_P_t_TextureDepth_1: texture_depth_2d, S_P_t_TextureDepth_1: sampler_comparison, t_ProjCoord_2: vec3, t_Bias: f32) -> f32 { + var t_ProjCoord_3: vec3; + var t_Bias_1: f32; + + t_ProjCoord_3 = t_ProjCoord_2; + t_Bias_1 = t_Bias; + let _e7 = t_ProjCoord_3; + let _e9 = t_Bias_1; + t_ProjCoord_3.z = (_e7.z + _e9); + let _e11 = t_ProjCoord_3; + _ = _e11.xyz; + let _e13 = t_ProjCoord_3; + let _e15 = CalcShadowPCF1_(T_P_t_TextureDepth_1, S_P_t_TextureDepth_1, _e13.xyz); + return _e15; +} + +fn main_1() { + return; +} + +@fragment +fn main() { + main_1(); + return; +}