mesa.git
8 years agoi965: Unwrap some lines.
Matt Turner [Mon, 26 Oct 2015 11:04:16 +0000 (04:04 -0700)]
i965: Unwrap some lines.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/vec4: Remove swizzle/writemask fields from src/dst_reg.
Matt Turner [Mon, 26 Oct 2015 04:14:56 +0000 (21:14 -0700)]
i965/vec4: Remove swizzle/writemask fields from src/dst_reg.

Also allows us to handle HW_REGs in the swizzle() and writemask()
functions.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Remove fixed_hw_reg field from backend_reg.
Matt Turner [Sat, 24 Oct 2015 22:29:03 +0000 (15:29 -0700)]
i965: Remove fixed_hw_reg field from backend_reg.

Since backend_reg now inherits brw_reg, we can use it in place of the
fixed_hw_reg field.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Use immediate storage in inherited brw_reg.
Matt Turner [Sat, 24 Oct 2015 21:55:57 +0000 (14:55 -0700)]
i965: Use immediate storage in inherited brw_reg.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add and use enum brw_reg_file.
Matt Turner [Fri, 23 Oct 2015 20:11:44 +0000 (13:11 -0700)]
i965: Add and use enum brw_reg_file.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Reorganize brw_reg fields.
Matt Turner [Fri, 23 Oct 2015 19:17:03 +0000 (12:17 -0700)]
i965: Reorganize brw_reg fields.

Put fields that are meaningless with an immediate in the same storage
with the immediate. This leaves fields type, file, nr, subnr in the
first dword where there's now extra room for expansion.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Make 'dw1' and 'bits' unnamed structures in brw_reg.
Matt Turner [Fri, 23 Oct 2015 02:41:30 +0000 (19:41 -0700)]
i965: Make 'dw1' and 'bits' unnamed structures in brw_reg.

Generated by

   sed -i -e 's/\.bits\././g' *.c *.h *.cpp
   sed -i -e 's/dw1\.//g' *.c *.h *.cpp

and then reverting changes to comments in gen7_blorp.cpp and
brw_fs_generator.cpp.

There wasn't any utility offered by forcing the programmer to list these
to access their fields. Removing them will reduce churn in future
commits.

This is C11 (and gcc has apparently supported it for sometime
"compatibility with other compilers")

See https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Delete type field from backend_reg.
Matt Turner [Sat, 24 Oct 2015 22:04:23 +0000 (15:04 -0700)]
i965: Delete type field from backend_reg.

Switching from an implicitly-sized type field to field with an explicit
bit width is safe because we have fewer than 2^4 types, and gcc will
warn if you attempt to set a value that will not fit.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Delete abs/negate fields from backend_reg.
Matt Turner [Sat, 24 Oct 2015 21:35:33 +0000 (14:35 -0700)]
i965: Delete abs/negate fields from backend_reg.

Instead use the ones provided by brw_reg. Also allows us to handle
HW_REGs in the negate() functions.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Make backend_reg inherit from brw_reg.
Matt Turner [Sat, 24 Oct 2015 21:32:03 +0000 (14:32 -0700)]
i965: Make backend_reg inherit from brw_reg.

Some fields (file, type, abs, negate) in brw_reg are shadowed by
backend_reg.

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Replace nested ternary with if ladder.
Matt Turner [Fri, 13 Nov 2015 00:02:22 +0000 (16:02 -0800)]
i965/fs: Replace nested ternary with if ladder.

Since the types of the expression were

   bool ? src_reg : (bool ? brw_reg : brw_reg)

the result of the second (nested) ternary would be implicitly
converted to a src_reg by the src_reg(struct brw_reg) constructor. I.e.,

   bool ? src_reg : src_reg(bool ? brw_reg : brw_reg)

In the next patch, I make backend_reg (the parent of src_reg) inherit
from brw_reg, which changes this expression to return brw_reg, which
throws away any fields that exist in the classes derived from brw_reg.
I.e.,

   src_reg(bool ? brw_reg(src_reg) : bool ? brw_reg : brw_reg)

Generally this code was gross, and wasn't actually shorter or easier to
read than an if ladder.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoradeonsi: remove dead code after ES-GS linkage change
Marek Olšák [Thu, 15 Oct 2015 21:41:35 +0000 (23:41 +0200)]
radeonsi: remove dead code after ES-GS linkage change

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: link ES-GS just like LS-HS
Marek Olšák [Thu, 15 Oct 2015 21:29:00 +0000 (23:29 +0200)]
radeonsi: link ES-GS just like LS-HS

This reduces the shader key for ES.

Use a fixed attrib location based on (semantic name,  index).

The ESGS item size is determined by the physical index of the highest ES
output, so it's almost always larger than before, but I think that
shouldn't matter as long as the ESGS ring buffer is large enough.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agoradeonsi: calculate optimal GS ring sizes to fix GS hangs on Tonga
Marek Olšák [Sun, 8 Nov 2015 12:34:44 +0000 (13:34 +0100)]
radeonsi: calculate optimal GS ring sizes to fix GS hangs on Tonga

