本文整理汇总了C++中GLResourceRecord类的典型用法代码示例。如果您正苦于以下问题:C++ GLResourceRecord类的具体用法?C++ GLResourceRecord怎么用?C++ GLResourceRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GLResourceRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetResourceManager
void WrappedOpenGL::glAttachShader(GLuint program, GLuint shader)
{
m_Real.glAttachShader(program, shader);
if(m_State >= WRITING && program != 0 && shader != 0)
{
GLResourceRecord *progRecord =
GetResourceManager()->GetResourceRecord(ProgramRes(GetCtx(), program));
GLResourceRecord *shadRecord =
GetResourceManager()->GetResourceRecord(ShaderRes(GetCtx(), shader));
RDCASSERT(progRecord && shadRecord);
if(progRecord && shadRecord)
{
SCOPED_SERIALISE_CONTEXT(ATTACHSHADER);
Serialise_glAttachShader(program, shader);
progRecord->AddParent(shadRecord);
progRecord->AddChunk(scope.Get());
}
}
else
{
ResourceId progid = GetResourceManager()->GetID(ProgramRes(GetCtx(), program));
ResourceId shadid = GetResourceManager()->GetID(ShaderRes(GetCtx(), shader));
m_Programs[progid].shaders.push_back(shadid);
}
}
示例2: SamplerRes
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);
}
}
}
示例3: FramebufferRes
void WrappedOpenGL::glGenFramebuffers(GLsizei n, GLuint *framebuffers)
{
m_Real.glGenFramebuffers(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(GEN_FRAMEBUFFERS);
Serialise_glGenFramebuffers(1, framebuffers+i);
chunk = scope.Get();
}
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
RDCASSERT(record);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, res);
}
}
}
示例4: GetResourceManager
void WrappedOpenGL::glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ,
GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ,
GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth)
{
m_Real.glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ,
dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
srcWidth, srcHeight, srcDepth);
if(m_State >= WRITING)
{
GLResourceRecord *srcrecord = GetResourceManager()->GetResourceRecord(TextureRes(srcName));
GLResourceRecord *dstrecord = GetResourceManager()->GetResourceRecord(TextureRes(dstName));
RDCASSERT(srcrecord && dstrecord);
SCOPED_SERIALISE_CONTEXT(COPY_SUBIMAGE);
Serialise_glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ,
dstName, dstTarget, dstLevel, dstX, dstY, dstZ,
srcWidth, srcHeight, srcDepth);
Chunk *chunk = scope.Get();
if(m_State == WRITING_CAPFRAME)
{
m_ContextRecord->AddChunk(chunk);
}
else
{
dstrecord->AddChunk(chunk);
dstrecord->AddParent(srcrecord);
}
}
}
示例5: TextureRes
void WrappedOpenGL::glGenTextures(GLsizei n, GLuint* textures)
{
m_Real.glGenTextures(n, textures);
for(GLsizei i=0; i < n; i++)
{
GLResource res = TextureRes(textures[i]);
ResourceId id = GetResourceManager()->RegisterResource(res);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(GEN_TEXTURE);
Serialise_glGenTextures(1, textures+i);
chunk = scope.Get();
}
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
RDCASSERT(record);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, res);
m_Textures[id].resource = res;
m_Textures[id].curType = eGL_UNKNOWN_ENUM;
}
}
}
示例6: glFramebufferTextureLayer
void WrappedOpenGL::glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
m_Real.glFramebufferTextureLayer(target, attachment, texture, level, layer);
if(m_State >= WRITING)
{
GLResourceRecord *record = m_DeviceRecord;
if(target == eGL_DRAW_FRAMEBUFFER || target == eGL_FRAMEBUFFER)
{
if(m_DrawFramebufferRecord) record = m_DrawFramebufferRecord;
}
else
{
if(m_ReadFramebufferRecord) record = m_ReadFramebufferRecord;
}
SCOPED_SERIALISE_CONTEXT(FRAMEBUFFER_TEXLAYER);
Serialise_glNamedFramebufferTextureLayerEXT(GetResourceManager()->GetCurrentResource(record->GetResourceID()).name,
attachment, texture, level, layer);
if(m_State == WRITING_IDLE)
record->AddChunk(scope.Get());
else
m_ContextRecord->AddChunk(scope.Get());
}
}
示例7: ShaderRes
GLuint WrappedOpenGL::glCreateShader(GLenum type)
{
GLuint real = m_Real.glCreateShader(type);
GLResource res = ShaderRes(GetCtx(), real);
ResourceId id = GetResourceManager()->RegisterResource(res);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(CREATE_SHADER);
Serialise_glCreateShader(real, type);
chunk = scope.Get();
}
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
RDCASSERT(record);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, res);
m_Shaders[id].type = type;
}
return real;
}
示例8: ProgramRes
GLuint WrappedOpenGL::glCreateProgram()
{
GLuint real = m_Real.glCreateProgram();
GLResource res = ProgramRes(GetCtx(), real);
ResourceId id = GetResourceManager()->RegisterResource(res);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(CREATE_PROGRAM);
Serialise_glCreateProgram(real);
chunk = scope.Get();
}
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
RDCASSERT(record);
// we always want to mark programs as dirty so we can serialise their
// locations as initial state (and form a remapping table)
GetResourceManager()->MarkDirtyResource(id);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, res);
}
return real;
}
示例9: QueryRes
void WrappedOpenGL::glGenQueries(GLsizei count, GLuint *ids)
{
m_Real.glGenSamplers(count, ids);
for(GLsizei i=0; i < count; i++)
{
GLResource res = QueryRes(ids[i]);
ResourceId id = GetResourceManager()->RegisterResource(res);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(GEN_QUERIES);
Serialise_glGenQueries(1, ids+i);
chunk = scope.Get();
}
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
RDCASSERT(record);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, res);
}
}
}
示例10: ProgramPipeRes
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);
}
}
}
示例11: ProgramRes
GLuint WrappedOpenGL::glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
{
GLuint real = m_Real.glCreateShaderProgramv(type, count, strings);
GLResource res = ProgramRes(GetCtx(), real);
ResourceId id = GetResourceManager()->RegisterResource(res);
if(m_State >= WRITING)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(CREATE_SHADERPROGRAM);
Serialise_glCreateShaderProgramv(real, type, count, strings);
chunk = scope.Get();
}
GLResourceRecord *record = GetResourceManager()->AddResourceRecord(id);
RDCASSERT(record);
// we always want to mark programs as dirty so we can serialise their
// locations as initial state (and form a remapping table)
GetResourceManager()->MarkDirtyResource(id);
record->AddChunk(chunk);
}
else
{
GetResourceManager()->AddLiveResource(id, res);
vector<string> src;
for(GLsizei i = 0; i < count; i++)
src.push_back(strings[i]);
GLuint sepprog = MakeSeparableShaderProgram(*this, type, src, NULL);
auto &progDetails = m_Programs[id];
progDetails.linked = true;
progDetails.shaders.push_back(id);
progDetails.stageShaders[ShaderIdx(type)] = id;
auto &shadDetails = m_Shaders[id];
shadDetails.type = type;
shadDetails.sources.swap(src);
shadDetails.prog = sepprog;
shadDetails.Compile(*this);
}
return real;
}
示例12: SCOPED_SERIALISE_CONTEXT
void WrappedOpenGL::glBindTexture(GLenum target, GLuint texture)
{
m_Real.glBindTexture(target, texture);
if(m_State == WRITING_CAPFRAME)
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(BIND_TEXTURE);
Serialise_glBindTexture(target, texture);
chunk = scope.Get();
}
m_ContextRecord->AddChunk(chunk);
}
else if(m_State < WRITING)
{
m_Textures[GetResourceManager()->GetID(TextureRes(texture))].curType = target;
}
if(texture == 0)
{
m_TextureRecord[m_TextureUnit] = NULL;
return;
}
if(m_State >= WRITING)
{
GLResourceRecord *r = m_TextureRecord[m_TextureUnit] = GetResourceManager()->GetResourceRecord(TextureRes(texture));
if(r->datatype)
{
// it's illegal to retype a texture
RDCASSERT(r->datatype == target);
}
else
{
Chunk *chunk = NULL;
{
SCOPED_SERIALISE_CONTEXT(BIND_TEXTURE);
Serialise_glBindTexture(target, texture);
chunk = scope.Get();
}
r->AddChunk(chunk);
}
}
}
示例13: GetResourceManager
void WrappedOpenGL::glLinkProgram(GLuint program)
{
m_Real.glLinkProgram(program);
if(m_State >= WRITING)
{
GLResourceRecord *record = GetResourceManager()->GetResourceRecord(ProgramRes(GetCtx(), program));
RDCASSERT(record);
{
SCOPED_SERIALISE_CONTEXT(LINKPROGRAM);
Serialise_glLinkProgram(program);
record->AddChunk(scope.Get());
}
}
}
示例14:
void WrappedOpenGL::glTexStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width)
{
m_Real.glTexStorage1D(target, levels, internalformat, width);
if(m_State >= WRITING)
{
GLResourceRecord *record = m_TextureRecord[m_TextureUnit];
RDCASSERT(record);
SCOPED_SERIALISE_CONTEXT(TEXSTORAGE1D);
Serialise_glTextureStorage1DEXT(GetResourceManager()->GetCurrentResource(record->GetResourceID()).name,
target, levels, internalformat, width);
record->AddChunk(scope.Get());
}
}
示例15: GetResourceManager
void WrappedOpenGL::glNamedFramebufferTextureLayerEXT(GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
m_Real.glNamedFramebufferTextureLayerEXT(framebuffer, attachment, texture, level, layer);
if(m_State >= WRITING)
{
GLResourceRecord *record = GetResourceManager()->GetResourceRecord(FramebufferRes(GetCtx(), framebuffer));
SCOPED_SERIALISE_CONTEXT(FRAMEBUFFER_TEXLAYER);
Serialise_glNamedFramebufferTextureLayerEXT(framebuffer, attachment, texture, level, layer);
if(m_State == WRITING_IDLE)
record->AddChunk(scope.Get());
else
m_ContextRecord->AddChunk(scope.Get());
}
}