mesa.git
8 years agonir/spirv/glsl450: Implement SmoothStep.
Kenneth Graunke [Tue, 29 Dec 2015 07:52:10 +0000 (23:52 -0800)]
nir/spirv/glsl450: Implement SmoothStep.

8 years agonir/spirv/glsl450: Implement Cross built-in.
Kenneth Graunke [Tue, 29 Dec 2015 07:39:14 +0000 (23:39 -0800)]
nir/spirv/glsl450: Implement Cross built-in.

8 years agonir/spirv/glsl450: Implement Clamp/SClamp/UClamp.
Kenneth Graunke [Tue, 29 Dec 2015 04:40:10 +0000 (20:40 -0800)]
nir/spirv/glsl450: Implement Clamp/SClamp/UClamp.

8 years agonir/spirv/glsl450: Implement the Log built-in.
Kenneth Graunke [Tue, 29 Dec 2015 05:21:51 +0000 (21:21 -0800)]
nir/spirv/glsl450: Implement the Log built-in.

8 years agonir/spirv/glsl450: Implement Exp built-in.
Kenneth Graunke [Tue, 29 Dec 2015 05:04:30 +0000 (21:04 -0800)]
nir/spirv/glsl450: Implement Exp built-in.

8 years agonir/spirv/glsl450: Add a helper for doing fclamp().
Kenneth Graunke [Tue, 29 Dec 2015 23:18:05 +0000 (15:18 -0800)]
nir/spirv/glsl450: Add a helper for doing fclamp().

8 years agonir/spirv/glsl450: Add helpers for calculating exp() and log().
Kenneth Graunke [Tue, 29 Dec 2015 23:15:05 +0000 (15:15 -0800)]
nir/spirv/glsl450: Add helpers for calculating exp() and log().

8 years agonir/spirv/glsl450: Add an 'nb' shortcut variable.
Kenneth Graunke [Tue, 29 Dec 2015 05:09:19 +0000 (21:09 -0800)]
nir/spirv/glsl450: Add an 'nb' shortcut variable.

"nb" is shorter and more convenient than "&b->nb", especially
when several operations are composed together into a larger expression
tree.

8 years agonir/lower_returns: Don't just change the type of a jump.
Jason Ekstrand [Tue, 29 Dec 2015 22:51:45 +0000 (14:51 -0800)]
nir/lower_returns: Don't just change the type of a jump.

It doesn't give core NIR the opportunity to update predecessors and
successors.  Instead, we have to remove and re-insert the instruction.

8 years agonir/builder: Add a nir_jump helper
Jason Ekstrand [Tue, 29 Dec 2015 22:48:34 +0000 (14:48 -0800)]
nir/builder: Add a nir_jump helper

8 years agoglsl/types.cpp: Fix function_key_compare
Jason Ekstrand [Tue, 29 Dec 2015 22:32:10 +0000 (14:32 -0800)]
glsl/types.cpp: Fix function_key_compare

8 years agonir/spirv: Update to the 1.0 GLSL.std.450 header
Jason Ekstrand [Tue, 29 Dec 2015 22:29:03 +0000 (14:29 -0800)]
nir/spirv: Update to the 1.0 GLSL.std.450 header

8 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Tue, 29 Dec 2015 21:47:37 +0000 (13:47 -0800)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

This pulls in nir_builder_init_simple_shader and allows us to delete
anv_nir_builder.h entirely.

8 years agonir/builder: Add an init function that creates a simple shader for you
Jason Ekstrand [Tue, 29 Dec 2015 17:56:44 +0000 (09:56 -0800)]
nir/builder: Add an init function that creates a simple shader for you

A hugely common case when using nir_builder is to have a shader with a
single function called main.  This adds a helper that gives you just that.
This commit also makes us use it in the NIR control-flow unit tests as well
as tgsi_to_nir and prog_to_nir.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir/spirv: Use a C99-style initializer for structure fields
Jason Ekstrand [Tue, 29 Dec 2015 21:15:17 +0000 (13:15 -0800)]
nir/spirv: Use a C99-style initializer for structure fields

This ensures that all unknown fields get zero-initizlied so we don't have
undefined values floating around.

