From 962d8215da059d1fd72f30cb434f8c07ea3fce88 Mon Sep 17 00:00:00 2001 From: sephiroth99 Date: Wed, 30 Dec 2015 15:51:32 -0500 Subject: [PATCH] shader_translator: Handle all enum values in switch-cases --- src/xenia/gpu/glsl_shader_translator.cc | 12 ++++++++++++ src/xenia/gpu/shader_translator.cc | 14 +++++++++++++- src/xenia/gpu/shader_translator_disasm.cc | 6 ++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/glsl_shader_translator.cc b/src/xenia/gpu/glsl_shader_translator.cc index 423ba191d..397dd3a63 100644 --- a/src/xenia/gpu/glsl_shader_translator.cc +++ b/src/xenia/gpu/glsl_shader_translator.cc @@ -559,6 +559,9 @@ void GlslShaderTranslator::ProcessVertexFetchInstruction( EmitSource(" = vf%u_%d;\n", instr.operands[1].storage_index, instr.attributes.offset); break; + default: + assert_always(); + break; } } @@ -676,6 +679,9 @@ void GlslShaderTranslator::ProcessTextureFetchInstruction( EmitUnimplementedTranslationError(); EmitSourceDepth("pv = vec4(0.0);\n"); break; + case FetchOpcode::kVertexFetch: + assert_always(); + break; } EmitStoreVectorResult(instr.result); @@ -728,6 +734,10 @@ void GlslShaderTranslator::EmitLoadOperand(size_t i, case InstructionStorageSource::kConstantBool: EmitSource("state.bool_consts"); break; + case InstructionStorageSource::kTextureFetchConstant: + case InstructionStorageSource::kVertexFetchConstant: + assert_always(); + break; } switch (op.storage_addressing_mode) { case InstructionStorageAddressingMode::kStatic: @@ -815,6 +825,8 @@ void GlslShaderTranslator::EmitStoreResult(const InstructionResult& result, case InstructionStorageTarget::kDepth: EmitSourceDepth("gl_FragDepth"); break; + case InstructionStorageTarget::kNone: + break; } if (uses_storage_index) { switch (result.storage_addressing_mode) { diff --git a/src/xenia/gpu/shader_translator.cc b/src/xenia/gpu/shader_translator.cc index f4e7376df..71d9b419d 100644 --- a/src/xenia/gpu/shader_translator.cc +++ b/src/xenia/gpu/shader_translator.cc @@ -159,7 +159,7 @@ void ShaderTranslator::GatherBindingInformation( case ControlFlowOpcode::kCondExecPred: case ControlFlowOpcode::kCondExecPredEnd: case ControlFlowOpcode::kCondExecPredClean: - case ControlFlowOpcode::kCondExecPredCleanEnd: + case ControlFlowOpcode::kCondExecPredCleanEnd: { uint32_t sequence = cf.exec.sequence(); for (uint32_t instr_offset = cf.exec.address(); instr_offset < cf.exec.address() + cf.exec.count(); @@ -195,6 +195,8 @@ void ShaderTranslator::GatherBindingInformation( } } } + } break; + default: break; } } @@ -248,6 +250,9 @@ void ShaderTranslator::GatherTextureBindingInformation( case FetchOpcode::kSetTextureGradientsVert: // Doesn't use bindings. return; + default: + // Continue. + break; } Shader::TextureBinding binding; binding.binding_index = texture_bindings_.size(); @@ -271,6 +276,9 @@ void AddControlFlowTargetLabel(const ControlFlowInstruction& cf, case ControlFlowOpcode::kCondJmp: label_addresses->insert(cf.cond_jmp.address()); break; + default: + // Ignored. + break; } } @@ -435,6 +443,8 @@ void ShaderTranslator::TranslateControlFlowCondExec( i.opcode_name = "cexece"; i.is_end = true; break; + default: + break; } i.instruction_address = cf.address(); i.instruction_count = cf.count(); @@ -446,6 +456,8 @@ void ShaderTranslator::TranslateControlFlowCondExec( case ControlFlowOpcode::kCondExecEnd: i.clean = false; break; + default: + break; } i.is_yield = cf.is_yield(); i.sequence = cf.sequence(); diff --git a/src/xenia/gpu/shader_translator_disasm.cc b/src/xenia/gpu/shader_translator_disasm.cc index 4f4022f6e..8e1bdb996 100644 --- a/src/xenia/gpu/shader_translator_disasm.cc +++ b/src/xenia/gpu/shader_translator_disasm.cc @@ -45,6 +45,8 @@ void DisassembleResultOperand(const InstructionResult& result, case InstructionStorageTarget::kDepth: out->Append("oDepth"); break; + case InstructionStorageTarget::kNone: + break; } if (uses_storage_index) { switch (result.storage_addressing_mode) { @@ -90,6 +92,10 @@ void DisassembleSourceOperand(const InstructionOperand& op, StringBuffer* out) { case InstructionStorageSource::kConstantBool: out->Append('b'); break; + case InstructionStorageSource::kTextureFetchConstant: + case InstructionStorageSource::kVertexFetchConstant: + assert_always(); + break; } if (op.is_absolute_value) { out->Append("_abs");