Query API: Non-precise occlusion query on D3D12

- Implement begin/endOcclusionQuery on D3D12, the query result is binary
  (0/1), so we don't need compute shader on D3D12.
- Add end2end tests with depth/stencil/scissor tests enable/disable

Bug: dawn:434
Change-Id: I7b58987a9bc3e7f9cbcdee83f630aaa166582f5f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36860
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Hao Li
2021-01-12 01:44:01 +00:00
committed by Commit Bot service account
parent ea26a8ce55
commit 9ff83f6c95
3 changed files with 195 additions and 12 deletions

View File

@@ -60,7 +60,7 @@ namespace dawn_native { namespace d3d12 {
D3D12_QUERY_TYPE D3D12QueryType(wgpu::QueryType type) {
switch (type) {
case wgpu::QueryType::Occlusion:
return D3D12_QUERY_TYPE_OCCLUSION;
return D3D12_QUERY_TYPE_BINARY_OCCLUSION;
case wgpu::QueryType::PipelineStatistics:
return D3D12_QUERY_TYPE_PIPELINE_STATISTICS;
case wgpu::QueryType::Timestamp:
@@ -1433,11 +1433,23 @@ namespace dawn_native { namespace d3d12 {
}
case Command::BeginOcclusionQuery: {
return DAWN_UNIMPLEMENTED_ERROR("Waiting for implementation.");
BeginOcclusionQueryCmd* cmd = mCommands.NextCommand<BeginOcclusionQueryCmd>();
QuerySet* querySet = ToBackend(cmd->querySet.Get());
ASSERT(D3D12QueryType(querySet->GetQueryType()) ==
D3D12_QUERY_TYPE_BINARY_OCCLUSION);
commandList->BeginQuery(querySet->GetQueryHeap(),
D3D12_QUERY_TYPE_BINARY_OCCLUSION, cmd->queryIndex);
break;
}
case Command::EndOcclusionQuery: {
return DAWN_UNIMPLEMENTED_ERROR("Waiting for implementation.");
EndOcclusionQueryCmd* cmd = mCommands.NextCommand<EndOcclusionQueryCmd>();
QuerySet* querySet = ToBackend(cmd->querySet.Get());
ASSERT(D3D12QueryType(querySet->GetQueryType()) ==
D3D12_QUERY_TYPE_BINARY_OCCLUSION);
commandList->EndQuery(querySet->GetQueryHeap(),
D3D12_QUERY_TYPE_BINARY_OCCLUSION, cmd->queryIndex);
break;
}
case Command::WriteTimestamp: {