1617a3babSopenharmony_ci#version 450 2617a3babSopenharmony_ci#extension GL_ARB_sparse_texture2: enable 3617a3babSopenharmony_ci 4617a3babSopenharmony_ciuniform sampler2D s2D; 5617a3babSopenharmony_ciuniform sampler3D s3D; 6617a3babSopenharmony_ciuniform sampler2DShadow s2DShadow; 7617a3babSopenharmony_ciuniform samplerCubeShadow sCubeShadow; 8617a3babSopenharmony_ciuniform sampler2DArrayShadow s2DArrayShadow; 9617a3babSopenharmony_ciuniform sampler2DRectShadow s2DRectShadow; 10617a3babSopenharmony_ciuniform samplerCubeArrayShadow sCubeArrayShadow; 11617a3babSopenharmony_ciuniform sampler2DMS s2DMS; 12617a3babSopenharmony_ci 13617a3babSopenharmony_ciuniform isamplerCube isCube; 14617a3babSopenharmony_ciuniform isampler2DArray is2DArray; 15617a3babSopenharmony_ci 16617a3babSopenharmony_ciuniform usamplerCubeArray usCubeArray; 17617a3babSopenharmony_ciuniform usampler2DRect us2DRect; 18617a3babSopenharmony_ci 19617a3babSopenharmony_cilayout(rgba32f) uniform image2D i2D; 20617a3babSopenharmony_cilayout(rgba32i) uniform iimage3D ii3D; 21617a3babSopenharmony_cilayout(rgba32f) uniform image2DMS i2DMS; 22617a3babSopenharmony_ci 23617a3babSopenharmony_ciin vec2 c2; 24617a3babSopenharmony_ciin vec3 c3; 25617a3babSopenharmony_ciin vec4 c4; 26617a3babSopenharmony_ci 27617a3babSopenharmony_ciin flat ivec2 ic2; 28617a3babSopenharmony_ciin flat ivec3 ic3; 29617a3babSopenharmony_ci 30617a3babSopenharmony_ciout vec4 outColor; 31617a3babSopenharmony_ci 32617a3babSopenharmony_civoid main() 33617a3babSopenharmony_ci{ 34617a3babSopenharmony_ci int resident = 0; 35617a3babSopenharmony_ci vec4 texel = vec4(0.0); 36617a3babSopenharmony_ci ivec4 itexel = ivec4(0); 37617a3babSopenharmony_ci uvec4 utexel = uvec4(0); 38617a3babSopenharmony_ci 39617a3babSopenharmony_ci resident |= sparseTextureARB(s2D, c2, texel); 40617a3babSopenharmony_ci resident |= sparseTextureARB(s3D, c3, texel, 2.0); 41617a3babSopenharmony_ci resident |= sparseTextureARB(isCube, c3, itexel); 42617a3babSopenharmony_ci resident |= sparseTextureARB(s2DShadow, c3, texel.x); 43617a3babSopenharmony_ci resident |= sparseTextureARB(sCubeArrayShadow, c4, 1.0, texel.x); 44617a3babSopenharmony_ci 45617a3babSopenharmony_ci resident |= sparseTextureLodARB(s2D, c2, 2.0, texel); 46617a3babSopenharmony_ci resident |= sparseTextureLodARB(usCubeArray, c4, 1.0, utexel); 47617a3babSopenharmony_ci resident |= sparseTextureLodARB(s2DShadow, c3, 2.0, texel.y); 48617a3babSopenharmony_ci 49617a3babSopenharmony_ci resident |= sparseTextureOffsetARB(s3D, c3, ivec3(2), texel, 2.0); 50617a3babSopenharmony_ci resident |= sparseTextureOffsetARB(us2DRect, c2, ivec2(3), utexel); 51617a3babSopenharmony_ci resident |= sparseTextureOffsetARB(s2DArrayShadow, c4, ivec2(5), texel.z); 52617a3babSopenharmony_ci 53617a3babSopenharmony_ci resident |= sparseTexelFetchARB(s2D, ivec2(c2), 2, texel); 54617a3babSopenharmony_ci resident |= sparseTexelFetchARB(us2DRect, ivec2(c2), utexel); 55617a3babSopenharmony_ci resident |= sparseTexelFetchARB(s2DMS, ivec2(c2), 4, texel); 56617a3babSopenharmony_ci 57617a3babSopenharmony_ci resident |= sparseTexelFetchOffsetARB(s3D, ivec3(c3), 2, ivec3(4), texel); 58617a3babSopenharmony_ci resident |= sparseTexelFetchOffsetARB(us2DRect, ivec2(c2), ivec2(3), utexel); 59617a3babSopenharmony_ci 60617a3babSopenharmony_ci resident |= sparseTextureLodOffsetARB(s2D, c2, 2.0, ivec2(5), texel); 61617a3babSopenharmony_ci resident |= sparseTextureLodOffsetARB(is2DArray, c3, 2.0, ivec2(6), itexel); 62617a3babSopenharmony_ci resident |= sparseTextureLodOffsetARB(s2DShadow, c3, 2.0, ivec2(7), texel.z); 63617a3babSopenharmony_ci 64617a3babSopenharmony_ci resident |= sparseTextureGradARB(s3D, c3, c3, c3, texel); 65617a3babSopenharmony_ci resident |= sparseTextureGradARB(sCubeShadow, c4, c3, c3, texel.y); 66617a3babSopenharmony_ci resident |= sparseTextureGradARB(usCubeArray, c4, c3, c3, utexel); 67617a3babSopenharmony_ci 68617a3babSopenharmony_ci resident |= sparseTextureGradOffsetARB(s2D, c2, c2, c2, ivec2(5), texel); 69617a3babSopenharmony_ci resident |= sparseTextureGradOffsetARB(s2DRectShadow, c3, c2, c2, ivec2(6), texel.w); 70617a3babSopenharmony_ci resident |= sparseTextureGradOffsetARB(is2DArray, c3, c2, c2, ivec2(2), itexel); 71617a3babSopenharmony_ci 72617a3babSopenharmony_ci resident |= sparseTextureGatherARB(s2D, c2, texel); 73617a3babSopenharmony_ci resident |= sparseTextureGatherARB(is2DArray, c3, itexel, 2); 74617a3babSopenharmony_ci resident |= sparseTextureGatherARB(s2DArrayShadow, c3, 2.0, texel); 75617a3babSopenharmony_ci 76617a3babSopenharmony_ci resident |= sparseTextureGatherOffsetARB(s2D, c2, ivec2(4), texel); 77617a3babSopenharmony_ci resident |= sparseTextureGatherOffsetARB(is2DArray, c3, ivec2(5), itexel, 2); 78617a3babSopenharmony_ci resident |= sparseTextureGatherOffsetARB(s2DRectShadow, c2, 2.0, ivec2(7), texel); 79617a3babSopenharmony_ci 80617a3babSopenharmony_ci const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0)); 81617a3babSopenharmony_ci resident |= sparseTextureGatherOffsetsARB(s2D, c2, constOffsets, texel); 82617a3babSopenharmony_ci resident |= sparseTextureGatherOffsetsARB(is2DArray, c3, constOffsets, itexel, 2); 83617a3babSopenharmony_ci resident |= sparseTextureGatherOffsetsARB(s2DRectShadow, c2, 2.0, constOffsets, texel); 84617a3babSopenharmony_ci 85617a3babSopenharmony_ci resident |= sparseImageLoadARB(i2D, ic2, texel); 86617a3babSopenharmony_ci resident |= sparseImageLoadARB(ii3D, ic3, itexel); 87617a3babSopenharmony_ci resident |= sparseImageLoadARB(i2DMS, ic2, 3, texel); 88617a3babSopenharmony_ci 89617a3babSopenharmony_ci outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel); 90617a3babSopenharmony_ci}