1#version 450 2#extension GL_ARB_sparse_texture2: enable 3 4uniform sampler2D s2D; 5uniform sampler3D s3D; 6uniform sampler2DShadow s2DShadow; 7uniform samplerCubeShadow sCubeShadow; 8uniform sampler2DArrayShadow s2DArrayShadow; 9uniform sampler2DRectShadow s2DRectShadow; 10uniform samplerCubeArrayShadow sCubeArrayShadow; 11uniform sampler2DMS s2DMS; 12 13uniform isamplerCube isCube; 14uniform isampler2DArray is2DArray; 15 16uniform usamplerCubeArray usCubeArray; 17uniform usampler2DRect us2DRect; 18 19layout(rgba32f) uniform image2D i2D; 20layout(rgba32i) uniform iimage3D ii3D; 21layout(rgba32f) uniform image2DMS i2DMS; 22 23in vec2 c2; 24in vec3 c3; 25in vec4 c4; 26 27in flat ivec2 ic2; 28in flat ivec3 ic3; 29 30out vec4 outColor; 31 32void main() 33{ 34 int resident = 0; 35 vec4 texel = vec4(0.0); 36 ivec4 itexel = ivec4(0); 37 uvec4 utexel = uvec4(0); 38 39 resident |= sparseTextureARB(s2D, c2, texel); 40 resident |= sparseTextureARB(s3D, c3, texel, 2.0); 41 resident |= sparseTextureARB(isCube, c3, itexel); 42 resident |= sparseTextureARB(s2DShadow, c3, texel.x); 43 resident |= sparseTextureARB(sCubeArrayShadow, c4, 1.0, texel.x); 44 45 resident |= sparseTextureLodARB(s2D, c2, 2.0, texel); 46 resident |= sparseTextureLodARB(usCubeArray, c4, 1.0, utexel); 47 resident |= sparseTextureLodARB(s2DShadow, c3, 2.0, texel.y); 48 49 resident |= sparseTextureOffsetARB(s3D, c3, ivec3(2), texel, 2.0); 50 resident |= sparseTextureOffsetARB(us2DRect, c2, ivec2(3), utexel); 51 resident |= sparseTextureOffsetARB(s2DArrayShadow, c4, ivec2(5), texel.z); 52 53 resident |= sparseTexelFetchARB(s2D, ivec2(c2), 2, texel); 54 resident |= sparseTexelFetchARB(us2DRect, ivec2(c2), utexel); 55 resident |= sparseTexelFetchARB(s2DMS, ivec2(c2), 4, texel); 56 57 resident |= sparseTexelFetchOffsetARB(s3D, ivec3(c3), 2, ivec3(4), texel); 58 resident |= sparseTexelFetchOffsetARB(us2DRect, ivec2(c2), ivec2(3), utexel); 59 60 resident |= sparseTextureLodOffsetARB(s2D, c2, 2.0, ivec2(5), texel); 61 resident |= sparseTextureLodOffsetARB(is2DArray, c3, 2.0, ivec2(6), itexel); 62 resident |= sparseTextureLodOffsetARB(s2DShadow, c3, 2.0, ivec2(7), texel.z); 63 64 resident |= sparseTextureGradARB(s3D, c3, c3, c3, texel); 65 resident |= sparseTextureGradARB(sCubeShadow, c4, c3, c3, texel.y); 66 resident |= sparseTextureGradARB(usCubeArray, c4, c3, c3, utexel); 67 68 resident |= sparseTextureGradOffsetARB(s2D, c2, c2, c2, ivec2(5), texel); 69 resident |= sparseTextureGradOffsetARB(s2DRectShadow, c3, c2, c2, ivec2(6), texel.w); 70 resident |= sparseTextureGradOffsetARB(is2DArray, c3, c2, c2, ivec2(2), itexel); 71 72 resident |= sparseTextureGatherARB(s2D, c2, texel); 73 resident |= sparseTextureGatherARB(is2DArray, c3, itexel, 2); 74 resident |= sparseTextureGatherARB(s2DArrayShadow, c3, 2.0, texel); 75 76 resident |= sparseTextureGatherOffsetARB(s2D, c2, ivec2(4), texel); 77 resident |= sparseTextureGatherOffsetARB(is2DArray, c3, ivec2(5), itexel, 2); 78 resident |= sparseTextureGatherOffsetARB(s2DRectShadow, c2, 2.0, ivec2(7), texel); 79 80 const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0)); 81 resident |= sparseTextureGatherOffsetsARB(s2D, c2, constOffsets, texel); 82 resident |= sparseTextureGatherOffsetsARB(is2DArray, c3, constOffsets, itexel, 2); 83 resident |= sparseTextureGatherOffsetsARB(s2DRectShadow, c2, 2.0, constOffsets, texel); 84 85 resident |= sparseImageLoadARB(i2D, ic2, texel); 86 resident |= sparseImageLoadARB(ii3D, ic3, itexel); 87 resident |= sparseImageLoadARB(i2DMS, ic2, 3, texel); 88 89 outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel); 90}