8 years agoanv/pipeline: Use vs_prog_data.inputs_read when computing vb_used
Jason Ekstrand [Tue, 29 Dec 2015 21:03:01 +0000 (13:03 -0800)]
anv/pipeline: Use vs_prog_data.inputs_read when computing vb_used

8 years agonir/spirv: Move CF emit code into vtn_cfg.c
Jason Ekstrand [Tue, 29 Dec 2015 20:09:32 +0000 (12:09 -0800)]
nir/spirv: Move CF emit code into vtn_cfg.c

8 years agonir/spirv: Add support for switch statements
Jason Ekstrand [Tue, 29 Dec 2015 18:24:54 +0000 (10:24 -0800)]
nir/spirv: Add support for switch statements

8 years agonir/spirv: A couple simple loop fixes
Jason Ekstrand [Tue, 29 Dec 2015 05:26:13 +0000 (21:26 -0800)]
nir/spirv: A couple simple loop fixes

8 years agonir/spirv: Add an actual CFG data structure
Jason Ekstrand [Tue, 29 Dec 2015 02:19:40 +0000 (18:19 -0800)]
nir/spirv: Add an actual CFG data structure

The current data structure doesn't handle much that we couldn't handle
before.  However, this will be absolutely crucial for doing swith
statements.  Also, this should fix structured continues.

8 years agomesa/st: Pad out _mesa_sysval_to_semantic for new SYSTEM_VALUE_* enums
Kristian Høgsberg Kristensen [Tue, 29 Dec 2015 19:14:07 +0000 (11:14 -0800)]
mesa/st: Pad out _mesa_sysval_to_semantic for new SYSTEM_VALUE_* enums

GL_ARB_shader_draw_parameters added two new system values.  This gets us
back to mapping mesa system values to the right TGSI semantics.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: float(s32 & 0xff) = float(u8), not s8
Ilia Mirkin [Tue, 29 Dec 2015 20:05:34 +0000 (15:05 -0500)]
nv50/ir: float(s32 & 0xff) = float(u8), not s8

Make sure to make conversion unsigned when we're ANDing the high bits
away. Fixes corruption in dolphin.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agoi965: Reemit vertex state between indirect multi draws
Kristian Høgsberg Kristensen [Tue, 15 Dec 2015 07:36:06 +0000 (23:36 -0800)]
i965: Reemit vertex state between indirect multi draws

If we're doing an indirect draw, prims[i].basevertex is always 0 and the
real base vertex value is in the indirect parameter buffer. We try to
avoid flagging BRW_NEW_VERTICES if prims[i].basevertex doesn't change,
which then breaks down for indirect draws. Thus, if a program uses base
vertex or base instance, and the draw call is indirect, always flag
BRW_NEW_VERTICES.  A new piglit test,
spec/ARB_shader_draw_parameters/drawid-indirect-vertexid tests this.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agonir: Teach nir_opt_algebraic about adding and subtracting the same thing
Kristian Høgsberg Kristensen [Tue, 15 Dec 2015 01:44:23 +0000 (17:44 -0800)]
nir: Teach nir_opt_algebraic about adding and subtracting the same thing

This optimizes a + b - b to just a. Modest shader-db results (BDW):

  total instructions in shared programs: 7842452 -> 7841862 (-0.01%)
  instructions in affected programs:     61938 -> 61348 (-0.95%)
  total loops in shared programs:        2131 -> 2131 (0.00%)
  helped:                                263
  HURT:                                  0
  GAINED:                                0
  LOST:                                  0

but the optimization turns

  gl_VertexID - gl_BaseVertexARB

into just a reference to SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, which the
i965 hardware supports natively. That means we can avoid using the
internal vertex buffer for gl_BaseVertexARB in this case.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Add support for gl_DrawIDARB and enable extension
Kristian Høgsberg Kristensen [Thu, 10 Dec 2015 20:27:38 +0000 (12:27 -0800)]
i965: Add support for gl_DrawIDARB and enable extension

We have to break open a new vec4 for gl_DrawIDARB. We've used up all
space in the vec4 we use for SGVS and gl_DrawIDARB has to come from its
own separate vertex buffer anyway.  This is because we point the vb for
base vertex and base instance into the draw parameter BO for indirect
draw calls, but the draw id is generated by mesa in a different buffer.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Add support for gl_BaseVertexARB and gl_BaseInstanceARB
Kristian Høgsberg Kristensen [Thu, 10 Dec 2015 20:24:50 +0000 (12:24 -0800)]
i965: Add support for gl_BaseVertexARB and gl_BaseInstanceARB

We already have gl_BaseVertexARB in the .x component of the SGVS vec4
and plug gl_BaseInstanceARB into the last free component (.y).

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Assert that SYSTEM_VALUE_VERTEX_ID gets lowered
Kristian Høgsberg Kristensen [Thu, 10 Dec 2015 20:10:28 +0000 (12:10 -0800)]
i965: Assert that SYSTEM_VALUE_VERTEX_ID gets lowered

fs_visitor::emit_vs_system_value() looks like it's trying to handle
SYSTEM_VALUE_VERTEX_ID, but we should never see that value in the
backend.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add core mesa support for GL_ARB_shader_draw_parameters
Kristian Høgsberg Kristensen [Thu, 10 Dec 2015 20:07:43 +0000 (12:07 -0800)]
mesa: Add core mesa support for GL_ARB_shader_draw_parameters

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa/vbo: Add draw_id field to struct _mesa_prim
Kristian Høgsberg Kristensen [Thu, 10 Dec 2015 20:06:17 +0000 (12:06 -0800)]
mesa/vbo: Add draw_id field to struct _mesa_prim

The drivers will need this for passing in gl_DrawIDARB. For indirect
multidraw calls, we get the prim array and prim[i].draw_id == i and is
redundant. But for non-indirect calls, we get one primitive at a time
and need the draw_id field.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir: Remove function overload in control flow test
Aaron Watry [Tue, 29 Dec 2015 16:51:54 +0000 (10:51 -0600)]
nir: Remove function overload in control flow test

Fixes make check.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agogen7/8/pipeline: s/vb_used/elements in emit_vertex_input
Jason Ekstrand [Tue, 29 Dec 2015 17:39:19 +0000 (09:39 -0800)]
gen7/8/pipeline: s/vb_used/elements in emit_vertex_input

8 years agoradeonsi: add RADEON_REPLACE_SHADERS debug option
Nicolai Hähnle [Tue, 15 Dec 2015 01:41:15 +0000 (20:41 -0500)]
radeonsi: add RADEON_REPLACE_SHADERS debug option