I discovered that increasing the ESGS ring size fixes GS hangs on Tonga,
so let's do it properly.

There is now a separate init_config_gs_rings state that is not immutable,
because GS rings are resized when needed.

This also saves some memory. Most apps won't need more than 1MB
per ring per shader engine.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: rename si_update_gs_rings
Marek Olšák [Sun, 8 Nov 2015 11:15:54 +0000 (12:15 +0100)]
radeonsi: rename si_update_gs_rings

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: calculate ESGS_RING_ITEMSIZE in create_shader
Marek Olšák [Sun, 8 Nov 2015 11:12:46 +0000 (12:12 +0100)]
radeonsi: calculate ESGS_RING_ITEMSIZE in create_shader

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: move maximum gs stream calculation into create_shader
Marek Olšák [Sun, 8 Nov 2015 11:05:39 +0000 (12:05 +0100)]
radeonsi: move maximum gs stream calculation into create_shader

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: clean up small duplication in si_shader_gs
Marek Olšák [Sun, 8 Nov 2015 10:49:33 +0000 (11:49 +0100)]
radeonsi: clean up small duplication in si_shader_gs

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: shorten render_cond variable names
Marek Olšák [Sat, 7 Nov 2015 15:30:01 +0000 (16:30 +0100)]
gallium/radeon: shorten render_cond variable names

and ..._cond -> ..._invert

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove predicate_drawing flag
Marek Olšák [Sat, 7 Nov 2015 15:24:47 +0000 (16:24 +0100)]
gallium/radeon: remove predicate_drawing flag

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: atomize render condition (SET_PREDICATION)
Marek Olšák [Sat, 7 Nov 2015 14:39:39 +0000 (15:39 +0100)]
gallium/radeon: atomize render condition (SET_PREDICATION)

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: simplify restoring render condition after flush
Marek Olšák [Sat, 7 Nov 2015 14:00:55 +0000 (15:00 +0100)]
gallium/radeon: simplify restoring render condition after flush

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: don't use PREDICATION_OP_CLEAR
Marek Olšák [Sat, 7 Nov 2015 13:55:23 +0000 (14:55 +0100)]
gallium/radeon: don't use PREDICATION_OP_CLEAR

Not setting the predication bit is sufficient.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: simplify disabling render condition for u_blitter
Marek Olšák [Sat, 7 Nov 2015 13:45:58 +0000 (14:45 +0100)]
gallium/radeon: simplify disabling render condition for u_blitter

just disable it by not setting the predication bit

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: don't set predication on non-draw packets
Marek Olšák [Sat, 7 Nov 2015 13:36:38 +0000 (14:36 +0100)]
r600g: don't set predication on non-draw packets

This has no effect.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: inline the r600_rings structure
Marek Olšák [Sat, 7 Nov 2015 13:00:30 +0000 (14:00 +0100)]
gallium/radeon: inline the r600_rings structure

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: prevent recursion in si_context_gfx_flush
Marek Olšák [Sat, 7 Nov 2015 11:22:56 +0000 (12:22 +0100)]
radeonsi: prevent recursion in si_context_gfx_flush

The recursion can only occur if you modify need_cs_space to always flush.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: remove the IB flushing flag
Marek Olšák [Sat, 7 Nov 2015 12:43:18 +0000 (13:43 +0100)]
gallium/radeon: remove the IB flushing flag

Not needed anymore. A similar flag will be introduced in the next commit,
which will be private in radeonsi.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: move GFX/DMA flushing from add_to_buffer_list to need_cs_space
Marek Olšák [Sat, 7 Nov 2015 12:31:03 +0000 (13:31 +0100)]
gallium/radeon: move GFX/DMA flushing from add_to_buffer_list to need_cs_space

need_cs_space isn't invoked so often and is called before all commands too.
This is a lot cleaner. The code in radeon_add_to_buffer_list always seemed
dodgy to me.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: rename cache flushing flags once more
Marek Olšák [Fri, 6 Nov 2015 20:11:16 +0000 (21:11 +0100)]
radeonsi: rename cache flushing flags once more

KCACHE, TC L1 and TC L2 are renamed to:
- SMEM L1
- VMEM L1
- GLOBAL L2

You can easily tell what they are used for now.
Shaders must deal with coherency issues between both L1s manually,
e.g. by setting GLC=1 or by using s_dcache_*.

BOTH_ICACHE_KCACHE was an unused definition.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: set the DISABLE_WR_CONFIRM flag on CI-VI as well
Marek Olšák [Sat, 7 Nov 2015 11:07:31 +0000 (12:07 +0100)]
radeonsi: set the DISABLE_WR_CONFIRM flag on CI-VI as well

