mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Change compile flags from uint32_t to string key/value pairs
* For D3D this is overkill as we just stuff the uint32_t flags into a string. However for SPIR-V this will let us store the parameters from an OpModuleProcessed.
This commit is contained in:
@@ -826,7 +826,7 @@ void PipelineStateViewer::EditShader(ShaderStage shaderType, ResourceId id,
|
||||
viewer](IReplayController *r) {
|
||||
rdctype::str errs;
|
||||
|
||||
uint flags = shaderDetails->DebugInfo.compileFlags;
|
||||
const ShaderCompileFlags &flags = shaderDetails->DebugInfo.compileFlags;
|
||||
|
||||
ResourceId from = id;
|
||||
ResourceId to;
|
||||
|
||||
@@ -3600,8 +3600,8 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
rdctype::str errors;
|
||||
|
||||
ResourceId id;
|
||||
std::tie(id, errors) =
|
||||
r->BuildCustomShader("main", source.toUtf8().data(), 0, ShaderStage::Pixel);
|
||||
std::tie(id, errors) = r->BuildCustomShader("main", source.toUtf8().data(),
|
||||
ShaderCompileFlags(), ShaderStage::Pixel);
|
||||
|
||||
if(m_CustomShaderEditor.contains(key))
|
||||
{
|
||||
|
||||
@@ -269,6 +269,17 @@ struct str : public rdctype::array<char>
|
||||
|
||||
operator std::string() const { return std::string(elems, elems + count); }
|
||||
const char *c_str() const { return elems ? elems : ""; }
|
||||
bool operator==(const char *const o) const
|
||||
{
|
||||
if(!elems)
|
||||
return o == NULL;
|
||||
return !strcmp(elems, o);
|
||||
}
|
||||
bool operator==(const std::string &o) const { return o == elems; }
|
||||
bool operator==(const str &o) const { return *this == (const char *const)o.elems; }
|
||||
bool operator!=(const char *const o) const { return !(*this == o); }
|
||||
bool operator!=(const std::string &o) const { return !(*this == o); }
|
||||
bool operator!=(const str &o) const { return !(*this == o); }
|
||||
};
|
||||
|
||||
inline str &str::operator=(const std::string &in)
|
||||
|
||||
@@ -580,10 +580,9 @@ See :data:`TextureDisplay.CustomShader`.
|
||||
:meth:`ResourceId.Null` otherwise, and a ``str`` with any warnings/errors from compilation.
|
||||
:rtype: ``tuple`` of :class:`ResourceId` and ``str``.
|
||||
)");
|
||||
virtual rdctype::pair<ResourceId, rdctype::str> BuildCustomShader(const char *entry,
|
||||
const char *source,
|
||||
const uint32_t compileFlags,
|
||||
ShaderStage type) = 0;
|
||||
virtual rdctype::pair<ResourceId, rdctype::str> BuildCustomShader(
|
||||
const char *entry, const char *source, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type) = 0;
|
||||
|
||||
DOCUMENT(R"(Free a previously created custom shader.
|
||||
|
||||
@@ -599,7 +598,7 @@ The language used is native to the API's renderer - HLSL for D3D based renderers
|
||||
|
||||
:param str entry: The entry point to use when compiling.
|
||||
:param str source: The source file.
|
||||
:param int compileFlags: API-specific compilation flags.
|
||||
:param ShaderCompileFlags compileFlags: API-specific compilation flags.
|
||||
:param ShaderStage type: The stage that this shader will be executed at.
|
||||
:return: A ``tuple`` with the id of the new shader if compilation was successful,
|
||||
:meth:`ResourceId.Null` otherwise, and a ``str`` with any warnings/errors from compilation.
|
||||
@@ -607,7 +606,7 @@ The language used is native to the API's renderer - HLSL for D3D based renderers
|
||||
)");
|
||||
virtual rdctype::pair<ResourceId, rdctype::str> BuildTargetShader(const char *entry,
|
||||
const char *source,
|
||||
const uint32_t compileFlags,
|
||||
const ShaderCompileFlags &flags,
|
||||
ShaderStage type) = 0;
|
||||
|
||||
DOCUMENT(R"(Replace one resource with another for subsequent replay and analysis work.
|
||||
|
||||
@@ -441,6 +441,16 @@ able to be read from and written to arbitrarily.
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(ShaderResource);
|
||||
|
||||
DOCUMENT("Contains the information about the compilation environment of a shader");
|
||||
struct ShaderCompileFlags
|
||||
{
|
||||
DOCUMENT(R"(A list of tuples, where each tuple is a pair of flagName, flagValue.
|
||||
|
||||
Each entry is an API or compiler specific flag used to compile this shader originally.
|
||||
)");
|
||||
rdctype::array<rdctype::pair<rdctype::str, rdctype::str> > flags;
|
||||
};
|
||||
|
||||
DOCUMENT(R"(Contains the information about a shader contained within API-specific debugging
|
||||
information attached to the shader.
|
||||
|
||||
@@ -448,9 +458,9 @@ Primarily this means the embedded original source files.
|
||||
)");
|
||||
struct ShaderDebugChunk
|
||||
{
|
||||
ShaderDebugChunk() : compileFlags(0) {}
|
||||
DOCUMENT("An API or compiler specific set of flags used to compile this shader originally.");
|
||||
uint32_t compileFlags;
|
||||
ShaderDebugChunk() {}
|
||||
DOCUMENT("A :class:`ShaderCompileFlags` containing the flags used to compile this shader.");
|
||||
ShaderCompileFlags compileFlags;
|
||||
|
||||
DOCUMENT(R"(A list of tuples, where each tuple is a pair of filename, source code.
|
||||
|
||||
|
||||
@@ -124,8 +124,8 @@ public:
|
||||
{
|
||||
return m_Proxy->PickVertex(eventID, cfg, x, y);
|
||||
}
|
||||
void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
{
|
||||
m_Proxy->BuildCustomShader(source, entry, compileFlags, type, id, errors);
|
||||
}
|
||||
@@ -231,8 +231,8 @@ public:
|
||||
RDCEraseEl(ret);
|
||||
return ret;
|
||||
}
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
{
|
||||
}
|
||||
void ReplaceResource(ResourceId from, ResourceId to) {}
|
||||
|
||||
@@ -207,14 +207,30 @@ void Serialiser::Serialise(const char *name, ShaderResource &el)
|
||||
SIZE_CHECK(80);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, ShaderCompileFlags &el)
|
||||
{
|
||||
Serialise("", el.flags);
|
||||
|
||||
SIZE_CHECK(16);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, ShaderDebugChunk &el)
|
||||
{
|
||||
Serialise("", el.compileFlags);
|
||||
Serialise("", el.files);
|
||||
|
||||
SIZE_CHECK(32);
|
||||
}
|
||||
|
||||
template <>
|
||||
void Serialiser::Serialise(const char *name, ShaderReflection &el)
|
||||
{
|
||||
Serialise("", el.ID);
|
||||
Serialise("", el.EntryPoint);
|
||||
|
||||
Serialise("", el.DebugInfo.compileFlags);
|
||||
Serialise("", el.DebugInfo.files);
|
||||
Serialise("", el.DebugInfo);
|
||||
|
||||
SerialisePODArray<3>("", el.DispatchThreadsDimension);
|
||||
|
||||
@@ -230,7 +246,7 @@ void Serialiser::Serialise(const char *name, ShaderReflection &el)
|
||||
|
||||
Serialise("", el.Interfaces);
|
||||
|
||||
SIZE_CHECK(176);
|
||||
SIZE_CHECK(184);
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -2247,7 +2263,7 @@ bool ReplayProxy::Tick(int type, Serialiser *incomingPacket)
|
||||
}
|
||||
case eReplayProxy_GetPostVS: GetPostVSBuffers(0, 0, MeshDataStage::Unknown); break;
|
||||
case eReplayProxy_BuildTargetShader:
|
||||
BuildTargetShader("", "", 0, ShaderStage::Vertex, NULL, NULL);
|
||||
BuildTargetShader("", "", ShaderCompileFlags(), ShaderStage::Vertex, NULL, NULL);
|
||||
break;
|
||||
case eReplayProxy_ReplaceResource: ReplaceResource(ResourceId(), ResourceId()); break;
|
||||
case eReplayProxy_RemoveReplacement: RemoveReplacement(ResourceId()); break;
|
||||
@@ -3072,10 +3088,11 @@ Callstack::AddressDetails ReplayProxy::GetAddr(uint64_t addr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ReplayProxy::BuildTargetShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void ReplayProxy::BuildTargetShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
uint32_t flags = compileFlags;
|
||||
ShaderCompileFlags flags = compileFlags;
|
||||
m_ToReplaySerialiser->Serialise("", source);
|
||||
m_ToReplaySerialiser->Serialise("", entry);
|
||||
m_ToReplaySerialiser->Serialise("", flags);
|
||||
|
||||
@@ -347,8 +347,8 @@ public:
|
||||
return ~0U;
|
||||
}
|
||||
|
||||
void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
{
|
||||
if(m_Proxy)
|
||||
{
|
||||
@@ -457,8 +457,8 @@ public:
|
||||
ShaderDebugTrace DebugThread(uint32_t eventID, const uint32_t groupid[3],
|
||||
const uint32_t threadid[3]);
|
||||
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void ReplaceResource(ResourceId from, ResourceId to);
|
||||
void RemoveReplacement(ResourceId id);
|
||||
|
||||
|
||||
@@ -808,7 +808,7 @@ ShaderReflection *MakeShaderReflection(DXBC::DXBCFile *dxbc)
|
||||
|
||||
if(dxbc->m_DebugInfo)
|
||||
{
|
||||
ret->DebugInfo.compileFlags = dxbc->m_DebugInfo->GetShaderCompileFlags();
|
||||
ret->DebugInfo.compileFlags = DXBC::EncodeFlags(dxbc->m_DebugInfo);
|
||||
|
||||
create_array_uninit(ret->DebugInfo.files, dxbc->m_DebugInfo->Files.size());
|
||||
for(size_t i = 0; i < dxbc->m_DebugInfo->Files.size(); i++)
|
||||
|
||||
@@ -442,9 +442,12 @@ ID3D11ComputeShader *D3D11DebugManager::MakeCShader(const char *source, const ch
|
||||
return cs;
|
||||
}
|
||||
|
||||
void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void D3D11DebugManager::BuildShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
uint32_t flags = DXBC::DecodeFlags(compileFlags);
|
||||
|
||||
if(id == NULL || errors == NULL)
|
||||
{
|
||||
if(id)
|
||||
@@ -469,7 +472,7 @@ void D3D11DebugManager::BuildShader(string source, string entry, const uint32_t
|
||||
}
|
||||
|
||||
ID3DBlob *blob = NULL;
|
||||
*errors = GetShaderBlob(source.c_str(), entry.c_str(), compileFlags, profile, &blob);
|
||||
*errors = GetShaderBlob(source.c_str(), entry.c_str(), flags, profile, &blob);
|
||||
|
||||
if(blob == NULL)
|
||||
{
|
||||
|
||||
@@ -176,8 +176,8 @@ public:
|
||||
ID3D11PixelShader *MakePShader(const char *source, const char *entry, const char *profile);
|
||||
ID3D11ComputeShader *MakeCShader(const char *source, const char *entry, const char *profile);
|
||||
|
||||
void BuildShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
|
||||
ID3D11Buffer *MakeCBuffer(UINT size);
|
||||
|
||||
|
||||
@@ -1524,15 +1524,19 @@ void D3D11Replay::RenderMesh(uint32_t eventID, const vector<MeshFormat> &seconda
|
||||
return m_pDevice->GetDebugManager()->RenderMesh(eventID, secondaryDraws, cfg);
|
||||
}
|
||||
|
||||
void D3D11Replay::BuildTargetShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void D3D11Replay::BuildTargetShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
m_pDevice->GetDebugManager()->BuildShader(source, entry, D3DCOMPILE_DEBUG | compileFlags, type,
|
||||
id, errors);
|
||||
ShaderCompileFlags debugCompileFlags =
|
||||
DXBC::EncodeFlags(DXBC::DecodeFlags(compileFlags) | D3DCOMPILE_DEBUG);
|
||||
|
||||
m_pDevice->GetDebugManager()->BuildShader(source, entry, debugCompileFlags, type, id, errors);
|
||||
}
|
||||
|
||||
void D3D11Replay::BuildCustomShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void D3D11Replay::BuildCustomShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
m_pDevice->GetDebugManager()->BuildShader(source, entry, compileFlags, type, id, errors);
|
||||
}
|
||||
|
||||
@@ -112,8 +112,8 @@ public:
|
||||
byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
const GetTextureDataParams ¶ms, size_t &dataSize);
|
||||
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void ReplaceResource(ResourceId from, ResourceId to);
|
||||
void RemoveReplacement(ResourceId id);
|
||||
|
||||
@@ -157,8 +157,8 @@ public:
|
||||
ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay,
|
||||
uint32_t eventID, const vector<uint32_t> &passEvents);
|
||||
|
||||
void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx,
|
||||
uint32_t sampleIdx, CompType typeHint);
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl,
|
||||
|
||||
if(dxbc->m_DebugInfo)
|
||||
{
|
||||
refl->DebugInfo.compileFlags = dxbc->m_DebugInfo->GetShaderCompileFlags();
|
||||
refl->DebugInfo.compileFlags = DXBC::EncodeFlags(dxbc->m_DebugInfo);
|
||||
|
||||
create_array_uninit(refl->DebugInfo.files, dxbc->m_DebugInfo->Files.size());
|
||||
for(size_t i = 0; i < dxbc->m_DebugInfo->Files.size(); i++)
|
||||
|
||||
@@ -3166,9 +3166,12 @@ void D3D12DebugManager::FillCBufferVariables(const vector<DXBC::CBufferVariable>
|
||||
outvars.push_back(v[i]);
|
||||
}
|
||||
|
||||
void D3D12DebugManager::BuildShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void D3D12DebugManager::BuildShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
uint32_t flags = DXBC::DecodeFlags(compileFlags);
|
||||
|
||||
if(id == NULL || errors == NULL)
|
||||
{
|
||||
if(id)
|
||||
@@ -3193,7 +3196,7 @@ void D3D12DebugManager::BuildShader(string source, string entry, const uint32_t
|
||||
}
|
||||
|
||||
ID3DBlob *blob = NULL;
|
||||
*errors = GetShaderBlob(source.c_str(), entry.c_str(), compileFlags, profile, &blob);
|
||||
*errors = GetShaderBlob(source.c_str(), entry.c_str(), flags, profile, &blob);
|
||||
|
||||
if(blob == NULL)
|
||||
{
|
||||
|
||||
@@ -107,8 +107,8 @@ public:
|
||||
byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
const GetTextureDataParams ¶ms, size_t &dataSize);
|
||||
|
||||
void BuildShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE AllocRTV();
|
||||
void FreeRTV(D3D12_CPU_DESCRIPTOR_HANDLE handle);
|
||||
|
||||
@@ -1574,11 +1574,14 @@ vector<DebugMessage> D3D12Replay::GetDebugMessages()
|
||||
return m_pDevice->GetDebugMessages();
|
||||
}
|
||||
|
||||
void D3D12Replay::BuildTargetShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void D3D12Replay::BuildTargetShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
m_pDevice->GetDebugManager()->BuildShader(source, entry, D3DCOMPILE_DEBUG | compileFlags, type,
|
||||
id, errors);
|
||||
ShaderCompileFlags debugCompileFlags =
|
||||
DXBC::EncodeFlags(DXBC::DecodeFlags(compileFlags) | D3DCOMPILE_DEBUG);
|
||||
|
||||
m_pDevice->GetDebugManager()->BuildShader(source, entry, debugCompileFlags, type, id, errors);
|
||||
}
|
||||
|
||||
void D3D12Replay::ReplaceResource(ResourceId from, ResourceId to)
|
||||
@@ -1681,8 +1684,9 @@ byte *D3D12Replay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mi
|
||||
return m_pDevice->GetDebugManager()->GetTextureData(tex, arrayIdx, mip, params, dataSize);
|
||||
}
|
||||
|
||||
void D3D12Replay::BuildCustomShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void D3D12Replay::BuildCustomShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
m_pDevice->GetDebugManager()->BuildShader(source, entry, compileFlags, type, id, errors);
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ public:
|
||||
byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
const GetTextureDataParams ¶ms, size_t &dataSize);
|
||||
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void ReplaceResource(ResourceId from, ResourceId to);
|
||||
void RemoveReplacement(ResourceId id);
|
||||
|
||||
@@ -155,8 +155,8 @@ public:
|
||||
ResourceId RenderOverlay(ResourceId texid, CompType typeHint, DebugOverlay overlay,
|
||||
uint32_t eventID, const vector<uint32_t> &passEvents);
|
||||
|
||||
void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip, uint32_t arrayIdx,
|
||||
uint32_t sampleIdx, CompType typeHint);
|
||||
|
||||
|
||||
@@ -2709,7 +2709,7 @@ byte *GLReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GLReplay::BuildCustomShader(string source, string entry, const uint32_t compileFlags,
|
||||
void GLReplay::BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
{
|
||||
if(id == NULL || errors == NULL)
|
||||
@@ -2859,7 +2859,7 @@ void GLReplay::FreeCustomShader(ResourceId id)
|
||||
m_pDriver->glDeleteProgram(m_pDriver->GetResourceManager()->GetCurrentResource(id).name);
|
||||
}
|
||||
|
||||
void GLReplay::BuildTargetShader(string source, string entry, const uint32_t compileFlags,
|
||||
void GLReplay::BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
{
|
||||
if(id == NULL || errors == NULL)
|
||||
|
||||
@@ -170,10 +170,10 @@ public:
|
||||
|
||||
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
|
||||
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void FreeCustomShader(ResourceId id);
|
||||
|
||||
enum TexDisplayFlags
|
||||
|
||||
@@ -895,8 +895,6 @@ void ReconstructVarTree(const GLHookSet &gl, GLenum query, GLuint sepProg, GLuin
|
||||
void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg,
|
||||
ShaderReflection &refl, bool pointSizeUsed, bool clipDistanceUsed)
|
||||
{
|
||||
refl.DebugInfo.compileFlags = 0;
|
||||
|
||||
if(shadType == eGL_COMPUTE_SHADER)
|
||||
{
|
||||
gl.glGetProgramiv(sepProg, eGL_COMPUTE_WORK_GROUP_SIZE, (GLint *)refl.DispatchThreadsDimension);
|
||||
|
||||
@@ -1396,6 +1396,31 @@ void DXBCFile::GuessResources()
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t DecodeFlags(const ShaderCompileFlags &compileFlags)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
if(compileFlags.flags.count >= 1 && compileFlags.flags[0].first == "compileFlags")
|
||||
ret = atoi(compileFlags.flags[0].second.c_str());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShaderCompileFlags EncodeFlags(const uint32_t flags)
|
||||
{
|
||||
ShaderCompileFlags ret;
|
||||
|
||||
create_array_uninit(ret.flags, 1);
|
||||
ret.flags = {{"compileFlags", StringFormat::Fmt("%u", flags)}};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShaderCompileFlags EncodeFlags(const DXBCDebugChunk *dbg)
|
||||
{
|
||||
return EncodeFlags(dbg ? dbg->GetShaderCompileFlags() : 0);
|
||||
}
|
||||
|
||||
SDBGChunk::SDBGChunk(void *data)
|
||||
{
|
||||
m_HasDebugInfo = false;
|
||||
|
||||
@@ -346,6 +346,10 @@ public:
|
||||
int32_t &lineNum) const = 0;
|
||||
};
|
||||
|
||||
uint32_t DecodeFlags(const ShaderCompileFlags &compileFlags);
|
||||
ShaderCompileFlags EncodeFlags(const DXBCDebugChunk *dbg);
|
||||
ShaderCompileFlags EncodeFlags(const uint32_t flags);
|
||||
|
||||
// declare one of these and pass in your shader bytecode, then inspect
|
||||
// the members that are populated with the shader information.
|
||||
class DXBCFile
|
||||
|
||||
@@ -5049,8 +5049,9 @@ byte *VulkanReplay::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t m
|
||||
return ret;
|
||||
}
|
||||
|
||||
void VulkanReplay::BuildCustomShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void VulkanReplay::BuildCustomShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
SPIRVShaderStage stage = SPIRVShaderStage::Invalid;
|
||||
|
||||
@@ -5162,8 +5163,9 @@ ResourceId VulkanReplay::ApplyCustomShader(ResourceId shader, ResourceId texid,
|
||||
return GetResID(GetDebugManager()->m_CustomTexImg);
|
||||
}
|
||||
|
||||
void VulkanReplay::BuildTargetShader(string source, string entry, const uint32_t compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors)
|
||||
void VulkanReplay::BuildTargetShader(string source, string entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors)
|
||||
{
|
||||
SPIRVShaderStage stage = SPIRVShaderStage::Invalid;
|
||||
|
||||
|
||||
@@ -202,10 +202,10 @@ public:
|
||||
|
||||
void RenderMesh(uint32_t eventID, const vector<MeshFormat> &secondaryDraws, const MeshDisplay &cfg);
|
||||
|
||||
void BuildTargetShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildCustomShader(string source, string entry, const uint32_t compileFlags, ShaderStage type,
|
||||
ResourceId *id, string *errors);
|
||||
void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors);
|
||||
void FreeCustomShader(ResourceId id);
|
||||
|
||||
bool RenderTexture(TextureDisplay cfg);
|
||||
|
||||
@@ -1476,7 +1476,7 @@ void ReplayController::Shutdown()
|
||||
}
|
||||
|
||||
rdctype::pair<ResourceId, rdctype::str> ReplayController::BuildTargetShader(
|
||||
const char *entry, const char *source, const uint32_t compileFlags, ShaderStage type)
|
||||
const char *entry, const char *source, const ShaderCompileFlags &compileFlags, ShaderStage type)
|
||||
{
|
||||
ResourceId id;
|
||||
string errs;
|
||||
@@ -1503,7 +1503,7 @@ rdctype::pair<ResourceId, rdctype::str> ReplayController::BuildTargetShader(
|
||||
}
|
||||
|
||||
rdctype::pair<ResourceId, rdctype::str> ReplayController::BuildCustomShader(
|
||||
const char *entry, const char *source, const uint32_t compileFlags, ShaderStage type)
|
||||
const char *entry, const char *source, const ShaderCompileFlags &compileFlags, ShaderStage type)
|
||||
{
|
||||
ResourceId id;
|
||||
string errs;
|
||||
|
||||
@@ -148,12 +148,12 @@ public:
|
||||
rdctype::str DisassembleShader(const ShaderReflection *refl, const char *target);
|
||||
|
||||
rdctype::pair<ResourceId, rdctype::str> BuildCustomShader(const char *entry, const char *source,
|
||||
const uint32_t compileFlags,
|
||||
const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type);
|
||||
void FreeCustomShader(ResourceId id);
|
||||
|
||||
rdctype::pair<ResourceId, rdctype::str> BuildTargetShader(const char *entry, const char *source,
|
||||
const uint32_t compileFlags,
|
||||
const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type);
|
||||
void ReplaceResource(ResourceId from, ResourceId to);
|
||||
void RemoveReplacement(ResourceId id);
|
||||
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
virtual byte *GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
const GetTextureDataParams ¶ms, size_t &dataSize) = 0;
|
||||
|
||||
virtual void BuildTargetShader(string source, string entry, const uint32_t compileFlags,
|
||||
virtual void BuildTargetShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors) = 0;
|
||||
virtual void ReplaceResource(ResourceId from, ResourceId to) = 0;
|
||||
virtual void RemoveReplacement(ResourceId id) = 0;
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
const MeshDisplay &cfg) = 0;
|
||||
virtual bool RenderTexture(TextureDisplay cfg) = 0;
|
||||
|
||||
virtual void BuildCustomShader(string source, string entry, const uint32_t compileFlags,
|
||||
virtual void BuildCustomShader(string source, string entry, const ShaderCompileFlags &compileFlags,
|
||||
ShaderStage type, ResourceId *id, string *errors) = 0;
|
||||
virtual ResourceId ApplyCustomShader(ResourceId shader, ResourceId texid, uint32_t mip,
|
||||
uint32_t arrayIdx, uint32_t sampleIdx, CompType typeHint) = 0;
|
||||
|
||||
Reference in New Issue
Block a user