mirror of
https://github.com/Inori/GPCS4.git
synced 2024-06-01 19:08:08 -04:00
fix scalar buffer load for ssbo
This commit is contained in:
parent
1f649c0d1c
commit
82dbae613a
|
@ -2269,26 +2269,33 @@ namespace sce::gcn
|
|||
return result;
|
||||
}
|
||||
|
||||
void GcnCompiler::emitConstantBufferLoad(
|
||||
void GcnCompiler::emitScalarBufferLoad(
|
||||
const GcnRegIndex& index,
|
||||
const GcnInstOperand& dst,
|
||||
uint32_t count)
|
||||
{
|
||||
uint32_t regId = index.regIdx;
|
||||
GcnRegisterValue baseId = emitIndexLoad(index);
|
||||
const auto& buffer = m_buffers.at(regId);
|
||||
|
||||
uint32_t fpTypeId = getScalarTypeId(GcnScalarType::Float32);
|
||||
const uint32_t typeId = getScalarTypeId(buffer.asSsbo
|
||||
? GcnScalarType::Uint32
|
||||
: GcnScalarType::Float32);
|
||||
|
||||
auto ptrList = emitUniformBufferAccess(m_buffers.at(regId).varId,
|
||||
baseId.id,
|
||||
count);
|
||||
auto ptrList = buffer.asSsbo
|
||||
? emitStorageBufferAccess(buffer.varId,
|
||||
baseId.id,
|
||||
count)
|
||||
: emitUniformBufferAccess(buffer.varId,
|
||||
baseId.id,
|
||||
count);
|
||||
|
||||
for (uint32_t i = 0; i != count ; ++i)
|
||||
{
|
||||
const auto& ptr = ptrList[i];
|
||||
GcnRegisterValuePair value = {};
|
||||
value.low.type = ptr.type;
|
||||
value.low.id = m_module.opLoad(fpTypeId,
|
||||
value.low.id = m_module.opLoad(typeId,
|
||||
ptr.id);
|
||||
|
||||
GcnInstOperand reg = dst;
|
||||
|
|
|
@ -483,7 +483,7 @@ namespace sce::gcn
|
|||
void emitRawBufferLoad(
|
||||
const GcnShaderInstruction& ins);
|
||||
|
||||
void emitConstantBufferLoad(
|
||||
void emitScalarBufferLoad(
|
||||
const GcnRegIndex& index,
|
||||
const GcnInstOperand& dst,
|
||||
uint32_t count);
|
||||
|
|
|
@ -45,7 +45,8 @@ namespace sce::gcn
|
|||
index.offset = 0;
|
||||
index.relReg = &smrd.offset;
|
||||
}
|
||||
emitConstantBufferLoad(index, smrd.sdst, smrd.control.count);
|
||||
|
||||
emitScalarBufferLoad(index, smrd.sdst, smrd.control.count);
|
||||
}
|
||||
break;
|
||||
case GcnOpcode::S_LOAD_DWORDX4:
|
||||
|
|
|
@ -720,7 +720,7 @@ namespace sce::gcn
|
|||
|
||||
if (flags.test(GcnMimgModifier::Offset))
|
||||
{
|
||||
m_module.enableCapability(spv::CapabilityImageGatherExtended);
|
||||
// m_module.enableCapability(spv::CapabilityImageGatherExtended);
|
||||
|
||||
auto offset = emitLoadTexOffset(ins);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "Gcn/GcnShaderMeta.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
LOG_CHANNEL(Graphic.Gnm.GnmShader);
|
||||
|
||||
|
@ -33,6 +33,11 @@ namespace sce::Gnm
|
|||
{
|
||||
m_shader = m_module.compile(meta, moduleInfo);
|
||||
m_shader->setShaderKey(m_key);
|
||||
|
||||
std::ofstream fout(
|
||||
fmt::format("shaders/{}", m_shader->debugName()),
|
||||
std::ofstream::binary);
|
||||
m_shader->dump(fout);
|
||||
}
|
||||
return m_shader;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue