diff options
author | Kristian Høgsberg <[email protected]> | 2015-04-14 15:02:18 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-04-22 16:13:50 +0100 |
commit | ee63b31594a5919f93240fa209c0ffa74ec5b081 (patch) | |
tree | b258f59af6b43e1536447dc8c8f44ed2937bd0c3 | |
parent | 1ebb42a6b2c21673aeb7ba09327043d278b0fe78 (diff) |
i965: Rewrite ir_tex to ir_txl with lod 0 for vertex shaders
The ir_tex opcode turns into a sample or sample_c message, which will try to
compute derivatives to determine the lod. This produces garbage for
non-fragment shaders where the sample coordinates don't correspond to
subspans.
We fix this by rewriting the opcode from ir_tex to ir_txl and setting the
lod to 0.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89457
Cc: "10.5" <[email protected]>
Signed-off-by: Kristian Høgsberg <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
(cherry picked from commit 993a6288f72fa98932df7cdb6f64d9dd645e670d)
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 80488926d02..7613da094c0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1683,6 +1683,15 @@ fs_visitor::emit_texture_gen7(ir_texture_opcode op, fs_reg dst, offset_value.file != BAD_FILE && offset_value.file != IMM; bool coordinate_done = false; + /* The sampler can only meaningfully compute LOD for fragment shader + * messages. For all other stages, we change the opcode to ir_txl and + * hardcode the LOD to 0. + */ + if (stage != MESA_SHADER_FRAGMENT && op == ir_tex) { + op = ir_txl; + lod = fs_reg(0.0f); + } + /* Set up the LOD info */ switch (op) { case ir_tex: |