Fix PrimitivesGenerated query, disable Transform Feedback queries for now

Lets Splatoon 2 work on nvidia. (mostly)
This commit is contained in:
riperiperi 2021-12-04 23:02:15 +00:00
parent 51bd7454bd
commit d55f664908
2 changed files with 10 additions and 5 deletions

View file

@ -27,12 +27,17 @@ namespace Ryujinx.Graphics.Vulkan.Queries
_api = gd.Api; _api = gd.Api;
_device = device; _device = device;
_pipeline = pipeline; _pipeline = pipeline;
_type = type;
QueryPipelineStatisticFlags flags = type == CounterType.PrimitivesGenerated ?
QueryPipelineStatisticFlags.QueryPipelineStatisticGeometryShaderPrimitivesBit : 0;
var queryPoolCreateInfo = new QueryPoolCreateInfo() var queryPoolCreateInfo = new QueryPoolCreateInfo()
{ {
SType = StructureType.QueryPoolCreateInfo, SType = StructureType.QueryPoolCreateInfo,
QueryCount = 1, QueryCount = 1,
QueryType = GetQueryType(type) QueryType = GetQueryType(type),
PipelineStatistics = flags
}; };
gd.Api.CreateQueryPool(device, queryPoolCreateInfo, null, out _queryPool).ThrowOnError(); gd.Api.CreateQueryPool(device, queryPoolCreateInfo, null, out _queryPool).ThrowOnError();
@ -40,7 +45,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true); var buffer = gd.BufferManager.Create(gd, sizeof(long), forConditionalRendering: true);
_bufferMap = buffer.Map(0, sizeof(long)); _bufferMap = buffer.Map(0, sizeof(long));
Marshal.WriteInt64(_bufferMap, -1L); Marshal.WriteInt64(_bufferMap, DefaultValue);
_buffer = buffer; _buffer = buffer;
} }
@ -77,7 +82,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
if (withResult) if (withResult)
{ {
Marshal.WriteInt64(_bufferMap, -1L); Marshal.WriteInt64(_bufferMap, DefaultValue);
_pipeline.CopyQueryResults(_queryPool, _buffer); _pipeline.CopyQueryResults(_queryPool, _buffer);
// _pipeline.FlushCommandsImpl(); // _pipeline.FlushCommandsImpl();
} }
@ -115,7 +120,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
if (iterations >= MaxQueryRetries) if (iterations >= MaxQueryRetries)
{ {
Logger.Error?.Print(LogClass.Gpu, $"Error: Query result timed out. Took more than {MaxQueryRetries} tries."); Logger.Error?.Print(LogClass.Gpu, $"Error: Query result {_type} timed out. Took more than {MaxQueryRetries} tries.");
} }
} }

View file

@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Vulkan.Queries
_current.ReserveForHostAccess(); _current.ReserveForHostAccess();
} }
if (draws > 0) if (draws > 0 && Type != CounterType.TransformFeedbackPrimitivesWritten)
{ {
_current.Complete(true); _current.Complete(true);
_events.Enqueue(_current); _events.Enqueue(_current);