d3d11: enable BindGroupTests
The cases can pass now with a few fixes. Bug: dawn:1776 Bug: dawn:1705 Change-Id: I4a38887c51d003b4e9b782fd9217c9ce2c7dd423 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128980 Commit-Queue: Jie A Chen <jie.a.chen@intel.com> Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
ed2ce8bab3
commit
c755ec54aa
|
@ -319,10 +319,10 @@ ResultOrError<ComPtr<ID3D11ShaderResourceView>> Buffer::CreateD3D11ShaderResourc
|
||||||
|
|
||||||
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
|
D3D11_SHADER_RESOURCE_VIEW_DESC desc;
|
||||||
desc.Format = DXGI_FORMAT_R32_TYPELESS;
|
desc.Format = DXGI_FORMAT_R32_TYPELESS;
|
||||||
desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
desc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||||
desc.Buffer.FirstElement = firstElement;
|
desc.BufferEx.FirstElement = firstElement;
|
||||||
desc.Buffer.NumElements = numElements;
|
desc.BufferEx.NumElements = numElements;
|
||||||
|
desc.BufferEx.Flags = D3D11_BUFFEREX_SRV_FLAG_RAW;
|
||||||
ComPtr<ID3D11ShaderResourceView> srv;
|
ComPtr<ID3D11ShaderResourceView> srv;
|
||||||
DAWN_TRY(CheckHRESULT(ToBackend(GetDevice())
|
DAWN_TRY(CheckHRESULT(ToBackend(GetDevice())
|
||||||
->GetD3D11Device()
|
->GetD3D11Device()
|
||||||
|
|
|
@ -105,10 +105,12 @@ class BindGroupTracker : public BindGroupTrackerBase<false, uint64_t> {
|
||||||
// Offset and size are measured in shader constants, which are 16 bytes
|
// Offset and size are measured in shader constants, which are 16 bytes
|
||||||
// (4*32-bit components). And the offsets and counts must be multiples
|
// (4*32-bit components). And the offsets and counts must be multiples
|
||||||
// of 16.
|
// of 16.
|
||||||
ASSERT(IsAligned(offset, 256));
|
DAWN_ASSERT(IsAligned(offset, 256));
|
||||||
UINT firstConstant = static_cast<UINT>(offset / 16);
|
uint32_t firstConstant = static_cast<uint32_t>(offset / 16);
|
||||||
UINT size = static_cast<UINT>(binding.size / 16);
|
uint32_t size = static_cast<uint32_t>(Align(binding.size, 16) / 16);
|
||||||
UINT numConstants = Align(size, 16);
|
uint32_t numConstants = Align(size, 16);
|
||||||
|
DAWN_ASSERT(offset + numConstants * 16 <=
|
||||||
|
binding.buffer->GetAllocatedSize());
|
||||||
|
|
||||||
if (bindingInfo.visibility & wgpu::ShaderStage::Vertex) {
|
if (bindingInfo.visibility & wgpu::ShaderStage::Vertex) {
|
||||||
deviceContext->VSSetConstantBuffers1(bindingSlot, 1, &d3d11Buffer,
|
deviceContext->VSSetConstantBuffers1(bindingSlot, 1, &d3d11Buffer,
|
||||||
|
@ -146,7 +148,7 @@ class BindGroupTracker : public BindGroupTrackerBase<false, uint64_t> {
|
||||||
ComPtr<ID3D11ShaderResourceView> d3d11SRV;
|
ComPtr<ID3D11ShaderResourceView> d3d11SRV;
|
||||||
DAWN_TRY_ASSIGN(d3d11SRV, ToBackend(binding.buffer)
|
DAWN_TRY_ASSIGN(d3d11SRV, ToBackend(binding.buffer)
|
||||||
->CreateD3D11ShaderResourceView(
|
->CreateD3D11ShaderResourceView(
|
||||||
binding.offset, binding.size));
|
offset, binding.size));
|
||||||
if (bindingInfo.visibility & wgpu::ShaderStage::Vertex) {
|
if (bindingInfo.visibility & wgpu::ShaderStage::Vertex) {
|
||||||
deviceContext->VSSetShaderResources(bindingSlot, 1,
|
deviceContext->VSSetShaderResources(bindingSlot, 1,
|
||||||
d3d11SRV.GetAddressOf());
|
d3d11SRV.GetAddressOf());
|
||||||
|
|
|
@ -241,6 +241,8 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
||||||
// shader. In D3D12 for example, these different types of bindings end up in different namespaces,
|
// shader. In D3D12 for example, these different types of bindings end up in different namespaces,
|
||||||
// but the register offsets used must match between the shader module and descriptor range.
|
// but the register offsets used must match between the shader module and descriptor range.
|
||||||
TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
|
// TODO(dawn:1768): enable this test once computer shader B2T is supported.
|
||||||
|
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
||||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||||
|
@ -992,6 +994,9 @@ TEST_P(BindGroupTests, DrawThenChangePipelineTwiceAndBindGroup) {
|
||||||
// Regression test for crbug.com/dawn/408 where dynamic offsets were applied in the wrong order.
|
// Regression test for crbug.com/dawn/408 where dynamic offsets were applied in the wrong order.
|
||||||
// Dynamic offsets should be applied in increasing order of binding number.
|
// Dynamic offsets should be applied in increasing order of binding number.
|
||||||
TEST_P(BindGroupTests, DynamicOffsetOrder) {
|
TEST_P(BindGroupTests, DynamicOffsetOrder) {
|
||||||
|
// TODO(dawn:1776): Fix the UpdateSubresource1 16-byte alignment.
|
||||||
|
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
||||||
|
|
||||||
// We will put the following values and the respective offsets into a buffer.
|
// We will put the following values and the respective offsets into a buffer.
|
||||||
// The test will ensure that the correct dynamic offset is applied to each buffer by reading the
|
// The test will ensure that the correct dynamic offset is applied to each buffer by reading the
|
||||||
// value from an offset binding.
|
// value from an offset binding.
|
||||||
|
@ -1077,6 +1082,9 @@ TEST_P(BindGroupTests, DynamicAndNonDynamicBindingsDoNotConflictAfterRemapping)
|
||||||
// // TODO(crbug.com/dawn/1106): Test output is wrong on D3D12 using WARP.
|
// // TODO(crbug.com/dawn/1106): Test output is wrong on D3D12 using WARP.
|
||||||
DAWN_SUPPRESS_TEST_IF(IsWARP());
|
DAWN_SUPPRESS_TEST_IF(IsWARP());
|
||||||
|
|
||||||
|
// TODO(dawn:1776): Fix the UpdateSubresource1 16-byte alignment.
|
||||||
|
DAWN_SUPPRESS_TEST_IF(IsD3D11());
|
||||||
|
|
||||||
auto RunTestWith = [&](bool dynamicBufferFirst) {
|
auto RunTestWith = [&](bool dynamicBufferFirst) {
|
||||||
uint32_t dynamicBufferBindingNumber = dynamicBufferFirst ? 0 : 1;
|
uint32_t dynamicBufferBindingNumber = dynamicBufferFirst ? 0 : 1;
|
||||||
uint32_t bufferBindingNumber = dynamicBufferFirst ? 1 : 0;
|
uint32_t bufferBindingNumber = dynamicBufferFirst ? 1 : 0;
|
||||||
|
@ -1507,6 +1515,7 @@ TEST_P(BindGroupTests, CreateWithDestroyedResource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(BindGroupTests,
|
DAWN_INSTANTIATE_TEST(BindGroupTests,
|
||||||
|
D3D11Backend(),
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
||||||
OpenGLBackend(),
|
OpenGLBackend(),
|
||||||
|
|
Loading…
Reference in New Issue