SPIRV-Cross/shaders-msl-no-opt/frag/texture-access-uint.swizzle.frag
Chip Davis 4302c5abfb Pass the swizzle constants as a buffer.
It'll be useful to have an "auxiliary buffer" for other builtins--e.g.
`DrawIndex` (which should be easier to implement now), or `ViewIndex`
when someone gets around to implementing multiview.

Pass this buffer to leaf functions as well.

Test that we handle this for integer textures as well.
2018-09-22 19:36:11 -05:00

54 lines
1.8 KiB
GLSL

#version 450
layout(binding = 0) uniform usampler1D tex1d;
layout(binding = 1) uniform usampler2D tex2d;
layout(binding = 2) uniform usampler3D tex3d;
layout(binding = 3) uniform usamplerCube texCube;
layout(binding = 4) uniform usampler2DArray tex2dArray;
layout(binding = 5) uniform usamplerCubeArray texCubeArray;
layout(binding = 6) uniform usamplerBuffer texBuffer;
void main()
{
// OpImageSampleImplicitLod
vec4 c = texture(tex1d, 0.0);
c = texture(tex2d, vec2(0.0, 0.0));
c = texture(tex3d, vec3(0.0, 0.0, 0.0));
c = texture(texCube, vec3(0.0, 0.0, 0.0));
c = texture(tex2dArray, vec3(0.0, 0.0, 0.0));
c = texture(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0));
// OpImageSampleProjImplicitLod
c = textureProj(tex1d, vec2(0.0, 1.0));
c = textureProj(tex2d, vec3(0.0, 0.0, 1.0));
c = textureProj(tex3d, vec4(0.0, 0.0, 0.0, 1.0));
// OpImageSampleExplicitLod
c = textureLod(tex1d, 0.0, 0.0);
c = textureLod(tex2d, vec2(0.0, 0.0), 0.0);
c = textureLod(tex3d, vec3(0.0, 0.0, 0.0), 0.0);
c = textureLod(texCube, vec3(0.0, 0.0, 0.0), 0.0);
c = textureLod(tex2dArray, vec3(0.0, 0.0, 0.0), 0.0);
c = textureLod(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 0.0);
// OpImageSampleProjExplicitLod
c = textureProjLod(tex1d, vec2(0.0, 1.0), 0.0);
c = textureProjLod(tex2d, vec3(0.0, 0.0, 1.0), 0.0);
c = textureProjLod(tex3d, vec4(0.0, 0.0, 0.0, 1.0), 0.0);
// OpImageFetch
c = texelFetch(tex1d, 0, 0);
c = texelFetch(tex2d, ivec2(0, 0), 0);
c = texelFetch(tex3d, ivec3(0, 0, 0), 0);
c = texelFetch(tex2dArray, ivec3(0, 0, 0), 0);
// Show that this transformation doesn't apply to Buffer images.
c = texelFetch(texBuffer, 0);
// OpImageGather
c = textureGather(tex2d, vec2(0.0, 0.0), 0);
c = textureGather(texCube, vec3(0.0, 0.0, 0.0), 1);
c = textureGather(tex2dArray, vec3(0.0, 0.0, 0.0), 2);
c = textureGather(texCubeArray, vec4(0.0, 0.0, 0.0, 0.0), 3);
}