mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-26 04:46:53 +01:00
graphics: emit PS5 register object and primitive IDs to RT7
This commit is contained in:
@@ -243,7 +243,8 @@ void DefineDescriptors(EmitterState& state) {
|
||||
IR::PushData::StartFor(bindings.push_data_start_dword, bindings.ShaderDataDwords());
|
||||
counts[static_cast<size_t>(Kind::ShaderData)] =
|
||||
bindings.ShaderDataDwords() != 0 && !bindings.UsesPushData();
|
||||
if (state.program.bindings.UsesPushData() || state.program.stage == ShaderType::Mesh) {
|
||||
if (state.program.bindings.UsesPushData() || state.program.stage == ShaderType::Mesh ||
|
||||
state.object_primitive_id_variable != 0) {
|
||||
const auto type = PushConstantBlockType(state);
|
||||
state.push_constant_variable = state.builder.DefineGlobalVariable(
|
||||
TypePointer(state, spv::StorageClassPushConstant, type), spv::StorageClassPushConstant);
|
||||
@@ -546,6 +547,11 @@ void DefineInputs(EmitterState& state) {
|
||||
}
|
||||
input.variable_id =
|
||||
DefineInterfaceVariable(state, type, spv::StorageClassInput, input.debug_name.c_str());
|
||||
if (state.program.stage == ShaderType::Pixel && input.kind == IR::StageInputKind::PrimitiveId) {
|
||||
// Fragment PrimitiveId accepts Tessellation, which the device already enables.
|
||||
state.builder.RequireCapability(spv::CapabilityTessellation);
|
||||
state.builder.AddAnnotation(spv::OpDecorate, input.variable_id, spv::DecorationFlat);
|
||||
}
|
||||
if (input.kind == IR::StageInputKind::Layer || input.kind == IR::StageInputKind::SampleId) {
|
||||
state.builder.AddAnnotation(spv::OpDecorate, input.variable_id, spv::DecorationFlat);
|
||||
}
|
||||
@@ -657,6 +663,13 @@ void DefineOutputs(EmitterState& state) {
|
||||
BuiltIn(state.sample_mask_variable, SampleMaskArrayType(state), "gl_SampleMask",
|
||||
spv::BuiltInSampleMask);
|
||||
break;
|
||||
case IR::StageOutputKind::ObjectPrimitiveId:
|
||||
binding.variable_id = DefineInterfaceVariable(
|
||||
state, TypeU32(state), spv::StorageClassOutput, binding.debug_name.c_str());
|
||||
state.object_primitive_id_variable = binding.variable_id;
|
||||
state.builder.AddAnnotation(spv::OpDecorate, binding.variable_id,
|
||||
spv::DecorationLocation, binding.location);
|
||||
break;
|
||||
case IR::StageOutputKind::Parameter:
|
||||
case IR::StageOutputKind::Mrt: {
|
||||
const bool uint_output =
|
||||
|
||||
Reference in New Issue
Block a user