I missed this in commit c3e527f93d4281ad6e2ca165eaf6ff588e4faefa
    radeonsi: only enable write confirmation on the last CP DMA packet

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: initialize SX_PS_DOWNCONVERT to 0 on Stoney
Marek Olšák [Thu, 5 Nov 2015 22:56:38 +0000 (23:56 +0100)]
radeonsi: initialize SX_PS_DOWNCONVERT to 0 on Stoney

otherwise the SX or CB blocks can go bananas

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoradeonsi: add glClearBufferSubData acceleration
Marek Olšák [Tue, 3 Nov 2015 18:35:46 +0000 (19:35 +0100)]
radeonsi: add glClearBufferSubData acceleration

8-bit and 16-bit clears which are not aligned to dwords are done in software.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: add SI_SAVE_FRAGMENT_STATE blitter flag
Marek Olšák [Fri, 6 Nov 2015 22:16:11 +0000 (23:16 +0100)]
radeonsi: add SI_SAVE_FRAGMENT_STATE blitter flag

Buffer clears via transform feedback won't set this.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/u_blitter: add support for multi-dword clear values in clear_buffer
Marek Olšák [Fri, 6 Nov 2015 22:41:15 +0000 (23:41 +0100)]
gallium/u_blitter: add support for multi-dword clear values in clear_buffer

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: fix a future crash in emit_cb_target_mask
Marek Olšák [Fri, 6 Nov 2015 22:42:49 +0000 (23:42 +0100)]
radeonsi: fix a future crash in emit_cb_target_mask

This can't crash currently, but it would crash if clear_buffer
from u_blitter were used with a clean context.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: fix unaligned clear_buffer fallback
Marek Olšák [Fri, 6 Nov 2015 22:06:47 +0000 (23:06 +0100)]
radeonsi: fix unaligned clear_buffer fallback

This is unreachable currently, but it will be used by unaligned 8-bit and
16-bit fills.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: fix clear_buffer fallback with offset != 0
Marek Olšák [Thu, 5 Nov 2015 11:24:20 +0000 (12:24 +0100)]
r600g: fix clear_buffer fallback with offset != 0

Discovered by luck. This code path hasn't been exercised since transform
feedback was implemented.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: fix PIPE_QUERY_GPU_FINISHED
Marek Olšák [Sat, 7 Nov 2015 18:31:55 +0000 (19:31 +0100)]
gallium/radeon: fix PIPE_QUERY_GPU_FINISHED

Broken by the addition of r600_multi_fence
in 3b37155a68acc351cba86a1fa142bd0de2192d4c

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

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agomesa: minor comment fix in blend.c
Brian Paul [Fri, 13 Nov 2015 15:02:05 +0000 (08:02 -0700)]
mesa: minor comment fix in blend.c

8 years agodocs: add link to Coverity on developer utilities page
Brian Paul [Fri, 13 Nov 2015 15:01:29 +0000 (08:01 -0700)]
docs: add link to Coverity on developer utilities page

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agodocs: update VMware driver instructions
Brian Paul [Fri, 13 Nov 2015 14:59:42 +0000 (07:59 -0700)]
docs: update VMware driver instructions

Use a LIBDIR variable, set per-platform.
Update the Mesa configuration flags.
Run update-initramfs or dracut, update /etc/modules

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agoegl/wayland: Ignore rects from SwapBuffersWithDamage
Daniel Stone [Sat, 7 Nov 2015 18:25:31 +0000 (18:25 +0000)]
egl/wayland: Ignore rects from SwapBuffersWithDamage

eglSwapBuffersWithDamage accepts damage-region rectangles to hint the
compositor that it only needs to redraw certain areas, which was passed
through the wl_surface_damage request, as designed.

Wayland also offers a buffer transformation interface, e.g. to allow
users to render pre-rotated buffers. Unfortunately, there is no way to
query buffer transforms, and the damage region was provided in surface,
rather than buffer, co-ordinate space.

Users could in theory account for this themselves, but EGL also requires
co-ordinates to be passed in GL/mathematical co-ordinate space, with an
inversion to Wayland's natural/scanout co-ordinate space, so
transformations other than a 180-degree rotation will fail as EGL
attempts to subtract the region from (its view of the) surface height.

Pending creation and acceptance of a wl_surface.buffer_damage request,
which will accept co-ordinates in buffer co-ordinate space, pessimise to
always sending full-surface damage.

bce64c6c provides the explanation for why we send maximum-range damage,
rather than the full size of the surface: in the presence of buffer
transformations, full-surface damage may not actually cover the entire
surface.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoRevert "nir/copy_propagate: do not copy-propagate MOV srcs with source modifiers"
Iago Toral Quiroga [Fri, 13 Nov 2015 07:51:06 +0000 (08:51 +0100)]
Revert "nir/copy_propagate: do not copy-propagate MOV srcs with source modifiers"

