diff --git a/src/xenia/gpu/shader.cc b/src/xenia/gpu/shader.cc index 3e0be41f9..cf8e43b9d 100644 --- a/src/xenia/gpu/shader.cc +++ b/src/xenia/gpu/shader.cc @@ -16,9 +16,11 @@ #include "xenia/base/math.h" #include "xenia/base/memory.h" #include "xenia/base/string.h" +#include "xenia/gpu/ucode.h" namespace xe { namespace gpu { +using namespace ucode; Shader::Shader(ShaderType shader_type, uint64_t ucode_data_hash, const uint32_t* ucode_dwords, size_t ucode_dword_count) @@ -38,7 +40,8 @@ std::string Shader::GetTranslatedBinaryString() const { return result; } -void Shader::Dump(const std::string& base_path, const char* path_prefix) { +std::pair Shader::Dump(const std::string& base_path, + const char* path_prefix) { // Ensure target path exists. auto target_path = xe::to_wstring(base_path); if (!target_path.empty()) { @@ -79,6 +82,8 @@ void Shader::Dump(const std::string& base_path, const char* path_prefix) { fwrite(ucode_data_.data(), 4, ucode_data_.size(), f); fclose(f); } + + return {std::string(txt_file_name), std::string(bin_file_name)}; } } // namespace gpu diff --git a/src/xenia/gpu/shader.h b/src/xenia/gpu/shader.h index 46f725475..ebe491d65 100644 --- a/src/xenia/gpu/shader.h +++ b/src/xenia/gpu/shader.h @@ -502,6 +502,7 @@ class Shader { // Microcode dwords in host endianness. const std::vector& ucode_data() const { return ucode_data_; } + uint64_t ucode_data_hash() const { return ucode_data_hash_; } const uint32_t* ucode_dwords() const { return ucode_data_.data(); } size_t ucode_dword_count() const { return ucode_data_.size(); } @@ -547,13 +548,12 @@ class Shader { // May be empty if the host does not support saving binaries. const std::vector& host_binary() const { return host_binary_; } - // Prepares the shader for use in the host graphics API. - virtual bool Prepare() { return is_valid_; } - // Dumps the shader to a file in the given path based on ucode hash. // Both the ucode binary and disassembled and translated shader will be // written. - void Dump(const std::string& base_path, const char* path_prefix); + // Returns the filename of the shader and the binary. + std::pair Dump(const std::string& base_path, + const char* path_prefix); protected: friend class ShaderTranslator;