Allow reinterpreting formats of constant blocks that have bytes backing

* Even without a true buffer, as long as we have access to the bag of bytes and
  a non-opaque layout we can allow reinterpreting.
This commit is contained in:
baldurk committed 2022-07-25 10:08:59 +01:00
1 parent 5d51b524c6
commit a33eb5fcb1
4 files changed
+22 -12

No files matched your search

+5 -1
View File
@@ -1109,7 +1109,7 @@ struct ConstantBlock
{
return name == o.name && variables == o.variables && bindPoint == o.bindPoint &&
byteSize == o.byteSize && bufferBacked == o.bufferBacked &&
compileConstants == o.compileConstants;
inlineDataBytes == o.inlineDataBytes && compileConstants == o.compileConstants;
}
bool operator<(const ConstantBlock &o) const
{
@@ -1123,6 +1123,8 @@ struct ConstantBlock
return byteSize < o.byteSize;
if(!(bufferBacked == o.bufferBacked))
return bufferBacked < o.bufferBacked;
if(!(inlineDataBytes == o.inlineDataBytes))
return inlineDataBytes < o.inlineDataBytes;
if(!(compileConstants == o.compileConstants))
return compileConstants < o.compileConstants;
return false;
@@ -1145,6 +1147,8 @@ some other API-specific method, such as direct function calls or they may be com
specialisation constants.
)");
bool bufferBacked = true;
DOCUMENT("``True`` if this is backed by in-line data bytes rather than a specific buffer.");
bool inlineDataBytes = false;
DOCUMENT("``True`` if this is a virtual buffer listing compile-time specialisation constants.");
bool compileConstants = false;
};
@@ -1269,6 +1269,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
if(cblock.name.empty())
cblock.name = StringFormat::Fmt("uniforms%u", global.id.value());
cblock.bufferBacked = !pushConst;
cblock.inlineDataBytes = pushConst;
MakeConstantBlockVariables(effectiveStorage, *varType, 0, 0, cblock.variables,
pointerTypes, specInfo);
@@ -1319,6 +1320,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
{
specblock.name = "Specialization Constants";
specblock.bufferBacked = false;
specblock.inlineDataBytes = true;
specblock.compileConstants = true;
specblock.byteSize = 0;
@@ -1338,6 +1340,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
{
globalsblock.name = "$Globals";
globalsblock.bufferBacked = false;
globalsblock.inlineDataBytes = false;
globalsblock.byteSize = (uint32_t)globalsblock.variables.size();
globalsblock.bindPoint = (int)cblocks.size();