Commit 3610ded5 by Chris Forbes

Adjust input attachment index when indexing into array of input descriptors

Bug: b/131171141 Test: dEQP-VK.renderpass* Change-Id: I22a443edeee705b24ccc3a838fbab5f333f5dd87 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/29730Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent f5c8936c
...@@ -714,7 +714,7 @@ namespace sw ...@@ -714,7 +714,7 @@ namespace sw
if (opcode == spv::OpAccessChain || opcode == spv::OpInBoundsAccessChain) if (opcode == spv::OpAccessChain || opcode == spv::OpInBoundsAccessChain)
{ {
Decorations dd{}; Decorations dd{};
ApplyDecorationsForAccessChain(&dd, pointerId, insn.wordCount() - 4, insn.wordPointer(4)); ApplyDecorationsForAccessChain(&dd, &descriptorDecorations[resultId], pointerId, insn.wordCount() - 4, insn.wordPointer(4));
// Note: offset is the one thing that does *not* propagate, as the access chain accounts for it. // Note: offset is the one thing that does *not* propagate, as the access chain accounts for it.
dd.HasOffset = false; dd.HasOffset = false;
decorations[resultId].Apply(dd); decorations[resultId].Apply(dd);
...@@ -1343,7 +1343,7 @@ namespace sw ...@@ -1343,7 +1343,7 @@ namespace sw
} }
} }
void SpirvShader::ApplyDecorationsForAccessChain(Decorations *d, Object::ID baseId, uint32_t numIndexes, uint32_t const *indexIds) const void SpirvShader::ApplyDecorationsForAccessChain(Decorations *d, DescriptorDecorations *dd, Object::ID baseId, uint32_t numIndexes, uint32_t const *indexIds) const
{ {
ApplyDecorationsForId(d, baseId); ApplyDecorationsForId(d, baseId);
auto &baseObject = getObject(baseId); auto &baseObject = getObject(baseId);
...@@ -1365,6 +1365,12 @@ namespace sw ...@@ -1365,6 +1365,12 @@ namespace sw
} }
case spv::OpTypeArray: case spv::OpTypeArray:
case spv::OpTypeRuntimeArray: case spv::OpTypeRuntimeArray:
if (dd->InputAttachmentIndex >= 0)
{
dd->InputAttachmentIndex += GetConstantInt(indexIds[i]);
}
typeId = type.element;
break;
case spv::OpTypeVector: case spv::OpTypeVector:
typeId = type.element; typeId = type.element;
break; break;
......
...@@ -656,7 +656,7 @@ namespace sw ...@@ -656,7 +656,7 @@ namespace sw
uint32_t ComputeTypeSize(InsnIterator insn); uint32_t ComputeTypeSize(InsnIterator insn);
void ApplyDecorationsForId(Decorations *d, TypeOrObjectID id) const; void ApplyDecorationsForId(Decorations *d, TypeOrObjectID id) const;
void ApplyDecorationsForIdMember(Decorations *d, Type::ID id, uint32_t member) const; void ApplyDecorationsForIdMember(Decorations *d, Type::ID id, uint32_t member) const;
void ApplyDecorationsForAccessChain(Decorations *d, Object::ID baseId, uint32_t numIndexes, uint32_t const *indexIds) const; void ApplyDecorationsForAccessChain(Decorations *d, DescriptorDecorations *dd, Object::ID baseId, uint32_t numIndexes, uint32_t const *indexIds) const;
// Creates an Object for the instruction's result in 'defs'. // Creates an Object for the instruction's result in 'defs'.
void DefineResult(const InsnIterator &insn); void DefineResult(const InsnIterator &insn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment