1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +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 DxbcModuleInfo* pDxbcModuleInfo,
const void* pShaderBytecode,
size_t BytecodeLength)
: m_name(pShaderKey->toString()) {
Logger::debug(str::format("Compiling shader ", m_name));
size_t BytecodeLength) {
const std::string name = pShaderKey->toString();
Logger::debug(str::format("Compiling shader ", name));
DxbcReader reader(
reinterpret_cast<const char*>(pShaderBytecode),
@ -27,16 +27,16 @@ namespace dxvk {
const std::string dumpPath = env::getEnvVar(L"DXVK_SHADER_DUMP_PATH");
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));
}
m_shader = module.compile(*pDxbcModuleInfo, m_name);
m_shader->setDebugName(m_name);
m_shader = module.compile(*pDxbcModuleInfo, name);
m_shader->setShaderKey(*pShaderKey);
if (dumpPath.size() != 0) {
std::ofstream dumpStream(
str::format(dumpPath, "/", m_name, ".spv"),
str::format(dumpPath, "/", name, ".spv"),
std::ios_base::binary | std::ios_base::trunc);
m_shader->dump(dumpStream);

View File

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

View File

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