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

Method RenderTextureInternal

renderdoc/driver/gl/gl_rendertexture.cpp:39–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39bool GLReplay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flags)
40{
41 const bool blendAlpha = (flags & eTexDisplay_BlendAlpha) != 0;
42 const bool mipShift = (flags & eTexDisplay_MipShift) != 0;
43
44 WrappedOpenGL &drv = *m_pDriver;
45
46 WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[cfg.resourceId];
47
48 if(texDetails.internalFormat == eGL_NONE)
49 return false;
50
51 CacheTexture(cfg.resourceId);
52
53 bool renderbuffer = false;
54
55 int intIdx = 0;
56
57 int resType;
58 switch(texDetails.curType)
59 {
60 case eGL_RENDERBUFFER:
61 resType = RESTYPE_TEX2D;
62 if(texDetails.samples > 1)
63 resType = RESTYPE_TEX2DMS;
64 renderbuffer = true;
65 break;
66 case eGL_TEXTURE_1D: resType = RESTYPE_TEX1D; break;
67 default: RDCWARN("Unexpected texture type"); DELIBERATE_FALLTHROUGH();
68 case eGL_TEXTURE_2D: resType = RESTYPE_TEX2D; break;
69 case eGL_TEXTURE_2D_MULTISAMPLE: resType = RESTYPE_TEX2DMS; break;
70 case eGL_TEXTURE_2D_MULTISAMPLE_ARRAY: resType = RESTYPE_TEX2DMSARRAY; break;
71 case eGL_TEXTURE_RECTANGLE: resType = RESTYPE_TEXRECT; break;
72 case eGL_TEXTURE_BUFFER: resType = RESTYPE_TEXBUFFER; break;
73 case eGL_TEXTURE_3D: resType = RESTYPE_TEX3D; break;
74 case eGL_TEXTURE_CUBE_MAP: resType = RESTYPE_TEXCUBE; break;
75 case eGL_TEXTURE_1D_ARRAY: resType = RESTYPE_TEX1DARRAY; break;
76 case eGL_TEXTURE_2D_ARRAY: resType = RESTYPE_TEX2DARRAY; break;
77 case eGL_TEXTURE_CUBE_MAP_ARRAY: resType = RESTYPE_TEXCUBEARRAY; break;
78 }
79
80 GLuint texname = texDetails.resource.name;
81 GLenum target = texDetails.curType;
82
83 // do blit from renderbuffer to texture, then sample from texture
84 if(renderbuffer)
85 {
86 // need replay context active to do blit (as FBOs aren't shared)
87 MakeCurrentReplayContext(&m_ReplayCtx);
88
89 GLMarkerRegion blitRegion("Renderbuffer Blit");
90
91 GLuint curDrawFBO = 0;
92 GLuint curReadFBO = 0;
93 drv.glGetIntegerv(eGL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&curDrawFBO);
94 drv.glGetIntegerv(eGL_READ_FRAMEBUFFER_BINDING, (GLint *)&curReadFBO);
95
96 drv.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, texDetails.renderbufferFBOs[1]);

Callers

nothing calls this directly

Calls 15

SafeBlitFramebufferFunction · 0.85
IsCompressedFormatFunction · 0.85
GetTextureSwizzleFunction · 0.85
SetTextureSwizzleFunction · 0.85
RDCMAXFunction · 0.85
GetCompressedByteSizeFunction · 0.85
IsDepthStencilFormatFunction · 0.85
GetBaseFormatFunction · 0.85
RDCCLAMPFunction · 0.85
RDCMINFunction · 0.85
CreateTextureImageMethod · 0.80

Tested by

no test coverage detected