shader_ir/memory: Emit AL2P IR
This commit is contained in:
		| @@ -12,6 +12,8 @@ | |||||||
| #include "video_core/engines/shader_bytecode.h" | #include "video_core/engines/shader_bytecode.h" | ||||||
| #include "video_core/shader/shader_ir.h" | #include "video_core/shader/shader_ir.h" | ||||||
|  |  | ||||||
|  | #pragma optimize("", off) | ||||||
|  |  | ||||||
| namespace VideoCommon::Shader { | namespace VideoCommon::Shader { | ||||||
|  |  | ||||||
| using Tegra::Shader::Attribute; | using Tegra::Shader::Attribute; | ||||||
| @@ -239,6 +241,21 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) { | |||||||
|         } |         } | ||||||
|         break; |         break; | ||||||
|     } |     } | ||||||
|  |     case OpCode::Id::AL2P: { | ||||||
|  |         // Ignore al2p.direction since we don't care about it. | ||||||
|  |  | ||||||
|  |         // Calculate emulation fake physical address. | ||||||
|  |         const Node fixed_address{Immediate(static_cast<u32>(instr.al2p.address))}; | ||||||
|  |         const Node reg{GetRegister(instr.gpr8)}; | ||||||
|  |         const Node fake_address{Operation(OperationCode::IAdd, NO_PRECISE, reg, fixed_address)}; | ||||||
|  |  | ||||||
|  |         // Set the fake address to target register. | ||||||
|  |         SetRegister(bb, instr.gpr0, fake_address); | ||||||
|  |  | ||||||
|  |         // Signal the shader IR to declare all possible attributes and varyings | ||||||
|  |         use_physical_attributes = true; | ||||||
|  |         break; | ||||||
|  |     } | ||||||
|     default: |     default: | ||||||
|         UNIMPLEMENTED_MSG("Unhandled memory instruction: {}", opcode->get().GetName()); |         UNIMPLEMENTED_MSG("Unhandled memory instruction: {}", opcode->get().GetName()); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -615,6 +615,10 @@ public: | |||||||
|         return static_cast<std::size_t>(coverage_end * sizeof(u64)); |         return static_cast<std::size_t>(coverage_end * sizeof(u64)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     bool HasPhysicalAttributes() const { | ||||||
|  |         return use_physical_attributes; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     const Tegra::Shader::Header& GetHeader() const { |     const Tegra::Shader::Header& GetHeader() const { | ||||||
|         return header; |         return header; | ||||||
|     } |     } | ||||||
| @@ -879,6 +883,7 @@ private: | |||||||
|     std::set<Sampler> used_samplers; |     std::set<Sampler> used_samplers; | ||||||
|     std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances> used_clip_distances{}; |     std::array<bool, Tegra::Engines::Maxwell3D::Regs::NumClipDistances> used_clip_distances{}; | ||||||
|     std::map<GlobalMemoryBase, GlobalMemoryUsage> used_global_memory; |     std::map<GlobalMemoryBase, GlobalMemoryUsage> used_global_memory; | ||||||
|  |     bool use_physical_attributes = true; // Shader uses AL2P | ||||||
|  |  | ||||||
|     Tegra::Shader::Header header; |     Tegra::Shader::Header header; | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ReinUsesLisp
					ReinUsesLisp