1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Implement Stream Output queries

This commit is contained in:
Philip Rebohle 2018-08-31 16:10:55 +02:00
parent 93753a5ce7
commit 44024e7a7a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 49 additions and 10 deletions

View File

@ -985,16 +985,6 @@ namespace dxvk {
ID3D11Query** ppQuery) { ID3D11Query** ppQuery) {
InitReturnPtr(ppQuery); InitReturnPtr(ppQuery);
if (pQueryDesc->Query != D3D11_QUERY_EVENT
&& pQueryDesc->Query != D3D11_QUERY_OCCLUSION
&& pQueryDesc->Query != D3D11_QUERY_TIMESTAMP
&& pQueryDesc->Query != D3D11_QUERY_TIMESTAMP_DISJOINT
&& pQueryDesc->Query != D3D11_QUERY_PIPELINE_STATISTICS
&& pQueryDesc->Query != D3D11_QUERY_OCCLUSION_PREDICATE) {
Logger::warn(str::format("D3D11Query: Unsupported query type ", pQueryDesc->Query));
return E_INVALIDARG;
}
if (ppQuery == nullptr) if (ppQuery == nullptr)
return S_FALSE; return S_FALSE;

View File

@ -36,6 +36,35 @@ namespace dxvk {
VK_QUERY_TYPE_PIPELINE_STATISTICS, 0); VK_QUERY_TYPE_PIPELINE_STATISTICS, 0);
break; break;
case D3D11_QUERY_SO_STATISTICS:
case D3D11_QUERY_SO_STATISTICS_STREAM0:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0:
// FIXME it is technically incorrect to map
// SO_OVERFLOW_PREDICATE to the first stream,
// but this is good enough for D3D10 behaviour
m_query = new DxvkQuery(
VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT, 0, 0);
break;
case D3D11_QUERY_SO_STATISTICS_STREAM1:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1:
m_query = new DxvkQuery(
VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT, 0, 1);
break;
case D3D11_QUERY_SO_STATISTICS_STREAM2:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2:
m_query = new DxvkQuery(
VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT, 0, 2);
break;
case D3D11_QUERY_SO_STATISTICS_STREAM3:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3:
m_query = new DxvkQuery(
VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT, 0, 3);
break;
default: default:
throw DxvkError(str::format("D3D11: Unhandled query type: ", desc.Query)); throw DxvkError(str::format("D3D11: Unhandled query type: ", desc.Query));
} }
@ -247,6 +276,26 @@ namespace dxvk {
data->CSInvocations = queryData.statistic.csInvocations; data->CSInvocations = queryData.statistic.csInvocations;
} return S_OK; } return S_OK;
case D3D11_QUERY_SO_STATISTICS:
case D3D11_QUERY_SO_STATISTICS_STREAM0:
case D3D11_QUERY_SO_STATISTICS_STREAM1:
case D3D11_QUERY_SO_STATISTICS_STREAM2:
case D3D11_QUERY_SO_STATISTICS_STREAM3: {
auto data = static_cast<D3D11_QUERY_DATA_SO_STATISTICS*>(pData);
data->NumPrimitivesWritten = queryData.xfbStream.primitivesWritten;
data->PrimitivesStorageNeeded = queryData.xfbStream.primitivesNeeded;
} return S_OK;
case D3D11_QUERY_SO_OVERFLOW_PREDICATE:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2:
case D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3: {
auto data = static_cast<BOOL*>(pData);
*data = queryData.xfbStream.primitivesNeeded
> queryData.xfbStream.primitivesWritten;
} return S_OK;
default: default:
Logger::err(str::format("D3D11: Unhandled query type in GetData: ", m_desc.Query)); Logger::err(str::format("D3D11: Unhandled query type in GetData: ", m_desc.Query));
return E_INVALIDARG; return E_INVALIDARG;