Commit Graph

60361 Commits

Author SHA1 Message Date
Rob Clark c0766528ba freedreno/a3xx: support for hw binning pass
The binning pass sorts vertices into which bins/tiles they apply to.
The visibility information generated during the binning pass can be
used to speed up the rendering pass by filtering out vertices which
do not apply to the current tile.  See:

 https://github.com/freedreno/freedreno/wiki/Adreno-tiling#optimized-approach

This brings a significant fps boost.  A rough assortment of tests
(supertuxkart, etracer, tremulous, glmark2 'build' test, etc) seems
to yield a ~35-45% fps improvement.

For now, to be conservative, the binning pass is not enabled yet by
default.  To enable it use:

  FD_MESA_DEBUG=binning

So far I haven't found anything that breaks with binning enabled,
but I'd like a bit more testing before I enable it as default.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-01-08 16:30:18 -05:00
Rob Clark bfb44c24bc freedreno: be more clever about gmem usage
Only need to leave room for depth/stencil if it is actually used, etc.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-01-08 16:30:18 -05:00
Rob Clark 42c5e2a2ed freedreno: resync generated headers
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-01-08 16:30:18 -05:00
Chris Forbes 9e99735f30 i965: fold offset into coord for textureOffset(gsampler2DRect)
The hardware is broken with nonzero texel offsets and unnormalized
coordinates; instead of doing correct offsetting, we get garbage.

This just extends the existing workaround for ir_txf and
ir_tg4+gsampler2DRect to also consider ir_tex+gsampler2DRect.

Fixes broken rendering in 'tesseract' when 'mesa_texrectoffset_bug' is
not enabled; also fixes the new piglit test
'tests/spec/glsl-1.30/execution/fs-textureOffset-Rect'.

Has been broken ~forever; suggesting including this in only 10.0 because
the lowering pass doesn't exist in 9.2 or earlier so would require quite
a different patch.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Lee Salzman <lsalzman@gmail.com>
Cc: "10.0" <mesa-stable@lists.freedesktop.org>
2014-01-09 10:09:01 +13:00
Paul Berry 31ec2f8338 mesa: Remove _mesa_progshader_enum_to_string(), which is no longer used.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-08 07:32:14 -08:00
Paul Berry acfc58a7e5 glsl: Make more use of gl_shader_stage enum in ir_set_program_inouts.cpp.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-08 07:32:01 -08:00
Paul Berry 2adb9fea77 glsl: Make more use of gl_shader_stage enum in lower_clip_distance.cpp.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-08 07:31:58 -08:00
Paul Berry 80ee24823f glsl: Make more use of gl_shader_stage enum in link_varyings.cpp.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Also rename "shaderType" param of is_varying_var() to "stage".

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-08 07:31:55 -08:00
Paul Berry 9110078209 glsl: Change _mesa_glsl_parse_state ctor to use gl_shader_stage enum.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Also rename "target" param to "stage".

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-08 07:31:49 -08:00
Paul Berry e3b86f07da mesa: Use gl_shader::Stage instead of gl_shader::Type where possible.
This reduces confusion since gl_shader::Type is sometimes
GL_SHADER_PROGRAM_MESA but is more frequently
GL_SHADER_{VERTEX,GEOMETRY,FRAGMENT}.  It also has the advantage that
when switching on gl_shader::Stage, the compiler will alert if one of
the possible enum types is unhandled.  Finally, many functions in
src/glsl (especially those dealing with linking) already use
gl_shader_stage to represent pipeline stages; using gl_shader::Stage
in those functions avoids the need for a conversion.

Note: in the process I changed _mesa_write_shader_to_file() so that if
it encounters an unexpected shader stage, it will use a file suffix of
"????" rather than "geom".

Reviewed-by: Brian Paul <brianp@vmware.com>

v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects."

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-08 07:31:45 -08:00
Paul Berry 65511e5f22 mesa: Store gl_shader_stage enum in gl_shader objects.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-08 07:31:28 -08:00
Paul Berry 1722f5e73e mesa: Move declaration of gl_shader_stage earlier in mtypes.h.
Also move the related #define MESA_SHADER_STAGES.  This will allow
gl_shader_stage to be used in struct gl_shader.

Reviewed-by: Brian Paul <brianp@vmware.com>

