Expose microcode data hash in Shader
Return paths to files that were dumped from Dump
This commit is contained in:
parent
b696c645f5
commit
ccb6a9146c
|
@ -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<std::string, std::string> 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
|
||||
|
|
|
@ -502,6 +502,7 @@ class Shader {
|
|||
|
||||
// Microcode dwords in host endianness.
|
||||
const std::vector<uint32_t>& 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<uint8_t>& 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<std::string, std::string> Dump(const std::string& base_path,
|
||||
const char* path_prefix);
|
||||
|
||||
protected:
|
||||
friend class ShaderTranslator;
|
||||
|
|
Loading…
Reference in New Issue