const GLubyte *WrappedOpenGL::glGetStringi(GLenum name, GLuint i) { if(name == eGL_EXTENSIONS) { if((size_t)i < GetCtxData().glExts.size()) return (const GLubyte *)GetCtxData().glExts[i].c_str(); return (const GLubyte *)""; } return m_Real.glGetStringi(name, i); }
GLuint WrappedOpenGL::GetUniformProgram() { ContextData &cd = GetCtxData(); // program gets first dibs, if one is bound then that's where glUniform* calls go. if(cd.m_Program != 0) { return cd.m_Program; } else if(cd.m_ProgramPipeline != 0) { GLuint ret = 0; // otherwise, query the active program for the pipeline (could cache this above in // glActiveShaderProgram) // we do this query every time instead of caching the result, since I think it's unlikely that // we'll ever // hit this path (most people using separable programs will use the glProgramUniform* // interface). // That way we don't pay the cost of a potentially expensive query unless we really need it. m_Real.glGetProgramPipelineiv(cd.m_ProgramPipeline, eGL_ACTIVE_PROGRAM, (GLint *)&ret); return ret; } return 0; }
void WrappedOpenGL::glGetBufferPointerv(GLenum target, GLenum pname, void **params) { CoherentMapImplicitBarrier(); // intercept GL_BUFFER_MAP_POINTER queries if(pname == eGL_BUFFER_MAP_POINTER) { GLResourceRecord *record = GetCtxData().m_BufferRecord[BufferIdx(target)]; RDCASSERT(record); if(record) { if(record->Map.status == GLResourceRecord::Unmapped) *params = NULL; else *params = (void *)record->Map.ptr; } else { *params = NULL; } } else { m_Real.glGetBufferPointerv(target, pname, params); } }
const GLubyte *WrappedOpenGL::glGetString(GLenum name) { if(name == eGL_EXTENSIONS) { return (const GLubyte *)GetCtxData().glExtsString.c_str(); } return m_Real.glGetString(name); }
const GLubyte *WrappedOpenGL::glGetString(GLenum name) { if(name == eGL_EXTENSIONS) { return (const GLubyte *)GetCtxData().glExtsString.c_str(); } else if(name == eGL_DEBUG_TOOL_NAME_EXT) { return (const GLubyte *)"RenderDoc"; } return m_Real.glGetString(name); }
void WrappedOpenGL::glUseProgram(GLuint program) { m_Real.glUseProgram(program); GetCtxData().m_Program = program; if(m_State == WRITING_CAPFRAME) { SCOPED_SERIALISE_CONTEXT(USEPROGRAM); Serialise_glUseProgram(program); m_ContextRecord->AddChunk(scope.Get()); } }
void WrappedOpenGL::glBindProgramPipeline(GLuint pipeline) { m_Real.glBindProgramPipeline(pipeline); GetCtxData().m_ProgramPipeline = pipeline; if(m_State == WRITING_CAPFRAME) { SCOPED_SERIALISE_CONTEXT(BIND_PROGRAMPIPE); Serialise_glBindProgramPipeline(pipeline); m_ContextRecord->AddChunk(scope.Get()); } }
void WrappedOpenGL::glUseProgram(GLuint program) { m_Real.glUseProgram(program); GetCtxData().m_Program = program; if(m_State == WRITING_CAPFRAME) { SCOPED_SERIALISE_CONTEXT(USEPROGRAM); Serialise_glUseProgram(program); m_ContextRecord->AddChunk(scope.Get()); GetResourceManager()->MarkResourceFrameReferenced(ProgramRes(GetCtx(), program), eFrameRef_Read); } }
void WrappedOpenGL::glBindProgramPipeline(GLuint pipeline) { m_Real.glBindProgramPipeline(pipeline); GetCtxData().m_ProgramPipeline = pipeline; if(m_State == WRITING_CAPFRAME) { SCOPED_SERIALISE_CONTEXT(BIND_PROGRAMPIPE); Serialise_glBindProgramPipeline(pipeline); m_ContextRecord->AddChunk(scope.Get()); GetResourceManager()->MarkResourceFrameReferenced(ProgramPipeRes(GetCtx(), pipeline), eFrameRef_Read); } }
void WrappedOpenGL::glGetIntegerv(GLenum pname, GLint *params) { if(pname == eGL_MIN_MAP_BUFFER_ALIGNMENT) { if(params) *params = (GLint)64; return; } if(pname == eGL_NUM_EXTENSIONS) { if(params) *params = (GLint)GetCtxData().glExts.size(); return; } m_Real.glGetIntegerv(pname, params); }
void WrappedOpenGL::glGetIntegerv(GLenum pname, GLint *params) { if(pname == eGL_MIN_MAP_BUFFER_ALIGNMENT) { if(params) *params = (GLint)64; return; } else if(pname == eGL_NUM_EXTENSIONS) { if(params) *params = (GLint)GetCtxData().glExts.size(); return; } else if(pname == eGL_DEBUG_TOOL_PURPOSE_EXT) { if(params) *params = GLint(eGL_DEBUG_TOOL_FRAME_CAPTURE_BIT_EXT); return; } m_Real.glGetIntegerv(pname, params); }