mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Support push constants display in UI
This commit is contained in:
@@ -2466,8 +2466,12 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
|
||||
AddSignatureParameter(nm, inst->var->type, inst->decorations, *sigarray, isInput ? &mapping->InputAttributes : NULL);
|
||||
}
|
||||
else if(inst->var->storage == spv::StorageClassUniform || inst->var->storage == spv::StorageClassUniformConstant)
|
||||
else if(inst->var->storage == spv::StorageClassUniform ||
|
||||
inst->var->storage == spv::StorageClassUniformConstant ||
|
||||
inst->var->storage == spv::StorageClassPushConstant)
|
||||
{
|
||||
bool pushConst = (inst->var->storage == spv::StorageClassPushConstant);
|
||||
|
||||
SPVTypeData *type = inst->var->type;
|
||||
if(type->type == SPVTypeData::ePointer)
|
||||
type = type->baseType;
|
||||
@@ -2489,7 +2493,7 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
cblock.name = type->name;
|
||||
else
|
||||
cblock.name = StringFormat::Fmt("uniforms%u", inst->id);
|
||||
cblock.bufferBacked = true;
|
||||
cblock.bufferBacked = !pushConst;
|
||||
|
||||
BindpointMap bindmap = {0};
|
||||
// set can be implicitly 0, but the binding must be set explicitly.
|
||||
@@ -2528,8 +2532,8 @@ void SPVModule::MakeReflection(ShaderReflection *reflection, ShaderBindpointMapp
|
||||
}
|
||||
|
||||
// should never have elements that have no binding declared but
|
||||
// are used
|
||||
RDCASSERT(!bindmap.used || bindmap.bind >= 0);
|
||||
// are used, unless it's push constants (which is handled elsewhere)
|
||||
RDCASSERT(!bindmap.used || !cblock.bufferBacked || bindmap.bind >= 0);
|
||||
|
||||
cblocks.push_back(cblockpair(bindmap, cblock));
|
||||
}
|
||||
|
||||
@@ -3265,7 +3265,19 @@ void VulkanReplay::FillCBufferVariables(ResourceId shader, uint32_t cbufSlot, ve
|
||||
ConstantBlock &c = refl.ConstantBlocks[cbufSlot];
|
||||
|
||||
size_t zero = 0;
|
||||
FillCBufferVariables(c.variables, outvars, data, zero);
|
||||
|
||||
if(c.bufferBacked)
|
||||
{
|
||||
FillCBufferVariables(c.variables, outvars, data, zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
vector<byte> pushdata;
|
||||
pushdata.resize(sizeof(m_pDriver->m_PartialReplayData.state.pushconsts));
|
||||
memcpy(&pushdata[0], m_pDriver->m_PartialReplayData.state.pushconsts, pushdata.size());
|
||||
FillCBufferVariables(c.variables, outvars, pushdata, zero);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool VulkanReplay::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t mip, uint32_t sample, float *minval, float *maxval)
|
||||
|
||||
@@ -640,8 +640,8 @@ namespace renderdocui.Windows.PipelineState
|
||||
|
||||
var slotBinds = pipe.DescSets[bindMap.bindset].bindings[bindMap.bind].binds;
|
||||
|
||||
// consider it filled if any array element is filled
|
||||
bool filledSlot = false;
|
||||
// consider it filled if any array element is filled (or it's push constants)
|
||||
bool filledSlot = !b.bufferBacked;
|
||||
for (UInt32 idx = 0; idx < bindMap.arraySize; idx++)
|
||||
filledSlot |= slotBinds[idx].res != ResourceId.Null;
|
||||
|
||||
@@ -701,6 +701,18 @@ namespace renderdocui.Windows.PipelineState
|
||||
string sizestr = String.Format("{0} Variables, {1} bytes", numvars, length);
|
||||
string vecrange = String.Format("{0} - {1}", descriptorBind.offset, descriptorBind.offset + descriptorBind.size);
|
||||
|
||||
if (!b.bufferBacked)
|
||||
{
|
||||
setname = "";
|
||||
slotname = b.name;
|
||||
name = "Push constants";
|
||||
vecrange = "";
|
||||
sizestr = String.Format("{0} Variables", numvars);
|
||||
|
||||
// could maybe get range from ShaderVariable.reg if it's filled out
|
||||
// from SPIR-V side.
|
||||
}
|
||||
|
||||
var node = parentNodes.Add(new object[] { "", setname, slotname, name, vecrange, sizestr });
|
||||
|
||||
node.Image = global::renderdocui.Properties.Resources.action;
|
||||
|
||||
Reference in New Issue
Block a user