summaryrefslogtreecommitdiff
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-01-29 04:39:07 -0300
committerGravatar ReinUsesLisp2019-02-07 17:36:46 -0300
commit889c646ac0d769e6c950e8ee75eb92b019def8c5 (patch)
tree0242d7726ae034361718295f40e69dcc79270a14 /src/video_core/shader
parentshader_ir: Clean texture management code (diff)
downloadyuzu-889c646ac0d769e6c950e8ee75eb92b019def8c5.tar.gz
yuzu-889c646ac0d769e6c950e8ee75eb92b019def8c5.tar.xz
yuzu-889c646ac0d769e6c950e8ee75eb92b019def8c5.zip
shader_ir: Remove F4 prefix to texture operations
This was originally included because texture operations returned a vec4. These operations now return a single float and the F4 prefix doesn't mean anything.
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/decode/memory.cpp15
-rw-r--r--src/video_core/shader/shader_ir.h12
2 files changed, 13 insertions, 14 deletions
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp
index be6ca044b..523421794 100644
--- a/src/video_core/shader/decode/memory.cpp
+++ b/src/video_core/shader/decode/memory.cpp
@@ -336,8 +336,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
336 for (u32 element = 0; element < values.size(); ++element) { 336 for (u32 element = 0; element < values.size(); ++element) {
337 auto coords_copy = coords; 337 auto coords_copy = coords;
338 MetaTexture meta{sampler, {}, {}, extras, element}; 338 MetaTexture meta{sampler, {}, {}, extras, element};
339 values[element] = 339 values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy));
340 Operation(OperationCode::F4TextureGather, meta, std::move(coords_copy));
341 } 340 }
342 341
343 WriteTexsInstructionFloat(bb, instr, values); 342 WriteTexsInstructionFloat(bb, instr, values);
@@ -362,8 +361,8 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
362 continue; 361 continue;
363 } 362 }
364 MetaTexture meta{sampler, {}, {}, {}, element}; 363 MetaTexture meta{sampler, {}, {}, {}, element};
365 const Node value = Operation(OperationCode::F4TextureQueryDimensions, meta, 364 const Node value =
366 GetRegister(instr.gpr8)); 365 Operation(OperationCode::TextureQueryDimensions, meta, GetRegister(instr.gpr8));
367 SetTemporal(bb, indexer++, value); 366 SetTemporal(bb, indexer++, value);
368 } 367 }
369 for (u32 i = 0; i < indexer; ++i) { 368 for (u32 i = 0; i < indexer; ++i) {
@@ -412,7 +411,7 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
412 for (u32 element = 0; element < 2; ++element) { 411 for (u32 element = 0; element < 2; ++element) {
413 auto params = coords; 412 auto params = coords;
414 MetaTexture meta{sampler, {}, {}, {}, element}; 413 MetaTexture meta{sampler, {}, {}, {}, element};
415 const Node value = Operation(OperationCode::F4TextureQueryLod, meta, std::move(params)); 414 const Node value = Operation(OperationCode::TextureQueryLod, meta, std::move(params));
416 SetTemporal(bb, element, value); 415 SetTemporal(bb, element, value);
417 } 416 }
418 for (u32 element = 0; element < 2; ++element) { 417 for (u32 element = 0; element < 2; ++element) {
@@ -555,7 +554,7 @@ Node4 ShaderIR::GetTextureCode(Instruction instr, TextureType texture_type,
555 (texture_type == Tegra::Shader::TextureType::TextureCube && is_array && is_shadow)); 554 (texture_type == Tegra::Shader::TextureType::TextureCube && is_array && is_shadow));
556 555
557 const OperationCode read_method = 556 const OperationCode read_method =
558 lod_needed && gl_lod_supported ? OperationCode::F4TextureLod : OperationCode::F4Texture; 557 lod_needed && gl_lod_supported ? OperationCode::TextureLod : OperationCode::Texture;
559 558
560 UNIMPLEMENTED_IF(process_mode != TextureProcessMode::None && !gl_lod_supported); 559 UNIMPLEMENTED_IF(process_mode != TextureProcessMode::None && !gl_lod_supported);
561 560
@@ -671,7 +670,7 @@ Node4 ShaderIR::GetTld4Code(Instruction instr, TextureType texture_type, bool de
671 for (u32 element = 0; element < values.size(); ++element) { 670 for (u32 element = 0; element < values.size(); ++element) {
672 auto coords_copy = coords; 671 auto coords_copy = coords;
673 MetaTexture meta{sampler, GetRegister(array_register), {}, {}, element}; 672 MetaTexture meta{sampler, GetRegister(array_register), {}, {}, element};
674 values[element] = Operation(OperationCode::F4TextureGather, meta, std::move(coords_copy)); 673 values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy));
675 } 674 }
676 675
677 return values; 676 return values;
@@ -707,7 +706,7 @@ Node4 ShaderIR::GetTldsCode(Instruction instr, TextureType texture_type, bool is
707 for (u32 element = 0; element < values.size(); ++element) { 706 for (u32 element = 0; element < values.size(); ++element) {
708 auto coords_copy = coords; 707 auto coords_copy = coords;
709 MetaTexture meta{sampler, array, {}, {lod}, element}; 708 MetaTexture meta{sampler, array, {}, {lod}, element};
710 values[element] = Operation(OperationCode::F4TexelFetch, meta, std::move(coords_copy)); 709 values[element] = Operation(OperationCode::TexelFetch, meta, std::move(coords_copy));
711 } 710 }
712 return values; 711 return values;
713} 712}
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index 0c3d9c61e..52c7f2c4e 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -156,12 +156,12 @@ enum class OperationCode {
156 Logical2HNotEqual, /// (MetaHalfArithmetic, f16vec2 a, f16vec2) -> bool2 156 Logical2HNotEqual, /// (MetaHalfArithmetic, f16vec2 a, f16vec2) -> bool2
157 Logical2HGreaterEqual, /// (MetaHalfArithmetic, f16vec2 a, f16vec2) -> bool2 157 Logical2HGreaterEqual, /// (MetaHalfArithmetic, f16vec2 a, f16vec2) -> bool2
158 158
159 F4Texture, /// (MetaTexture, float[N] coords, float[M] params) -> float4 159 Texture, /// (MetaTexture, float[N] coords) -> float4
160 F4TextureLod, /// (MetaTexture, float[N] coords, float[M] params) -> float4 160 TextureLod, /// (MetaTexture, float[N] coords) -> float4
161 F4TextureGather, /// (MetaTexture, float[N] coords, float[M] params) -> float4 161 TextureGather, /// (MetaTexture, float[N] coords) -> float4
162 F4TextureQueryDimensions, /// (MetaTexture, float a) -> float4 162 TextureQueryDimensions, /// (MetaTexture, float a) -> float4
163 F4TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4 163 TextureQueryLod, /// (MetaTexture, float[N] coords) -> float4
164 F4TexelFetch, /// (MetaTexture, int[N], int) -> float4 164 TexelFetch, /// (MetaTexture, int[N], int) -> float4
165 165
166 Branch, /// (uint branch_target) -> void 166 Branch, /// (uint branch_target) -> void
167 PushFlowStack, /// (uint branch_target) -> void 167 PushFlowStack, /// (uint branch_target) -> void