MCPcopy Create free account
hub / github.com/baldurk/renderdoc / GetHistogram

Method GetHistogram

renderdoc/driver/gl/gl_debug.cpp:2202–2476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2200}
2201
2202bool GLReplay::GetHistogram(ResourceId texid, const Subresource &sub, CompType typeCast,
2203 float minval, float maxval, const rdcfixedarray<bool, 4> &channels_,
2204 rdcarray<uint32_t> &histogram)
2205{
2206 if(minval >= maxval || texid == ResourceId())
2207 return false;
2208
2209 if(m_pDriver->m_Textures.find(texid) == m_pDriver->m_Textures.end())
2210 return false;
2211
2212 if(!HasExt[ARB_compute_shader] || !HasExt[ARB_shading_language_420pack])
2213 return false;
2214
2215 // take a local copy so we can modify it
2216 rdcfixedarray<bool, 4> channels = channels_;
2217
2218 WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[texid];
2219
2220 TextureDescription details = GetTexture(texid);
2221
2222 int texSlot = 0;
2223 int intIdx = 0;
2224
2225 bool renderbuffer = false;
2226
2227 switch(texDetails.curType)
2228 {
2229 case eGL_RENDERBUFFER:
2230 texSlot = texDetails.samples > 1 ? RESTYPE_TEX2DMS : RESTYPE_TEX2D;
2231 renderbuffer = true;
2232 break;
2233 case eGL_TEXTURE_1D: texSlot = RESTYPE_TEX1D; break;
2234 default: RDCWARN("Unexpected texture type"); DELIBERATE_FALLTHROUGH();
2235 case eGL_TEXTURE_2D: texSlot = RESTYPE_TEX2D; break;
2236 case eGL_TEXTURE_2D_MULTISAMPLE: texSlot = RESTYPE_TEX2DMS; break;
2237 case eGL_TEXTURE_2D_MULTISAMPLE_ARRAY: texSlot = RESTYPE_TEX2DMSARRAY; break;
2238 case eGL_TEXTURE_RECTANGLE: texSlot = RESTYPE_TEXRECT; break;
2239 case eGL_TEXTURE_BUFFER: texSlot = RESTYPE_TEXBUFFER; break;
2240 case eGL_TEXTURE_3D: texSlot = RESTYPE_TEX3D; break;
2241 case eGL_TEXTURE_CUBE_MAP: texSlot = RESTYPE_TEXCUBE; break;
2242 case eGL_TEXTURE_1D_ARRAY: texSlot = RESTYPE_TEX1DARRAY; break;
2243 case eGL_TEXTURE_2D_ARRAY: texSlot = RESTYPE_TEX2DARRAY; break;
2244 case eGL_TEXTURE_CUBE_MAP_ARRAY: texSlot = RESTYPE_TEXCUBEARRAY; break;
2245 }
2246
2247 GLenum target = texDetails.curType;
2248 GLuint texname = texDetails.resource.name;
2249
2250 // do blit from renderbuffer to texture, then sample from texture
2251 if(renderbuffer)
2252 {
2253 // need replay context active to do blit (as FBOs aren't shared)
2254 MakeCurrentReplayContext(&m_ReplayCtx);
2255
2256 GLMarkerRegion blitRegion("Renderbuffer Blit");
2257
2258 GLuint curDrawFBO = 0;
2259 GLuint curReadFBO = 0;

Callers 15

glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45
glGetHistogramMethod · 0.45

Calls 15

SafeBlitFramebufferFunction · 0.85
IsDepthStencilFormatFunction · 0.85
GetBaseFormatFunction · 0.85
RDCMAXFunction · 0.85
RDCCLAMPFunction · 0.85
ResourceIdFunction · 0.50
ceilFunction · 0.50
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected