mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Add an enum listing how a shader's bytes are encoded.
This commit is contained in:
@@ -781,6 +781,18 @@ std::string DoStringise(const GraphicsAPI &el)
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const ShaderEncoding &el)
|
||||
{
|
||||
BEGIN_ENUM_STRINGISE(ShaderEncoding)
|
||||
{
|
||||
STRINGISE_ENUM_CLASS(DXBC);
|
||||
STRINGISE_ENUM_CLASS(GLSL);
|
||||
STRINGISE_ENUM_CLASS_NAMED(SPIRV, "SPIR-V");
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string DoStringise(const SectionType &el)
|
||||
{
|
||||
|
||||
@@ -1239,6 +1239,29 @@ constexpr inline bool IsD3D(GraphicsAPI api)
|
||||
return api == GraphicsAPI::D3D11 || api == GraphicsAPI::D3D12;
|
||||
}
|
||||
|
||||
DOCUMENT(R"(Identifies a shader encoding used to pass shader code to an API.
|
||||
|
||||
.. data:: DXBC
|
||||
|
||||
DXBC binary shader, used by D3D11 and D3D12.
|
||||
|
||||
.. data:: GLSL
|
||||
|
||||
GLSL in string format, used by OpenGL.
|
||||
|
||||
.. data:: SPIRV
|
||||
|
||||
SPIR-V binary shader, used by Vulkan and with an extension by OpenGL.
|
||||
)");
|
||||
enum class ShaderEncoding : uint32_t
|
||||
{
|
||||
DXBC,
|
||||
GLSL,
|
||||
SPIRV,
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_ENUM(ShaderEncoding);
|
||||
|
||||
DOCUMENT(R"(A primitive topology used for processing vertex data.
|
||||
|
||||
.. data:: Unknown
|
||||
|
||||
@@ -766,7 +766,12 @@ struct ShaderReflection
|
||||
"A :class:`ShaderDebugInfo` containing any embedded debugging information in this shader.");
|
||||
ShaderDebugInfo debugInfo;
|
||||
|
||||
DOCUMENT("A raw ``bytes`` dump of the original shader, encoded in API specific binary form.");
|
||||
DOCUMENT("The :class:`ShaderEncoding` of this shader. See :data:`rawBytes`.");
|
||||
ShaderEncoding encoding;
|
||||
|
||||
DOCUMENT(R"(A raw ``bytes`` dump of the original shader, encoded in the form denoted by
|
||||
:data:`encoding`.
|
||||
)");
|
||||
bytebuf rawBytes;
|
||||
|
||||
DOCUMENT("The 3D dimensions of a compute workgroup, for compute shaders.");
|
||||
|
||||
@@ -78,6 +78,7 @@ void WrappedOpenGL::ShaderData::Compile(WrappedOpenGL &gl, ResourceId id, GLuint
|
||||
concatenated += sources[i];
|
||||
}
|
||||
|
||||
reflection.encoding = ShaderEncoding::GLSL;
|
||||
reflection.rawBytes.assign((byte *)concatenated.c_str(), concatenated.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -289,6 +289,7 @@ void MakeShaderReflection(DXBC::DXBCFile *dxbc, ShaderReflection *refl,
|
||||
}
|
||||
}
|
||||
|
||||
refl->encoding = ShaderEncoding::DXBC;
|
||||
refl->rawBytes = dxbc->m_ShaderBlob;
|
||||
|
||||
refl->dispatchThreadsDimension[0] = dxbc->DispatchThreadsDimension[0];
|
||||
|
||||
@@ -151,6 +151,7 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
if(!spv.spirv.empty())
|
||||
{
|
||||
const std::vector<uint32_t> &spirv = spv.spirv;
|
||||
reflData.refl.encoding = ShaderEncoding::SPIRV;
|
||||
reflData.refl.rawBytes.assign((byte *)spirv.data(), spirv.size() * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
@@ -375,6 +376,7 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
if(!spv.spirv.empty())
|
||||
{
|
||||
const vector<uint32_t> &spirv = spv.spirv;
|
||||
reflData.refl.encoding = ShaderEncoding::SPIRV;
|
||||
reflData.refl.rawBytes.assign((byte *)spirv.data(), spirv.size() * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ void DoSerialise(SerialiserType &ser, ShaderReflection &el)
|
||||
|
||||
SERIALISE_MEMBER(interfaces);
|
||||
|
||||
SIZE_CHECK(208);
|
||||
SIZE_CHECK(216);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
|
||||
Reference in New Issue
Block a user