| 26 | #include "gl_replay.h" |
| 27 | |
| 28 | void GLReplay::CreateOutputWindowBackbuffer(OutputWindow &outwin, bool depth) |
| 29 | { |
| 30 | if(m_pDriver == NULL) |
| 31 | return; |
| 32 | |
| 33 | MakeCurrentReplayContext(m_DebugCtx); |
| 34 | |
| 35 | WrappedOpenGL &drv = *m_pDriver; |
| 36 | |
| 37 | // create fake backbuffer for this output window. |
| 38 | // We'll make an FBO for this backbuffer on the replay context, so we can |
| 39 | // use the replay context to do the hard work of rendering to it, then just |
| 40 | // blit across to the real default framebuffer on the output window context |
| 41 | drv.glGenFramebuffers(1, &outwin.BlitData.windowFBO); |
| 42 | drv.glBindFramebuffer(eGL_FRAMEBUFFER, outwin.BlitData.windowFBO); |
| 43 | |
| 44 | drv.glObjectLabel(eGL_FRAMEBUFFER, outwin.BlitData.windowFBO, -1, "FBO for output window"); |
| 45 | |
| 46 | drv.glGenTextures(1, &outwin.BlitData.backbuffer); |
| 47 | drv.glBindTexture(eGL_TEXTURE_2D, outwin.BlitData.backbuffer); |
| 48 | |
| 49 | drv.glObjectLabel(eGL_TEXTURE, outwin.BlitData.backbuffer, -1, "Colour for output window"); |
| 50 | |
| 51 | drv.glTextureImage2DEXT(outwin.BlitData.backbuffer, eGL_TEXTURE_2D, 0, eGL_SRGB8_ALPHA8, |
| 52 | outwin.width, outwin.height, 0, eGL_RGBA, eGL_UNSIGNED_BYTE, NULL); |
| 53 | drv.glTextureParameteriEXT(outwin.BlitData.backbuffer, eGL_TEXTURE_2D, eGL_TEXTURE_MAX_LEVEL, 0); |
| 54 | drv.glTextureParameteriEXT(outwin.BlitData.backbuffer, eGL_TEXTURE_2D, eGL_TEXTURE_MIN_FILTER, |
| 55 | eGL_NEAREST); |
| 56 | drv.glTextureParameteriEXT(outwin.BlitData.backbuffer, eGL_TEXTURE_2D, eGL_TEXTURE_MAG_FILTER, |
| 57 | eGL_NEAREST); |
| 58 | drv.glTextureParameteriEXT(outwin.BlitData.backbuffer, eGL_TEXTURE_2D, eGL_TEXTURE_WRAP_S, |
| 59 | eGL_CLAMP_TO_EDGE); |
| 60 | drv.glTextureParameteriEXT(outwin.BlitData.backbuffer, eGL_TEXTURE_2D, eGL_TEXTURE_WRAP_T, |
| 61 | eGL_CLAMP_TO_EDGE); |
| 62 | drv.glFramebufferTexture2D(eGL_FRAMEBUFFER, eGL_COLOR_ATTACHMENT0, eGL_TEXTURE_2D, |
| 63 | outwin.BlitData.backbuffer, 0); |
| 64 | |
| 65 | if(depth) |
| 66 | { |
| 67 | drv.glGenTextures(1, &outwin.BlitData.depthstencil); |
| 68 | drv.glBindTexture(eGL_TEXTURE_2D, outwin.BlitData.depthstencil); |
| 69 | |
| 70 | drv.glObjectLabel(eGL_TEXTURE, outwin.BlitData.depthstencil, -1, |
| 71 | "Depth-stencil for output window"); |
| 72 | |
| 73 | drv.glTextureImage2DEXT(outwin.BlitData.depthstencil, eGL_TEXTURE_2D, 0, eGL_DEPTH_COMPONENT24, |
| 74 | outwin.width, outwin.height, 0, eGL_DEPTH_COMPONENT, eGL_UNSIGNED_INT, |
| 75 | NULL); |
| 76 | drv.glTextureParameteriEXT(outwin.BlitData.depthstencil, eGL_TEXTURE_2D, eGL_TEXTURE_MAX_LEVEL, |
| 77 | 0); |
| 78 | drv.glTextureParameteriEXT(outwin.BlitData.depthstencil, eGL_TEXTURE_2D, eGL_TEXTURE_MIN_FILTER, |
| 79 | eGL_NEAREST); |
| 80 | drv.glTextureParameteriEXT(outwin.BlitData.depthstencil, eGL_TEXTURE_2D, eGL_TEXTURE_MAG_FILTER, |
| 81 | eGL_NEAREST); |
| 82 | drv.glTextureParameteriEXT(outwin.BlitData.depthstencil, eGL_TEXTURE_2D, eGL_TEXTURE_WRAP_S, |
| 83 | eGL_CLAMP_TO_EDGE); |
| 84 | drv.glTextureParameteriEXT(outwin.BlitData.depthstencil, eGL_TEXTURE_2D, eGL_TEXTURE_WRAP_T, |
| 85 | eGL_CLAMP_TO_EDGE); |
nothing calls this directly
no test coverage detected