1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Replace shader debug name with shader key

This commit is contained in:
Philip Rebohle 2018-09-18 10:21:18 +02:00
parent a078bb947e
commit 4469ef1ec1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 22 additions and 18 deletions

View File

@ -12,9 +12,9 @@ namespace dxvk {
const DxvkShaderKey* pShaderKey, const DxvkShaderKey* pShaderKey,
const DxbcModuleInfo* pDxbcModuleInfo, const DxbcModuleInfo* pDxbcModuleInfo,
const void* pShaderBytecode, const void* pShaderBytecode,
size_t BytecodeLength) size_t BytecodeLength) {
: m_name(pShaderKey->toString()) { const std::string name = pShaderKey->toString();
Logger::debug(str::format("Compiling shader ", m_name)); Logger::debug(str::format("Compiling shader ", name));
DxbcReader reader( DxbcReader reader(
reinterpret_cast<const char*>(pShaderBytecode), reinterpret_cast<const char*>(pShaderBytecode),
@ -27,16 +27,16 @@ namespace dxvk {
const std::string dumpPath = env::getEnvVar(L"DXVK_SHADER_DUMP_PATH"); const std::string dumpPath = env::getEnvVar(L"DXVK_SHADER_DUMP_PATH");
if (dumpPath.size() != 0) { if (dumpPath.size() != 0) {
reader.store(std::ofstream(str::format(dumpPath, "/", m_name, ".dxbc"), reader.store(std::ofstream(str::format(dumpPath, "/", name, ".dxbc"),
std::ios_base::binary | std::ios_base::trunc)); std::ios_base::binary | std::ios_base::trunc));
} }
m_shader = module.compile(*pDxbcModuleInfo, m_name); m_shader = module.compile(*pDxbcModuleInfo, name);
m_shader->setDebugName(m_name); m_shader->setShaderKey(*pShaderKey);
if (dumpPath.size() != 0) { if (dumpPath.size() != 0) {
std::ofstream dumpStream( std::ofstream dumpStream(
str::format(dumpPath, "/", m_name, ".spv"), str::format(dumpPath, "/", name, ".spv"),
std::ios_base::binary | std::ios_base::trunc); std::ios_base::binary | std::ios_base::trunc);
m_shader->dump(dumpStream); m_shader->dump(dumpStream);

View File

@ -48,12 +48,11 @@ namespace dxvk {
} }
std::string GetName() const { std::string GetName() const {
return m_name; return m_shader->debugName();
} }
private: private:
std::string m_name;
Rc<DxvkShader> m_shader; Rc<DxvkShader> m_shader;
Rc<DxvkBuffer> m_buffer; Rc<DxvkBuffer> m_buffer;

View File

@ -237,14 +237,19 @@ namespace dxvk {
void dump(std::ostream& outputStream) const; void dump(std::ostream& outputStream) const;
/** /**
* \brief Sets the shader's debug name * \brief Sets the shader key
* * \param [in] key Unique key
* Debug names may be used by the backend in
* order to help debug shader compiler issues.
* \param [in] name The shader's name
*/ */
void setDebugName(const std::string& name) { void setShaderKey(const DxvkShaderKey& key) {
m_debugName = name; m_key = key;
}
/**
* \brief Retrieves shader key
* \returns The unique shader key
*/
DxvkShaderKey getShaderKey() const {
return m_key;
} }
/** /**
@ -252,7 +257,7 @@ namespace dxvk {
* \returns The shader's name * \returns The shader's name
*/ */
std::string debugName() const { std::string debugName() const {
return m_debugName; return m_key.toString();
} }
private: private:
@ -264,7 +269,7 @@ namespace dxvk {
std::vector<size_t> m_idOffsets; std::vector<size_t> m_idOffsets;
DxvkInterfaceSlots m_interface; DxvkInterfaceSlots m_interface;
DxvkShaderConstData m_constData; DxvkShaderConstData m_constData;
std::string m_debugName; DxvkShaderKey m_key;
}; };