mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 05:46:56 +01:00
graphics: emit PS5 register object and primitive IDs to RT7
This commit is contained in:
@@ -245,6 +245,7 @@ enum class StageOutputKind {
|
||||
Position,
|
||||
Parameter,
|
||||
Mrt,
|
||||
ObjectPrimitiveId,
|
||||
Depth,
|
||||
SampleMask,
|
||||
PointSize,
|
||||
@@ -350,6 +351,10 @@ struct PushData {
|
||||
static constexpr uint32_t NoStart = UINT32_MAX;
|
||||
std::array<uint32_t, DwordCount> dwords {};
|
||||
|
||||
[[nodiscard]] static constexpr uint32_t GraphicsDrawDwords(bool mesh, bool object_id) {
|
||||
return mesh ? MeshDrawDwordCount : static_cast<uint32_t>(object_id);
|
||||
}
|
||||
|
||||
[[nodiscard]] static constexpr bool CanFit(uint32_t start, uint32_t size) {
|
||||
return size != 0 && start <= DwordCount && size <= DwordCount - start;
|
||||
}
|
||||
|
||||
@@ -599,6 +599,15 @@ void CollectShaderInfo(Program& program, ShaderStageInputInfo input_info) {
|
||||
case ShaderType::Mesh: break;
|
||||
case ShaderType::Pixel:
|
||||
CollectPixelInputs(input_info.pixel, info, inputs.per_vertex, inputs.components);
|
||||
if (input_info.pixel->object_primitive_id) {
|
||||
if (std::ranges::any_of(info.outputs, [](const StageOutput& output) {
|
||||
return output.kind == StageOutputKind::Mrt && output.location == 7u;
|
||||
})) {
|
||||
return Fail("explicit MRT7 export overlaps automatic object/primitive ID");
|
||||
}
|
||||
AddBuiltinInput(info, StageInputKind::PrimitiveId);
|
||||
AddOutput(info, StageOutputKind::ObjectPrimitiveId, 0, 7, "out_object_primitive_id");
|
||||
}
|
||||
break;
|
||||
case ShaderType::Compute: CollectComputeInputs(input_info.compute, info); break;
|
||||
default: return Fail("unsupported shader stage for info collection");
|
||||
|
||||
Reference in New Issue
Block a user