Khronos Public Bugzilla
Bug 825 - OpenGL lacks a function for getting # of samples of multisampled images and textures
OpenGL lacks a function for getting # of samples of multisampled images and t...
Status: RESOLVED LATER
Product: OpenGL
Classification: Unclassified
Component: Registry
GLSL 4.30
All All
: P3 normal
: ---
Assigned To: Jon Leech
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-12 02:55 PDT by rtfss1
Modified: 2013-08-22 15:25 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rtfss1 2013-03-12 02:55:43 PDT
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:
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):
Code :

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
Code :

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 );
    }
Comment 1 Jon Leech 2013-08-22 15:25:13 PDT
Thanks for the suggestion (and especially the sample use case). We're taking
this under advisement as a feature request going forward and tracking
it internally, closing this LATER since we're not going to address it in
the near future.