The change proposed in the review leads to piglit regressions because
is_move() is used in other places and relies on the checks for source
modifiers to be there.

Revert this until we agree on a better solution.

8 years agoglsl: fix 'shared' layout qualifier related regressions
Samuel Iglesias Gonsálvez [Thu, 12 Nov 2015 15:14:07 +0000 (16:14 +0100)]
glsl: fix 'shared' layout qualifier related regressions

Commit 8b28b35 added 'shared' as a keyword for compute shaders
but it broke the existing 'shared' layout qualifier support for
uniform and shader storage blocks.

This patch fixes 578 dEQP-GLES31.functional.ssbo.* tests.

v2:
- Move SHARED to interface_block_layout_qualifier (Timothy)
- Don't remove "shared" case insensitive check (Timothy)
- Remove the clearing of shared_storage flag (Timothy)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonir/copy_propagate: do not copy-propagate MOV srcs with source modifiers
Iago Toral Quiroga [Fri, 6 Nov 2015 11:08:49 +0000 (12:08 +0100)]
nir/copy_propagate: do not copy-propagate MOV srcs with source modifiers

If a source operand in a MOV has source modifiers, then we cannot
copy-propagate it from the parent instruction and remove the MOV.

v2: remove the check for source source modifiers from is_move() (Jason)

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agonir/vars_to_ssa: Delete dead output set code
Jason Ekstrand [Fri, 13 Nov 2015 05:52:37 +0000 (21:52 -0800)]
nir/vars_to_ssa: Delete dead output set code

This was a remnant of an early attempt to handle output reads in
vars_to_ssa.  That attempt was abandon a long time ago but these few lines
were aparently left in the pass and managed to evade review.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir/vars_to_ssa: Rework copy set handling in lower_copies_to_load_store
Jason Ekstrand [Fri, 13 Nov 2015 02:10:22 +0000 (18:10 -0800)]
nir/vars_to_ssa: Rework copy set handling in lower_copies_to_load_store

Previously, we walked through a given deref_node's copies and, after
lowering the copy away, removed it from both the source and destination
copy sets.  This commit changes this to only remove it from the other
node's copy set (not the one we're lowering).  At the end of the loop, we
just throw away the copy set for the node we're lowering since that node no
longer has any copies.  This has two advantages:

 1) It's more efficient because we're doing potentially half as many set
    search operations.

 2) It now properly handles copies from a node to itself.  Perviously, it
    would delete the copy from the set when processing the destinatioon and
    then assert-fail when we couldn't find it for the source.

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92588
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir/validate: Allow subroutine types for the tails of derefs
Jason Ekstrand [Tue, 10 Nov 2015 22:13:47 +0000 (14:13 -0800)]
nir/validate: Allow subroutine types for the tails of derefs

The shader-subroutine code creates uniforms of type SUBROUTINE for
subroutines that are then read as integers in the backends.  If we ever
want to do any optimizations on these, we'll need to come up with a better
plan where they are actual scalars or something, but this works for now.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92859
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agomesa: Replace gl_extensions::EXT_texture3D with ::dummy_true
Nanley Chery [Fri, 16 Oct 2015 17:14:39 +0000 (10:14 -0700)]
mesa: Replace gl_extensions::EXT_texture3D with ::dummy_true

Mesa unconditionally sets this driver flag to true in
_mesa_init_extensions(). There is therefore no need for
the driver to communicate support for this extension.
Replace the driver capability flag with ::dummy_true.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa: fix MSVC build break in extensions.h
Brian Paul [Thu, 12 Nov 2015 22:59:21 +0000 (15:59 -0700)]
mesa: fix MSVC build break in extensions.h

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agonvc0/ir: add support for TGSI_SEMANTIC_HELPER_INVOCATION
Ilia Mirkin [Mon, 14 Sep 2015 20:23:29 +0000 (16:23 -0400)]
nvc0/ir: add support for TGSI_SEMANTIC_HELPER_INVOCATION

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogallium: add support for gl_HelperInvocation semantic
Ilia Mirkin [Mon, 14 Sep 2015 20:23:04 +0000 (16:23 -0400)]
gallium: add support for gl_HelperInvocation semantic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
8 years agoglsl: add gl_HelperInvocation system value
Ilia Mirkin [Mon, 14 Sep 2015 20:13:43 +0000 (16:13 -0400)]
glsl: add gl_HelperInvocation system value

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Correctly handle vector extract on function parameter
Jordan Justen [Thu, 12 Nov 2015 06:02:06 +0000 (22:02 -0800)]
glsl: Correctly handle vector extract on function parameter

This commit accidentally used a '==' when '=' was intended.

