From 585339f3cd0dd0b0ac8bdd51c1ce5ac5415c8682 Mon Sep 17 00:00:00 2001 From: Robert Konrad Date: Fri, 21 Apr 2017 14:55:01 +0200 Subject: [PATCH] Test HLSL cube maps --- reference/shaders-hlsl/frag/tex-sampling.frag | 5 +++++ shaders-hlsl/frag/tex-sampling.frag | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/reference/shaders-hlsl/frag/tex-sampling.frag b/reference/shaders-hlsl/frag/tex-sampling.frag index 5976a73..aff433e 100644 --- a/reference/shaders-hlsl/frag/tex-sampling.frag +++ b/reference/shaders-hlsl/frag/tex-sampling.frag @@ -4,6 +4,8 @@ Texture2D tex2d; SamplerState _tex2d_sampler; Texture3D tex3d; SamplerState _tex3d_sampler; +TextureCube texCube; +SamplerState _texCube_sampler; static float texCoord1d; static float2 texCoord2d; @@ -57,6 +59,9 @@ void frag_main() texcolor += tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); texcolor += tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f))); texcolor += tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f); + texcolor += texCube.Sample(_texCube_sampler, texCoord3d); + texcolor += texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f); + texcolor += texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f); FragColor = texcolor; } diff --git a/shaders-hlsl/frag/tex-sampling.frag b/shaders-hlsl/frag/tex-sampling.frag index b9718e6..2b2ca79 100644 --- a/shaders-hlsl/frag/tex-sampling.frag +++ b/shaders-hlsl/frag/tex-sampling.frag @@ -3,6 +3,7 @@ uniform sampler1D tex1d; uniform sampler2D tex2d; uniform sampler3D tex3d; +uniform samplerCube texCube; in float texCoord1d; in vec2 texCoord2d; @@ -32,5 +33,9 @@ void main() { texcolor += textureProj(tex3d, vec4(texCoord3d, 2.0)); texcolor += texture(tex3d, texCoord3d, 1.0); + texcolor += texture(texCube, texCoord3d); + texcolor += textureLod(texCube, texCoord3d, 2); + texcolor += texture(texCube, texCoord3d, 1.0); + FragColor = texcolor; }