Hi,
similar to GL 4.3 adding a image_size request function in GLSL seems GL is still lacking is that you can’t get # of samples of textures and images in shader via some GLSL function… note D3D HLSL can via .GetDimensions() function and also even OpenCL kernels can via new 1.2 cl_khr_gl_msaa_sharing which adds get_image_num_samples()! Notice this should be useful for real work shader a port of deferred+ shader to GLSL:
can be a new function or better yet extending textureSize and imageSize by one more component (last one being #of samples and 1 for normal tex)… it’s always <=4 components
snippet of HLSL code:
uint depthBufferWidth, depthBufferHeight, depthBufferNumSamples;
g_DepthTexture.GetDimensions( depthBufferWidth, depthBufferHeight, depthBufferNumSamples );
for( uint sampleIdx=0; sampleIdx<depthBufferNumSamples; sampleIdx++ )
{
depth=CalculateMinMaxDepthInLds( globalIdx, sampleIdx );
}
plausible easy port to GLSL code using a new function called(textureNsamples):
uint depthBufferWidth, depthBufferHeight, depthBufferNumSamples;
ivec2 dims=textureSize(g_DepthTexture);
depthBufferWidth=dims.x;
depthBufferHeight=dims.y;
depthBufferNumSamples=textureNsamples(g_DepthTexture);
for( uint sampleIdx=0; sampleIdx<depthBufferNumSamples; sampleIdx++ )
{
depth=CalculateMinMaxDepthInLds( globalIdx, sampleIdx );
}
extended textureSize
uint depthBufferWidth, depthBufferHeight, depthBufferNumSamples;
ivec3 dims=textureSize(g_DepthTexture);
depthBufferWidth=dims.x;
depthBufferHeight=dims.y;
depthBufferNumSamples=dims.z;
for( uint sampleIdx=0; sampleIdx<depthBufferNumSamples; sampleIdx++ )
{
depth=CalculateMinMaxDepthInLds( globalIdx, sampleIdx );
}