Falcor icon indicating copy to clipboard operation
Falcor copied to clipboard

constant buffer not uploaded to GPU

Open bryan05 opened this issue 6 years ago • 4 comments

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

bryan05 avatar Jul 06 '18 23:07 bryan05

All bound constant buffers should be automatically uploaded before rendering, are you sure it isn't working?

kyaoNV avatar Jul 07 '18 00:07 kyaoNV

I changed the function from updateData to VariablesBuffer::setBlob, it works, because mDirty is set to true in setBlob function

bryan05 avatar Jul 09 '18 16:07 bryan05

@kyaoNV updateData() should work. If it doesn't, we need to figure out why

nbentyNV avatar Jul 09 '18 17:07 nbentyNV

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.

nbentyNV avatar Oct 18 '18 18:10 nbentyNV