This option allows replacing a single shader by a pre-compiled ELF object
as generated by LLVM's llc, for example. This can be useful for debugging a
deterministically occuring error in shaders (and has in fact helped find
the causes of https://bugs.freedesktop.org/show_bug.cgi?id=93264).

v2: drop the debug flag, use DEBUG_GET_ONCE_OPTION instead

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: count compilations in si_compile_llvm
Nicolai Hähnle [Tue, 15 Dec 2015 00:34:45 +0000 (19:34 -0500)]
radeonsi: count compilations in si_compile_llvm

This changes the count slightly (because of si_generate_gs_copy_shader), but
this is only relevant for the driver-specific num-compilations query. It sets
the stage for the next commit.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/util: add DEBUG_GET_ONCE_OPTION
Nicolai Hähnle [Mon, 21 Dec 2015 21:11:37 +0000 (16:11 -0500)]
gallium/util: add DEBUG_GET_ONCE_OPTION

This is analogous to the alreading existing macros for BOOL, NUM, and FLAGS.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agor600: fix constant buffer size programming
Grazvydas Ignotas [Tue, 22 Dec 2015 02:12:07 +0000 (04:12 +0200)]
r600: fix constant buffer size programming

When buffer size is less than 16, zero ends up being programmed as
size, which prevents the hardware from fetching the correct values.
Fix it by combining shift and align so that the value is always
rounded up.

Cc: "11.1 11.0 10.6" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92229
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agovk: Fill out buffer surface state when updating descriptor set
Kristian Høgsberg Kristensen [Mon, 21 Dec 2015 08:03:28 +0000 (00:03 -0800)]
vk: Fill out buffer surface state when updating descriptor set

We can do this when we update the descriptor set instead of on the
fly.

8 years agovk: Unstub VkSemaphore implementation
Kristian Høgsberg Kristensen [Mon, 21 Dec 2015 06:58:38 +0000 (22:58 -0800)]
vk: Unstub VkSemaphore implementation

There really is nothing to do for us here, at least with the current
kernel interface.

8 years agogen7/pipeline: Actually use inputs_read from the VS for laying out inputs
Jason Ekstrand [Thu, 24 Dec 2015 09:10:51 +0000 (01:10 -0800)]
gen7/pipeline: Actually use inputs_read from the VS for laying out inputs

8 years agogen8/pipeline: Actually use inputs_read from the VS for laying out inputs
Jason Ekstrand [Thu, 24 Dec 2015 07:33:18 +0000 (23:33 -0800)]
gen8/pipeline: Actually use inputs_read from the VS for laying out inputs

8 years agoanv/meta: Fix the pos_out location for the vertex shader
Jason Ekstrand [Thu, 24 Dec 2015 07:32:55 +0000 (23:32 -0800)]
anv/meta: Fix the pos_out location for the vertex shader

8 years agonir/spirv: Add GLSL.std.450.h
Jason Ekstrand [Mon, 28 Dec 2015 23:46:20 +0000 (15:46 -0800)]
nir/spirv: Add GLSL.std.450.h

It accidentally got removed during the mass rename.

8 years agoanv/device: Set device->info sooner in CreateDevice
Jason Ekstrand [Mon, 28 Dec 2015 21:26:49 +0000 (13:26 -0800)]
anv/device: Set device->info sooner in CreateDevice

anv_block_pool_init calls anv_block_pool_grow which checks
device->info.has_llc to see if it needs to set caching parameters.
If we don't set device->info early enough, this reads an undefined value
which is probably 0 and not what we want on llc platforms.

Found with valgrind.

8 years agonir/lower_returns: Fix a bug in loop lowering
Jason Ekstrand [Mon, 28 Dec 2015 21:22:09 +0000 (13:22 -0800)]
nir/lower_returns: Fix a bug in loop lowering

8 years agodocs: Mark ARB_tessellation_shader as done on all i965 platforms.
Kenneth Graunke [Fri, 25 Dec 2015 01:19:14 +0000 (17:19 -0800)]
docs: Mark ARB_tessellation_shader as done on all i965 platforms.

We now support all Intel GPUs which can do tessellation.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Enable ARB_tessellation_shader on Gen7-7.5.
Kenneth Graunke [Thu, 26 Nov 2015 01:56:33 +0000 (17:56 -0800)]
i965: Enable ARB_tessellation_shader on Gen7-7.5.

We've resolved all the GPU hangs, and everything seems to be working.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Don't set interleave or complete on TCS EOT message.
Kenneth Graunke [Thu, 24 Dec 2015 21:09:26 +0000 (13:09 -0800)]
i965: Don't set interleave or complete on TCS EOT message.

Setting interleave on the TCS EOT message causes Ivybridge hardware to
GPU hang like crazy.  Individual tests would pass, but running even a
simple test like nop.shader_test in a loop would hang within 1-3 runs.
Adding sleep delays worked around the problem, somehow.

Interleave doesn't make much sense given that we only have one patch
URB handle, not two.  Complete doesn't seem useful either.

There's no reason to actually set those bits.  We were just being lazy.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Relase input URB Handles on Gen7/7.5 when TCS threads finish.
Kenneth Graunke [Thu, 26 Nov 2015 01:54:22 +0000 (17:54 -0800)]
i965: Relase input URB Handles on Gen7/7.5 when TCS threads finish.

Pre-Broadwell hardware requires us to manually release the ICP Handles
by issuing URB read messages with the "Complete" bit set.  We can do
this in pairs to use fewer URB read messages.

Based heavily on work from Chris Forbes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Use proper TCS barrier ID bits for Ivybridge/Baytrail.
Kenneth Graunke [Thu, 24 Dec 2015 23:26:55 +0000 (15:26 -0800)]
i965: Use proper TCS barrier ID bits for Ivybridge/Baytrail.

Gen7 uses bits 15:12 while Gen7+ uses bits 16:13.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Use proper TCS Instance ID bits for Ivybridge/Baytrail.
Kenneth Graunke [Thu, 26 Nov 2015 07:27:02 +0000 (23:27 -0800)]
i965: Use proper TCS Instance ID bits for Ivybridge/Baytrail.

Gen7 uses 22:16 while Gen7.5+ uses 23:17.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Port tessellation evaluation shaders to vec4 mode.
Kenneth Graunke [Tue, 17 Nov 2015 09:30:35 +0000 (01:30 -0800)]
i965: Port tessellation evaluation shaders to vec4 mode.

This can be used on Broadwell by setting INTEL_SCALAR_TES=0.
More importantly, it will be used for Ivybridge and Haswell.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Emit a real 3DSTATE_DS on Gen7.
Kenneth Graunke [Thu, 26 Nov 2015 01:18:50 +0000 (17:18 -0800)]
i965: Emit a real 3DSTATE_DS on Gen7.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Emit a real 3DSTATE_HS on Gen7.
Kenneth Graunke [Thu, 26 Nov 2015 01:12:17 +0000 (17:12 -0800)]
i965: Emit a real 3DSTATE_HS on Gen7.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Add the TCS/TES state upload atoms to the gen7_atoms list.
Kenneth Graunke [Wed, 2 Dec 2015 06:41:32 +0000 (22:41 -0800)]
i965: Add the TCS/TES state upload atoms to the gen7_atoms list.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/spirv: Move to its own directory
Jason Ekstrand [Mon, 28 Dec 2015 19:49:33 +0000 (11:49 -0800)]
nir/spirv: Move to its own directory

8 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Mon, 28 Dec 2015 18:56:31 +0000 (10:56 -0800)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

This pulls in the removal of nir_function_overload

8 years agonir/spirv: Use nir_build_alu for alu instructions
Jason Ekstrand [Mon, 28 Dec 2015 18:35:18 +0000 (10:35 -0800)]
nir/spirv: Use nir_build_alu for alu instructions

8 years agonir: Get rid of function overloads
Jason Ekstrand [Sat, 26 Dec 2015 18:00:47 +0000 (10:00 -0800)]
nir: Get rid of function overloads

When Connor originally drafted NIR, he copied the same function+overload
system that GLSL IR had with a few names changed.  However, this
double-indirection is not really needed and has only served to confuse
people.  Instead, let's just have functions which may not have unique names
and may or may not have an implementation.  If someone wants to do overload
resolving, they can hav a hash table based function+overload system in the
overload resolving pass.  There's no good reason to keep it in core NIR.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
ir3 bits are

Reviewed-by: Rob Clark <robclark@gmail.com>
8 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Mon, 28 Dec 2015 07:23:05 +0000 (23:23 -0800)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

This pulls in tessellation and the store_var changes that go with it.

8 years agonir/lower_returns: Better algorithm as per connor
Jason Ekstrand [Mon, 28 Dec 2015 06:50:45 +0000 (22:50 -0800)]
nir/lower_returns: Better algorithm as per connor

8 years agonir: Add a cursor helper for getting a cursor after any phi nodes
Jason Ekstrand [Mon, 28 Dec 2015 06:50:14 +0000 (22:50 -0800)]
nir: Add a cursor helper for getting a cursor after any phi nodes

8 years agonvc0: don't forget to reset VTX_TMP bufctx slot after blit completion
Ilia Mirkin [Mon, 28 Dec 2015 01:44:01 +0000 (20:44 -0500)]
nvc0: don't forget to reset VTX_TMP bufctx slot after blit completion

Also release the scratch allocation if any.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50,nvc0: add a note when converting vertex elements using CPU
Ilia Mirkin [Sun, 27 Dec 2015 20:13:21 +0000 (15:13 -0500)]
nv50,nvc0: add a note when converting vertex elements using CPU

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonir/gather_info: Handle multi-slot variables in io bitfields
Jason Ekstrand [Tue, 27 Oct 2015 03:56:06 +0000 (20:56 -0700)]
nir/gather_info: Handle multi-slot variables in io bitfields

8 years agonir: Add a helper for getting the bitmask for a variable's location
Jason Ekstrand [Tue, 27 Oct 2015 18:32:34 +0000 (11:32 -0700)]
nir: Add a helper for getting the bitmask for a variable's location

8 years agonir/types: Expose glsl_type::count_attribute_slots()
Jason Ekstrand [Tue, 27 Oct 2015 02:45:30 +0000 (19:45 -0700)]
nir/types: Expose glsl_type::count_attribute_slots()

8 years agonir/lower_return: Do it for real this time
Jason Ekstrand [Thu, 24 Dec 2015 07:45:47 +0000 (23:45 -0800)]
nir/lower_return: Do it for real this time

8 years agonir/cf: Make extracting or re-inserting nothing a no-op
Jason Ekstrand [Thu, 24 Dec 2015 02:10:08 +0000 (18:10 -0800)]
nir/cf: Make extracting or re-inserting nothing a no-op

8 years agonir: Add a function for comparing cursors
Jason Ekstrand [Thu, 24 Dec 2015 02:09:42 +0000 (18:09 -0800)]
nir: Add a function for comparing cursors

8 years agogallium/auxiliary: don't build NIR sources with MSVC2008 flags
Connor Abbott [Sun, 20 Dec 2015 16:42:56 +0000 (11:42 -0500)]
gallium/auxiliary: don't build NIR sources with MSVC2008 flags

NIR has never been built with MSVC2008, so we shouldn't add
MSVC2008_COMPAT_CFLAGS to anything that uses it. This allows us to get
rid of the pragma in tgsi_to_nir.c.

Build tested with freedreno.

v2: Use MSVC2013_COMPAT_CLFAGS instead.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir/spirv: Add support for undefs in vtn_ssa_value()
Jason Ekstrand [Wed, 23 Dec 2015 22:14:39 +0000 (14:14 -0800)]
nir/spirv: Add support for undefs in vtn_ssa_value()

8 years agonir/spirv: Properly handle vector times matrix
Jason Ekstrand [Wed, 23 Dec 2015 21:17:18 +0000 (13:17 -0800)]
nir/spirv: Properly handle vector times matrix

8 years agonir/spirv: Create the correct type if a matrix-vector multiply produces a vector
Jason Ekstrand [Wed, 23 Dec 2015 21:17:00 +0000 (13:17 -0800)]
nir/spirv: Create the correct type if a matrix-vector multiply produces a vector

8 years agonir/spirv: Fix some mem_ctx issues with create_vec
Jason Ekstrand [Wed, 23 Dec 2015 21:13:54 +0000 (13:13 -0800)]
nir/spirv: Fix some mem_ctx issues with create_vec

8 years agonir/spirv: Better document vtn_ssa_value.transposed
Jason Ekstrand [Wed, 23 Dec 2015 20:45:13 +0000 (12:45 -0800)]
nir/spirv: Better document vtn_ssa_value.transposed

8 years agoanv/descriptor_set: Use anv_foreach_stage
Jason Ekstrand [Wed, 23 Dec 2015 19:25:35 +0000 (11:25 -0800)]
anv/descriptor_set: Use anv_foreach_stage

8 years agoanv: Mask out invalid stages in foreach_stage
Jason Ekstrand [Wed, 23 Dec 2015 19:24:23 +0000 (11:24 -0800)]
anv: Mask out invalid stages in foreach_stage

8 years agonir/spirv: Handle LogicalNot
Jason Ekstrand [Wed, 23 Dec 2015 19:11:58 +0000 (11:11 -0800)]
nir/spirv: Handle LogicalNot

8 years agonir/spirv: Handle derefs in vtn_ssa_value
Jason Ekstrand [Wed, 23 Dec 2015 19:10:58 +0000 (11:10 -0800)]
nir/spirv: Handle derefs in vtn_ssa_value

This is kind of a hack, but it makes vtn_ssa_value insert a load if the
value requested is actually a deref.  This shouldn't happen normally but,
thanks to the impedence mismatch of the NIR function parameter model vs.
the SPIR-V model, this can happen for function arguments.

8 years agonir/spirv: Do boolean fixup on block loads
Jason Ekstrand [Wed, 23 Dec 2015 19:10:13 +0000 (11:10 -0800)]
nir/spirv: Do boolean fixup on block loads

We used to do it for variable loads on things of type "uniform" but that
never got ported to block loads.

8 years agospirv/nir: Handle non-vector extractions in vtn_composite_extract
Jason Ekstrand [Tue, 22 Dec 2015 05:20:50 +0000 (21:20 -0800)]
spirv/nir: Handle non-vector extractions in vtn_composite_extract

8 years agonir/spirv: Handle function calls
Jason Ekstrand [Fri, 18 Dec 2015 23:07:16 +0000 (15:07 -0800)]
nir/spirv: Handle function calls

8 years agonir: Create the params array in function_impl_create
Jason Ekstrand [Fri, 18 Dec 2015 23:06:02 +0000 (15:06 -0800)]
nir: Create the params array in function_impl_create

8 years agoi965/nir: Remove return handling
Jason Ekstrand [Fri, 18 Dec 2015 19:28:57 +0000 (11:28 -0800)]
i965/nir: Remove return handling

This was added because we were getting spurrious returns coming out of
SPIR-V.  Now that we're calling lower_returns, we don't need this.

8 years agoanv/pipeline: Run lower_returns and inline_functions after spirv_to_nir
Jason Ekstrand [Fri, 18 Dec 2015 19:28:21 +0000 (11:28 -0800)]
anv/pipeline: Run lower_returns and inline_functions after spirv_to_nir

8 years agonir: Add a function inlining pass
Jason Ekstrand [Fri, 18 Dec 2015 20:17:29 +0000 (12:17 -0800)]
nir: Add a function inlining pass

8 years agonir/builder: Add a copy_deref_var helper
Jason Ekstrand [Fri, 18 Dec 2015 20:16:45 +0000 (12:16 -0800)]
nir/builder: Add a copy_deref_var helper

8 years agonir: move nir_copy_var from anv_nir_builder to nir_builder
Jason Ekstrand [Fri, 18 Dec 2015 19:45:59 +0000 (11:45 -0800)]
nir: move nir_copy_var from anv_nir_builder to nir_builder

8 years agonir/clone: Add support for cloning a single function_impl
Jason Ekstrand [Wed, 28 Oct 2015 04:44:27 +0000 (21:44 -0700)]
nir/clone: Add support for cloning a single function_impl

This will be useful for things such as function inlining.

8 years agonir: Add a helper for creating a "bare" nir_function_impl
Jason Ekstrand [Wed, 28 Oct 2015 04:34:56 +0000 (21:34 -0700)]
nir: Add a helper for creating a "bare" nir_function_impl

This is useful if you want to clone a single function_impl if, for
instance, you wanted to do function inlining.

8 years agonir/control_flow: Handle relinking top-level blocks
Jason Ekstrand [Fri, 18 Dec 2015 19:27:00 +0000 (11:27 -0800)]
nir/control_flow: Handle relinking top-level blocks

This can happen if a function ends in a return instruction and you remove
the return.

8 years agonir: Add a stub function inlining pass
Jason Ekstrand [Fri, 18 Dec 2015 19:16:16 +0000 (11:16 -0800)]
nir: Add a stub function inlining pass

All it does is remove the return at the end, but it's good enough for
simple functions.

8 years agonir/print: Factor variable name lookup into a helper
Jason Ekstrand [Fri, 18 Dec 2015 22:39:02 +0000 (14:39 -0800)]
nir/print: Factor variable name lookup into a helper

Otherwise, we have a problem when we go to print functions with arguments
because their names get added to the hash table during declaration which
happens after we print the prototype.

8 years agoi965: Add tr_mode and mip tail information in surface state dump
Anuj Phogat [Wed, 23 Dec 2015 19:14:20 +0000 (11:14 -0800)]
i965: Add tr_mode and mip tail information in surface state dump

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
8 years agoi965/gen8/cs: Gen8 requires 64 byte alignment for push constant data
Jordan Justen [Wed, 23 Dec 2015 07:42:52 +0000 (23:42 -0800)]
i965/gen8/cs: Gen8 requires 64 byte alignment for push constant data

The BDW PRM Vol2a: Command Reference: Instructions, section MEDIA_CURBE_LOAD,
says that 'CURBE Total Data Length' and 'CURBE Data Start Address' are
64-byte aligned. This is different from previous gens, that were 32-byte
aligned.

v2 (Jordan):
  - CURBE Data Start Address is also 64-byte aligned.
    - The call to brw_state_batch should also use 64-byte alignment.
      - Improve PRM reference.

v3:
 * New patch from Jordan. Always align base and size to 64 bytes.

Fixes the following SSBO CTS tests on BDW:
ES31-CTS.shader_storage_buffer_object.basic-atomic-case1-cs
ES31-CTS.shader_storage_buffer_object.basic-operations-case1-cs
ES31-CTS.shader_storage_buffer_object.basic-operations-case2-cs
ES31-CTS.shader_storage_buffer_object.basic-stdLayout_UBO_SSBO-case2-cs
ES31-CTS.shader_storage_buffer_object.advanced-write-fragment-cs
ES31-CTS.shader_storage_buffer_object.advanced-indirectAddressing-case2-cs
ES31-CTS.shader_storage_buffer_object.advanced-matrix-cs

And many other CS CTS tests as reported by Marta Lofstedt.

(Commit message is from Iago, but in v3, code is from Jordan.)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agofreedreno/ir3: spelling..
Rob Clark [Wed, 23 Dec 2015 05:06:00 +0000 (00:06 -0500)]
freedreno/ir3: spelling..

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonir/print: print variable constant-initializers
Rob Clark [Tue, 22 Dec 2015 21:50:23 +0000 (16:50 -0500)]
nir/print: print variable constant-initializers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agodocs: Clarify that ARB_tessellation_shader is only done on i965/gen8+.
Kenneth Graunke [Wed, 23 Dec 2015 04:14:35 +0000 (20:14 -0800)]
docs: Clarify that ARB_tessellation_shader is only done on i965/gen8+.

Requested by kisak on IRC.

8 years agodocs: Mark ARB_tessellation_shader as done on i965/gen8+.
Kenneth Graunke [Wed, 23 Dec 2015 02:50:18 +0000 (18:50 -0800)]
docs: Mark ARB_tessellation_shader as done on i965/gen8+.

8 years agoi965: Enable ARB_tessellation_shader on Gen8+.
Kenneth Graunke [Mon, 27 Jul 2015 21:19:31 +0000 (14:19 -0700)]
i965: Enable ARB_tessellation_shader on Gen8+.

Everything is in place and I'm not aware of any further issues.

Tested with:
- Piglit
- Tessmark
- Unigine Heaven
- Shadow of Mordor
- GRID Autosport

I have patches to backport this to Haswell, Ivybridge, and Baytrail as
well (the first Intel hardware to support tessellation), but there are
still a lot of GPU hangs left to debug.  So that will come later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Handle mix-and-match TCS/TES with separate shader objects.
Kenneth Graunke [Tue, 8 Dec 2015 04:18:42 +0000 (20:18 -0800)]
i965: Handle mix-and-match TCS/TES with separate shader objects.

GL_ARB_separate_shader_objects allows the application to mix-and-match
TCS and TES programs separately.  This means that the interface between
the two stages isn't known until the final SSO pipeline is in place.

This isn't a great match for our hardware: the TCS and TES have to agree
on the Patch URB entry layout.  Since we store data as per-patch slots
followed by per-vertex slots, changing the number of per-patch slots can
significantly alter the layout.  This can easily happen with SSO.

To handle this, we store the [Patch]OutputsWritten and [Patch]InputsRead
bitfields in the TCS/TES program keys, introducing program recompiles.
brw_upload_programs() decides the layout for both TCS and TES, and
passes it to brw_upload_tcs/tes(), which store it in the key.

When creating the NIR for a shader specialization, we override
nir->info.inputs_read (and friends) to the program key's values.
Since everything uses those, no further compiler changes are needed.
This also replaces the hack in brw_create_nir().

To avoid recompiles, brw_precompile_tes() looks to see if there's a
TCS in the linked shader.  If so, it accounts for the TCS outputs,
just as brw_upload_programs() would.  This eliminates all recompiles
in the non-SSO case.  In the SSO case, there should only be recompiles
when using a TCS and TES that have different input/output interfaces.

Fixes Piglit's mix-and-match-tcs-tes test.

v2: Pull the brw_upload_programs code into a brw_upload_tess_programs()
    helper function (requested by Jordan Justen).

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