summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrChat <arkolbed@gmail.com>2017-08-07 21:08:01 -0500
committerDrChat <arkolbed@gmail.com>2017-08-07 21:08:01 -0500
commitcfc65a01978814e349938e90e227332b2dde9265 (patch)
tree4291791829f3e9064451324cfcd983a52afe5f6c
parent6d9a56a269f5de1ddd85b8424595bd01375528a7 (diff)
GPU: Rewrite/rephrase some confusing shader translator code
-rw-r--r--src/xenia/gpu/shader_translator.cc15
-rw-r--r--src/xenia/gpu/spirv_shader_translator.cc2
2 files changed, 9 insertions, 8 deletions
diff --git a/src/xenia/gpu/shader_translator.cc b/src/xenia/gpu/shader_translator.cc
index e39280ddd..4fbc62b83 100644
--- a/src/xenia/gpu/shader_translator.cc
+++ b/src/xenia/gpu/shader_translator.cc
@@ -257,14 +257,12 @@ void ShaderTranslator::GatherBindingInformation(
// Gather up color targets written to.
auto& op = *reinterpret_cast<const AluInstruction*>(ucode_dwords_ +
instr_offset * 3);
- if (op.has_vector_op() && op.is_export()) {
- if (op.vector_dest() <= 3) {
+ if (op.is_export()) {
+ if (op.has_vector_op() && op.vector_dest() <= 3) {
writes_color_targets_[op.vector_dest()] = true;
}
- }
- if (op.has_scalar_op() && op.is_export()) {
- if (op.vector_dest() <= 3) {
- writes_color_targets_[op.vector_dest()] = true;
+ if (op.has_scalar_op() && op.scalar_dest() <= 3) {
+ writes_color_targets_[op.scalar_dest()] = true;
}
}
}
@@ -1321,8 +1319,9 @@ void ShaderTranslator::ParseAluScalarInstruction(
uint32_t src3_swizzle = op.src_swizzle(3);
uint32_t swiz_a = ((src3_swizzle >> 6) + 3) & 0x3;
uint32_t swiz_b = ((src3_swizzle >> 0) + 0) & 0x3;
- uint32_t reg2 = (static_cast<int>(op.scalar_opcode()) & 1) |
- (src3_swizzle & 0x3C) | (op.src_is_temp(3) << 1);
+ uint32_t reg2 = (src3_swizzle & 0x3C) | (op.src_is_temp(3) << 1) |
+ (static_cast<int>(op.scalar_opcode()) & 1);
+
int const_slot = (op.src_is_temp(1) || op.src_is_temp(2)) ? 1 : 0;
ParseAluInstructionOperandSpecial(
diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc
index b7feb21e2..365994d69 100644
--- a/src/xenia/gpu/spirv_shader_translator.cc
+++ b/src/xenia/gpu/spirv_shader_translator.cc
@@ -243,6 +243,7 @@ void SpirvShaderTranslator::StartTranslation() {
attrib_type = is_signed ? vec2_int_type_ : vec2_uint_type_;
break;
}
+ // Intentionally fall through to float type.
case VertexFormat::k_16_16_FLOAT:
case VertexFormat::k_32_32_FLOAT:
attrib_type = vec2_float_type_;
@@ -260,6 +261,7 @@ void SpirvShaderTranslator::StartTranslation() {
attrib_type = is_signed ? vec4_int_type_ : vec4_uint_type_;
break;
}
+ // Intentionally fall through to float type.
case VertexFormat::k_16_16_16_16_FLOAT:
case VertexFormat::k_32_32_32_32_FLOAT:
attrib_type = vec4_float_type_;