D3D: update BoundingBox to match generated shader code
This commit is contained in:
parent
cad1d6ce90
commit
0eb9352579
|
@ -27,7 +27,8 @@ bool D3DBoundingBox::Initialize()
|
||||||
// Create 2 buffers here.
|
// Create 2 buffers here.
|
||||||
// First for unordered access on default pool.
|
// First for unordered access on default pool.
|
||||||
auto desc = CD3D11_BUFFER_DESC(NUM_BBOX_VALUES * sizeof(BBoxType), D3D11_BIND_UNORDERED_ACCESS,
|
auto desc = CD3D11_BUFFER_DESC(NUM_BBOX_VALUES * sizeof(BBoxType), D3D11_BIND_UNORDERED_ACCESS,
|
||||||
D3D11_USAGE_DEFAULT, 0, 0, sizeof(BBoxType));
|
D3D11_USAGE_DEFAULT, 0, D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS,
|
||||||
|
sizeof(BBoxType));
|
||||||
const BBoxType initial_values[NUM_BBOX_VALUES] = {0, 0, 0, 0};
|
const BBoxType initial_values[NUM_BBOX_VALUES] = {0, 0, 0, 0};
|
||||||
D3D11_SUBRESOURCE_DATA data;
|
D3D11_SUBRESOURCE_DATA data;
|
||||||
data.pSysMem = initial_values;
|
data.pSysMem = initial_values;
|
||||||
|
@ -44,6 +45,7 @@ bool D3DBoundingBox::Initialize()
|
||||||
desc.Usage = D3D11_USAGE_STAGING;
|
desc.Usage = D3D11_USAGE_STAGING;
|
||||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||||
desc.BindFlags = 0;
|
desc.BindFlags = 0;
|
||||||
|
desc.MiscFlags = 0;
|
||||||
hr = D3D::device->CreateBuffer(&desc, nullptr, &m_staging_buffer);
|
hr = D3D::device->CreateBuffer(&desc, nullptr, &m_staging_buffer);
|
||||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create BoundingBox Staging Buffer: {}",
|
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create BoundingBox Staging Buffer: {}",
|
||||||
DX11HRWrap(hr));
|
DX11HRWrap(hr));
|
||||||
|
@ -53,10 +55,10 @@ bool D3DBoundingBox::Initialize()
|
||||||
|
|
||||||
// UAV is required to allow concurrent access.
|
// UAV is required to allow concurrent access.
|
||||||
D3D11_UNORDERED_ACCESS_VIEW_DESC UAVdesc = {};
|
D3D11_UNORDERED_ACCESS_VIEW_DESC UAVdesc = {};
|
||||||
UAVdesc.Format = DXGI_FORMAT_R32_SINT;
|
UAVdesc.Format = DXGI_FORMAT_R32_TYPELESS;
|
||||||
UAVdesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
UAVdesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||||
UAVdesc.Buffer.FirstElement = 0;
|
UAVdesc.Buffer.FirstElement = 0;
|
||||||
UAVdesc.Buffer.Flags = 0;
|
UAVdesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
|
||||||
UAVdesc.Buffer.NumElements = NUM_BBOX_VALUES;
|
UAVdesc.Buffer.NumElements = NUM_BBOX_VALUES;
|
||||||
hr = D3D::device->CreateUnorderedAccessView(m_buffer.Get(), &UAVdesc, &m_uav);
|
hr = D3D::device->CreateUnorderedAccessView(m_buffer.Get(), &UAVdesc, &m_uav);
|
||||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create BoundingBox UAV: {}", DX11HRWrap(hr));
|
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create BoundingBox UAV: {}", DX11HRWrap(hr));
|
||||||
|
|
Loading…
Reference in New Issue