Showing results for 
Search instead for 
Did you mean: 

CopyResource from staging buffer to constant buffer not working

Calling CopyResource with a staging buffer as source and constant buffer as destination seems to not copy any data at all, leaving it with the initial data it was created with (either provided at buffer creation or garbage uninitialized data). So far it seems to only happen when the destination buffer has both DEFAULT usage and CONSTANT_BUFFER bind flags. The same operation works for buffers which have BIND_VERTEX_BUFFER and BIND_INDEX_BUFFER.

System Used: (Manufacturer/Model)
    Apple Inc., MacBookPro9,2
CPU SKU: (i3, i5, Pentium, Celeron, etc.)
    Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
GPU SKU: (HD4400, HD5100, etc.)
    Intel(R) HD Graphics 4000
Processor Line: (Y-Series, U-Series, etc.)
System BIOS Version:
CMOS settings:
Graphics Driver Version:
GOP/VBIOS Version:
    2120 PC 14.34 08/03/2011 23:04:12
Operating System:
    Windows 7
OS Version:
    Windows 7 Professional SP1
    DirectX 11
Occurs on non-Intel GPUs?:

Steps to Reproduce:
1. Create and populate a buffer with `D3D11_USAGE_STAGING` flags and cpu read & write.
2. Create the destination buffer with `D3D11_USAGE_DEFAULT` and `D3D11_BIND_CONSTANT_BUFFER` flags.
3. Call `CopyResource` with the staging buffer as source and the constant buffer as destination.
4. Read from the constant buffer in any shader stage.

Expected Results:
The destination buffer of the CopyResource call gets updated with the contents of the source buffer and can be used in any shader stage.

Actual Results:
The destination buffer does not get updated with the contents of the source buffer (at least from within the shader). Writing out the contents of the buffer from within the VS shows garbage values (0xfefefefefe..)

Additional Information:
Inspecting the contents of the buffer at the drawcall with both Intel GPA and RenderDoc shows the correct buffer contents.

Following link contains a small application with the bug reproduced. The VS reads some values and should animate the triangle drawn. The constant buffer is updated via CopyResource as described above each frame:


0 Kudos
0 Replies