mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-10-31 07:59:02 -05:00 
			
		
		
		
	Properly Implemented TXQ Instruction
This commit is contained in:
		| @@ -2976,6 +2976,8 @@ private: | ||||
|                 ASSERT_MSG(!instr.txq.UsesMiscMode(Tegra::Shader::TextureMiscMode::NODEP), | ||||
|                            "NODEP is not implemented"); | ||||
|  | ||||
|                 ++shader.scope; | ||||
|                 shader.AddLine('{'); | ||||
|                 // TODO: the new commits on the texture refactor, change the way samplers work. | ||||
|                 // Sadly, not all texture instructions specify the type of texture their sampler | ||||
|                 // uses. This must be fixed at a later instance. | ||||
| @@ -2983,8 +2985,14 @@ private: | ||||
|                     GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false); | ||||
|                 switch (instr.txq.query_type) { | ||||
|                 case Tegra::Shader::TextureQueryType::Dimension: { | ||||
|                     const std::string texture = "textureQueryLevels(" + sampler + ')'; | ||||
|                     regs.SetRegisterToInteger(instr.gpr0, true, 0, texture, 1, 1); | ||||
|                     const std::string texture = "textureSize(" + sampler + ", " + | ||||
|                                                 regs.GetRegisterAsInteger(instr.gpr8) + ')'; | ||||
|                     const std::string mip_level = "textureQueryLevels(" + sampler + ')'; | ||||
|                     shader.AddLine("ivec2 sizes = " + texture + ';'); | ||||
|                     regs.SetRegisterToInteger(instr.gpr0, true, 0, "sizes.x", 1, 1); | ||||
|                     regs.SetRegisterToInteger(instr.gpr0.Value() + 1, true, 0, "sizes.y", 1, 1); | ||||
|                     regs.SetRegisterToInteger(instr.gpr0.Value() + 2, true, 0, "0", 1, 1); | ||||
|                     regs.SetRegisterToInteger(instr.gpr0.Value() + 3, true, 0, mip_level, 1, 1); | ||||
|                     break; | ||||
|                 } | ||||
|                 default: { | ||||
| @@ -2993,6 +3001,8 @@ private: | ||||
|                     UNREACHABLE(); | ||||
|                 } | ||||
|                 } | ||||
|                 --shader.scope; | ||||
|                 shader.AddLine('}'); | ||||
|                 break; | ||||
|             } | ||||
|             case OpCode::Id::TMML: { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 FernandoS27
					FernandoS27