Falcor
Falcor copied to clipboard
constant buffer not uploaded to GPU
I have a buffer of data and I want to set it to a constant buffer. my code is like the following:
Falcor::ConstantBuffer::SharedPtr const_buf = pVars->getConstantBuffer(buffer->name.get());
const_buf->updateData(buffer->data, 0, buffer->size);
but when I call this function
bool VariablesBuffer::uploadToGPU(size_t offset, size_t size)
{
if(mDirty == false)
{
return false;
}
I found mDirty is always false, so the data will never uploaded to GPU
All bound constant buffers should be automatically uploaded before rendering, are you sure it isn't working?
I changed the function from updateData to VariablesBuffer::setBlob, it works, because mDirty is set to true in setBlob function
@kyaoNV updateData()
should work. If it doesn't, we need to figure out why
The solution is to not have a CPU-side buffer, constant buffer should allocate and write directly to the upload heap and uploadToGPU()
should just allocate a new chunk
We should also consider supporting constant buffers on the default heap.