Merge branch 'linuxfix' of https://github.com/sephiroth99/xenia into sephiroth99-linuxfix

This commit is contained in:
Ben Vanik
2015-12-31 14:39:23 -08:00
16 changed files with 124 additions and 64 deletions

View File

@@ -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) {

View File

@@ -9,6 +9,7 @@
#include "xenia/gpu/shader.h"
#include <cinttypes>
#include <cstring>
#include "xenia/base/filesystem.h"
@@ -47,8 +48,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) {
char txt_file_name[kMaxPath];
std::snprintf(txt_file_name, xe::countof(txt_file_name),
"%s/shader_%s_%.16llX.%s", base_path.c_str(), path_prefix,
ucode_data_hash_,
"%s/shader_%s_%.16" PRIX64 ".%s", base_path.c_str(),
path_prefix, ucode_data_hash_,
shader_type_ == ShaderType::kVertex ? "vert" : "frag");
FILE* f = fopen(txt_file_name, "w");
if (f) {
@@ -70,8 +71,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) {
char bin_file_name[kMaxPath];
std::snprintf(bin_file_name, xe::countof(bin_file_name),
"%s/shader_%s_%.16llX.bin.%s", base_path.c_str(), path_prefix,
ucode_data_hash_,
"%s/shader_%s_%.16" PRIX64 ".bin.%s", base_path.c_str(),
path_prefix, ucode_data_hash_,
shader_type_ == ShaderType::kVertex ? "vert" : "frag");
f = fopen(bin_file_name, "w");
if (f) {

View File

@@ -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();
@@ -184,17 +184,19 @@ void ShaderTranslator::GatherBindingInformation(
auto& op = *reinterpret_cast<const AluInstruction*>(ucode_dwords_ +
instr_offset * 3);
if (op.has_vector_op() && op.is_export()) {
if (op.vector_dest() >= 0 && op.vector_dest() <= 3) {
if (op.vector_dest() <= 3) {
writes_color_targets_[op.vector_dest()] = true;
}
}
if (op.has_scalar_op() && op.is_export()) {
if (op.vector_dest() >= 0 && op.vector_dest() <= 3) {
if (op.vector_dest() <= 3) {
writes_color_targets_[op.vector_dest()] = true;
}
}
}
}
} 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();

View File

@@ -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");