mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 20:50:09 +01:00
nvc0/ir: fix indirect access for images
When the array doesn't start at 0 we need to account for su->tex.r. While we are at it, make sure to avoid out of bounds access by masking the index. This fixes GL45-CTS.shading_language_420pack.binding_image_array. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reported-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
cb9a51d1f6
commit
a7fad12931
1 changed files with 14 additions and 8 deletions
|
|
@ -1677,10 +1677,13 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)
|
|||
adjustCoordinatesMS(su);
|
||||
|
||||
if (su->tex.rIndirectSrc >= 0) {
|
||||
// FIXME: out of bounds
|
||||
assert(su->tex.r == 0);
|
||||
ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(),
|
||||
su->getIndirectR(), bld.mkImm(6));
|
||||
ind = su->getIndirectR();
|
||||
if (su->tex.r > 0) {
|
||||
ind = bld.mkOp2v(OP_ADD, TYPE_U32, bld.getSSA(), ind,
|
||||
bld.loadImm(NULL, su->tex.r));
|
||||
}
|
||||
ind = bld.mkOp2v(OP_AND, TYPE_U32, bld.getSSA(), ind, bld.mkImm(7));
|
||||
ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(), ind, bld.mkImm(6));
|
||||
}
|
||||
|
||||
// calculate clamped coordinates
|
||||
|
|
@ -2026,10 +2029,13 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)
|
|||
Value *ind = NULL;
|
||||
|
||||
if (su->tex.rIndirectSrc >= 0) {
|
||||
// FIXME: out of bounds
|
||||
assert(su->tex.r == 0);
|
||||
ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(),
|
||||
su->getIndirectR(), bld.mkImm(6));
|
||||
ind = su->getIndirectR();
|
||||
if (su->tex.r > 0) {
|
||||
ind = bld.mkOp2v(OP_ADD, TYPE_U32, bld.getSSA(), ind,
|
||||
bld.loadImm(NULL, su->tex.r));
|
||||
}
|
||||
ind = bld.mkOp2v(OP_AND, TYPE_U32, bld.getSSA(), ind, bld.mkImm(7));
|
||||
ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(), ind, bld.mkImm(6));
|
||||
}
|
||||
|
||||
// get surface coordinates
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue