Skip to content

Commit

Permalink
D3D: update BoundingBox to match generated shader code
Browse files Browse the repository at this point in the history
  • Loading branch information
iwubcode committed May 22, 2022
1 parent 58d618c commit 8fac4d6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Source/Core/VideoBackends/D3D/D3DBoundingBox.cpp
Expand Up @@ -27,7 +27,8 @@ bool D3DBoundingBox::Initialize()
// Create 2 buffers here.
// First for unordered access on default pool.
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};
D3D11_SUBRESOURCE_DATA data;
data.pSysMem = initial_values;
Expand All @@ -44,6 +45,7 @@ bool D3DBoundingBox::Initialize()
desc.Usage = D3D11_USAGE_STAGING;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
desc.BindFlags = 0;
desc.MiscFlags = 0;
hr = D3D::device->CreateBuffer(&desc, nullptr, &m_staging_buffer);
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create BoundingBox Staging Buffer: {}",
DX11HRWrap(hr));
Expand All @@ -53,10 +55,10 @@ bool D3DBoundingBox::Initialize()

// UAV is required to allow concurrent access.
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.Buffer.FirstElement = 0;
UAVdesc.Buffer.Flags = 0;
UAVdesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW;
UAVdesc.Buffer.NumElements = NUM_BBOX_VALUES;
hr = D3D::device->CreateUnorderedAccessView(m_buffer.Get(), &UAVdesc, &m_uav);
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create BoundingBox UAV: {}", DX11HRWrap(hr));
Expand Down

0 comments on commit 8fac4d6

Please sign in to comment.