diff options
| author | 2021-04-12 19:41:22 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:27 -0400 | |
| commit | f263760c5a3aff771123b32b15677e1f7a089640 (patch) | |
| tree | 3d9c41ce708beb8a76f28ceee1c9ebb25108a471 /src/shader_recompiler/frontend/ir | |
| parent | shader: Implement OUT (diff) | |
| download | yuzu-f263760c5a3aff771123b32b15677e1f7a089640.tar.gz yuzu-f263760c5a3aff771123b32b15677e1f7a089640.tar.xz yuzu-f263760c5a3aff771123b32b15677e1f7a089640.zip | |
shader: Implement geometry shaders
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 20 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 6 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.inc | 8 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/program.h | 4 |
4 files changed, 26 insertions, 12 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 7d48fa1ba..d66eb17a6 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -308,19 +308,27 @@ U1 IREmitter::GetFlowTestResult(FlowTest test) { | |||
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | F32 IREmitter::GetAttribute(IR::Attribute attribute) { | 310 | F32 IREmitter::GetAttribute(IR::Attribute attribute) { |
| 311 | return Inst<F32>(Opcode::GetAttribute, attribute); | 311 | return GetAttribute(attribute, Imm32(0)); |
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | void IREmitter::SetAttribute(IR::Attribute attribute, const F32& value) { | 314 | F32 IREmitter::GetAttribute(IR::Attribute attribute, const U32& vertex) { |
| 315 | Inst(Opcode::SetAttribute, attribute, value); | 315 | return Inst<F32>(Opcode::GetAttribute, attribute, vertex); |
| 316 | } | ||
| 317 | |||
| 318 | void IREmitter::SetAttribute(IR::Attribute attribute, const F32& value, const U32& vertex) { | ||
| 319 | Inst(Opcode::SetAttribute, attribute, value, vertex); | ||
| 316 | } | 320 | } |
| 317 | 321 | ||
| 318 | F32 IREmitter::GetAttributeIndexed(const U32& phys_address) { | 322 | F32 IREmitter::GetAttributeIndexed(const U32& phys_address) { |
| 319 | return Inst<F32>(Opcode::GetAttributeIndexed, phys_address); | 323 | return GetAttributeIndexed(phys_address, Imm32(0)); |
| 324 | } | ||
| 325 | |||
| 326 | F32 IREmitter::GetAttributeIndexed(const U32& phys_address, const U32& vertex) { | ||
| 327 | return Inst<F32>(Opcode::GetAttributeIndexed, phys_address, vertex); | ||
| 320 | } | 328 | } |
| 321 | 329 | ||
| 322 | void IREmitter::SetAttributeIndexed(const U32& phys_address, const F32& value) { | 330 | void IREmitter::SetAttributeIndexed(const U32& phys_address, const F32& value, const U32& vertex) { |
| 323 | Inst(Opcode::SetAttributeIndexed, phys_address, value); | 331 | Inst(Opcode::SetAttributeIndexed, phys_address, value, vertex); |
| 324 | } | 332 | } |
| 325 | 333 | ||
| 326 | void IREmitter::SetFragColor(u32 index, u32 component, const F32& value) { | 334 | void IREmitter::SetFragColor(u32 index, u32 component, const F32& value) { |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 033c4332e..e70359eb1 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -77,10 +77,12 @@ public: | |||
| 77 | [[nodiscard]] U1 GetFlowTestResult(FlowTest test); | 77 | [[nodiscard]] U1 GetFlowTestResult(FlowTest test); |
| 78 | 78 | ||
| 79 | [[nodiscard]] F32 GetAttribute(IR::Attribute attribute); | 79 | [[nodiscard]] F32 GetAttribute(IR::Attribute attribute); |
| 80 | void SetAttribute(IR::Attribute attribute, const F32& value); | 80 | [[nodiscard]] F32 GetAttribute(IR::Attribute attribute, const U32& vertex); |
| 81 | void SetAttribute(IR::Attribute attribute, const F32& value, const U32& vertex); | ||
| 81 | 82 | ||
| 82 | [[nodiscard]] F32 GetAttributeIndexed(const U32& phys_address); | 83 | [[nodiscard]] F32 GetAttributeIndexed(const U32& phys_address); |
| 83 | void SetAttributeIndexed(const U32& phys_address, const F32& value); | 84 | [[nodiscard]] F32 GetAttributeIndexed(const U32& phys_address, const U32& vertex); |
| 85 | void SetAttributeIndexed(const U32& phys_address, const F32& value, const U32& vertex); | ||
| 84 | 86 | ||
| 85 | void SetFragColor(u32 index, u32 component, const F32& value); | 87 | void SetFragColor(u32 index, u32 component, const F32& value); |
| 86 | void SetFragDepth(const F32& value); | 88 | void SetFragDepth(const F32& value); |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 0e487f1a7..7a21fe746 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -44,10 +44,10 @@ OPCODE(GetCbufS16, U32, U32, | |||
| 44 | OPCODE(GetCbufU32, U32, U32, U32, ) | 44 | OPCODE(GetCbufU32, U32, U32, U32, ) |
| 45 | OPCODE(GetCbufF32, F32, U32, U32, ) | 45 | OPCODE(GetCbufF32, F32, U32, U32, ) |
| 46 | OPCODE(GetCbufU32x2, U32x2, U32, U32, ) | 46 | OPCODE(GetCbufU32x2, U32x2, U32, U32, ) |
| 47 | OPCODE(GetAttribute, F32, Attribute, ) | 47 | OPCODE(GetAttribute, F32, Attribute, U32, ) |
| 48 | OPCODE(SetAttribute, Void, Attribute, F32, ) | 48 | OPCODE(SetAttribute, Void, Attribute, F32, U32, ) |
| 49 | OPCODE(GetAttributeIndexed, F32, U32, ) | 49 | OPCODE(GetAttributeIndexed, F32, U32, U32, ) |
| 50 | OPCODE(SetAttributeIndexed, Void, U32, F32, ) | 50 | OPCODE(SetAttributeIndexed, Void, U32, F32, U32, ) |
| 51 | OPCODE(SetFragColor, Void, U32, U32, F32, ) | 51 | OPCODE(SetFragColor, Void, U32, U32, F32, ) |
| 52 | OPCODE(SetFragDepth, Void, F32, ) | 52 | OPCODE(SetFragDepth, Void, F32, ) |
| 53 | OPCODE(GetZFlag, U1, Void, ) | 53 | OPCODE(GetZFlag, U1, Void, ) |
diff --git a/src/shader_recompiler/frontend/ir/program.h b/src/shader_recompiler/frontend/ir/program.h index 3a37b3ab9..51e1a8c77 100644 --- a/src/shader_recompiler/frontend/ir/program.h +++ b/src/shader_recompiler/frontend/ir/program.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <boost/container/small_vector.hpp> | 10 | #include <boost/container/small_vector.hpp> |
| 11 | 11 | ||
| 12 | #include "shader_recompiler/frontend/ir/basic_block.h" | 12 | #include "shader_recompiler/frontend/ir/basic_block.h" |
| 13 | #include "shader_recompiler/program_header.h" | ||
| 13 | #include "shader_recompiler/shader_info.h" | 14 | #include "shader_recompiler/shader_info.h" |
| 14 | #include "shader_recompiler/stage.h" | 15 | #include "shader_recompiler/stage.h" |
| 15 | 16 | ||
| @@ -21,6 +22,9 @@ struct Program { | |||
| 21 | Info info; | 22 | Info info; |
| 22 | Stage stage{}; | 23 | Stage stage{}; |
| 23 | std::array<u32, 3> workgroup_size{}; | 24 | std::array<u32, 3> workgroup_size{}; |
| 25 | OutputTopology output_topology{}; | ||
| 26 | u32 output_vertices{}; | ||
| 27 | u32 invocations{}; | ||
| 24 | u32 local_memory_size{}; | 28 | u32 local_memory_size{}; |
| 25 | u32 shared_memory_size{}; | 29 | u32 shared_memory_size{}; |
| 26 | }; | 30 | }; |