History log of /external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
be7048477a2989bd11ab590c65ea1515f764a86c 14-Feb-2013 Eric Anholt <eric@anholt.net> i965/gen7: Set up all samplers even if samplers are sparsely used.

In GLSL, sampler indices are allocated contiguously from 0. But in the
case of ARB_fragment_program (and possibly fixed function), an app that
uses texture 0 and 2 will use sampler indices 0 and 2, so we were only
allocating space for samplers 0 and 1 and setting up sampler 0. We
would read garbage for sampler 2, resulting in flickering textures and
an angry simulator.

Fixes bad rendering in 0 A.D. and ETQW. This was fixed for pre-gen7 by
28f4be9eb91b12a2c6b1db6660cca71a98c486ec

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25201
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58680
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable branches.
(cherry picked from commit 5bb05c6e6d596d66c177e42a36128d2ca2e300aa)
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
85e8e9e000732908b259a7e2cbc1724a1be2d447 24-Aug-2012 Kenneth Graunke <kenneth@whitecape.org> i965: Use linker-assigned sampler IDs in instruction encoding.

When assigning uniform locations, the linker assigns each sampler
uniform a sequential numerical ID. gl_shader_program::SamplerUnits maps
these sampler variable IDs to the actual texture units they reference
(specified via glUniform1i).

Previously, we encoded this mapping in the SEND instruction encoding:
the "sampler" was the texture unit number, and the binding table index
was SURF_INDEX_TEXTURE(the texture unit number). This unfortunately
meant that whenever the application changed the value of a sampler
uniform, we had to recompile the shader to change the SEND instructions.

This was horrible for the game Cogs, which repeatedly switches between
using texture unit 0 and 1. It also made fragment shader precompiles
useless: we'd do the precompile at glLinkShader() time, before the
application called glUniform1i to set the sampler values. As soon as
it did that, we'd have to recompile, wasting time and space in the
program cache.

This patch encodes the SamplerUnits indirection in the binding table,
sampler state, and sampler default color tables. Instead of baking the
texture unit number into the shader, we bake in the sampler variable ID
assigned by the linker. Since those never change, we don't need to
recompile programs on uniform changes.

This does mean that the tables now depend on the linked shader program
being used for rendering, rather than simply representing all available
texture units. This could cause an increase in state emission.

Another plus is that the sampler state and sampler default color tables
are now compact: we only emit as many entries as there are sampler
uniforms, with no holes in the table since the new sampler IDs are
sequential. Previously we had to emit a full 16 entries every time,
since the tables tracked the state of all active texture units.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
2faa592e7f54ef21b799b61ffa50c6bc8039ddc1 24-Aug-2012 Kenneth Graunke <kenneth@whitecape.org> i965: Add a "sampler state index" parameter to update_sampler_state().

This represents the index into the sampler state table or sampler
default color table (the two are identical).

Right now, this is still the texture unit, but that will change shortly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
f510dd5d60401ee44512ba7ae4ded3b32b19f12d 22-Aug-2012 Kenneth Graunke <kenneth@whitecape.org> i965: Remove four and a half year old TODO comments about samplers.

I can't actually understand what these mean, and they seem to
essentially say "we should simplify things", which is a nice goal but
not very specific.

Presumably things got cleaned up at some point.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
a07cf3397e332388d3599c83e50ac45511972890 27-Mar-2012 Eric Anholt <eric@anholt.net> i965: Add support for sampling texture buffer objects on gen7+.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
32dfa6e5ef3d1fb703ec34942c55408be22e7ec3 28-Oct-2011 Kenneth Graunke <kenneth@whitecape.org> i965: Move and rename "wm sampler" fields to just "sampler".

brw_wm_samplers actually enables any active samplers regardless of what
pipeline stage is using them, so it doesn't make much sense for it to be
WM-specific. So, rename it to "brw_samplers."

To properly generalize it, move sampler_count and sampler_offset from
brw_context::wm to a new brw_context::sampler that can be shared without
looking strange.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
9a5f8a98ed9eebec89f151d2b6df08c423b6ef34 22-Oct-2011 Eric Anholt <eric@anholt.net> i965: Move sampler state to emit() time.

This is consumed by the WM unit, which is already at emit().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
76669381c0de6a49a1edd0b88fa1ae6b86f10b30 14-Oct-2011 Yuanhan Liu <yuanhan.liu@linux.intel.com> i965: setup address rounding enable bits

The patch(based on the reading of the emulator) came from while I was
trying to fix the oglc pbo texImage.1PBODefaults fail. This case
generates a texture with the width and height equal to window's width
and height respectively, then try to texture it on the whole window.
So, it's exactly one texel for one pixel. And, the min filter and mag
filter are GL_LINEAR. It runs with swrast OK, as expected. But it failed
with i965 driver.

Well, you can't tell the difference from the screen, as the error is
quite tiny. From my digging, it seems that there are some tiny error
happened while getting tex address. This will break the one texel for
one pixel rule in this case. Thus the linear result is taken, with tiny
error.

This patch would fix all oglc pbo subcase fail with the same issue on
both ILK, SNB and IVB.

v2: comments from Ian, make the address_round filed assignment consistent.
(the sampler is alread memset to 0 by the xxx_update_samper_state
caller, so need to assign 0 first)

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
9d4b98eb9eadecc17cd1cda0074b420a39e74647 17-Aug-2011 Eric Anholt <eric@anholt.net> i965/gen6+: Use non-normalized coordinates for GL_TEXTURE_RECTANGLE.

Improves performance of a GL_TEXTURE_RECTANGLE microbenchmark by 1.84%
+/- .15% (n=3)
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
d375df220fae47f38944c4832bcbd5f5d568884c 23-Jun-2011 Eric Anholt <eric@anholt.net> i965: Add a type argument to brw_state_batch().

I want to make brw_state_dump.c handle more than just the last
statechange, so I want to keep track of what's in the batch state. By
using AUB file numbering for most of these packets, this may be
reusable for aub dumping.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
b126a0c0cb30b1e2f2df1953fe14d8596d1cf4f7 02-Nov-2010 Eric Anholt <eric@anholt.net> i965: Add support for correct GL_CLAMP behavior by clamping coordinates.

This removes the stupid strict-conformance fallback code I broke when
adding ARB_sampler_objects.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36572
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
461e193971db4ac456be0d383e9aebf15868542a 17-May-2011 Kenneth Graunke <kenneth@whitecape.org> i965: Updated fixed-point sizes in Ivybridge SAMPLER_STATE.

Texture LOD Bias is now S4.8 instead of S4.6;
Min LOD, and Max LOD are now U4.8 instead of U4.6.

Fixes piglit test tex-miplevel-selection.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c
3f44043da37bcd0c481ceddf4f878ddb3419b763 29-Apr-2011 Kenneth Graunke <kenneth@whitecape.org> i965: Fix SAMPLER_STATE on Ivybridge.

Most of this code copied from brw_wm_sampler_state.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/mesa/drivers/dri/i965/gen7_sampler_state.c