commit 96b22fb080894ba1840af2372f28a46cc0f40c76
Author: Kristian Høgsberg Kristensen <krh@bitplanet.net>
Date:   Wed Nov 4 14:58:54 2015 -0800

    glsl: Use array deref for access to vector components

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
8 years agomesa: In helpers, only check driver capability for meta
Nanley Chery [Thu, 15 Oct 2015 19:34:43 +0000 (12:34 -0700)]
mesa: In helpers, only check driver capability for meta

Make API context and version checks done by the helper functions pass
unconditionally while meta is in progress. This transparently makes
extension checks solely dependent on struct gl_extensions while in meta.

v2: Use an 8-bit data type instead of a GLuint

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Prefix global struct and extension type
Nanley Chery [Mon, 26 Oct 2015 22:22:24 +0000 (15:22 -0700)]
mesa/extensions: Prefix global struct and extension type

Rename the following types and variables:
* struct extension -> struct mesa_extension,
  like the mesa_format type.
* extension_table -> _mesa_extension_table,
  like the _mesa_extension_override_{enables,disables} structs.

Suggested-by: Marek Olšák <marek.olsak@amd.com>
Suggested-by: Chad Versace <chad.versace@intel.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa: Generate a helper function for each extension
Nanley Chery [Thu, 17 Sep 2015 22:49:40 +0000 (15:49 -0700)]
mesa: Generate a helper function for each extension

Generate functions which determine if an extension is supported in the
current context. Initially, enums were going to be explicitly used with
_mesa_extension_supported(). The idea to embed the function and enums
into generated helper functions was suggested by Kristian Høgsberg.

For performance, the function body no longer uses
_mesa_extension_supported() and, as suggested by Chad Versace, the
functions are also declared static inline.

v2: Place function qualifiers on separate line (Chad)
v3: Move function curly brace to new line (Chad)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Replace extension::api_set with ::version
Nanley Chery [Mon, 21 Sep 2015 18:23:33 +0000 (11:23 -0700)]
mesa/extensions: Replace extension::api_set with ::version

The api_set field has no users outside of _mesa_extension_supported().
Remove it and allow the version field to take its place.

The brunt of the transformation was performed with the following vim commands:
s/\(GL [^,]\+\),\s*\d*,\s*\d*\(,\s*\d*\)\(,\s*\d*\)/\1, GLL, GLC\2\3/g
s/\(GLL [^,]\+\)\,\s*\d*/\1, GLL/g
s/\(GLC [^,]\+\)\(,\s*\d*\),\s*\d*\(,\s*\d*\)\(,\s*\d*\)/\1\2, GLC\3\4/g
s/\( ES1[^,]*\)\(,\s*\(\w\|\d\)\+\)\(,\s*\(\w\|\d\)\+\),\s*\d*/\1\2\4, ES1/g
s/\( ES2[^,]*\)\(,\s*\(\w\|\d\)\+\)\(,\s*\(\w\|\d\)\+\)\(,\s*\(\w\|\d\)\+\),\s*\d*/\1\2\4\6, ES2/g

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Use _mesa_extension_supported()
Nanley Chery [Tue, 8 Sep 2015 19:41:18 +0000 (12:41 -0700)]
mesa/extensions: Use _mesa_extension_supported()

Replace open-coded checks for extension support with
_mesa_extension_supported().

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Create _mesa_extension_supported()
Nanley Chery [Wed, 2 Sep 2015 18:53:16 +0000 (11:53 -0700)]
mesa/extensions: Create _mesa_extension_supported()

Create a function which determines if an extension is supported in the
current context.

v2: Use common variable names (Emil)
    Insert new line between variables and return statement (Chad)
    Rename api_set variable to api_bit (Chad)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Add extension::version
Nanley Chery [Tue, 8 Sep 2015 19:25:56 +0000 (12:25 -0700)]
mesa/extensions: Add extension::version

Enable limiting advertised extension support by context version with
finer granularity. This new field is currently unused and is set to
0 everywhere. When it is used, a value of 0 will indicate that the
extension is supported for any version of a context.

v2: Use uint*t type for version and note the expected values (Emil)
    Use an 8-bit data type
    Reformat macro for better readability (Chad)

v3: Note preparatory nature of commit (Chad)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Move entries entries to separate file
Nanley Chery [Wed, 16 Sep 2015 18:27:38 +0000 (11:27 -0700)]
mesa/extensions: Move entries entries to separate file

With this infrastructure set in place, we can now reuse the entries to
generate useful code.

v2: Add the new file into Makefile.sources (Emil)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Wrap array entries in macros
Nanley Chery [Wed, 2 Sep 2015 18:26:57 +0000 (11:26 -0700)]
mesa/extensions: Wrap array entries in macros

Now that we're using macros, remove the redundant text from each entry.

Remove comments between the entries to make editing easier and separate
the sections with blank lines. Structure the EXT macros in a way that
helps reviewers verify that no meaning has been altered.

