mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Take stencil value from max of red or green channel
* I swear some implementations return stencil in the green channel, but the spec says red channel. This should be safe
This commit is contained in:
@@ -1241,13 +1241,15 @@ void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sl
|
||||
uint32_t stencilpixel[4];
|
||||
gl.glReadPixels(0, 0, 1, 1, eGL_RGBA, eGL_FLOAT, (void *)stencilpixel);
|
||||
|
||||
pixel[1] = float(stencilpixel[1])/255.0f;
|
||||
// not sure whether [0] or [1] will return stencil values, so use
|
||||
// max of two because other channel should be 0
|
||||
pixel[1] = float(RDCMAX(stencilpixel[0], stencilpixel[1]))/255.0f;
|
||||
|
||||
// the first depth read will have read stencil instead.
|
||||
// NULL it out so the UI sees only stencil
|
||||
if(texDetails.internalFormat == eGL_STENCIL_INDEX8)
|
||||
{
|
||||
pixel[1] = float(stencilpixel[0])/255.0f;
|
||||
pixel[1] = float(RDCMAX(stencilpixel[0], stencilpixel[1]))/255.0f;
|
||||
pixel[0] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user