v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects."

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-08 07:30:54 -08:00
Paul Berry 72a995d307 glsl: make _mesa_shader_stage_to_string() available to non-C++ code.
Reviewed-by: Brian Paul <brianp@vmware.com>

v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects."

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-08 07:30:48 -08:00
Paul Berry 665b8d7b6d mesa: Clean up nomenclature for pipeline stages.
Previously, we had an enum called gl_shader_type which represented
pipeline stages in the order they occur in the pipeline
(i.e. MESA_SHADER_VERTEX=0, MESA_SHADER_GEOMETRY=1, etc), and several
inconsistently named functions for converting between it and other
representations:

- _mesa_shader_type_to_string: gl_shader_type -> string
- _mesa_shader_type_to_index: GLenum (GL_*_SHADER) -> gl_shader_type
- _mesa_program_target_to_index: GLenum (GL_*_PROGRAM) -> gl_shader_type
- _mesa_shader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string

This patch tries to clean things up so that we use more consistent
terminology: the enum is now called gl_shader_stage (to emphasize that
it is in the order of pipeline stages), and the conversion functions are:

- _mesa_shader_stage_to_string: gl_shader_stage -> string
- _mesa_shader_enum_to_shader_stage: GLenum (GL_*_SHADER) -> gl_shader_stage
- _mesa_program_enum_to_shader_stage: GLenum (GL_*_PROGRAM) -> gl_shader_stage
- _mesa_progshader_enum_to_string: GLenum (GL_*_{SHADER,PROGRAM}) -> string

In addition, MESA_SHADER_TYPES has been renamed to MESA_SHADER_STAGES,
for consistency with the new name for the enum.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Also rename the "target" field of _mesa_glsl_parse_state and the
"target" parameter of _mesa_shader_stage_to_string to "stage".

Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-08 07:30:30 -08:00
José Fonseca eda21d2a30 llvmpipe: Fix the bottom_edge_rule adjustment for points.
The adjustment needs to be applied to the y coordinates and not the x
coordinates, just like the equivalent code for lines and triangles in
lp_setup_line.c and lp_setup_tri.c.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-08 12:18:17 +00:00
José Fonseca 37de6b0682 llvmpipe: Respect bottom_edge_rule when computing the rasterization bounding boxes.
This was inadvertently forgotten when replacing gl_rasterization_rules
with lower_left_origin and half_pixel_center (commit
2737abb44e).

This makes a difference when lower_left_origin != half_pixel_center, e.g,
D3D10.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-08 12:18:17 +00:00
Chia-I Wu 76edf44f9e ilo: enable HiZ
The support is still early.  Fast depth buffer clear is not enabled yet.

