diff options
author | Samuel Pitoiset <[email protected]> | 2016-06-13 17:13:28 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2016-06-13 20:12:48 +0200 |
commit | 7f257abc1bdd153b3981efffc3f201e1ea5fe843 (patch) | |
tree | 62c7db30d50cbba8e761f170d2f34369a9e4eb75 /src/gallium/drivers/nouveau | |
parent | 6e1b12c7881fe663cb500cb2f7374f4862bae179 (diff) |
nvc0/ir: clamp the UBO index for compute on Kepler
We already check that the address is not "too far", but we should also
clamp the UBO index in order to avoid looking at the wrong place in the
driver cb. This is a pretty rare situation though.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Cc: "12.0" <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp index cb822168d16..71013eb63b5 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp @@ -2183,7 +2183,15 @@ NVC0LoweringPass::handleLDST(Instruction *i) int8_t fileIndex = i->getSrc(0)->reg.fileIndex - 1; Value *ind = i->getIndirect(0, 1); - // TODO: clamp the offset to the maximum number of const buf. + if (ind) { + // Clamp the UBO index when an indirect access is used to avoid + // loading information from the wrong place in the driver cb. + ind = bld.mkOp2v(OP_MIN, TYPE_U32, ind, + bld.mkOp2v(OP_ADD, TYPE_U32, bld.getSSA(), + ind, bld.loadImm(NULL, fileIndex)), + bld.loadImm(NULL, 12)); + } + if (i->src(0).isIndirect(1)) { Value *offset = bld.loadImm(NULL, i->getSrc(0)->reg.data.offset + typeSizeof(i->sType)); Value *ptr = loadUboInfo64(ind, fileIndex * 16); |