v2: Indent the entries (Chad)

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agomesa/extensions: Remove array sentinel
Nanley Chery [Fri, 11 Sep 2015 16:59:32 +0000 (09:59 -0700)]
mesa/extensions: Remove array sentinel

Simplify future updates to the extension struct array by removing
the sentinel.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
8 years agoi965: Check instructions appear only on supported hardware.
Matt Turner [Mon, 29 Jun 2015 22:59:37 +0000 (15:59 -0700)]
i965: Check instructions appear only on supported hardware.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add initial assembly validation pass.
Matt Turner [Mon, 29 Jun 2015 21:08:51 +0000 (14:08 -0700)]
i965: Add initial assembly validation pass.

Initially just checks that sources are non-NULL, which would have
alerted us to the problem fixed by commit 6c846dc5.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Add annotation_insert_error() and support for printing errors.
Matt Turner [Wed, 21 Oct 2015 22:23:10 +0000 (15:23 -0700)]
i965: Add annotation_insert_error() and support for printing errors.

Will allow annotations to contain error messages (indicating an
instruction violates a rule for instance) that are printed after the
disassembly of the block.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Combine assembly annotations if possible.
Matt Turner [Thu, 8 Oct 2015 04:04:48 +0000 (21:04 -0700)]
i965: Combine assembly annotations if possible.

Often annotations are identical between sets of consecutive
instructions. We can perhaps avoid some memory allocations by reusing
the previous annotation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Set annotation_info's mem_ctx.
Matt Turner [Mon, 29 Jun 2015 21:05:27 +0000 (14:05 -0700)]
i965: Set annotation_info's mem_ctx.

It was being memset to 0 previously.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965: Don't consider control flow instructions to have sources.
Matt Turner [Thu, 15 Oct 2015 18:38:43 +0000 (11:38 -0700)]
i965: Don't consider control flow instructions to have sources.

And why did IFF have a destination?

I suspect that once upon a time the disassembler used this information
to know which fields to find the jump targets in. The jump targets have
moved, so the disassembler has to know how to handle these
per-generation anyway.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Fill out instruction list.
Matt Turner [Mon, 29 Jun 2015 21:03:55 +0000 (14:03 -0700)]
i965: Fill out instruction list.

Add some instructions: illegal, movi, sends, sendsc.

Remove some instructions with reused opcodes: msave, mrestore, push,
pop, goto. I did have some gross code for disassembling opcodes
per-generation, but there's very little meaningful overlap so it's
probably not needed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoralloc: Set *start in ralloc_vasprintf_rewrite_tail() if str is NULL.
Matt Turner [Mon, 29 Jun 2015 22:05:19 +0000 (15:05 -0700)]
ralloc: Set *start in ralloc_vasprintf_rewrite_tail() if str is NULL.

We were leaving it undefined, even though we were writing a string to
*str.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Consolidate is_3src() functions.
Matt Turner [Thu, 8 Oct 2015 21:19:10 +0000 (14:19 -0700)]
i965: Consolidate is_3src() functions.

Otherwise I'll have to add another later in this series.

8 years agost/wgl: add a comment about recursive locking in stw_make_current()
Brian Paul [Tue, 10 Nov 2015 21:49:17 +0000 (14:49 -0700)]
st/wgl: add a comment about recursive locking in stw_make_current()

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: add a lock assertion in stw_framebuffer_from_hwnd_locked()
Brian Paul [Tue, 10 Nov 2015 21:49:01 +0000 (14:49 -0700)]
st/wgl: add a lock assertion in stw_framebuffer_from_hwnd_locked()

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: add some mutex checking code
José Fonseca [Tue, 10 Nov 2015 21:41:30 +0000 (14:41 -0700)]
st/wgl: add some mutex checking code

This would have caught the locking bug that was fixed in the earlier
"st/wgl: fix locking issue in stw_st_framebuffer_present_locked()"
patch.

v2: minor coding style changes by Brian.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: rename stw_framebuffer_release() to stw_framebuffer_unlock()
Brian Paul [Tue, 10 Nov 2015 21:51:26 +0000 (14:51 -0700)]
st/wgl: rename stw_framebuffer_release() to stw_framebuffer_unlock()

To match the new stw_framebuffer_lock() function.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: reimplement stw_framebuffer::mutex with CRITICAL_SECTION
Brian Paul [Tue, 10 Nov 2015 21:38:25 +0000 (14:38 -0700)]
st/wgl: reimplement stw_framebuffer::mutex with CRITICAL_SECTION

v2: update comments on the stw_framebuffer::mutex field regarding locking
order.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: include u_debug.h
Brian Paul [Tue, 10 Nov 2015 21:34:51 +0000 (14:34 -0700)]
st/wgl: include u_debug.h

