mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-10 03:50:36 +00:00
ARB_dsa part 2 - Implement glCreate* functions
* For the most part these are identical to the equivalent glGen*. * For textures, we bake in the current type immediately, for buffers we would ideally want a type but the glCreateBuffers doesn't take one (it then gets renamed/retyped).
This commit is contained in:
@@ -160,6 +160,7 @@ enum GLChunkType
|
||||
DEVICE_INIT = FIRST_CHUNK_ID,
|
||||
|
||||
GEN_TEXTURE,
|
||||
CREATE_TEXTURE,
|
||||
BIND_TEXTURE,
|
||||
BIND_TEXTURES,
|
||||
BIND_MULTI_TEX,
|
||||
@@ -227,6 +228,7 @@ enum GLChunkType
|
||||
COMPILESHADERINCLUDE,
|
||||
|
||||
GEN_FEEDBACK,
|
||||
CREATE_FEEDBACK,
|
||||
BIND_FEEDBACK,
|
||||
BEGIN_FEEDBACK,
|
||||
END_FEEDBACK,
|
||||
@@ -234,6 +236,7 @@ enum GLChunkType
|
||||
RESUME_FEEDBACK,
|
||||
|
||||
GEN_PROGRAMPIPE,
|
||||
CREATE_PROGRAMPIPE,
|
||||
USE_PROGRAMSTAGES,
|
||||
BIND_PROGRAMPIPE,
|
||||
|
||||
@@ -242,6 +245,7 @@ enum GLChunkType
|
||||
WAIT_SYNC,
|
||||
|
||||
GEN_QUERIES,
|
||||
CREATE_QUERIES,
|
||||
BEGIN_QUERY,
|
||||
BEGIN_QUERY_INDEXED,
|
||||
END_QUERY,
|
||||
@@ -352,6 +356,7 @@ enum GLChunkType
|
||||
MULTI_DRAWELEMENTS_INDIRECT_COUNT,
|
||||
|
||||
GEN_FRAMEBUFFERS,
|
||||
CREATE_FRAMEBUFFERS,
|
||||
FRAMEBUFFER_TEX,
|
||||
FRAMEBUFFER_TEX1D,
|
||||
FRAMEBUFFER_TEX2D,
|
||||
@@ -366,10 +371,12 @@ enum GLChunkType
|
||||
BLIT_FRAMEBUFFER,
|
||||
|
||||
GEN_RENDERBUFFERS,
|
||||
CREATE_RENDERBUFFERS,
|
||||
RENDERBUFFER_STORAGE,
|
||||
RENDERBUFFER_STORAGEMS,
|
||||
|
||||
GEN_SAMPLERS,
|
||||
CREATE_SAMPLERS,
|
||||
SAMPLER_PARAMETERI,
|
||||
SAMPLER_PARAMETERF,
|
||||
SAMPLER_PARAMETERIV,
|
||||
@@ -380,6 +387,7 @@ enum GLChunkType
|
||||
BIND_SAMPLERS,
|
||||
|
||||
GEN_BUFFER,
|
||||
CREATE_BUFFER,
|
||||
BIND_BUFFER,
|
||||
BIND_BUFFER_BASE,
|
||||
BIND_BUFFER_RANGE,
|
||||
@@ -392,6 +400,7 @@ enum GLChunkType
|
||||
UNMAP,
|
||||
FLUSHMAP,
|
||||
GEN_VERTEXARRAY,
|
||||
CREATE_VERTEXARRAY,
|
||||
BIND_VERTEXARRAY,
|
||||
VERTEXATTRIB_GENERIC,
|
||||
VERTEXATTRIBPOINTER,
|
||||
|
||||
@@ -44,6 +44,7 @@ const char *GLChunkNames[] =
|
||||
"WrappedOpenGL::Initialisation",
|
||||
|
||||
"glGenTextures",
|
||||
"glCreateTextures",
|
||||
"glBindTexture",
|
||||
"glBindTextures",
|
||||
"glBindMultiTexture",
|
||||
@@ -111,6 +112,7 @@ const char *GLChunkNames[] =
|
||||
"glCompileShaderIncludeARB",
|
||||
|
||||
"glGenTransformFeedbacks",
|
||||
"glCreateTransformFeedbacks",
|
||||
"glBindTransformFeedback",
|
||||
"glBeginTransformFeedback",
|
||||
"glEndTransformFeedback",
|
||||
@@ -118,6 +120,7 @@ const char *GLChunkNames[] =
|
||||
"glResumeTransformFeedback",
|
||||
|
||||
"glGenProgramPipelines",
|
||||
"glCreateProgramPipelines",
|
||||
"glUseProgramStages",
|
||||
"glBindProgramPipeline",
|
||||
|
||||
@@ -126,6 +129,7 @@ const char *GLChunkNames[] =
|
||||
"glWaitSync",
|
||||
|
||||
"glGenQueries",
|
||||
"glCreateQueries",
|
||||
"glBeginQuery",
|
||||
"glBeginQueryIndexed",
|
||||
"glEndQuery",
|
||||
@@ -236,6 +240,7 @@ const char *GLChunkNames[] =
|
||||
"glMultiDrawElementsIndirectCountARB",
|
||||
|
||||
"glGenFramebuffers",
|
||||
"glCreateFramebuffers",
|
||||
"glFramebufferTexture",
|
||||
"glFramebufferTexture1D",
|
||||
"glFramebufferTexture2D",
|
||||
@@ -250,10 +255,12 @@ const char *GLChunkNames[] =
|
||||
"glBlitFramebuffer",
|
||||
|
||||
"glGenRenderbuffers",
|
||||
"glCreateRenderbuffers",
|
||||
"glRenderbufferStorage",
|
||||
"glRenderbufferStorageMultisample",
|
||||
|
||||
"glGenSamplers",
|
||||
"glCreateSamplers",
|
||||
"glSamplerParameteri",
|
||||
"glSamplerParameterf",
|
||||
"glSamplerParameteriv",
|
||||
@@ -264,6 +271,7 @@ const char *GLChunkNames[] =
|
||||
"glBindSamplers",
|
||||
|
||||
"glGenBuffers",
|
||||
"glCreateBuffers",
|
||||
"glBindBuffer",
|
||||
"glBindBufferBase",
|
||||
"glBindBufferRange",
|
||||
@@ -276,6 +284,7 @@ const char *GLChunkNames[] =
|
||||
"glUnmapBuffer",
|
||||
"glFlushMappedBufferRange",
|
||||
"glGenVertexArrays",
|
||||
"glCreateVertexArrays",
|
||||
"glBindVertexArray",
|
||||
"glVertexAttrib*",
|
||||
"glVertexAttribPointer",
|
||||
@@ -2312,6 +2321,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_TEXTURE:
|
||||
Serialise_glGenTextures(0, NULL);
|
||||
break;
|
||||
case CREATE_TEXTURE:
|
||||
Serialise_glCreateTextures(eGL_NONE, 0, NULL);
|
||||
break;
|
||||
case ACTIVE_TEXTURE:
|
||||
Serialise_glActiveTexture(eGL_NONE);
|
||||
break;
|
||||
@@ -2507,6 +2519,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_FEEDBACK:
|
||||
Serialise_glGenTransformFeedbacks(0, NULL);
|
||||
break;
|
||||
case CREATE_FEEDBACK:
|
||||
Serialise_glCreateTransformFeedbacks(0, NULL);
|
||||
break;
|
||||
case BIND_FEEDBACK:
|
||||
Serialise_glBindTransformFeedback(eGL_NONE, 0);
|
||||
break;
|
||||
@@ -2526,6 +2541,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_PROGRAMPIPE:
|
||||
Serialise_glGenProgramPipelines(0, NULL);
|
||||
break;
|
||||
case CREATE_PROGRAMPIPE:
|
||||
Serialise_glCreateProgramPipelines(0, NULL);
|
||||
break;
|
||||
case USE_PROGRAMSTAGES:
|
||||
Serialise_glUseProgramStages(0, 0, 0);
|
||||
break;
|
||||
@@ -2546,6 +2564,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_QUERIES:
|
||||
Serialise_glGenQueries(0, NULL);
|
||||
break;
|
||||
case CREATE_QUERIES:
|
||||
Serialise_glCreateQueries(eGL_NONE, 0, NULL);
|
||||
break;
|
||||
case BEGIN_QUERY:
|
||||
Serialise_glBeginQuery(eGL_NONE, 0);
|
||||
break;
|
||||
@@ -2875,6 +2896,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_FRAMEBUFFERS:
|
||||
Serialise_glGenFramebuffers(0, NULL);
|
||||
break;
|
||||
case CREATE_FRAMEBUFFERS:
|
||||
Serialise_glCreateFramebuffers(0, NULL);
|
||||
break;
|
||||
case FRAMEBUFFER_TEX:
|
||||
Serialise_glNamedFramebufferTextureEXT(0, eGL_NONE, 0, 0);
|
||||
break;
|
||||
@@ -2915,6 +2939,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_RENDERBUFFERS:
|
||||
Serialise_glGenRenderbuffers(0, NULL);
|
||||
break;
|
||||
case CREATE_RENDERBUFFERS:
|
||||
Serialise_glCreateRenderbuffers(0, NULL);
|
||||
break;
|
||||
case RENDERBUFFER_STORAGE:
|
||||
Serialise_glNamedRenderbufferStorageEXT(0, eGL_NONE, 0, 0);
|
||||
break;
|
||||
@@ -2925,6 +2952,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_SAMPLERS:
|
||||
Serialise_glGenSamplers(0, NULL);
|
||||
break;
|
||||
case CREATE_SAMPLERS:
|
||||
Serialise_glCreateSamplers(0, NULL);
|
||||
break;
|
||||
case SAMPLER_PARAMETERI:
|
||||
Serialise_glSamplerParameteri(0, eGL_NONE, 0);
|
||||
break;
|
||||
@@ -2953,6 +2983,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_BUFFER:
|
||||
Serialise_glGenBuffers(0, NULL);
|
||||
break;
|
||||
case CREATE_BUFFER:
|
||||
Serialise_glCreateBuffers(0, NULL);
|
||||
break;
|
||||
case BIND_BUFFER:
|
||||
Serialise_glBindBuffer(eGL_NONE, 0);
|
||||
break;
|
||||
@@ -2989,6 +3022,9 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context)
|
||||
case GEN_VERTEXARRAY:
|
||||
Serialise_glGenVertexArrays(0, NULL);
|
||||
break;
|
||||
case CREATE_VERTEXARRAY:
|
||||
Serialise_glCreateVertexArrays(0, NULL);
|
||||
break;
|
||||
case BIND_VERTEXARRAY:
|
||||
Serialise_glBindVertexArray(0);
|
||||
break;
|
||||
|
||||
@@ -83,6 +83,61 @@ void WrappedOpenGL::glGenBuffers(GLsizei n, GLuint *buffers)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateBuffers(GLsizei n, GLuint* buffers)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(BufferRes(GetCtx(), *buffers)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateBuffers(1, &real);
|
||||
|
||||
GLResource res = BufferRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
|
||||
m_Buffers[live].resource = res;
|
||||
m_Buffers[live].curType = eGL_NONE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateBuffers(GLsizei n, GLuint *buffers)
|
||||
{
|
||||
m_Real.glCreateBuffers(n, buffers);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = BufferRes(GetCtx(), buffers[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_BUFFER);
|
||||
Serialise_glCreateBuffers(1, buffers+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
m_Buffers[id].resource = res;
|
||||
m_Buffers[id].curType = eGL_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBindBuffer(GLenum target, GLuint buffer)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
@@ -1924,6 +1979,56 @@ void WrappedOpenGL::glGenTransformFeedbacks(GLsizei n, GLuint *ids)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateTransformFeedbacks(GLsizei n, GLuint* ids)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(FeedbackRes(GetCtx(), *ids)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateTransformFeedbacks(1, &real);
|
||||
|
||||
GLResource res = FeedbackRes(GetCtx(), real);
|
||||
|
||||
m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateTransformFeedbacks(GLsizei n, GLuint *ids)
|
||||
{
|
||||
m_Real.glCreateTransformFeedbacks(n, ids);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = FeedbackRes(GetCtx(), ids[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_FEEDBACK);
|
||||
Serialise_glCreateTransformFeedbacks(1, ids+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
|
||||
{
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
@@ -3043,6 +3148,56 @@ void WrappedOpenGL::glGenVertexArrays(GLsizei n, GLuint *arrays)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateVertexArrays(GLsizei n, GLuint* arrays)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(VertexArrayRes(GetCtx(), *arrays)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateVertexArrays(1, &real);
|
||||
|
||||
GLResource res = VertexArrayRes(GetCtx(), real);
|
||||
|
||||
m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateVertexArrays(GLsizei n, GLuint *arrays)
|
||||
{
|
||||
m_Real.glCreateVertexArrays(n, arrays);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = VertexArrayRes(GetCtx(), arrays[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_VERTEXARRAY);
|
||||
Serialise_glCreateVertexArrays(1, arrays+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBindVertexArray(GLuint array)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, (array ? GetResourceManager()->GetID(VertexArrayRes(GetCtx(), array)) : ResourceId()));
|
||||
|
||||
@@ -76,6 +76,56 @@ void WrappedOpenGL::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateFramebuffers(GLsizei n, GLuint* framebuffers)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(FramebufferRes(GetCtx(), *framebuffers)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateFramebuffers(1, &real);
|
||||
|
||||
GLResource res = FramebufferRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||
{
|
||||
m_Real.glCreateFramebuffers(n, framebuffers);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = FramebufferRes(GetCtx(), framebuffers[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_FRAMEBUFFERS);
|
||||
Serialise_glCreateFramebuffers(1, framebuffers+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glNamedFramebufferTextureEXT(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Attach, attachment);
|
||||
@@ -1319,6 +1369,60 @@ void WrappedOpenGL::glGenRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateRenderbuffers(GLsizei n, GLuint* renderbuffers)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(RenderbufferRes(GetCtx(), *renderbuffers)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateRenderbuffers(1, &real);
|
||||
m_Real.glBindRenderbuffer(eGL_RENDERBUFFER, real);
|
||||
|
||||
GLResource res = RenderbufferRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
|
||||
m_Textures[live].resource = res;
|
||||
m_Textures[live].curType = eGL_RENDERBUFFER;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||
{
|
||||
m_Real.glCreateRenderbuffers(n, renderbuffers);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = RenderbufferRes(GetCtx(), renderbuffers[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_RENDERBUFFERS);
|
||||
Serialise_glCreateRenderbuffers(1, renderbuffers+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glBindRenderbuffer(GLenum target, GLuint renderbuffer)
|
||||
{
|
||||
// don't need to serialise this, as the GL_RENDERBUFFER target does nothing
|
||||
|
||||
@@ -203,6 +203,57 @@ void WrappedOpenGL::glGenQueries(GLsizei count, GLuint *ids)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateQueries(GLenum target, GLsizei n, GLuint* ids)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(QueryRes(GetCtx(), *ids)));
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateQueries(Target, 1, &real);
|
||||
|
||||
GLResource res = QueryRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateQueries(GLenum target, GLsizei count, GLuint *ids)
|
||||
{
|
||||
m_Real.glCreateQueries(target, count, ids);
|
||||
|
||||
for(GLsizei i=0; i < count; i++)
|
||||
{
|
||||
GLResource res = QueryRes(GetCtx(), ids[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_QUERIES);
|
||||
Serialise_glCreateQueries(target, 1, ids+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBeginQuery(GLenum target, GLuint qid)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
|
||||
@@ -76,6 +76,56 @@ void WrappedOpenGL::glGenSamplers(GLsizei count, GLuint *samplers)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateSamplers(GLsizei n, GLuint* samplers)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(SamplerRes(GetCtx(), *samplers)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateSamplers(1, &real);
|
||||
|
||||
GLResource res = SamplerRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateSamplers(GLsizei count, GLuint *samplers)
|
||||
{
|
||||
m_Real.glCreateSamplers(count, samplers);
|
||||
|
||||
for(GLsizei i=0; i < count; i++)
|
||||
{
|
||||
GLResource res = SamplerRes(GetCtx(), samplers[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_SAMPLERS);
|
||||
Serialise_glCreateSamplers(1, samplers+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBindSampler(GLuint unit, GLuint sampler)
|
||||
{
|
||||
SERIALISE_ELEMENT(uint32_t, Unit, unit);
|
||||
|
||||
@@ -951,6 +951,56 @@ void WrappedOpenGL::glGenProgramPipelines(GLsizei n, GLuint *pipelines)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateProgramPipelines(GLsizei n, GLuint* pipelines)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(ProgramPipeRes(GetCtx(), *pipelines)));
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateProgramPipelines(1, &real);
|
||||
|
||||
GLResource res = ProgramPipeRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateProgramPipelines(GLsizei n, GLuint *pipelines)
|
||||
{
|
||||
m_Real.glCreateProgramPipelines(n, pipelines);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = ProgramPipeRes(GetCtx(), pipelines[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_PROGRAMPIPE);
|
||||
Serialise_glCreateProgramPipelines(1, pipelines+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glBindProgramPipeline(GLuint pipeline)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, (pipeline ? GetResourceManager()->GetID(ProgramPipeRes(GetCtx(), pipeline)) : ResourceId()));
|
||||
|
||||
@@ -104,6 +104,68 @@ void WrappedOpenGL::glGenTextures(GLsizei n, GLuint* textures)
|
||||
}
|
||||
}
|
||||
|
||||
bool WrappedOpenGL::Serialise_glCreateTextures(GLenum target, GLsizei n, GLuint* textures)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(GetCtx(), *textures)));
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
GLuint real = 0;
|
||||
m_Real.glCreateTextures(Target, 1, &real);
|
||||
|
||||
GLResource res = TextureRes(GetCtx(), real);
|
||||
|
||||
ResourceId live = m_ResourceManager->RegisterResource(res);
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
|
||||
m_Textures[live].resource = res;
|
||||
m_Textures[live].curType = TextureTarget(Target);
|
||||
m_Textures[live].creationFlags |= eTextureCreate_SRV;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glCreateTextures(GLenum target, GLsizei n, GLuint* textures)
|
||||
{
|
||||
m_Real.glCreateTextures(target, n, textures);
|
||||
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
{
|
||||
GLResource res = TextureRes(GetCtx(), textures[i]);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
Chunk *chunk = NULL;
|
||||
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(CREATE_TEXTURE);
|
||||
Serialise_glCreateTextures(target, 1, textures+i);
|
||||
|
||||
chunk = scope.Get();
|
||||
}
|
||||
|
||||
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
|
||||
RDCASSERT(record);
|
||||
|
||||
record->datatype = TextureBinding(target);
|
||||
m_Textures[id].resource = res;
|
||||
m_Textures[id].curType = TextureTarget(target);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
m_Textures[id].resource = res;
|
||||
m_Textures[id].curType = TextureTarget(target);
|
||||
m_Textures[id].creationFlags |= eTextureCreate_SRV;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WrappedOpenGL::glDeleteTextures(GLsizei n, const GLuint *textures)
|
||||
{
|
||||
for(GLsizei i=0; i < n; i++)
|
||||
|
||||
Reference in New Issue
Block a user