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