mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Process lifetime of Id params to GLSL ExtInsts
This commit is contained in:
@@ -218,6 +218,89 @@ public:
|
||||
const T &operator[](Id id) const { return (*this)[id.value()]; }
|
||||
};
|
||||
|
||||
struct IdOrWord
|
||||
{
|
||||
constexpr inline IdOrWord() : value(0) {}
|
||||
constexpr inline IdOrWord(uint32_t val) : value(val) {}
|
||||
inline IdOrWord(Id id) : value(id.value()) {}
|
||||
inline operator uint32_t() const { return value; }
|
||||
constexpr inline bool operator==(const IdOrWord o) const { return value == o.value; }
|
||||
constexpr inline bool operator!=(const IdOrWord o) const { return value != o.value; }
|
||||
constexpr inline bool operator<(const IdOrWord o) const { return value < o.value; }
|
||||
private:
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
// helper in the style of the auto-generated one for ext insts
|
||||
template <typename InstType>
|
||||
struct OpExtInstGeneric
|
||||
{
|
||||
OpExtInstGeneric(IdResultType resultType, IdResult result, Id set, InstType inst,
|
||||
const rdcarray<IdOrWord> ¶ms)
|
||||
: op(OpCode), wordCount(MinWordSize + (uint16_t)params.size())
|
||||
{
|
||||
this->resultType = resultType;
|
||||
this->result = result;
|
||||
this->set = set;
|
||||
this->inst = inst;
|
||||
this->params.resize(params.size());
|
||||
for(size_t i = 0; i < params.size(); i++)
|
||||
this->params[i] = params[i];
|
||||
}
|
||||
OpExtInstGeneric(const ConstIter &it)
|
||||
{
|
||||
this->op = OpCode;
|
||||
this->wordCount = (uint16_t)it.size();
|
||||
this->resultType = Id::fromWord(it.word(1));
|
||||
this->result = Id::fromWord(it.word(2));
|
||||
this->set = Id::fromWord(it.word(3));
|
||||
this->inst = InstType(it.word(4));
|
||||
this->params.reserve(it.size() - 5);
|
||||
for(size_t word = 5; word < it.size(); word++)
|
||||
this->params.push_back(it.word(word));
|
||||
}
|
||||
|
||||
operator Operation() const
|
||||
{
|
||||
rdcarray<uint32_t> words;
|
||||
words.push_back(resultType.value());
|
||||
words.push_back(result.value());
|
||||
words.push_back(set.value());
|
||||
words.push_back((uint32_t)inst);
|
||||
words.append(params);
|
||||
return Operation(OpCode, words);
|
||||
}
|
||||
|
||||
static constexpr Op OpCode = Op::ExtInst;
|
||||
static constexpr uint16_t MinWordSize = 4U;
|
||||
Op op;
|
||||
uint16_t wordCount;
|
||||
IdResultType resultType;
|
||||
IdResult result;
|
||||
Id set;
|
||||
InstType inst;
|
||||
rdcarray<uint32_t> params;
|
||||
};
|
||||
|
||||
struct OpExtInst : public OpExtInstGeneric<uint32_t>
|
||||
{
|
||||
OpExtInst(IdResultType resultType, IdResult result, Id set, uint32_t inst,
|
||||
const rdcarray<IdOrWord> ¶ms)
|
||||
: OpExtInstGeneric(resultType, result, set, inst, params)
|
||||
{
|
||||
}
|
||||
OpExtInst(const ConstIter &it) : OpExtInstGeneric(it) {}
|
||||
};
|
||||
struct OpGLSL450 : public OpExtInstGeneric<rdcspv::GLSLstd450>
|
||||
{
|
||||
OpGLSL450(IdResultType resultType, IdResult result, Id set, rdcspv::GLSLstd450 inst,
|
||||
const rdcarray<IdOrWord> ¶ms)
|
||||
: OpExtInstGeneric(resultType, result, set, inst, params)
|
||||
{
|
||||
}
|
||||
OpGLSL450(const ConstIter &it) : OpExtInstGeneric(it) {}
|
||||
};
|
||||
|
||||
}; // namespace rdcspv
|
||||
|
||||
static const uint32_t SpecializationConstantBindSet = 1234567;
|
||||
|
||||
@@ -1646,6 +1646,21 @@ void Debugger::RegisterOp(Iter it)
|
||||
idDeathOffset[id] = RDCMAX(it.offs() + 1, idDeathOffset[id]);
|
||||
});
|
||||
|
||||
if(opdata.op == Op::ExtInst)
|
||||
{
|
||||
OpExtInst extinst(it);
|
||||
|
||||
if(extSets[extinst.set] == "GLSL.std.450")
|
||||
{
|
||||
// all parameters to GLSL.std.450 are Ids, extend idDeathOffset appropriately
|
||||
for(const uint32_t param : extinst.params)
|
||||
{
|
||||
Id id = Id::fromWord(param);
|
||||
idDeathOffset[id] = RDCMAX(it.offs() + 1, idDeathOffset[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(opdata.op == Op::Line || opdata.op == Op::NoLine)
|
||||
{
|
||||
// ignore OpLine/OpNoLine
|
||||
|
||||
@@ -34,57 +34,6 @@ namespace rdcspv
|
||||
{
|
||||
class Editor;
|
||||
|
||||
struct IdOrWord
|
||||
{
|
||||
constexpr inline IdOrWord() : value(0) {}
|
||||
constexpr inline IdOrWord(uint32_t val) : value(val) {}
|
||||
inline IdOrWord(Id id) : value(id.value()) {}
|
||||
inline operator uint32_t() const { return value; }
|
||||
constexpr inline bool operator==(const IdOrWord o) const { return value == o.value; }
|
||||
constexpr inline bool operator!=(const IdOrWord o) const { return value != o.value; }
|
||||
constexpr inline bool operator<(const IdOrWord o) const { return value < o.value; }
|
||||
private:
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
// helper in the style of the auto-generated one for GLSL ext insts
|
||||
struct OpGLSL450
|
||||
{
|
||||
OpGLSL450(IdResultType resultType, IdResult result, Id glsl450, rdcspv::GLSLstd450 inst,
|
||||
const rdcarray<IdOrWord> ¶ms)
|
||||
: op(OpCode), wordCount(MinWordSize + (uint16_t)params.size())
|
||||
{
|
||||
this->resultType = resultType;
|
||||
this->result = result;
|
||||
this->glsl450 = glsl450;
|
||||
this->inst = inst;
|
||||
this->params.resize(params.size());
|
||||
for(size_t i = 0; i < params.size(); i++)
|
||||
this->params[i] = params[i];
|
||||
}
|
||||
|
||||
operator Operation() const
|
||||
{
|
||||
rdcarray<uint32_t> words;
|
||||
words.push_back(resultType.value());
|
||||
words.push_back(result.value());
|
||||
words.push_back(glsl450.value());
|
||||
words.push_back((uint32_t)inst);
|
||||
words.append(params);
|
||||
return Operation(OpCode, words);
|
||||
}
|
||||
|
||||
static constexpr Op OpCode = Op::ExtInst;
|
||||
static constexpr uint16_t MinWordSize = 4U;
|
||||
Op op;
|
||||
uint16_t wordCount;
|
||||
IdResultType resultType;
|
||||
IdResult result;
|
||||
Id glsl450;
|
||||
rdcspv::GLSLstd450 inst;
|
||||
rdcarray<uint32_t> params;
|
||||
};
|
||||
|
||||
struct OperationList : public rdcarray<Operation>
|
||||
{
|
||||
// add an operation and return its result id
|
||||
|
||||
Reference in New Issue
Block a user