HiZ can be forced off with ILO_DEBUG=nohiz.
2014-01-08 18:11:36 +08:00
Chia-I Wu e7b4219e22 ilo: resolve Z/HiZ correctly
When the depth buffer is to be read, perform a Depth Buffer Resolve if it has
been rendered.  When the depth buffer is to be rendered, perform a HiZ Buffer
Resolve when the depth buffer is modified externally.
2014-01-08 18:11:35 +08:00
Chia-I Wu 77e3db464f ilo: add flags to texture slices
The flags are used to mark who (CPU, BLT, or RENDER) has accessed the resource
and how (READ or WRITE).
2014-01-08 18:11:35 +08:00
Chia-I Wu 846f70a6ef ilo: rename and add an accessor for texture slices
Rename ilo_texture::slice_offsets to ilo_texture::slices and add an accessor,
ilo_texture_get_slice().
2014-01-08 18:11:35 +08:00
Chia-I Wu 127fbc086b ilo: add HiZ op support to the pipelines
Add blitter functions to perform Depth Buffer Clear, Depth Buffer Resolve, and
Hierarchical Depth Buffer Resolve.  Those functions set ilo_blitter up and
pass it to the pipelines to emit the commands.
2014-01-08 18:11:35 +08:00
Chia-I Wu 546416d495 ilo: add support for HiZ allocation
Add tex_create_hiz() to create HiZ bo.  It is not really called yet.
2014-01-08 18:11:35 +08:00
Chia-I Wu e372819589 ilo: refactor separate stencil allocation
Move separate stencil allocation code to tex_create_separate_stencil to keep
tex_create sane.
2014-01-08 18:11:35 +08:00
Chia-I Wu 82676f5d34 ilo: assorted GPE fixes for HiZ
Allow HiZ op to be specified in 3DSTATE_WM.  Pass depth format directly in
gen7_emit_3DSTATE_SF.  Use tex->hiz.bo to determine if HiZ exists.  Fix
3DSTATE_SF for the case when there is no ilo_rasterizer_state.  Fix
3DSTATE_PS for the case when there is no ilo_shader_state.
2014-01-08 18:11:35 +08:00
Chia-I Wu 6642381e75 ilo: no layer offsetting on GEN7+
Even though the Ivy Bridge PRM lists some restrictions that require layer
offsetting as the Sandy Bridge PRM does, it seems they are actually lifted.
2014-01-08 18:11:34 +08:00
Chia-I Wu 011fde4bf2 ilo: offset to layers only when necessary
GEN6 has several requirements regarding the LOD/Depth/Width/Height of the
render targets and the depth buffer.  We used to offset to the layers in
question unconditionally to meet the requirements.  With this commit,
offseting is done only when the requirements are not met.
2014-01-08 18:11:34 +08:00
Chia-I Wu 0a2a221d01 ilo: allow ilo_zs_surface to skip layer offsetting
Make offset to layer optional in ilo_gpe_init_zs_surface.
2014-01-08 18:11:34 +08:00
Chia-I Wu 8d9f5d57e2 ilo: allow ilo_view_surface to skip layer offsetting
Make offset to layer optional in ilo_gpe_init_view_surface_for_texture.
render_cache_rw is always the same as is_rt and is replaced.
2014-01-08 18:11:34 +08:00
Tapani Pälli 0978a6966a i965/fs: do SEL optimization only when src type for MOV matches
Fixes a bug where then branch operates with ivec4 while else uses vec4.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72379

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-08 07:06:45 +02:00
Kenneth Graunke 847bc36a38 glsl: Optimize pow(2, x) --> exp2(x).
On Haswell, POW takes 24 cycles, while EXP2 only takes 14.  Plus, using
POW requires putting 2.0 in a register, while EXP2 doesn't.

I believe that EXP2 will be faster than POW on basically all GPUs, so
it makes sense to optimize it.

Looking at the savage2 subset of shader-db:
total instructions in shared programs: 113225 -> 113179 (-0.04%)
instructions in affected programs:     2139 -> 2093 (-2.15%)
instances of 'math pow':               795 -> 749 (-6.14%)
instances of 'math exp':               389 -> 435 (11.8%)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-07 12:54:57 -08:00
Kenneth Graunke 5e3fd6a9db glsl: Refactor is_zero/one/negative_one into an is_value() method.
This patch creates a new generic is_value() method, which checks if an
ir_constant has a particular value.  (For vectors, it must have the
single value repeated across all components.)

It then rewrites the is_zero/is_one/is_negative_one methods to use this
generic helper.  All three were basically identical except for the value
they checked for.  The other difference is that is_negative_one rejects
boolean types.  The new is_value function maintains this behavior, only
allowing boolean types when checking for 0 or 1.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-07 12:54:57 -08:00
Kenneth Graunke d6c1d66d3a glsl: Optimize pow(1.0, X) --> 1.0.
Surprisingly, this helps one vertex shader in 3DMMES.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-01-07 12:54:57 -08:00
Kenneth Graunke 05fbb021a6 mesa: Use get_local_param_pointer in glProgramLocalParameters4fvEXT().
Using the get_local_param_pointer helper ensures that the LocalParams
arrays have actually been allocated before attempting to use them.

glProgramLocalParameters4fvEXT needs to do a bit of extra checking,
but it can be simplified since the helper has already validated the
target.

