MCPcopy Create free account
hub / github.com/baldurk/renderdoc / RT_FetchVertexPipeData

Function RT_FetchVertexPipeData

qrenderdoc/Windows/BufferViewer.cpp:2055–2314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2053}
2054
2055static void RT_FetchVertexPipeData(IReplayController *r, ICaptureContext &ctx,
2056 PopulateBufferData *data)
2057{
2058 const ActionDescription *action = ctx.CurAction();
2059
2060 BoundVBuffer ib = ctx.CurPipelineState().GetIBuffer();
2061
2062 rdcarray<BoundVBuffer> vbs = ctx.CurPipelineState().GetVBuffers();
2063
2064 uint32_t numIndices = action ? action->numIndices : 0;
2065
2066 bytebuf idata;
2067 if(ib.resourceId != ResourceId() && action && (action->flags & ActionFlags::Indexed))
2068 {
2069 uint64_t readBytes = numIndices * ib.byteStride;
2070 uint32_t offset = action->indexOffset * ib.byteStride;
2071
2072 if(ib.byteSize > offset)
2073 readBytes = qMin(ib.byteSize - offset, readBytes);
2074 else
2075 readBytes = 0;
2076
2077 if(readBytes > 0)
2078 idata = r->GetBufferData(ib.resourceId, ib.byteOffset + offset, readBytes);
2079 }
2080
2081 if(data->inConfig.indices)
2082 data->inConfig.indices->deref();
2083
2084 data->inConfig.indices = new BufferData();
2085
2086 if(action && ib.byteStride != 0 && !idata.isEmpty())
2087 data->inConfig.indices->storage.resize(
2088 sizeof(uint32_t) *
2089 qMin(numIndices, (((uint32_t)idata.size() + ib.byteStride - 1) / ib.byteStride)));
2090 else if(action && (action->flags & ActionFlags::Indexed))
2091 data->inConfig.indices->storage.resize(sizeof(uint32_t));
2092
2093 uint32_t *indices = (uint32_t *)data->inConfig.indices->data();
2094
2095 uint32_t maxIndex = 0;
2096 if(action)
2097 maxIndex = qMax(1U, numIndices) - 1;
2098
2099 if(action && !idata.isEmpty())
2100 {
2101 maxIndex = 0;
2102 if(ib.byteStride == 1)
2103 {
2104 uint8_t primRestart = data->inConfig.primRestart & 0xff;
2105
2106 for(size_t i = 0; i < idata.size() && (uint32_t)i < numIndices; i++)
2107 {
2108 indices[i] = (uint32_t)idata[i];
2109 if(primRestart && indices[i] == primRestart)
2110 continue;
2111
2112 maxIndex = qMax(maxIndex, indices[i]);

Callers 1

OnEventChangedMethod · 0.85

Calls 12

ResourceIdFunction · 0.50
memcpyFunction · 0.50
CurActionMethod · 0.45
GetBufferDataMethod · 0.45
derefMethod · 0.45
isEmptyMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
countMethod · 0.45
push_backMethod · 0.45
refMethod · 0.45

Tested by

no test coverage detected