To get declaration for debug_printf() directly instead of getting it
indirectly through os_thread.h

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: reimplement stw_device::fb_mutex with CRITICAL_SECTION
Brian Paul [Tue, 10 Nov 2015 21:24:18 +0000 (14:24 -0700)]
st/wgl: reimplement stw_device::fb_mutex with CRITICAL_SECTION

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/wgl: re-implement stw_device::ctx_mutex with CRITICAL_SECTION
Brian Paul [Tue, 10 Nov 2015 21:10:45 +0000 (14:10 -0700)]
st/wgl: re-implement stw_device::ctx_mutex with CRITICAL_SECTION

This is Windows-only code so we can use the native Win32 functions for
critical sections.  This will also allow us to (cleanly) add some mutex
check/debug code in subsequent patches.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agogallium/hud: add cpu graph support for Windows
Brian Paul [Thu, 12 Nov 2015 16:06:25 +0000 (09:06 -0700)]
gallium/hud: add cpu graph support for Windows

We support "cpu" but not "cpu#" because there's no good way of querying
per-cpu usage.  Also, the cpu usage is for the process, not the whole
system.

Original code cobbled together by Brian and then fixed/polished by Jose.

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agoglsl: set matrix_stride for non matrices with atomic counter buffers
Tapani Pälli [Mon, 2 Nov 2015 11:36:19 +0000 (13:36 +0200)]
glsl: set matrix_stride for non matrices with atomic counter buffers

Patch sets matrix_stride as 0 for non matrix uniforms that are in a
atomic counter buffer. Matrix stride calculation for actual matrix
uniforms is done during link_assign_uniform_locations.

From ARB_program_interface_query specification:

GL_MATRIX_STRIDE:

   "For active variables not declared as a matrix or array of matrices,
   zero is written to <params>.  For active variables not backed by a
   buffer object, -1 is written to <params>, regardless of the variable
   type."

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agomesa: validate precision of varyings during ValidateProgramPipeline
Tapani Pälli [Thu, 5 Nov 2015 10:52:26 +0000 (12:52 +0200)]
mesa: validate precision of varyings during ValidateProgramPipeline

Fixes following failing ES3.1 CTS tests:

   ES31-CTS.sepshaderobjs.InterfacePrecisionMatchingFloat
   ES31-CTS.sepshaderobjs.InterfacePrecisionMatchingInt
   ES31-CTS.sepshaderobjs.InterfacePrecisionMatchingUInt

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoglsl: do not lose precision information when packing varyings
Tapani Pälli [Thu, 5 Nov 2015 10:23:17 +0000 (12:23 +0200)]
glsl: do not lose precision information when packing varyings

This information will be used by cross stage validation of varyings
for pipeline objects.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoglsl: Add precision information to ir_variable
Iago Toral Quiroga [Tue, 10 Nov 2015 06:22:07 +0000 (08:22 +0200)]
glsl: Add precision information to ir_variable

We will need this later on when we implement proper support for
precision qualifiers in the drivers and also to do link time checks for
uniforms as indicated by the spec.

This patch also adds compile-time checks for variables without precision
information (currently, Mesa only checks that a default precision is set
for floats in fragment shaders).

As indicated by Ian, the addition of the precision information to
ir_variable has been done using a bitfield and pahole to identify an
available hole so that memory requirements for ir_variable stay the
same.

v2 (Ian):
  - Avoid if-ladders by defining arrays of supported sampler names and
    indexing
    into them with type->sampler_array + 2 * type->sampler_shadow
  - Make the code that selects the precision qualifier to use an utility
    function
  - Fix a typo

v3 (Tapani):
  - rebased
  - squashed in "Precision qualifiers are not allowed on structs"
  - fixed select_gles_precision for sampler arrays
  - fixed precision_qualifier_allowed for arrays of structs

v4 (Tapani):
  - add atomic_uint handling
  - do not allow precision qualifier on images
  (issues reported by Marta)

v5 (Tapani):
  - support precision qualifier on image types

v6 (Tapani):
  - set precision qualifier on interface block members

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoglsl: Move the definition of precision_qualifier_allowed
Iago Toral Quiroga [Thu, 5 Nov 2015 06:18:46 +0000 (08:18 +0200)]
glsl: Move the definition of precision_qualifier_allowed

We will need this to build later patches

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoglsl: Add user-defined default precision qualifiers to the symbol table
Iago Toral Quiroga [Thu, 26 Feb 2015 11:15:18 +0000 (12:15 +0100)]
glsl: Add user-defined default precision qualifiers to the symbol table

Notice that the spec requires that a default precision has been set for every
type used by a shader that can use a precision qualifier and does not have a
predefined precision, however, at the moment, Mesa only checks this for floats
in the fragment shader. This is probably because the GLSL ES 1.0 specs mentions
this case specifically, but GLSL ES 3.0 clarifies that the same applies to
other types:

