shader_translator: Handle all enum values in switch-cases
This commit is contained in:
parent
ee8e6e8822
commit
962d8215da
|
@ -559,6 +559,9 @@ void GlslShaderTranslator::ProcessVertexFetchInstruction(
|
||||||
EmitSource(" = vf%u_%d;\n", instr.operands[1].storage_index,
|
EmitSource(" = vf%u_%d;\n", instr.operands[1].storage_index,
|
||||||
instr.attributes.offset);
|
instr.attributes.offset);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
assert_always();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,6 +679,9 @@ void GlslShaderTranslator::ProcessTextureFetchInstruction(
|
||||||
EmitUnimplementedTranslationError();
|
EmitUnimplementedTranslationError();
|
||||||
EmitSourceDepth("pv = vec4(0.0);\n");
|
EmitSourceDepth("pv = vec4(0.0);\n");
|
||||||
break;
|
break;
|
||||||
|
case FetchOpcode::kVertexFetch:
|
||||||
|
assert_always();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitStoreVectorResult(instr.result);
|
EmitStoreVectorResult(instr.result);
|
||||||
|
@ -728,6 +734,10 @@ void GlslShaderTranslator::EmitLoadOperand(size_t i,
|
||||||
case InstructionStorageSource::kConstantBool:
|
case InstructionStorageSource::kConstantBool:
|
||||||
EmitSource("state.bool_consts");
|
EmitSource("state.bool_consts");
|
||||||
break;
|
break;
|
||||||
|
case InstructionStorageSource::kTextureFetchConstant:
|
||||||
|
case InstructionStorageSource::kVertexFetchConstant:
|
||||||
|
assert_always();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
switch (op.storage_addressing_mode) {
|
switch (op.storage_addressing_mode) {
|
||||||
case InstructionStorageAddressingMode::kStatic:
|
case InstructionStorageAddressingMode::kStatic:
|
||||||
|
@ -815,6 +825,8 @@ void GlslShaderTranslator::EmitStoreResult(const InstructionResult& result,
|
||||||
case InstructionStorageTarget::kDepth:
|
case InstructionStorageTarget::kDepth:
|
||||||
EmitSourceDepth("gl_FragDepth");
|
EmitSourceDepth("gl_FragDepth");
|
||||||
break;
|
break;
|
||||||
|
case InstructionStorageTarget::kNone:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (uses_storage_index) {
|
if (uses_storage_index) {
|
||||||
switch (result.storage_addressing_mode) {
|
switch (result.storage_addressing_mode) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ void ShaderTranslator::GatherBindingInformation(
|
||||||
case ControlFlowOpcode::kCondExecPred:
|
case ControlFlowOpcode::kCondExecPred:
|
||||||
case ControlFlowOpcode::kCondExecPredEnd:
|
case ControlFlowOpcode::kCondExecPredEnd:
|
||||||
case ControlFlowOpcode::kCondExecPredClean:
|
case ControlFlowOpcode::kCondExecPredClean:
|
||||||
case ControlFlowOpcode::kCondExecPredCleanEnd:
|
case ControlFlowOpcode::kCondExecPredCleanEnd: {
|
||||||
uint32_t sequence = cf.exec.sequence();
|
uint32_t sequence = cf.exec.sequence();
|
||||||
for (uint32_t instr_offset = cf.exec.address();
|
for (uint32_t instr_offset = cf.exec.address();
|
||||||
instr_offset < cf.exec.address() + cf.exec.count();
|
instr_offset < cf.exec.address() + cf.exec.count();
|
||||||
|
@ -195,6 +195,8 @@ void ShaderTranslator::GatherBindingInformation(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,6 +250,9 @@ void ShaderTranslator::GatherTextureBindingInformation(
|
||||||
case FetchOpcode::kSetTextureGradientsVert:
|
case FetchOpcode::kSetTextureGradientsVert:
|
||||||
// Doesn't use bindings.
|
// Doesn't use bindings.
|
||||||
return;
|
return;
|
||||||
|
default:
|
||||||
|
// Continue.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
Shader::TextureBinding binding;
|
Shader::TextureBinding binding;
|
||||||
binding.binding_index = texture_bindings_.size();
|
binding.binding_index = texture_bindings_.size();
|
||||||
|
@ -271,6 +276,9 @@ void AddControlFlowTargetLabel(const ControlFlowInstruction& cf,
|
||||||
case ControlFlowOpcode::kCondJmp:
|
case ControlFlowOpcode::kCondJmp:
|
||||||
label_addresses->insert(cf.cond_jmp.address());
|
label_addresses->insert(cf.cond_jmp.address());
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// Ignored.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,6 +443,8 @@ void ShaderTranslator::TranslateControlFlowCondExec(
|
||||||
i.opcode_name = "cexece";
|
i.opcode_name = "cexece";
|
||||||
i.is_end = true;
|
i.is_end = true;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
i.instruction_address = cf.address();
|
i.instruction_address = cf.address();
|
||||||
i.instruction_count = cf.count();
|
i.instruction_count = cf.count();
|
||||||
|
@ -446,6 +456,8 @@ void ShaderTranslator::TranslateControlFlowCondExec(
|
||||||
case ControlFlowOpcode::kCondExecEnd:
|
case ControlFlowOpcode::kCondExecEnd:
|
||||||
i.clean = false;
|
i.clean = false;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
i.is_yield = cf.is_yield();
|
i.is_yield = cf.is_yield();
|
||||||
i.sequence = cf.sequence();
|
i.sequence = cf.sequence();
|
||||||
|
|
|
@ -45,6 +45,8 @@ void DisassembleResultOperand(const InstructionResult& result,
|
||||||
case InstructionStorageTarget::kDepth:
|
case InstructionStorageTarget::kDepth:
|
||||||
out->Append("oDepth");
|
out->Append("oDepth");
|
||||||
break;
|
break;
|
||||||
|
case InstructionStorageTarget::kNone:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (uses_storage_index) {
|
if (uses_storage_index) {
|
||||||
switch (result.storage_addressing_mode) {
|
switch (result.storage_addressing_mode) {
|
||||||
|
@ -90,6 +92,10 @@ void DisassembleSourceOperand(const InstructionOperand& op, StringBuffer* out) {
|
||||||
case InstructionStorageSource::kConstantBool:
|
case InstructionStorageSource::kConstantBool:
|
||||||
out->Append('b');
|
out->Append('b');
|
||||||
break;
|
break;
|
||||||
|
case InstructionStorageSource::kTextureFetchConstant:
|
||||||
|
case InstructionStorageSource::kVertexFetchConstant:
|
||||||
|
assert_always();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (op.is_absolute_value) {
|
if (op.is_absolute_value) {
|
||||||
out->Append("_abs");
|
out->Append("_abs");
|
||||||
|
|
Loading…
Reference in New Issue