mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-15 18:31:14 +00:00
Do friendly stringification of vulkan API versions in serialised data
* We use a wrapper type instead of uint32_t to let us stringify it as VK_MAKE_VERSION
This commit is contained in:
5 files changed
+46
-3
No files matched your search
@@ -720,6 +720,8 @@ StencilOperation MakeStencilOp(VkStencilOp op)
|
||||
return StencilOperation::Keep;
|
||||
}
|
||||
|
||||
BASIC_TYPE_SERIALISE_STRINGIFY(VkPackedVersion, (uint32_t &)el, SDBasic::UnsignedInteger, 4);
|
||||
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, VkInitParams &el)
|
||||
{
|
||||
@@ -727,7 +729,7 @@ void DoSerialise(SerialiserType &ser, VkInitParams &el)
|
||||
SERIALISE_MEMBER(EngineName);
|
||||
SERIALISE_MEMBER(AppVersion);
|
||||
SERIALISE_MEMBER(EngineVersion);
|
||||
SERIALISE_MEMBER(APIVersion);
|
||||
SERIALISE_MEMBER(APIVersion).TypedAs("uint32_t"_lit);
|
||||
SERIALISE_MEMBER(Layers);
|
||||
SERIALISE_MEMBER(Extensions);
|
||||
SERIALISE_MEMBER(InstanceID).TypedAs("VkInstance"_lit);
|
||||
|
||||
@@ -115,6 +115,34 @@ int StageIndex(VkShaderStageFlagBits stageFlag);
|
||||
|
||||
class WrappedVulkan;
|
||||
|
||||
struct VkPackedVersion
|
||||
{
|
||||
VkPackedVersion(uint32_t v = 0) : version(v) {}
|
||||
uint32_t version;
|
||||
|
||||
bool operator<(uint32_t v) const { return version < v; }
|
||||
bool operator>(uint32_t v) const { return version > v; }
|
||||
bool operator<=(uint32_t v) const { return version <= v; }
|
||||
bool operator>=(uint32_t v) const { return version >= v; }
|
||||
bool operator==(uint32_t v) const { return version == v; }
|
||||
bool operator!=(uint32_t v) const { return version == v; }
|
||||
// int overloads because VK_MAKE_VERSION is type int...
|
||||
bool operator<(int v) const { return version < (uint32_t)v; }
|
||||
bool operator>(int v) const { return version > (uint32_t)v; }
|
||||
bool operator<=(int v) const { return version <= (uint32_t)v; }
|
||||
bool operator>=(int v) const { return version >= (uint32_t)v; }
|
||||
bool operator==(int v) const { return version == (uint32_t)v; }
|
||||
bool operator!=(int v) const { return version == (uint32_t)v; }
|
||||
operator uint32_t() const { return version; }
|
||||
VkPackedVersion &operator=(uint32_t v)
|
||||
{
|
||||
version = v;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_STRUCT(VkPackedVersion);
|
||||
|
||||
// replay only class for handling marker regions.
|
||||
//
|
||||
// The cmd allows you to pass in an existing command buffer to insert/add the marker to.
|
||||
|
||||
@@ -42,7 +42,8 @@ struct VkInitParams
|
||||
void Set(const VkInstanceCreateInfo *pCreateInfo, ResourceId inst);
|
||||
|
||||
std::string AppName, EngineName;
|
||||
uint32_t AppVersion = 0, EngineVersion = 0, APIVersion = 0;
|
||||
uint32_t AppVersion = 0, EngineVersion = 0;
|
||||
VkPackedVersion APIVersion;
|
||||
|
||||
std::vector<std::string> Layers;
|
||||
std::vector<std::string> Extensions;
|
||||
|
||||
@@ -1463,7 +1463,12 @@ void DoSerialise(SerialiserType &ser, VkQueueFamilyProperties &el)
|
||||
template <typename SerialiserType>
|
||||
void DoSerialise(SerialiserType &ser, VkPhysicalDeviceProperties &el)
|
||||
{
|
||||
SERIALISE_MEMBER(apiVersion);
|
||||
// serialise apiVersion as packed version so we get a nice display.
|
||||
VkPackedVersion packedVer = el.apiVersion;
|
||||
ser.Serialise("apiVersion"_lit, packedVer).TypedAs("uint32_t"_lit);
|
||||
el.apiVersion = packedVer;
|
||||
|
||||
// driver version is *not* necessarily via VK_MAKE_VERSION
|
||||
SERIALISE_MEMBER(driverVersion);
|
||||
SERIALISE_MEMBER(vendorID);
|
||||
SERIALISE_MEMBER(deviceID);
|
||||
|
||||
@@ -2467,6 +2467,13 @@ rdcstr DoStringise(const VkExtent3D &el)
|
||||
return StringFormat::Fmt("VkExtent3D(%u, %u, %u)", el.width, el.height, el.depth);
|
||||
}
|
||||
|
||||
template <>
|
||||
rdcstr DoStringise(const VkPackedVersion &el)
|
||||
{
|
||||
return StringFormat::Fmt("VK_MAKE_VERSION(%u, %u, %u)", VK_VERSION_MAJOR(el.version),
|
||||
VK_VERSION_MINOR(el.version), VK_VERSION_PATCH(el.version));
|
||||
}
|
||||
|
||||
#if ENABLED(RDOC_WIN32)
|
||||
template <>
|
||||
rdcstr DoStringise(const VkFullScreenExclusiveEXT &el)
|
||||
|
||||
Reference in new issue
Block a user