"The fragment language has no default precision qualifier for floating point
 types. Hence for float, floating point vector and matrix variable
 declarations, either the declaration must include a precision qualifier or
 the default float precision must have been previously declared. Similarly,
 there is no default precision qualifier for the following sampler types in
 either the vertex or fragment language:

 sampler3D;
 samplerCubeShadow;
 sampler2DShadow;
 sampler2DArray;
 sampler2DArrayShadow;
 isampler2D;
 isampler3D;
 isamplerCube;
 isampler2DArray;
 usampler2D;
 usampler3D;
 usamplerCube;
 usampler2DArray;"

we will fix this in a later patch.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoglsl: Add default precision qualifiers to the symbol table
Iago Toral Quiroga [Thu, 26 Feb 2015 11:15:17 +0000 (12:15 +0100)]
glsl: Add default precision qualifiers to the symbol table

The GLSL ES spec specifies default precision qualifiers for certain types,
so populate the symbol table with these.

Notice that the desktop GLSL spec also indicates defaults for some types
but this is not really useful since precision qualifiers are completely
ignored in desktop GLSL.

v2: simplify and add samplerExternalOES, specified by
    OES_EGL_image_external (Tapani)

v3: add atomic_uint (reported missing by Marta)

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: Add API to put default precision qualifiers in the symbol table
Iago Toral Quiroga [Thu, 26 Feb 2015 11:15:16 +0000 (12:15 +0100)]
glsl: Add API to put default precision qualifiers in the symbol table

These have scoping rules that match the ones defined for other things such
as variables, so we want them in the symbol table.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoi965/fs/nir: fix the number of register written by FS_OPCODE_GET_BUFFER_SIZE
Samuel Iglesias Gonsálvez [Tue, 10 Nov 2015 12:45:21 +0000 (13:45 +0100)]
i965/fs/nir: fix the number of register written by FS_OPCODE_GET_BUFFER_SIZE

FS_OPCODE_GET_BUFFER_SIZE is calculated with a resinfo's sampler message.

This patch adjusts the number of registers written by the opcode
following what the PRM spec says about the number of registers written
by the SIMD8 and SIMD16's writeback messages for sampler messages.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoi965/skl/gt4: Fix URB programming restriction.
Ben Widawsky [Sat, 7 Nov 2015 02:12:27 +0000 (18:12 -0800)]
i965/skl/gt4: Fix URB programming restriction.

The comment in the code details the restriction. Thanks to Ken for having a very
helpful conversation with me, and spotting the blurb in the link I sent him :P.

There are still stability problems for me on GT4, but this definitely helps with
some of the failures.

v2: Comment fixes

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonv50,nvc0: add ARB_clear_texture support
Ilia Mirkin [Mon, 9 Nov 2015 17:39:05 +0000 (12:39 -0500)]
nv50,nvc0: add ARB_clear_texture support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: implement ARB_clear_texture
Ilia Mirkin [Wed, 5 Mar 2014 02:51:55 +0000 (21:51 -0500)]
st/mesa: implement ARB_clear_texture

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add PIPE_CAP_CLEAR_TEXTURE and clear_texture prototype
Ilia Mirkin [Mon, 9 Nov 2015 18:27:07 +0000 (13:27 -0500)]
gallium: add PIPE_CAP_CLEAR_TEXTURE and clear_texture prototype

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: add helper to check for enhanced layouts support
Timothy Arceri [Tue, 27 Oct 2015 20:42:49 +0000 (07:42 +1100)]
glsl: add helper to check for enhanced layouts support

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
8 years agomesa: add ARB_enhanced_layouts
Timothy Arceri [Sun, 4 Oct 2015 13:01:45 +0000 (00:01 +1100)]
mesa: add ARB_enhanced_layouts

Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
8 years agor600: initialised PGM_RESOURCES_2 for ES/GS
Dave Airlie [Wed, 11 Nov 2015 22:34:18 +0000 (08:34 +1000)]
r600: initialised PGM_RESOURCES_2 for ES/GS

This fixes the corruption on rendering that we are seeing in
certain geometry shaders.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91780
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested / Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Cc: "10.6" "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoi965: Split nir_emit_intrinsic by stage with a general fallback.
Kenneth Graunke [Thu, 5 Nov 2015 07:05:07 +0000 (23:05 -0800)]
i965: Split nir_emit_intrinsic by stage with a general fallback.

Many intrinsics only apply to a particular stage (such as discard).
In other cases, we may want to interpret them differently based on
the stage (such as load_primitive_id or load_input).

The current method isn't that pretty - we handle all intrinsics in
one giant function.  Sometimes we assert on stage, sometimes we forget.
Different behaviors are handled via if-ladders based on stage.

This commit introduces new nir_emit_<stage>_intrinsic() functions,
and makes nir_emit_instr() call those.  In turn, those fall back to
the generic nir_emit_intrinsic() function for cases they don't want
to handle specially.

This makes it clear which intrinsics only exist in one stage, and makes
it easy to handle inputs/outputs differently for various stages.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>