mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 22:28:45 +00:00
fix for components mapping; missing prim type
This commit is contained in:
parent
3403e5a92a
commit
097a68a695
6 changed files with 17 additions and 10 deletions
|
@ -25,6 +25,7 @@ static constexpr spv::ExecutionMode GetInputPrimitiveType(AmdGpu::PrimitiveType
|
||||||
case AmdGpu::PrimitiveType::LineList:
|
case AmdGpu::PrimitiveType::LineList:
|
||||||
return spv::ExecutionMode::InputLines;
|
return spv::ExecutionMode::InputLines;
|
||||||
case AmdGpu::PrimitiveType::TriangleList:
|
case AmdGpu::PrimitiveType::TriangleList:
|
||||||
|
case AmdGpu::PrimitiveType::TriangleStrip:
|
||||||
return spv::ExecutionMode::Triangles;
|
return spv::ExecutionMode::Triangles;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -322,6 +323,7 @@ std::vector<u32> EmitSPIRV(const Profile& profile, const RuntimeInfo& runtime_in
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PatchPhiNodes(program, ctx);
|
PatchPhiNodes(program, ctx);
|
||||||
|
binding.user_data += program.info.ud_mask.NumRegs();
|
||||||
return ctx.Assemble();
|
return ctx.Assemble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ CopyShaderData ParseCopyShader(const std::span<const u32>& code) {
|
||||||
for (int i = 0; i < inst.src_count; ++i) {
|
for (int i = 0; i < inst.src_count; ++i) {
|
||||||
const auto ofs = offsets[inst.src[i].code];
|
const auto ofs = offsets[inst.src[i].code];
|
||||||
if (ofs != -1) {
|
if (ofs != -1) {
|
||||||
data.attr_map[ofs] = semantic;
|
data.attr_map[ofs] = {semantic, i};
|
||||||
if (semantic > last_attr) {
|
if (semantic > last_attr) {
|
||||||
last_attr = semantic;
|
last_attr = semantic;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace Shader {
|
namespace Shader {
|
||||||
|
|
||||||
struct CopyShaderData {
|
struct CopyShaderData {
|
||||||
std::unordered_map<u32, Shader::IR::Attribute> attr_map;
|
std::unordered_map<u32, std::pair<Shader::IR::Attribute, u32>> attr_map;
|
||||||
u32 num_attrs{0};
|
u32 num_attrs{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,15 +83,15 @@ void RingAccessElimination(const IR::Program& program, const RuntimeInfo& runtim
|
||||||
const auto data = ir.BitCast<IR::F32>(IR::U32{inst.Arg(2)});
|
const auto data = ir.BitCast<IR::F32>(IR::U32{inst.Arg(2)});
|
||||||
const auto comp_ofs = runtime_info.gs_info.output_vertices * 4u;
|
const auto comp_ofs = runtime_info.gs_info.output_vertices * 4u;
|
||||||
const auto output_size = comp_ofs * runtime_info.gs_info.out_vertex_data_size;
|
const auto output_size = comp_ofs * runtime_info.gs_info.out_vertex_data_size;
|
||||||
const auto comp = (offset / comp_ofs) % 4;
|
|
||||||
|
|
||||||
const auto vc_read_ofs = (((offset / comp_ofs) * comp_ofs) % output_size) * 16u;
|
const auto vc_read_ofs = (((offset / comp_ofs) * comp_ofs) % output_size) * 16u;
|
||||||
const auto& attr = runtime_info.gs_info.copy_data.attr_map.find(vc_read_ofs);
|
const auto& it = runtime_info.gs_info.copy_data.attr_map.find(vc_read_ofs);
|
||||||
ASSERT(attr != runtime_info.gs_info.copy_data.attr_map.cend());
|
ASSERT(it != runtime_info.gs_info.copy_data.attr_map.cend());
|
||||||
|
const auto& [attr, comp] = it->second;
|
||||||
|
|
||||||
inst.ReplaceOpcode(IR::Opcode::SetAttribute);
|
inst.ReplaceOpcode(IR::Opcode::SetAttribute);
|
||||||
inst.ClearArgs();
|
inst.ClearArgs();
|
||||||
inst.SetArg(0, IR::Value{attr->second});
|
inst.SetArg(0, IR::Value{attr});
|
||||||
inst.SetArg(1, data);
|
inst.SetArg(1, data);
|
||||||
inst.SetArg(2, ir.Imm32(comp));
|
inst.SetArg(2, ir.Imm32(comp));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -73,10 +73,10 @@ struct VertexRuntimeInfo {
|
||||||
static constexpr auto GsMaxOutputStreams = 4u;
|
static constexpr auto GsMaxOutputStreams = 4u;
|
||||||
using GsOutputPrimTypes = std::array<AmdGpu::GsOutputPrimitiveType, GsMaxOutputStreams>;
|
using GsOutputPrimTypes = std::array<AmdGpu::GsOutputPrimitiveType, GsMaxOutputStreams>;
|
||||||
struct GeometryRuntimeInfo {
|
struct GeometryRuntimeInfo {
|
||||||
u32 num_invocations;
|
u32 num_invocations{};
|
||||||
u32 output_vertices;
|
u32 output_vertices{};
|
||||||
u32 in_vertex_data_size;
|
u32 in_vertex_data_size{};
|
||||||
u32 out_vertex_data_size;
|
u32 out_vertex_data_size{};
|
||||||
AmdGpu::PrimitiveType in_primitive;
|
AmdGpu::PrimitiveType in_primitive;
|
||||||
GsOutputPrimTypes out_primitive;
|
GsOutputPrimTypes out_primitive;
|
||||||
CopyShaderData copy_data;
|
CopyShaderData copy_data;
|
||||||
|
@ -157,6 +157,10 @@ struct RuntimeInfo {
|
||||||
return vs_info == other.vs_info;
|
return vs_info == other.vs_info;
|
||||||
case Stage::Compute:
|
case Stage::Compute:
|
||||||
return cs_info == other.cs_info;
|
return cs_info == other.cs_info;
|
||||||
|
case Stage::Export:
|
||||||
|
return es_info == other.es_info;
|
||||||
|
case Stage::Geometry:
|
||||||
|
return gs_info == other.gs_info;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,6 +322,7 @@ bool Instance::CreateDevice() {
|
||||||
.geometryShader = features.geometryShader,
|
.geometryShader = features.geometryShader,
|
||||||
.logicOp = features.logicOp,
|
.logicOp = features.logicOp,
|
||||||
.depthBiasClamp = features.depthBiasClamp,
|
.depthBiasClamp = features.depthBiasClamp,
|
||||||
|
.fillModeNonSolid = features.fillModeNonSolid,
|
||||||
.multiViewport = features.multiViewport,
|
.multiViewport = features.multiViewport,
|
||||||
.samplerAnisotropy = features.samplerAnisotropy,
|
.samplerAnisotropy = features.samplerAnisotropy,
|
||||||
.vertexPipelineStoresAndAtomics = features.vertexPipelineStoresAndAtomics,
|
.vertexPipelineStoresAndAtomics = features.vertexPipelineStoresAndAtomics,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue