diff --git a/rpcsx/gpu/Cache.cpp b/rpcsx/gpu/Cache.cpp index 0f29bc1a9..bb0aa2406 100644 --- a/rpcsx/gpu/Cache.cpp +++ b/rpcsx/gpu/Cache.cpp @@ -1072,7 +1072,7 @@ Cache::Shader Cache::Tag::getShader(const ShaderKey &key, readMemory(&result->magic, rx::AddressRange::fromBeginSize( key.address, sizeof(result->magic))); - for (auto entry : converted->info.memoryMap) { + for (auto entry : result->info.memoryMap) { auto entryRange = rx::AddressRange::fromBeginEnd(entry.beginAddress, entry.endAddress); auto &inserted = result->usedMemory.emplace_back(); @@ -1194,7 +1194,8 @@ Cache::Buffer Cache::Tag::getBuffer(rx::AddressRange range, Access access) { addressRange.beginAddress(), addressRange.size()) || !mParent->isInSync(addressRange, cached->tagId)) { - + mParent->flushImages(*this, range); + getScheduler().wait(); mParent->trackUpdate(EntryType::HostVisibleBuffer, addressRange, it.get(), getReadId(), cached->expensive()); amdgpu::RemoteMemory memory{mParent->mVmId}; diff --git a/rpcsx/gpu/lib/gcn-shader/src/GcnConverter.cpp b/rpcsx/gpu/lib/gcn-shader/src/GcnConverter.cpp index 631ee3101..c33d093eb 100644 --- a/rpcsx/gpu/lib/gcn-shader/src/GcnConverter.cpp +++ b/rpcsx/gpu/lib/gcn-shader/src/GcnConverter.cpp @@ -728,20 +728,6 @@ static void expToSpv(GcnConverter &converter, gcn::Stage stage, auto channelType = context.getTypeFloat32(); - if (swizzle == 0 && done) { - auto termBuilder = gcn::Builder::createAppend( - context, context.layout.getOrCreateFunctions(context)); - auto terminateFn = termBuilder.createSpvFunction( - loc, context.getTypeVoid(), ir::spv::FunctionControl::None, - context.getTypeFunction(context.getTypeVoid(), {})); - termBuilder.createSpvLabel(loc); - termBuilder.createSpvKill(loc); - termBuilder.createSpvFunctionEnd(loc); - - builder.createSpvFunctionCall(loc, context.getTypeVoid(), terminateFn, - {}); - } - for (int channel = 0; channel < 4; ++channel) { if (~swizzle & (1 << channel)) { continue; @@ -1111,7 +1097,8 @@ static void instructionsToSpv(GcnConverter &converter, gcn::Import &importer, if (resultType == ir::spv::OpTypeInt) { auto floatType = context.getTypeFloat(*resultType.getOperand(0).getAsInt32()); - value = builder.createSpvBitcast(resultType.getLocation(), floatType, value); + value = builder.createSpvBitcast(resultType.getLocation(), floatType, + value); resultType = floatType; } @@ -1716,7 +1703,8 @@ gcn::convertToSpv(Context &context, ir::Region body, ir::spv::Capability::Int64Atomics); } - capabilities.createSpvCapability(context.getUnknownLocation(), ir::spv::Capability::ImageQuery); + capabilities.createSpvCapability(context.getUnknownLocation(), + ir::spv::Capability::ImageQuery); extensions.createSpvExtension(context.getUnknownLocation(), "SPV_KHR_physical_storage_buffer"); diff --git a/rpcsx/gpu/lib/gcn-shader/src/GcnInstruction.cpp b/rpcsx/gpu/lib/gcn-shader/src/GcnInstruction.cpp index 0492cd561..e312a9b0b 100644 --- a/rpcsx/gpu/lib/gcn-shader/src/GcnInstruction.cpp +++ b/rpcsx/gpu/lib/gcn-shader/src/GcnInstruction.cpp @@ -862,6 +862,28 @@ readSoppInst(GcnInstruction &inst, std::uint64_t &address, } void GcnOperand::print(std::ostream &os) const { + if (neg) { + os << '-'; + } + if (abs) { + os << "abs "; + } + + if (clamp) { + os << "clamp "; + } + switch (omod) { + case 1: + os << "2 * "; + break; + case 2: + os << "4 * "; + break; + case 3: + os << "0.5 * "; + break; + } + switch (kind) { case Kind::Invalid: os << ""; diff --git a/rpcsx/gpu/lib/gcn-shader/src/SpvConverter.cpp b/rpcsx/gpu/lib/gcn-shader/src/SpvConverter.cpp index dc7d26cf0..4fa3d53db 100644 --- a/rpcsx/gpu/lib/gcn-shader/src/SpvConverter.cpp +++ b/rpcsx/gpu/lib/gcn-shader/src/SpvConverter.cpp @@ -561,6 +561,8 @@ ir::Value spv::Context::createOutput(ir::Location loc, int index) { if (result == nullptr) { auto floatType = getTypeFloat32(); auto float32x4Type = getTypeVector(floatType, 4); + auto nullValue = getNull(float32x4Type); + auto variableType = getTypePointer(ir::spv::StorageClass::Output, float32x4Type); @@ -570,7 +572,7 @@ ir::Value spv::Context::createOutput(ir::Location loc, int index) { Builder::createAppend(*this, layout.getOrCreateAnnotations(*this)); auto variable = globals.createSpvVariable(loc, variableType, - ir::spv::StorageClass::Output); + ir::spv::StorageClass::Output, nullValue); annotations.createSpvDecorate(loc, variable, ir::spv::Decoration::Location(index)); diff --git a/rpcsx/gpu/lib/gcn-shader/src/gcn.cpp b/rpcsx/gpu/lib/gcn-shader/src/gcn.cpp index 1be27322b..3e0ef1fbd 100644 --- a/rpcsx/gpu/lib/gcn-shader/src/gcn.cpp +++ b/rpcsx/gpu/lib/gcn-shader/src/gcn.cpp @@ -1283,7 +1283,7 @@ static ir::Value deserializeGcnRegion( inst.addOperand(createOperandRead(loc, paramBuilder, uint32TV, op)); } - if (isaInst == ir::exp::EXP && isaInst.getOperand(1).value != 0) { + if (isaInst == ir::exp::EXP) { createExecTest(); } continue; @@ -1381,10 +1381,8 @@ static ir::Value deserializeGcnRegion( converter.getTypePointer(ir::spv::StorageClass::Function, paramType), ir::spv::StorageClass::Function); - if ((paramInfo.access & Access::Read) == Access::Read) { auto result = createOperandRead(loc, builder, paramType, op); builder.createSpvStore(loc, arg, result); - } callArgs.push_back(arg); }