mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 20:52:10 +01:00
[d3d11] Implement Stream Output queries
This commit is contained in:
parent
93753a5ce7
commit
44024e7a7a
@ -985,16 +985,6 @@ namespace dxvk {
|
||||
ID3D11Query** 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)
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -36,6 +36,35 @@ namespace dxvk {
|
||||
VK_QUERY_TYPE_PIPELINE_STATISTICS, 0);
|
||||
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:
|
||||
throw DxvkError(str::format("D3D11: Unhandled query type: ", desc.Query));
|
||||
}
|
||||
@ -247,6 +276,26 @@ namespace dxvk {
|
||||
data->CSInvocations = queryData.statistic.csInvocations;
|
||||
} 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:
|
||||
Logger::err(str::format("D3D11: Unhandled query type in GetData: ", m_desc.Query));
|
||||
return E_INVALIDARG;
|
||||
|
Loading…
x
Reference in New Issue
Block a user