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

@ -577,7 +577,7 @@ namespace CafeSystem
const auto file = fsc_open(rpxPath.c_str(), FSC_ACCESS_FLAG::OPEN_FILE | FSC_ACCESS_FLAG::READ_PERMISSION, &status);
if (file)
{
_pathToExecutable = rpxPath;
_pathToExecutable = std::move(rpxPath);
fsc_close(file);
}
}

View file

@ -143,7 +143,7 @@ sint32 fsc_mount(std::string_view mountPath, std::string_view targetPath, fscDev
}
node->device = fscDevice;
node->ctx = ctx;
node->deviceTargetPath = targetPathWithSlash;
node->deviceTargetPath = std::move(targetPathWithSlash);
fscLeave();
return FSC_STATUS_OK;
}

View file

@ -1020,9 +1020,9 @@ bool GraphicPack2::Deactivate()
m_upscaling_shader_ud.reset();
m_downscaling_shader_ud.reset();
m_output_shader_source = "";
m_upscaling_shader_source = "";
m_downscaling_shader_source = "";
m_output_shader_source.clear();
m_upscaling_shader_source.clear();
m_downscaling_shader_source.clear();
if (HasCustomVSyncFrequency())
{

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;

View file

@ -243,6 +243,7 @@ bool RPLLoader_ProcessHeaders(std::string_view moduleName, uint8* rplData, uint3
if (fileinfoSection->sectionSize < sizeof(RPLFileInfoData))
{
cemuLog_force("RPLLoader: FILEINFO section size is below expected size");
delete rplLoaderContext;
return false;
}
@ -1963,7 +1964,7 @@ void RPLLoader_AddDependency(const char* name)
if (rplLoader_currentTlsModuleIndex == 0x7FFF)
cemuLog_force("RPLLoader: Exhausted TLS module indices pool");
// convert name to path/filename if it isn't already one
if (strstr(name, "."))
if (strchr(name, '.'))
{
strcpy_s(newDependency->filepath, name);
}

View file

@ -10,7 +10,7 @@ template <typename T>
class PPCConcurrentQueue
{
public:
PPCConcurrentQueue() {}
PPCConcurrentQueue() = default;
PPCConcurrentQueue(const PPCConcurrentQueue&) = delete;
PPCConcurrentQueue& operator=(const PPCConcurrentQueue&) = delete;

View file

@ -54,9 +54,7 @@ namespace coreinit
{
}
~OSHostThread()
{
}
~OSHostThread() = default;
OSThread_t* m_thread;
Fiber m_fiber;
@ -1223,7 +1221,7 @@ namespace coreinit
{
struct DeallocatorQueueEntry
{
DeallocatorQueueEntry() {};
DeallocatorQueueEntry() = default;
DeallocatorQueueEntry(OSThread_t* thread, MEMPTR<void> stack, MEMPTR<void> deallocatorFunc) : thread(thread), stack(stack), deallocatorFunc(deallocatorFunc) {};
OSThread_t* thread{};

View file

@ -835,8 +835,11 @@ namespace H264
auto asyncTask = std::async(std::launch::async, _async_H264DECEnd, executeDoneEvent.GetPointer(), session, ctx, &results);
coreinit::OSWaitEvent(executeDoneEvent);
_ReleaseDecoderSession(session);
for (auto& itr : results)
H264DoFrameOutputCallback(ctx, itr);
if (!results.empty())
{
for (auto& itr : results)
H264DoFrameOutputCallback(ctx, itr);
}
return H264DEC_STATUS::SUCCESS;
}

View file

@ -72,7 +72,6 @@ void MetaInfo::ParseDirectory(const fs::path& filename)
bool MetaInfo::ParseFile(const fs::path& filename)
{
const auto extension = filename.extension();
if (filename.filename() != "meta.xml")
return false;

View file

@ -287,7 +287,6 @@ void TitleInfo::CalcUID()
m_uid = 0;
return;
}
std::error_code ec;
// get absolute normalized path
fs::path normalizedPath;
if (m_fullPath.is_relative())

View file

@ -78,9 +78,9 @@ void CafeTitleList::LoadCacheFile()
cacheEntry.titleVersion = titleVersion;
cacheEntry.titleDataFormat = format;
cacheEntry.region = region;
cacheEntry.titleName = name;
cacheEntry.titleName = std::move(name);
cacheEntry.path = _utf8ToPath(path);
cacheEntry.subPath = sub_path;
cacheEntry.subPath = std::move(sub_path);
cacheEntry.group_id = group_id;
cacheEntry.app_type = app_type;
@ -482,7 +482,7 @@ void CafeTitleList::AddTitle(TitleInfo* titleInfo)
}
}
sTLList.emplace_back(titleInfo);
sTLMap.insert(std::pair(titleInfo->GetAppTitleId(), titleInfo));
sTLMap.emplace(titleInfo->GetAppTitleId(), titleInfo);
// send out notification
CafeTitleListCallbackEvent evt;
evt.eventType = CafeTitleListCallbackEvent::TYPE::TITLE_DISCOVERED;