mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Update external code to use new SPIR-V reflector, remove old one
This commit is contained in:
@@ -611,7 +611,7 @@ public:
|
||||
GLenum type;
|
||||
std::vector<std::string> sources;
|
||||
std::vector<std::string> includepaths;
|
||||
SPVModule spirv;
|
||||
rdcspv::Reflector spirv;
|
||||
std::string disassembly;
|
||||
ShaderReflection reflection;
|
||||
int version;
|
||||
|
||||
@@ -62,13 +62,15 @@ void WrappedOpenGL::ShaderData::ProcessSPIRVCompilation(WrappedOpenGL &drv, Reso
|
||||
const GLuint *pConstantValue)
|
||||
{
|
||||
reflection.resourceId = id;
|
||||
reflection.entryPoint = pEntryPoint;
|
||||
reflection.stage = MakeShaderStage(type);
|
||||
reflection.encoding = ShaderEncoding::SPIRV;
|
||||
reflection.rawBytes.assign((byte *)spirv.spirv.data(), spirv.spirv.size() * sizeof(uint32_t));
|
||||
|
||||
spirv.MakeReflection(GraphicsAPI::OpenGL, ShaderStage(ShaderIdx(type)), pEntryPoint, reflection,
|
||||
mapping, patchData);
|
||||
std::vector<SpecConstant> specInfo;
|
||||
for(size_t i = 0; i < specInfo.size(); i++)
|
||||
{
|
||||
specInfo.push_back(SpecConstant(pConstantIndex[i], pConstantValue[i], 4));
|
||||
}
|
||||
|
||||
spirv.MakeReflection(GraphicsAPI::OpenGL, ShaderStage(ShaderIdx(type)), pEntryPoint, specInfo,
|
||||
reflection, mapping, patchData);
|
||||
|
||||
version = 460;
|
||||
|
||||
@@ -267,7 +269,7 @@ void WrappedOpenGL::ShaderData::ProcessCompilation(WrappedOpenGL &drv, ResourceI
|
||||
|
||||
std::string s = rdcspv::Compile(settings, sources, spirvwords);
|
||||
if(!spirvwords.empty())
|
||||
ParseSPIRV(&spirvwords.front(), spirvwords.size(), spirv);
|
||||
spirv.Parse(spirvwords);
|
||||
else
|
||||
disassembly = s;
|
||||
|
||||
@@ -396,7 +398,7 @@ bool WrappedOpenGL::Serialise_glShaderSource(SerialiserType &ser, GLuint shaderH
|
||||
// so people who do that should be moderately ashamed.
|
||||
if(m_Shaders[liveId].reflection.resourceId != ResourceId())
|
||||
{
|
||||
m_Shaders[liveId].spirv = SPVModule();
|
||||
m_Shaders[liveId].spirv = rdcspv::Reflector();
|
||||
m_Shaders[liveId].reflection = ShaderReflection();
|
||||
}
|
||||
|
||||
@@ -1941,8 +1943,7 @@ bool WrappedOpenGL::Serialise_glSpecializeShader(SerialiserType &ser, GLuint sha
|
||||
GL.glSpecializeShader(shader.name, pEntryPoint, numSpecializationConstants, pConstantIndex,
|
||||
pConstantValue);
|
||||
|
||||
ParseSPIRV(m_Shaders[liveId].spirvWords.data(), m_Shaders[liveId].spirvWords.size(),
|
||||
m_Shaders[liveId].spirv);
|
||||
m_Shaders[liveId].spirv.Parse(m_Shaders[liveId].spirvWords);
|
||||
|
||||
m_Shaders[liveId].ProcessSPIRVCompilation(*this, GetResourceManager()->GetOriginalID(liveId),
|
||||
shader.name, pEntryPoint, numSpecializationConstants,
|
||||
@@ -1977,8 +1978,7 @@ void WrappedOpenGL::glSpecializeShader(GLuint shader, const GLchar *pEntryPoint,
|
||||
|
||||
ResourceId id = record->GetResourceID();
|
||||
|
||||
ParseSPIRV(m_Shaders[id].spirvWords.data(), m_Shaders[id].spirvWords.size(),
|
||||
m_Shaders[id].spirv);
|
||||
m_Shaders[id].spirv.Parse(m_Shaders[id].spirvWords);
|
||||
|
||||
m_Shaders[id].ProcessSPIRVCompilation(
|
||||
*this, id, shader, pEntryPoint, numSpecializationConstants, pConstantIndex, pConstantValue);
|
||||
@@ -1988,8 +1988,7 @@ void WrappedOpenGL::glSpecializeShader(GLuint shader, const GLchar *pEntryPoint,
|
||||
{
|
||||
ResourceId liveId = GetResourceManager()->GetID(ShaderRes(GetCtx(), shader));
|
||||
|
||||
ParseSPIRV(m_Shaders[liveId].spirvWords.data(), m_Shaders[liveId].spirvWords.size(),
|
||||
m_Shaders[liveId].spirv);
|
||||
m_Shaders[liveId].spirv.Parse(m_Shaders[liveId].spirvWords);
|
||||
|
||||
m_Shaders[liveId].ProcessSPIRVCompilation(*this, liveId, shader, pEntryPoint,
|
||||
numSpecializationConstants, pConstantIndex,
|
||||
|
||||
@@ -32,8 +32,6 @@ namespace DXBC
|
||||
class DXBCFile;
|
||||
};
|
||||
|
||||
struct SPVModule;
|
||||
|
||||
namespace GCNISA
|
||||
{
|
||||
void GetTargets(GraphicsAPI api, std::vector<std::string> &targets);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -498,6 +498,7 @@ public:
|
||||
const std::vector<EntryPoint> &GetEntries() { return entries; }
|
||||
const std::vector<Variable> &GetGlobals() { return globals; }
|
||||
Id GetIDType(Id id) { return idTypes[id]; }
|
||||
std::vector<uint32_t> GetSPIRV() const { return m_SPIRV; }
|
||||
protected:
|
||||
virtual void Parse(const std::vector<uint32_t> &spirvWords);
|
||||
|
||||
|
||||
@@ -112,17 +112,21 @@ void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patch
|
||||
{
|
||||
for(size_t i = 0; i < outsig.size(); i++)
|
||||
{
|
||||
if(outpatch[i].structID)
|
||||
if(outpatch[i].structID && it.opcode() == rdcspv::Op::MemberDecorate)
|
||||
{
|
||||
if(it.opcode() == rdcspv::Op::MemberDecorate && it.word(1) == outpatch[i].structID &&
|
||||
it.word(2) == outpatch[i].structMemberIndex)
|
||||
rdcspv::OpMemberDecorate decoded(it);
|
||||
|
||||
if(decoded.structureType == outpatch[i].structID &&
|
||||
decoded.member == outpatch[i].structMemberIndex)
|
||||
{
|
||||
editor.Remove(it);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(!outpatch[i].structID && it.opcode() == rdcspv::Op::Decorate)
|
||||
{
|
||||
if(it.opcode() == rdcspv::Op::Decorate && rdcspv::OpDecorate(it).target == outpatch[i].ID)
|
||||
rdcspv::OpDecorate decoded(it);
|
||||
|
||||
if(decoded.target == outpatch[i].ID)
|
||||
{
|
||||
editor.Remove(it);
|
||||
}
|
||||
@@ -160,15 +164,14 @@ void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patch
|
||||
}
|
||||
else if(outpatch[i].structID && !outpatch[i].accessChain.empty())
|
||||
{
|
||||
editor.AddDecoration(rdcspv::OpMemberDecorate(
|
||||
rdcspv::Id::fromWord(outpatch[i].structID), outpatch[i].structMemberIndex,
|
||||
rdcspv::DecorationParam<rdcspv::Decoration::Offset>(xfbStride)));
|
||||
editor.AddDecoration(
|
||||
rdcspv::OpMemberDecorate(outpatch[i].structID, outpatch[i].structMemberIndex,
|
||||
rdcspv::DecorationParam<rdcspv::Decoration::Offset>(xfbStride)));
|
||||
}
|
||||
else if(outpatch[i].ID)
|
||||
{
|
||||
editor.AddDecoration(
|
||||
rdcspv::OpDecorate(rdcspv::Id::fromWord(outpatch[i].ID),
|
||||
rdcspv::DecorationParam<rdcspv::Decoration::Offset>(xfbStride)));
|
||||
editor.AddDecoration(rdcspv::OpDecorate(
|
||||
outpatch[i].ID, rdcspv::DecorationParam<rdcspv::Decoration::Offset>(xfbStride)));
|
||||
}
|
||||
|
||||
uint32_t compByteSize = 4;
|
||||
@@ -179,19 +182,17 @@ void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patch
|
||||
xfbStride += outsig[i].compCount * compByteSize;
|
||||
}
|
||||
|
||||
std::set<uint32_t> vars;
|
||||
std::set<rdcspv::Id> vars;
|
||||
|
||||
for(size_t i = 0; i < outpatch.size(); i++)
|
||||
{
|
||||
if(outpatch[i].ID && !outpatch[i].isArraySubsequentElement &&
|
||||
vars.find(outpatch[i].ID) == vars.end())
|
||||
{
|
||||
editor.AddDecoration(
|
||||
rdcspv::OpDecorate(rdcspv::Id::fromWord(outpatch[i].ID),
|
||||
rdcspv::DecorationParam<rdcspv::Decoration::XfbBuffer>(0)));
|
||||
editor.AddDecoration(
|
||||
rdcspv::OpDecorate(rdcspv::Id::fromWord(outpatch[i].ID),
|
||||
rdcspv::DecorationParam<rdcspv::Decoration::XfbStride>(xfbStride)));
|
||||
editor.AddDecoration(rdcspv::OpDecorate(
|
||||
outpatch[i].ID, rdcspv::DecorationParam<rdcspv::Decoration::XfbBuffer>(0)));
|
||||
editor.AddDecoration(rdcspv::OpDecorate(
|
||||
outpatch[i].ID, rdcspv::DecorationParam<rdcspv::Decoration::XfbStride>(xfbStride)));
|
||||
vars.insert(outpatch[i].ID);
|
||||
}
|
||||
}
|
||||
@@ -1984,8 +1985,8 @@ void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stag
|
||||
|
||||
SPIRVPatchData::InterfaceAccess patch;
|
||||
patch.accessChain = parentPatch.accessChain;
|
||||
patch.ID = globalID.value();
|
||||
patch.structID = parentStructID.value();
|
||||
patch.ID = globalID;
|
||||
patch.structID = parentStructID;
|
||||
patch.isArraySubsequentElement = parentPatch.isArraySubsequentElement;
|
||||
if(parentStructID)
|
||||
patch.structMemberIndex = patch.accessChain.back();
|
||||
@@ -2130,7 +2131,6 @@ void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stag
|
||||
{
|
||||
// use an extra access chain to get each vector out of the matrix.
|
||||
patch.accessChain.push_back(0);
|
||||
patch.isMatrix = true;
|
||||
|
||||
for(uint32_t m = 0; m < varType->matrix().count; m++)
|
||||
{
|
||||
@@ -2153,7 +2153,6 @@ void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stag
|
||||
}
|
||||
|
||||
// pop the matrix column access chain
|
||||
patch.isMatrix = false;
|
||||
patch.accessChain.pop_back();
|
||||
}
|
||||
|
||||
@@ -2178,10 +2177,8 @@ void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stag
|
||||
TEST_CASE("Validate SPIR-V reflection", "[spirv][reflection]")
|
||||
{
|
||||
ShaderType type = ShaderType::eShaderVulkan;
|
||||
bool newRefl = false;
|
||||
auto compiler = [&type, &newRefl](ShaderStage stage, const std::string &source,
|
||||
const std::string &entryPoint, ShaderReflection &refl,
|
||||
ShaderBindpointMapping &mapping) {
|
||||
auto compiler = [&type](ShaderStage stage, const std::string &source, const std::string &entryPoint,
|
||||
ShaderReflection &refl, ShaderBindpointMapping &mapping) {
|
||||
|
||||
rdcspv::Init();
|
||||
RenderDoc::Inst().RegisterShutdownFunction(&rdcspv::Shutdown);
|
||||
@@ -2198,37 +2195,17 @@ TEST_CASE("Validate SPIR-V reflection", "[spirv][reflection]")
|
||||
|
||||
REQUIRE(!spirv.empty());
|
||||
|
||||
if(newRefl)
|
||||
{
|
||||
rdcspv::Reflector spv;
|
||||
spv.Parse(spirv);
|
||||
rdcspv::Reflector spv;
|
||||
spv.Parse(spirv);
|
||||
|
||||
SPIRVPatchData patchData;
|
||||
spv.MakeReflection(type == ShaderType::eShaderVulkan ? GraphicsAPI::Vulkan : GraphicsAPI::OpenGL,
|
||||
stage, entryPoint, {}, refl, mapping, patchData);
|
||||
}
|
||||
else
|
||||
{
|
||||
SPVModule spv;
|
||||
ParseSPIRV(spirv.data(), spirv.size(), spv);
|
||||
|
||||
SPIRVPatchData patchData;
|
||||
spv.MakeReflection(type == ShaderType::eShaderVulkan ? GraphicsAPI::Vulkan : GraphicsAPI::OpenGL,
|
||||
stage, entryPoint, refl, mapping, patchData);
|
||||
}
|
||||
SPIRVPatchData patchData;
|
||||
spv.MakeReflection(type == ShaderType::eShaderVulkan ? GraphicsAPI::Vulkan : GraphicsAPI::OpenGL,
|
||||
stage, entryPoint, {}, refl, mapping, patchData);
|
||||
};
|
||||
|
||||
// test both Vulkan and GL SPIR-V reflection
|
||||
SECTION("Old Vulkan GLSL reflection")
|
||||
SECTION("Vulkan GLSL reflection")
|
||||
{
|
||||
newRefl = false;
|
||||
type = ShaderType::eShaderVulkan;
|
||||
TestGLSLReflection(type, compiler);
|
||||
};
|
||||
|
||||
SECTION("New Vulkan GLSL reflection")
|
||||
{
|
||||
newRefl = true;
|
||||
type = ShaderType::eShaderVulkan;
|
||||
TestGLSLReflection(type, compiler);
|
||||
};
|
||||
@@ -2236,14 +2213,6 @@ TEST_CASE("Validate SPIR-V reflection", "[spirv][reflection]")
|
||||
SECTION("OpenGL GLSL reflection")
|
||||
{
|
||||
type = ShaderType::eShaderGLSPIRV;
|
||||
newRefl = false;
|
||||
TestGLSLReflection(type, compiler);
|
||||
};
|
||||
|
||||
SECTION("New OpenGL GLSL reflection")
|
||||
{
|
||||
type = ShaderType::eShaderGLSPIRV;
|
||||
newRefl = true;
|
||||
TestGLSLReflection(type, compiler);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#include <vector>
|
||||
#include "api/replay/renderdoc_replay.h"
|
||||
|
||||
struct SPVInstruction;
|
||||
#include "spirv_common.h"
|
||||
#include "spirv_processor.h"
|
||||
|
||||
enum class GraphicsAPI : uint32_t;
|
||||
enum class ShaderStage : uint32_t;
|
||||
@@ -42,10 +42,10 @@ struct SPIRVPatchData
|
||||
struct InterfaceAccess
|
||||
{
|
||||
// ID of the base variable
|
||||
uint32_t ID = 0;
|
||||
rdcspv::Id ID;
|
||||
|
||||
// ID of the struct parent of this variable
|
||||
uint32_t structID = 0;
|
||||
rdcspv::Id structID;
|
||||
|
||||
// member in the parent struct of this variable (for MemberDecorate)
|
||||
uint32_t structMemberIndex = 0;
|
||||
@@ -53,9 +53,6 @@ struct SPIRVPatchData
|
||||
// the access chain of indices
|
||||
std::vector<uint32_t> accessChain;
|
||||
|
||||
// is this input/output part of a matrix
|
||||
bool isMatrix = false;
|
||||
|
||||
// this is an element of an array that's been exploded after [0].
|
||||
// i.e. this is false for non-arrays, and false for element [0] in an array, then true for
|
||||
// elements [1], [2], [3], etc..
|
||||
@@ -71,65 +68,6 @@ struct SPIRVPatchData
|
||||
Topology outTopo = Topology::Unknown;
|
||||
};
|
||||
|
||||
#ifndef spirv_HPP
|
||||
namespace spv
|
||||
{
|
||||
using SourceLanguage = uint32_t;
|
||||
using Capability = uint32_t;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct SPVModule
|
||||
{
|
||||
SPVModule();
|
||||
~SPVModule();
|
||||
|
||||
std::vector<uint32_t> spirv;
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t major, minor;
|
||||
} moduleVersion;
|
||||
uint32_t generator;
|
||||
|
||||
spv::SourceLanguage sourceLang;
|
||||
uint32_t sourceVer;
|
||||
|
||||
std::string cmdline;
|
||||
std::vector<rdcpair<std::string, std::string>> sourceFiles;
|
||||
|
||||
std::vector<std::string> extensions;
|
||||
|
||||
std::vector<spv::Capability> capabilities;
|
||||
|
||||
std::vector<SPVInstruction *>
|
||||
operations; // all operations (including those that don't generate an ID)
|
||||
|
||||
std::vector<SPVInstruction *> ids; // pointers indexed by ID
|
||||
|
||||
std::vector<SPVInstruction *> sourceexts; // source extensions
|
||||
std::vector<SPVInstruction *> entries; // entry points
|
||||
std::vector<SPVInstruction *> globals; // global variables
|
||||
std::vector<SPVInstruction *> specConstants; // specialization constants
|
||||
std::vector<SPVInstruction *> funcs; // functions
|
||||
std::vector<SPVInstruction *> structs; // struct types
|
||||
|
||||
SPVInstruction *GetByID(uint32_t id);
|
||||
std::string Disassemble(const std::string &entryPoint);
|
||||
|
||||
std::vector<std::string> EntryPoints() const;
|
||||
ShaderStage StageForEntry(const std::string &entryPoint) const;
|
||||
|
||||
void MakeReflection(GraphicsAPI sourceAPI, ShaderStage stage, const std::string &entryPoint,
|
||||
ShaderReflection &reflection, ShaderBindpointMapping &mapping,
|
||||
SPIRVPatchData &patchData) const;
|
||||
};
|
||||
|
||||
static const uint32_t SpecializationConstantBindSet = 1234567;
|
||||
static const uint32_t PushConstantBindSet = 1234568;
|
||||
|
||||
void ParseSPIRV(uint32_t *spirv, size_t spirvLength, SPVModule &module);
|
||||
|
||||
struct SpecConstant
|
||||
{
|
||||
SpecConstant() = default;
|
||||
@@ -139,18 +77,6 @@ struct SpecConstant
|
||||
size_t dataSize = 0;
|
||||
};
|
||||
|
||||
void FillSpecConstantVariables(const rdcarray<ShaderConstant> &invars,
|
||||
rdcarray<ShaderVariable> &outvars,
|
||||
const std::vector<SpecConstant> &specInfo);
|
||||
|
||||
// common function used by any API that utilises SPIR-V
|
||||
void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patchData,
|
||||
const char *entryName, std::vector<uint32_t> &modSpirv, uint32_t &xfbStride);
|
||||
|
||||
// new reflection interface
|
||||
|
||||
#include "spirv_processor.h"
|
||||
|
||||
namespace rdcspv
|
||||
{
|
||||
struct SourceFile
|
||||
@@ -212,4 +138,15 @@ private:
|
||||
|
||||
rdcarray<MemberName> memberNames;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
static const uint32_t SpecializationConstantBindSet = 1234567;
|
||||
static const uint32_t PushConstantBindSet = 1234568;
|
||||
|
||||
void FillSpecConstantVariables(const rdcarray<ShaderConstant> &invars,
|
||||
rdcarray<ShaderVariable> &outvars,
|
||||
const std::vector<SpecConstant> &specInfo);
|
||||
|
||||
// common function used by any API that utilises SPIR-V
|
||||
void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patchData,
|
||||
const char *entryName, std::vector<uint32_t> &modSpirv, uint32_t &xfbStride);
|
||||
|
||||
@@ -702,7 +702,7 @@ void VulkanReplay::FetchShaderFeedback(uint32_t eventId)
|
||||
const VulkanCreationInfo::ShaderModule &moduleInfo =
|
||||
creationInfo.m_ShaderModule[pipeInfo.shaders[5].module];
|
||||
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.spirv;
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.GetSPIRV();
|
||||
|
||||
AnnotateShader(*pipeInfo.shaders[5].patchData, stage.pName, offsetMap, bufferAddress, modSpirv);
|
||||
|
||||
@@ -726,7 +726,7 @@ void VulkanReplay::FetchShaderFeedback(uint32_t eventId)
|
||||
const VulkanCreationInfo::ShaderModule &moduleInfo =
|
||||
creationInfo.m_ShaderModule[pipeInfo.shaders[idx].module];
|
||||
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.spirv;
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.GetSPIRV();
|
||||
|
||||
AnnotateShader(*pipeInfo.shaders[idx].patchData, stage.pName, offsetMap, bufferAddress,
|
||||
modSpirv);
|
||||
|
||||
@@ -1038,12 +1038,14 @@ void VulkanCreationInfo::ShaderModule::Init(VulkanResourceManager *resourceMan,
|
||||
else
|
||||
{
|
||||
RDCASSERT(pCreateInfo->codeSize % sizeof(uint32_t) == 0);
|
||||
ParseSPIRV((uint32_t *)pCreateInfo->pCode, pCreateInfo->codeSize / sizeof(uint32_t), spirv);
|
||||
spirv.Parse(std::vector<uint32_t>(
|
||||
(uint32_t *)(pCreateInfo->pCode),
|
||||
(uint32_t *)(pCreateInfo->pCode + pCreateInfo->codeSize / sizeof(uint32_t))));
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::ShaderModule::Reflection::Init(VulkanResourceManager *resourceMan,
|
||||
ResourceId id, const SPVModule &spv,
|
||||
ResourceId id, const rdcspv::Reflector &spv,
|
||||
const std::string &entry,
|
||||
VkShaderStageFlagBits stage)
|
||||
{
|
||||
@@ -1052,17 +1054,10 @@ void VulkanCreationInfo::ShaderModule::Reflection::Init(VulkanResourceManager *r
|
||||
entryPoint = entry;
|
||||
stageIndex = StageIndex(stage);
|
||||
|
||||
spv.MakeReflection(GraphicsAPI::Vulkan, ShaderStage(stageIndex), entryPoint, refl, mapping,
|
||||
spv.MakeReflection(GraphicsAPI::Vulkan, ShaderStage(stageIndex), entryPoint, {}, refl, mapping,
|
||||
patchData);
|
||||
|
||||
refl.resourceId = resourceMan->GetOriginalID(id);
|
||||
refl.entryPoint = entryPoint;
|
||||
|
||||
if(!spv.spirv.empty())
|
||||
{
|
||||
refl.encoding = ShaderEncoding::SPIRV;
|
||||
refl.rawBytes.assign((byte *)spv.spirv.data(), spv.spirv.size() * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@ struct VulkanCreationInfo
|
||||
void Init(VulkanResourceManager *resourceMan, VulkanCreationInfo &info,
|
||||
const VkShaderModuleCreateInfo *pCreateInfo);
|
||||
|
||||
SPVModule spirv;
|
||||
rdcspv::Reflector spirv;
|
||||
|
||||
std::string unstrippedPath;
|
||||
|
||||
@@ -482,7 +482,7 @@ struct VulkanCreationInfo
|
||||
ShaderBindpointMapping mapping;
|
||||
SPIRVPatchData patchData;
|
||||
|
||||
void Init(VulkanResourceManager *resourceMan, ResourceId id, const SPVModule &spv,
|
||||
void Init(VulkanResourceManager *resourceMan, ResourceId id, const rdcspv::Reflector &spv,
|
||||
const std::string &entry, VkShaderStageFlagBits stage);
|
||||
};
|
||||
std::map<std::string, Reflection> m_Reflections;
|
||||
|
||||
@@ -170,13 +170,9 @@ struct VulkanQuadOverdrawCallback : public VulkanDrawcallCallback
|
||||
|
||||
VkDevice dev = m_pDriver->GetDev();
|
||||
|
||||
vkr = ObjDisp(dev)->CreateShaderModule(Unwrap(dev), &modinfo, NULL, &module);
|
||||
vkr = m_pDriver->vkCreateShaderModule(dev, &modinfo, NULL, &module);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
m_pDriver->GetResourceManager()->WrapResource(Unwrap(dev), module);
|
||||
|
||||
m_pDriver->GetResourceManager()->AddLiveResource(GetResID(module), module);
|
||||
|
||||
bool found = false;
|
||||
for(uint32_t i = 0; i < pipeCreateInfo.stageCount; i++)
|
||||
{
|
||||
@@ -210,8 +206,7 @@ struct VulkanQuadOverdrawCallback : public VulkanDrawcallCallback
|
||||
&pipe.second);
|
||||
RDCASSERTEQUAL(vkr, VK_SUCCESS);
|
||||
|
||||
ObjDisp(dev)->DestroyShaderModule(Unwrap(dev), Unwrap(module), NULL);
|
||||
m_pDriver->GetResourceManager()->ReleaseWrappedResource(module);
|
||||
m_pDriver->vkDestroyShaderModule(dev, module, NULL);
|
||||
|
||||
pipe.first = descSet;
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
// constant for this index
|
||||
io.constID = editor.AddConstantImmediate(i);
|
||||
|
||||
io.variableID = rdcspv::Id::fromWord(patchData.outputs[i].ID);
|
||||
io.variableID = patchData.outputs[i].ID;
|
||||
|
||||
// base type - either a scalar or a vector, since matrix outputs are decayed to vectors
|
||||
{
|
||||
@@ -436,7 +436,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
// constant for this index
|
||||
io.constID = editor.AddConstantImmediate(i);
|
||||
|
||||
io.variableID = rdcspv::Id::fromWord(patchData.inputs[i].ID);
|
||||
io.variableID = patchData.inputs[i].ID;
|
||||
|
||||
rdcspv::Scalar scalarType = rdcspv::scalar<uint32_t>();
|
||||
|
||||
@@ -1082,7 +1082,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
}
|
||||
|
||||
ops.push_back(rdcspv::OpAccessChain(ins[i].privatePtrID, subElement,
|
||||
rdcspv::Id::fromWord(patchData.inputs[i].ID), chain));
|
||||
patchData.inputs[i].ID, chain));
|
||||
|
||||
ops.push_back(rdcspv::OpStore(subElement, result));
|
||||
}
|
||||
@@ -1103,8 +1103,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
{
|
||||
loaded = editor.MakeId();
|
||||
// type loaded = *globalvar;
|
||||
ops.push_back(rdcspv::OpLoad(outs[o].basetypeID, loaded,
|
||||
rdcspv::Id::fromWord(patchData.outputs[o].ID)));
|
||||
ops.push_back(rdcspv::OpLoad(outs[o].basetypeID, loaded, patchData.outputs[o].ID));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1123,8 +1122,8 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
}
|
||||
|
||||
// type *readPtr = globalvar.globalsub...;
|
||||
ops.push_back(rdcspv::OpAccessChain(
|
||||
outs[o].privatePtrID, readPtr, rdcspv::Id::fromWord(patchData.outputs[o].ID), chain));
|
||||
ops.push_back(
|
||||
rdcspv::OpAccessChain(outs[o].privatePtrID, readPtr, patchData.outputs[o].ID, chain));
|
||||
// type loaded = *readPtr;
|
||||
ops.push_back(rdcspv::OpLoad(outs[o].basetypeID, loaded, readPtr));
|
||||
}
|
||||
@@ -1870,7 +1869,7 @@ void VulkanReplay::FetchVSOut(uint32_t eventId)
|
||||
}
|
||||
|
||||
uint32_t bufStride = 0;
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.spirv;
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.GetSPIRV();
|
||||
|
||||
struct CompactedAttrBuffer
|
||||
{
|
||||
@@ -2698,7 +2697,7 @@ void VulkanReplay::FetchTessGSOut(uint32_t eventId)
|
||||
const VulkanCreationInfo::ShaderModule &moduleInfo =
|
||||
creationInfo.m_ShaderModule[pipeInfo.shaders[stageIndex].module];
|
||||
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.spirv;
|
||||
std::vector<uint32_t> modSpirv = moduleInfo.spirv.GetSPIRV();
|
||||
|
||||
uint32_t xfbStride = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user