Fixes crashes in programs that use Cg (for example, Awesomenauts,
Rocketbirds: Hardboiled Chicken, and Tiny and Big: Grandpa's Leftovers)
since commit e5885c119d
(mesa: Dynamically allocate the storage for program local parameters.)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73136
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Laurent Carlier <lordheavym@gmail.com>
2014-01-07 12:50:23 -08:00
José Fonseca 2d368b982a llvmpipe: Basic implementation of pipe_context::set_sample_mask.
We don't support MSAA (ie, number of samples is always one) therefore
sample_mask boils down to a synonym of the rasterizer_discard flag.

Also, this change makes setup actually use the value received in
lp_setup_set_rasterizer_discard instead of reaching out to llvmpipe
upper layers to re-fetch it.

Based on Si Chen's draft.

With this patch `wgf11multisample Coverage passes 100%` on the UMD
D3D10 state tracker.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Si Chen <sichen@vmware.com>
2014-01-07 16:04:42 +00:00
José Fonseca 95bf222603 cso_context: Fix cso_context::sample_mask initial value.
The initial value of cso_context::sample_mask_saved is irrelevant as it
will be overwritten with cso_context::sample_mask in
cso_save_sample_mask.  Therefore it is cso_context::sample_mask that
needs to be properly initialized.

This fixes regressions in blits and mipmap generation after adding
support for sample_mask to llvmpipe.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-01-07 16:04:42 +00:00
Si Chen 72c6d0e506 llvmpipe: Implement alpha_to_coverage for non-MSAA framebuffers.
Implement Alpha to Coverage by discarding a fragment alpha component is
less than 0.5.  This is a joint work of Jose and Si.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-01-07 16:04:42 +00:00
Andreas Fänger 2a0fb946e1 swrast: fix delayed texel buffer allocation regression for OpenMP
Commit 9119269ca1 moved the texel
buffer allocation to _swrast_texture_span(), however, when compiled
with OpenMP support this code already runs multi-threaded so a
critical section is required to prevent multiple allocations and
rendering errors.

Cc: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-07 08:03:49 -07:00
Dave Airlie aa4e2243a2 gallium/draw: remove double semicolon
code cleanup.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-07 18:52:46 +10:00
Brian Paul 8d1400fe12 glsl: rename min(), max() functions to fix MSVC build
Evidently, there's some other definition of "min" and "max" that
causes MSVC to choke on these function names.  Renaming to min2()
and max2() fixes things.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 16:57:49 -07:00
Kenneth Graunke f6b10544cd i965: Remove unused PIPE_CONTROL defines.
Both brw_defines.h and intel_reg.h defined PIPE_CONTROL fields, which
had similar names, but couldn't be used in the same way.  (One had
built-in shifts, and the other didn't...)

Delete the unused set to preserve sanity.

(Eric wrote an almost identical patch back in August, so I believe he
approves.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 15:45:42 -08:00
Vinson Lee f8432832a7 mesa: Remove GLXContextID typedef from glxext.h.
This patch fixes this build error with gcc <= 4.5 and clang <= 3.1.

  CC     clientattrib.lo
In file included from ../../include/GL/glx.h:333:0,
                 from glxclient.h:45,
                 from clientattrib.c:32:
../../include/GL/glxext.h:275:13: error: redefinition of typedef 'GLXContextID'
../../include/GL/glx.h:171:13: note: previous declaration of 'GLXContextID' was here

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70591
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:57:23 -08:00
Maxence Le Doré a44ca3595e docs/relnotes/10.1.html: report AMD_shader_trinary_minmax support
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:11 -08:00
Maxence Le Doré 1a9e8c23eb mesa: enable AMD_shader_trinary_minmax
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:10 -08:00
Maxence Le Doré eb5dc75601 glsl: implement mid3 built-in function
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:09 -08:00
Maxence Le Doré 73c7451587 glsl: implement max3 built-in function
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:08 -08:00
Maxence Le Doré ce46e14729 glsl: Implement min3 built-in function
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:08 -08:00
Maxence Le Doré 61c450fc81 glsl: add min() and max() functions to builder.cpp
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:07 -08:00
Maxence Le Doré cf70d2a7c0 glsl: add a shader_trinary_minmax predicate
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:06 -08:00
Maxence Le Doré ff50493bb3 glsl: Add extension tracking for AMD_shader_trinary_minmax
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-06 14:28:02 -08:00
Alexander von Gluck IV 61ef697afc haiku libGL: Move from gallium target to src/hgl
* The Haiku renderers need to link to libGL to function properly
  in all usage contexts. As mesa drivers build before gallium
  targets, we couldn't properly link the mesa swrast driver to
  the gallium libGL target for Haiku.
* This is likely better as it mimics how glx is laid out ensuring
  the Haiku libGL is better understood.
* All renderers properly link in libGL now.

Acked-by: Brian Paul <brianp@vmware.com>
2014-01-06 15:50:21 -06:00