本文整理汇总了C++中GLResourceRecord::FilterChunks方法的典型用法代码示例。如果您正苦于以下问题:C++ GLResourceRecord::FilterChunks方法的具体用法?C++ GLResourceRecord::FilterChunks怎么用?C++ GLResourceRecord::FilterChunks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLResourceRecord
的用法示例。
在下文中一共展示了GLResourceRecord::FilterChunks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glUseProgramStages
void WrappedOpenGL::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
{
m_Real.glUseProgramStages(pipeline, stages, program);
if(m_State > WRITING)
{
SCOPED_SERIALISE_CONTEXT(USE_PROGRAMSTAGES);
Serialise_glUseProgramStages(pipeline, stages, program);
GLResourceRecord *record =
GetResourceManager()->GetResourceRecord(ProgramPipeRes(GetCtx(), pipeline));
RDCASSERT(record);
Chunk *chunk = scope.Get();
if(m_State == WRITING_CAPFRAME)
{
m_ContextRecord->AddChunk(chunk);
}
else
{
// USE_PROGRAMSTAGES is one of the few kinds of chunk that are
// recorded to pipeline records, so we can probably find previous
// uses (if it's been constantly rebound instead of once at init
// time) that can be popped as redundant.
// We do have to be careful though to make sure we only remove
// redundant calls, not other different USE_PROGRAMSTAGES calls!
struct FilterChunkClass
{
FilterChunkClass(uint32_t s) : stages(s) {}
uint32_t stages;
// this is kind of a hack, but it would be really awkward
// to make a general solution just for this one case, and
// we also can't really afford to drop it entirely.
// we search for the marker serialised above, skip over the
// pipeline id (as it will be the same in all chunks in this
// record), and check if the Stages bitfield afterwards is
// the same - if so we remove that chunk as replaced by
// this one
bool operator()(Chunk *c) const
{
if(c->GetChunkType() != USE_PROGRAMSTAGES)
return false;
byte *b = c->GetData();
byte *end = b + c->GetLength();
// 'fast' path, rather than searching byte-by-byte from
// the start to be safe, check the exact difference it should
// always be first.
if(*(uint64_t *)(b + 6) == marker_glUseProgramStages_hack)
b += 6;
while(b + sizeof(uint64_t) < end)
{
uint64_t *marker = (uint64_t *)b;
if(*marker == marker_glUseProgramStages_hack)
{
// increment to point to pipeline id
marker++;
// increment to point to stages field
marker++;
// now compare
uint32_t *chunkStages = (uint32_t *)marker;
if(*chunkStages == stages)
return true;
return false;
}
b++;
}
RDCERR(
"Didn't find marker value! This should not happen, check "
"Serialise_glUseProgramStages serialisation");
return false;
}
};
record->FilterChunks(FilterChunkClass(stages));
record->AddChunk(chunk);
}
if(program)
{
GLResourceRecord *progrecord =
GetResourceManager()->GetResourceRecord(ProgramRes(GetCtx(), program));
RDCASSERT(progrecord);
record->AddParent(progrecord);
}
}
else
{
if(program)
{
ResourceId pipeID = GetResourceManager()->GetID(ProgramPipeRes(GetCtx(), pipeline));
ResourceId progID = GetResourceManager()->GetID(ProgramRes(GetCtx(), program));
//.........这里部分代码省略.........