-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for SM 3.0 texture sampling
- Loading branch information
Showing
2 changed files
with
140 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
uniform sampler1D tex1d; | ||
uniform sampler2D tex2d; | ||
uniform sampler3D tex3d; | ||
uniform samplerCUBE texCube; | ||
uniform sampler1D tex1dShadow; | ||
uniform sampler2D tex2dShadow; | ||
|
||
static float texCoord1d; | ||
static float2 texCoord2d; | ||
static float3 texCoord3d; | ||
static float4 FragColor; | ||
static float4 texCoord4d; | ||
|
||
struct SPIRV_Cross_Input | ||
{ | ||
float texCoord1d : TEXCOORD0; | ||
float2 texCoord2d : TEXCOORD1; | ||
float3 texCoord3d : TEXCOORD2; | ||
float4 texCoord4d : TEXCOORD3; | ||
}; | ||
|
||
struct SPIRV_Cross_Output | ||
{ | ||
float4 FragColor : COLOR0; | ||
}; | ||
|
||
void frag_main() | ||
{ | ||
float4 texcolor = tex1D(tex1d, texCoord1d); | ||
texcolor += tex1Dlod(tex1d, float4(texCoord1d, 0.0, 0.0, 2.0f)); | ||
texcolor += tex1Dgrad(tex1d, texCoord1d, 1.0f, 2.0f); | ||
float2 _34 = float2(texCoord1d, 2.0f); | ||
texcolor += tex1Dproj(tex1d, float4(_34.x, 0.0, 0.0, _34.y)); | ||
texcolor += tex1Dbias(tex1d, float4(texCoord1d, 0.0, 0.0, 1.0f)); | ||
texcolor += tex2D(tex2d, texCoord2d); | ||
texcolor += tex2Dlod(tex2d, float4(texCoord2d, 0.0, 2.0f)); | ||
texcolor += tex2Dgrad(tex2d, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f)); | ||
float3 _73 = float3(texCoord2d, 2.0f); | ||
texcolor += tex2Dproj(tex2d, float4(_73.xy, 0.0, _73.z)); | ||
texcolor += tex2Dbias(tex2d, float4(texCoord2d, 0.0, 1.0f)); | ||
texcolor += tex3D(tex3d, texCoord3d); | ||
texcolor += tex3Dlod(tex3d, float4(texCoord3d, 2.0f)); | ||
texcolor += tex3Dgrad(tex3d, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f)); | ||
float4 _112 = float4(texCoord3d, 2.0f); | ||
texcolor += tex3Dproj(tex3d, float4(_112.xyz, _112.w)); | ||
texcolor += tex3Dbias(tex3d, float4(texCoord3d, 1.0f)); | ||
texcolor += texCUBE(texCube, texCoord3d); | ||
texcolor += texCUBElod(texCube, float4(texCoord3d, 2.0f)); | ||
texcolor += texCUBEbias(texCube, float4(texCoord3d, 1.0f)); | ||
float3 _147 = float3(texCoord1d, 0.0f, 0.0f); | ||
float _148 = _147.z; | ||
texcolor.w += tex1Dproj(tex1dShadow, float4(_147.x, _148, _148, 1.0)); | ||
float3 _159 = float3(texCoord1d, 0.0f, 0.0f); | ||
float _160 = _159.z; | ||
texcolor.w += tex1Dlod(tex1dShadow, float4(_159.x, _160, _160, 2.0f)); | ||
float4 _168 = float4(texCoord1d, 0.0f, 0.0f, 2.0f); | ||
float _169 = _168.z; | ||
float4 _171 = _168; | ||
_171.y = _168.w; | ||
texcolor.w += tex1Dproj(tex1dShadow, float4(_171.x, _169, _169, _171.y)); | ||
float3 _179 = float3(texCoord1d, 0.0f, 0.0f); | ||
float _180 = _179.z; | ||
texcolor.w += tex1Dbias(tex1dShadow, float4(_179.x, _180, _180, 1.0f)); | ||
float3 _194 = float3(texCoord2d, 0.0f); | ||
texcolor.w += tex2Dproj(tex2dShadow, float4(_194.xy, _194.z, 1.0)); | ||
float3 _205 = float3(texCoord2d, 0.0f); | ||
texcolor.w += tex2Dlod(tex2dShadow, float4(_205.xy, _205.z, 2.0f)); | ||
float4 _216 = float4(texCoord2d, 0.0f, 2.0f); | ||
float4 _219 = _216; | ||
_219.z = _216.w; | ||
texcolor.w += tex2Dproj(tex2dShadow, float4(_219.xy, _216.z, _219.z)); | ||
float3 _229 = float3(texCoord2d, 0.0f); | ||
texcolor.w += tex2Dbias(tex2dShadow, float4(_229.xy, _229.z, 1.0f)); | ||
FragColor = texcolor; | ||
} | ||
|
||
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) | ||
{ | ||
texCoord1d = stage_input.texCoord1d; | ||
texCoord2d = stage_input.texCoord2d; | ||
texCoord3d = stage_input.texCoord3d; | ||
texCoord4d = stage_input.texCoord4d; | ||
frag_main(); | ||
SPIRV_Cross_Output stage_output; | ||
stage_output.FragColor = float4(FragColor); | ||
return stage_output; | ||
} |
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,53 @@ | ||
#version 450 | ||
|
||
layout(binding = 0) uniform sampler1D tex1d; | ||
layout(binding = 1) uniform sampler2D tex2d; | ||
layout(binding = 2) uniform sampler3D tex3d; | ||
layout(binding = 3) uniform samplerCube texCube; | ||
|
||
layout(binding = 4) uniform sampler1DShadow tex1dShadow; | ||
layout(binding = 5) uniform sampler2DShadow tex2dShadow; | ||
|
||
layout(location = 0) in float texCoord1d; | ||
layout(location = 1) in vec2 texCoord2d; | ||
layout(location = 2) in vec3 texCoord3d; | ||
layout(location = 3) in vec4 texCoord4d; | ||
|
||
layout(location = 0) out vec4 FragColor; | ||
|
||
void main() | ||
{ | ||
vec4 texcolor = texture(tex1d, texCoord1d); | ||
texcolor += textureLod(tex1d, texCoord1d, 2); | ||
texcolor += textureGrad(tex1d, texCoord1d, 1.0, 2.0); | ||
texcolor += textureProj(tex1d, vec2(texCoord1d, 2.0)); | ||
texcolor += texture(tex1d, texCoord1d, 1.0); | ||
|
||
texcolor += texture(tex2d, texCoord2d); | ||
texcolor += textureLod(tex2d, texCoord2d, 2); | ||
texcolor += textureGrad(tex2d, texCoord2d, vec2(1.0, 2.0), vec2(3.0, 4.0)); | ||
texcolor += textureProj(tex2d, vec3(texCoord2d, 2.0)); | ||
texcolor += texture(tex2d, texCoord2d, 1.0); | ||
|
||
texcolor += texture(tex3d, texCoord3d); | ||
texcolor += textureLod(tex3d, texCoord3d, 2); | ||
texcolor += textureGrad(tex3d, texCoord3d, vec3(1.0, 2.0, 3.0), vec3(4.0, 5.0, 6.0)); | ||
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); | ||
|
||
texcolor.a += texture(tex1dShadow, vec3(texCoord1d, 0.0, 0.0)); | ||
texcolor.a += textureLod(tex1dShadow, vec3(texCoord1d, 0.0, 0.0), 2); | ||
texcolor.a += textureProj(tex1dShadow, vec4(texCoord1d, 0.0, 0.0, 2.0)); | ||
texcolor.a += texture(tex1dShadow, vec3(texCoord1d, 0.0, 0.0), 1.0); | ||
|
||
texcolor.a += texture(tex2dShadow, vec3(texCoord2d, 0.0)); | ||
texcolor.a += textureLod(tex2dShadow, vec3(texCoord2d, 0.0), 2); | ||
texcolor.a += textureProj(tex2dShadow, vec4(texCoord2d, 0.0, 2.0)); | ||
texcolor.a += texture(tex2dShadow, vec3(texCoord2d, 0.0), 1.0); | ||
|
||
FragColor = texcolor; | ||
} |