diff options
| author | 2022-11-18 22:04:18 -0500 | |
|---|---|---|
| committer | 2022-11-18 22:04:18 -0500 | |
| commit | 9c67334031ba979db7e1596f9015b1c134c23876 (patch) | |
| tree | 3e89f99a0f3823d1eb76551719e5ffcbbb95b989 /src/shader_recompiler/backend/spirv | |
| parent | Merge pull request #9234 from liamwhite/data-cash-money (diff) | |
| parent | shader: Implement miss attribute layer (diff) | |
| download | yuzu-9c67334031ba979db7e1596f9015b1c134c23876.tar.gz yuzu-9c67334031ba979db7e1596f9015b1c134c23876.tar.xz yuzu-9c67334031ba979db7e1596f9015b1c134c23876.zip | |
Merge pull request #9253 from vonchenplus/attr_layer
shader: Implement miss attribute layer
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index 5b3b5d1f3..01f6ec9b5 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | |||
| @@ -315,6 +315,8 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) { | |||
| 315 | switch (attr) { | 315 | switch (attr) { |
| 316 | case IR::Attribute::PrimitiveId: | 316 | case IR::Attribute::PrimitiveId: |
| 317 | return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.primitive_id)); | 317 | return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.primitive_id)); |
| 318 | case IR::Attribute::Layer: | ||
| 319 | return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.layer)); | ||
| 318 | case IR::Attribute::PositionX: | 320 | case IR::Attribute::PositionX: |
| 319 | case IR::Attribute::PositionY: | 321 | case IR::Attribute::PositionY: |
| 320 | case IR::Attribute::PositionZ: | 322 | case IR::Attribute::PositionZ: |
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index 0bfc2dd89..dd96b7803 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | |||
| @@ -1359,6 +1359,10 @@ void EmitContext::DefineInputs(const IR::Program& program) { | |||
| 1359 | if (loads[IR::Attribute::PrimitiveId]) { | 1359 | if (loads[IR::Attribute::PrimitiveId]) { |
| 1360 | primitive_id = DefineInput(*this, U32[1], false, spv::BuiltIn::PrimitiveId); | 1360 | primitive_id = DefineInput(*this, U32[1], false, spv::BuiltIn::PrimitiveId); |
| 1361 | } | 1361 | } |
| 1362 | if (loads[IR::Attribute::Layer]) { | ||
| 1363 | AddCapability(spv::Capability::Geometry); | ||
| 1364 | layer = DefineInput(*this, U32[1], false, spv::BuiltIn::Layer); | ||
| 1365 | } | ||
| 1362 | if (loads.AnyComponent(IR::Attribute::PositionX)) { | 1366 | if (loads.AnyComponent(IR::Attribute::PositionX)) { |
| 1363 | const bool is_fragment{stage != Stage::Fragment}; | 1367 | const bool is_fragment{stage != Stage::Fragment}; |
| 1364 | const spv::BuiltIn built_in{is_fragment ? spv::BuiltIn::Position : spv::BuiltIn::FragCoord}; | 1368 | const spv::BuiltIn built_in{is_fragment ? spv::BuiltIn::Position : spv::BuiltIn::FragCoord}; |