Declare input attachments in shader reflection

* This avoids the need to communicate this information in the descriptor type.
  Since descriptors must match the shader in this area, it's easier to
  communicate this through shader reflection.
This commit is contained in:
baldurk
2024-03-11 14:03:49 +00:00
parent 13986a0da5
commit 1f803add1e
3 changed files with 7 additions and 1 deletions
+5 -1
View File
@@ -1243,7 +1243,7 @@ struct ShaderResource
{
return resType == o.resType && name == o.name && variableType == o.variableType &&
bindPoint == o.bindPoint && isTexture == o.isTexture && hasSampler == o.hasSampler &&
isReadOnly == o.isReadOnly;
isInputAttachment == o.isInputAttachment && isReadOnly == o.isReadOnly;
}
bool operator<(const ShaderResource &o) const
{
@@ -1259,6 +1259,8 @@ struct ShaderResource
return isTexture < o.isTexture;
if(!(hasSampler == o.hasSampler))
return hasSampler < o.hasSampler;
if(!(isInputAttachment == o.isInputAttachment))
return isInputAttachment < o.isInputAttachment;
if(!(isReadOnly == o.isReadOnly))
return isReadOnly < o.isReadOnly;
return false;
@@ -1285,6 +1287,8 @@ struct ShaderResource
bool isTexture;
DOCUMENT("``True`` if this texture resource has a sampler as well.");
bool hasSampler = false;
DOCUMENT("``True`` if this texture resource is a subpass input attachment.");
bool isInputAttachment = false;
DOCUMENT(R"(``True`` if this resource is available to the shader for reading only, otherwise it is
able to be read from and written to arbitrarily.
)");
@@ -1465,6 +1465,7 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
res.isTexture = res.resType != TextureType::Buffer;
res.isReadOnly = imageType.sampled != 2 || imageType.dim == rdcspv::Dim::SubpassData;
res.isInputAttachment = imageType.dim == rdcspv::Dim::SubpassData;
res.variableType.baseType = imageType.retType.Type();
+1
View File
@@ -223,6 +223,7 @@ void DoSerialise(SerialiserType &ser, ShaderResource &el)
SERIALISE_MEMBER(bindPoint);
SERIALISE_MEMBER(isTexture);
SERIALISE_MEMBER(hasSampler);
SERIALISE_MEMBER(isInputAttachment);
SERIALISE_MEMBER(isReadOnly);
SIZE_CHECK(112);