Skip to content

Commit

Permalink
RD DXIL Disassembly fix getival to work with Literal
Browse files Browse the repository at this point in the history
Inlined getival to get around template instantiation outside of the compilation unit
  • Loading branch information
Zorro666 committed May 16, 2024
1 parent c70c1a5 commit da5c1d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
16 changes: 15 additions & 1 deletion renderdoc/driver/shaders/dxil/dxil_bytecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,21 @@ rdcstr escapeString(const rdcstr &str);
rdcstr escapeStringIfNeeded(const rdcstr &name);

template <typename T>
bool getival(const Value *v, T &out);
bool getival(const Value *v, T &out)
{
if(const Constant *c = cast<Constant>(v))
{
out = T(c->getU64());
return true;
}
else if(const Literal *lit = cast<Literal>(v))
{
out = T(lit->literal);
return true;
}
out = T();
return false;
}

}; // namespace DXIL

Expand Down
17 changes: 0 additions & 17 deletions renderdoc/driver/shaders/dxil/dxil_disassemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,6 @@ bool isUndef(const Value *v)
return false;
}

template <typename T>
bool getival(const Value *v, T &out)
{
if(const Constant *c = cast<Constant>(v))
{
out = T(c->getU64());
return true;
}
else if(const Literal *lit = cast<Literal>(v))
{
out = T(c->getU64());
return true;
}
out = T();
return false;
}

static const char *shaderNames[] = {
"Pixel", "Vertex", "Geometry", "Hull", "Domain",
"Compute", "Library", "RayGeneration", "Intersection", "AnyHit",
Expand Down

0 comments on commit da5c1d4

Please sign in to comment.