Fix incorrect streamout buffer index in GS + refactor various code (#258)

This commit is contained in:
Herman Semenov 2022-09-17 04:45:18 +03:00 committed by GitHub
parent 4a3d02db55
commit 03f5967408
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 70 additions and 92 deletions

View file

@ -101,7 +101,7 @@ namespace Espresso
struct BOField
{
BOField() {};
BOField() = default;
BOField(uint8 bo) : bo(bo) {};
bool conditionInverted() const

View file

@ -10,7 +10,7 @@ class PPCFunctionBoundaryTracker
public:
struct PPCRange_t
{
PPCRange_t() {};
PPCRange_t() = default;
PPCRange_t(uint32 _startAddress) : startAddress(_startAddress) {};
uint32 startAddress{};

View file

@ -197,7 +197,7 @@ struct raLivenessLocation_t
bool isRead;
bool isWrite;
raLivenessLocation_t() {};
raLivenessLocation_t() = default;
raLivenessLocation_t(sint32 index, bool isRead, bool isWrite)
: index(index), isRead(isRead), isWrite(isWrite) {};

View file

@ -29,7 +29,7 @@ class IntervalTree2
struct InternalRange
{
InternalRange() {};
InternalRange() = default;
InternalRange(TRangeData _rangeBegin, TRangeData _rangeEnd) : rangeBegin(_rangeBegin), rangeEnd(_rangeEnd) { cemu_assert_debug(_rangeBegin < _rangeEnd); };
TRangeData rangeBegin;

View file

@ -208,7 +208,7 @@ LatteParsedGSCopyShader* LatteGSCopyShaderParser_parse(uint8* programData, uint3
uint32 bufferIndex;
if (cf_inst23_7 == GPU7_CF_INST_MEM_STREAM0_WRITE)
bufferIndex = 0;
else if (cf_inst23_7 == GPU7_CF_INST_MEM_STREAM0_WRITE)
else if (cf_inst23_7 == GPU7_CF_INST_MEM_STREAM1_WRITE)
bufferIndex = 1;
else
cemu_assert_debug(false);

View file

@ -493,17 +493,18 @@ bool LatteMRT::UpdateCurrentFBO()
sint32 colorAttachmentWidth;
sint32 colorAttachmentHeight;
LatteTexture_getSize(colorAttachmentView->baseTexture, &colorAttachmentWidth, &colorAttachmentHeight, nullptr, colorAttachmentView->firstMip);
// set effective size
sint32 effectiveWidth, effectiveHeight;
LatteTexture_getEffectiveSize(colorAttachmentView->baseTexture, &effectiveWidth, &effectiveHeight, nullptr, colorAttachmentView->firstMip);
if( rtEffectiveSize->width == 0 && rtEffectiveSize->height == 0 )
if (rtEffectiveSize->width == 0 && rtEffectiveSize->height == 0)
{
rtEffectiveSize->width = effectiveWidth;
rtEffectiveSize->height = effectiveHeight;
}
else if( rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight )
else if (rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight)
{
#ifndef PUBLIC_RELEASE
forceLog_printf("Color buffer size mismatch (%dx%d). Effective size: %dx%d Real size: %dx%d Mismatching texture: %08x %dx%d fmt %04x", rtEffectiveSize->width, rtEffectiveSize->height, effectiveWidth, effectiveHeight, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, colorAttachmentView->baseTexture->physAddress, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, (uint32)colorAttachmentView->baseTexture->format);

View file

@ -609,7 +609,7 @@ void LatteShaderCache_loadOrCompileSeparableShader(LatteDecompilerShader* shader
bool LatteShaderCache_readSeparableVertexShader(MemStreamReader& streamReader, uint8 version)
{
std::unique_ptr<LatteContextRegister> lcr(new LatteContextRegister());
auto lcr = std::make_unique<LatteContextRegister>();
if (version != 1)
return false;
uint64 shaderBaseHash = streamReader.readBE<uint64>();
@ -658,7 +658,7 @@ bool LatteShaderCache_readSeparableGeometryShader(MemStreamReader& streamReader,
{
if (version != 1)
return false;
std::unique_ptr<LatteContextRegister> lcr(new LatteContextRegister());
auto lcr = std::make_unique<LatteContextRegister>();
uint64 shaderBaseHash = streamReader.readBE<uint64>();
uint64 shaderAuxHash = streamReader.readBE<uint64>();
uint32 vsRingParameterCount = streamReader.readBE<uint16>();
@ -698,7 +698,7 @@ bool LatteShaderCache_readSeparablePixelShader(MemStreamReader& streamReader, ui
{
if (version != 1)
return false;
std::unique_ptr<LatteContextRegister> lcr(new LatteContextRegister());
auto lcr = std::make_unique<LatteContextRegister>();
uint64 shaderBaseHash = streamReader.readBE<uint64>();
uint64 shaderAuxHash = streamReader.readBE<uint64>();
bool usesGeometryShader = streamReader.readBE<uint8>() != 0;

View file

@ -214,6 +214,10 @@ void VulkanPipelineStableCache::LoadPipelineFromCache(std::span<uint8> fileData)
if (!DeserializePipeline(streamReader, *cachedPipeline))
{
// failed to deserialize
s_spinlockSharedInternal.acquire();
delete lcr;
delete cachedPipeline;
s_spinlockSharedInternal.release();
return;
}
// restored register view from compacted state

View file

@ -3,7 +3,7 @@
struct VulkanPipelineHash
{
VulkanPipelineHash() {};
VulkanPipelineHash() = default;
VulkanPipelineHash(uint64 h0, uint64 h1) : h0(h0), h1(h1) {};
uint64 h0;