mesa.git
8 years agometa/blit: Rework how format and aspect choices are made
Jason Ekstrand [Thu, 31 Dec 2015 21:22:43 +0000 (13:22 -0800)]
meta/blit: Rework how format and aspect choices are made

This commit does two things.  First, it introduces choose_* functions for
chosing formats and aspects.  Second, it changes the copy (not blit) code
to use appropreately sized UINT formats for everything except depth.  There
are two main reasons for this:  First, it means that compressed and other
non-renderable texture upload should "just work" because it won't be
tripping over non-renderable formats.  Second, it allows us to easly copy
an RGB buffer to and from an RGBX image because the formats will get
switched over to their UINT variants and the shader will deal with the
extra channel for us.

8 years agoanv/image: Add a vk_format field
Jason Ekstrand [Thu, 31 Dec 2015 20:39:34 +0000 (12:39 -0800)]
anv/image: Add a vk_format field

We've been trying to move away from anv_format for a while and this should
help with the transition.  There are cases (mostly in meta) where we need
the original format for the image and not the isl_format.  These will be
moved over to the new vk_format and everythign else will use the isl_format
from the particular anv_surface.

8 years agoisl: Document mnemonic in Yf and Ys tiling
Chad Versace [Mon, 4 Jan 2016 23:30:27 +0000 (15:30 -0800)]
isl: Document mnemonic in Yf and Ys tiling

The 'f' means "four K". The 's' means "sixty-four K".

8 years agoisl: Use isl_align_npot for row_pitch
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 18:53:47 +0000 (10:53 -0800)]
isl: Use isl_align_npot for row_pitch

Many formats are not power-of-two bytes per pixels and we need the
non-power-of-two align macro here.

This reverts the revert from 4f9a211b, but keeps the change from a827b553
that fixed the yuv if-else mix-up.

8 years agovk: Don't leak pipeline if initialization fails
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 18:42:50 +0000 (10:42 -0800)]
vk: Don't leak pipeline if initialization fails

8 years agovk: Allocate subpass attachment in one big block
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 06:58:00 +0000 (22:58 -0800)]
vk: Allocate subpass attachment in one big block

This avoids making a lot of small allocations and handles allocation
failure correctly.

Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.

8 years agovk: Handle allocation failures in meta init paths
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 06:43:47 +0000 (22:43 -0800)]
vk: Handle allocation failures in meta init paths

Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.

8 years agovk: Handle allocation failure in anv_pipeline_init()
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 06:42:01 +0000 (22:42 -0800)]
vk: Handle allocation failure in anv_pipeline_init()

Fixes dEQP-VK.api.object_management.alloc_callback_fail.* failures.

8 years agovk: Call vk_error when we generate a VK_ERROR
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 05:31:22 +0000 (21:31 -0800)]
vk: Call vk_error when we generate a VK_ERROR

8 years agovk: Only finish wayland wsi if we created it
Kristian Høgsberg Kristensen [Mon, 4 Jan 2016 05:15:29 +0000 (21:15 -0800)]
vk: Only finish wayland wsi if we created it

Failure during instance creation will leave instance->wayland_wsi
undefined. When we then try to clean that up we crash. Set
instance->wayland_wsi to NULL on failure and only clean it up if it's
non-NULL.

Fixes part of dEQP-VK.api.object_management.alloc_callback_fail.*

8 years agoisl: Fix row pitch for linear buffers
Chad Versace [Fri, 1 Jan 2016 17:52:57 +0000 (09:52 -0800)]
isl: Fix row pitch for linear buffers

isl always aligned the row pitch to the surface's image alignment.  This
was sometimes wrong when the surface backed a VkBuffer. For a VkBuffer,
the surface's row pitch is set by VkBufferImageCopy::bufferRowLength,
whose required alignment is only that of the VkFormat.

In particular, VkBuffer rows are packed in many dEQP and Crucible tests.
And packed rows are rarely aligned to the surface's image alignment.

Fixes: dEQP-VK.pipeline.image.view_type.2d.format.r8g8b8a8_unorm.size.13x13
8 years agoisl: Fix swapped if-else in isl_calc_row_pitch
Chad Versace [Fri, 1 Jan 2016 18:37:25 +0000 (10:37 -0800)]
isl: Fix swapped if-else in isl_calc_row_pitch

The YUV case was applied to non-YUV formats. Oops.

8 years agonir/spirv: Fix group decorations
Jason Ekstrand [Sat, 2 Jan 2016 19:51:40 +0000 (11:51 -0800)]
nir/spirv: Fix group decorations

They were completely bogus before.  For one thing, OpDecorationGroup
created a value of type undef rather than decoration_group.  Also
OpGroupMemberDecorate didn't properly apply the decoration to the different
members of the different groups.  It *should* be correct now but there's no
good way to test it yet.

8 years agoanv/device: Only allocate whole pages in AllocateMemory
Jason Ekstrand [Sat, 2 Jan 2016 15:52:22 +0000 (07:52 -0800)]
anv/device: Only allocate whole pages in AllocateMemory

The kernel is going to give us whole pages anyway, so allocating part of a
page doesn't help.  And this ensures that we can always work with whole
pages.

8 years agoanv/device: Handle non-4k-aligned calls to MapMemory
Jason Ekstrand [Fri, 1 Jan 2016 17:26:06 +0000 (09:26 -0800)]
anv/device: Handle non-4k-aligned calls to MapMemory

As per the spec:

   minMemoryMapAlignment is the minimum required alignment, in bytes, of
   host-visible memory allocations within the host address space. When
   mapping a memory allocation with vkMapMemory, subtracting offset bytes
   from the returned pointer will always produce a multiple of the value of
   this limit.

8 years agoanv/format: Get rid of num_channels
Jason Ekstrand [Thu, 31 Dec 2015 20:07:23 +0000 (12:07 -0800)]
anv/format: Get rid of num_channels

8 years agoanv/cmd_buffer: Fix a pointer-cast typo
Jason Ekstrand [Thu, 31 Dec 2015 20:07:10 +0000 (12:07 -0800)]
anv/cmd_buffer: Fix a pointer-cast typo

8 years agoisl: Document some isl_surf::phys_level0_sa invariants
Chad Versace [Thu, 31 Dec 2015 20:02:04 +0000 (12:02 -0800)]
isl: Document some isl_surf::phys_level0_sa invariants

isl_dim_layout restricts the range of isl_surf::phys_level0_sa.

8 years agoanv/pipeline: Better vertex input channel setup
Jason Ekstrand [Thu, 31 Dec 2015 20:00:58 +0000 (12:00 -0800)]
anv/pipeline: Better vertex input channel setup

First off, it now uses isl formats instead of anv_format.  Also, it
properly handles integer vs. floating-point default channels and can
properly handle alpha-only channels.  (Not sure if those are allowed).

8 years agoanv/pipeline: Move vk_to_gen tables into a shared header
Jason Ekstrand [Thu, 31 Dec 2015 19:58:24 +0000 (11:58 -0800)]
anv/pipeline: Move vk_to_gen tables into a shared header

8 years agoisl: Better document surface units
Chad Versace [Thu, 31 Dec 2015 19:56:13 +0000 (11:56 -0800)]
isl: Better document surface units

Logical pixels, physical surface samples, and physical surface elements.

Requested-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agoisl: Document the 3D block extent of isl_format
Chad Versace [Thu, 31 Dec 2015 19:55:48 +0000 (11:55 -0800)]
isl: Document the 3D block extent of isl_format

8 years agonir/spirv: Add a missing break statement in handle_image
Jason Ekstrand [Thu, 31 Dec 2015 05:57:04 +0000 (21:57 -0800)]
nir/spirv: Add a missing break statement in handle_image

8 years agoRevert "isl: Fix assertion failure for npot pixel formats"
Jason Ekstrand [Thu, 31 Dec 2015 05:01:55 +0000 (21:01 -0800)]
Revert "isl: Fix assertion failure for npot pixel formats"

This reverts commit 96d1baa88d37c51c94579f650cfd9465d28634f4.

8 years agonir/spirv: Handle push constants after decorations
Jason Ekstrand [Thu, 31 Dec 2015 04:54:27 +0000 (20:54 -0800)]
nir/spirv: Handle push constants after decorations

8 years agoanv/device: Place memory types at heapIndex == 0
Jason Ekstrand [Thu, 31 Dec 2015 03:32:41 +0000 (19:32 -0800)]
anv/device: Place memory types at heapIndex == 0

Previously, they were at heapIndex == 1 even though we only advertised one
heap.

8 years agonir/spirv: Fix constant num_elements and allocation
Jason Ekstrand [Thu, 31 Dec 2015 02:51:57 +0000 (18:51 -0800)]
nir/spirv: Fix constant num_elements and allocation

Thanks to the addition of nir_clone, we now have a num_elements field in
nir_constant which we weren't setting.  Also, constants have to be parented
to the variable they initialize, so we have to make a copy.

8 years agonir/lower_outputs_to_temporaries: Reparent constant initializers
Jason Ekstrand [Thu, 31 Dec 2015 02:51:06 +0000 (18:51 -0800)]
nir/lower_outputs_to_temporaries: Reparent constant initializers

8 years agonir/clone: Expose nir_constant_clone
Jason Ekstrand [Thu, 31 Dec 2015 02:44:19 +0000 (18:44 -0800)]
nir/clone: Expose nir_constant_clone

8 years agonir/gather_info: Add support for end_primitive_with_counter
Jason Ekstrand [Thu, 31 Dec 2015 01:43:00 +0000 (17:43 -0800)]
nir/gather_info: Add support for end_primitive_with_counter

8 years agonir/spirv: Handle OpLine
Jason Ekstrand [Thu, 31 Dec 2015 01:32:03 +0000 (17:32 -0800)]
nir/spirv: Handle OpLine

8 years agonir/spirv: Let OpEntryPoint act as an OpName
Jason Ekstrand [Thu, 31 Dec 2015 01:31:51 +0000 (17:31 -0800)]
nir/spirv: Let OpEntryPoint act as an OpName

8 years agonir/lower_outputs_to_temporaries: Take a nir_function entrypoint
Jason Ekstrand [Thu, 31 Dec 2015 01:31:19 +0000 (17:31 -0800)]
nir/lower_outputs_to_temporaries: Take a nir_function entrypoint

8 years agonir/spirv: Add support for multiple entrypoints per shader
Jason Ekstrand [Thu, 31 Dec 2015 01:17:12 +0000 (17:17 -0800)]
nir/spirv: Add support for multiple entrypoints per shader

This is done by passing the entrypoint name into spirv_to_nir.  It will
then process the shader as if that were the only entrypoint we care about.
Instead of returning a nir_shader, it now returns a nir_function.

8 years agonir/spirv: Get the shader stage from the SPIR-V
Jason Ekstrand [Thu, 31 Dec 2015 01:00:16 +0000 (17:00 -0800)]
nir/spirv: Get the shader stage from the SPIR-V

Previously, we depended on it being passed in.

8 years agonir/spirv: Use shader stage for determining variable locations
Jason Ekstrand [Thu, 31 Dec 2015 00:48:59 +0000 (16:48 -0800)]
nir/spirv: Use shader stage for determining variable locations

8 years agonir/spirv: Get rid of default GS info
Jason Ekstrand [Thu, 31 Dec 2015 00:41:54 +0000 (16:41 -0800)]
nir/spirv: Get rid of default GS info

shaderc has been fixed for a while now.

8 years agonir/spirv: Handle execution modes as decorations
Jason Ekstrand [Thu, 31 Dec 2015 00:38:16 +0000 (16:38 -0800)]
nir/spirv: Handle execution modes as decorations

They're basically the same thing.

8 years agonir/spirv: Separate handling of preamble from type/var/const instructions
Jason Ekstrand [Thu, 31 Dec 2015 00:35:34 +0000 (16:35 -0800)]
nir/spirv: Separate handling of preamble from type/var/const instructions

8 years agoisl: Fix assertion failure for npot pixel formats
Chad Versace [Thu, 31 Dec 2015 00:26:10 +0000 (16:26 -0800)]
isl: Fix assertion failure for npot pixel formats

When aligning to isl_format_layout::bs (which is the number of bytes in
the pixel), use isl_align_npot() instead of isl_align(), because
isl_align() works only for power-of-2 alignment.

Fixes assertion in
dEQP-VK.pipeline.image.view_type.1d.format.r16g16b16_sfloat.size.512x1.

8 years agonir/spirv/GLSL450: Add support for SAbs
Jason Ekstrand [Wed, 30 Dec 2015 22:41:13 +0000 (14:41 -0800)]
nir/spirv/GLSL450: Add support for SAbs

8 years agonir/spirv: Implement IsInf and IsNan built-ins.
Kenneth Graunke [Wed, 30 Dec 2015 00:21:09 +0000 (16:21 -0800)]
nir/spirv: Implement IsInf and IsNan built-ins.

8 years agoisl: Tile-align height in image size calculation
Jason Ekstrand [Wed, 30 Dec 2015 22:02:20 +0000 (14:02 -0800)]
isl: Tile-align height in image size calculation

This fixes a bunch of gpu hangs on the dEQP-VK.glsl.ShaderExecutor.common
group of CTS tests.

8 years agoRevert "nir/spirv: Update to the 1.0 GLSL.std.450 header"
Kenneth Graunke [Wed, 30 Dec 2015 21:22:32 +0000 (13:22 -0800)]
Revert "nir/spirv: Update to the 1.0 GLSL.std.450 header"

This reverts commit b33f5d388979f23c583c78f10a18a941cb04ce04,
and also removes the (empty) case statements for the new built-ins.

It doesn't look like glslang has updated yet, so updating the header
just breaks everything, as we no longer agree on opcode numbers.

8 years agoanv/allocator: Rework state streams again
Jason Ekstrand [Wed, 30 Dec 2015 19:40:38 +0000 (11:40 -0800)]
anv/allocator: Rework state streams again

If we're going to hav valgrind verify state streams then we need to ensure
that once we choose a pointer into a block we always use that pointer until
the block is freed.  I was trying to do this with the "current_map" thing.
However, that breaks down because you have to use the map from the block
pool to get to the stream_block to get at current_map.  Instead, this
commit changes things to track the stream_block by pointer instead of by
offset into the block pool.

8 years agogen7/8/cmd_buffer: Allocate the correct ammount for COLOR_CALC_STATE
Jason Ekstrand [Wed, 30 Dec 2015 18:37:50 +0000 (10:37 -0800)]
gen7/8/cmd_buffer: Allocate the correct ammount for COLOR_CALC_STATE

We were allocating 6 bytes when we should have been allocating 6 dwords.

8 years agoanv/stream_alloc: Properly manage valgrind NOACCESS and UNDEFINED status
Jason Ekstrand [Wed, 30 Dec 2015 18:33:09 +0000 (10:33 -0800)]
anv/stream_alloc: Properly manage valgrind NOACCESS and UNDEFINED status

When I first did the valgrindifying for stream allocators, I misunderstood
some things about valgrind's expectations for NOACCESS and UNDEFINED.
First off, valgrind expects things to be marked NOACCESS before you
allocate out of them.  Since our blocks came from a pool backed by a
mmapped memfd, they came in as UNDEFINED; we needed to mark them as
NOACCESS.  Also, I didn't realize that VALGRIND_MEMPOOL_CHANGE only updated
the mempool allocation state and didn't actually change definedness; we had
to add a VALGRIND_MAKE_MEM_UNDEFINED to get rid of the NOACCESS on the
newly allocated portion.

8 years agonir/spirv: Lower gl_GlobalInvocationID correctly
Kristian Høgsberg Kristensen [Wed, 30 Dec 2015 07:59:38 +0000 (23:59 -0800)]
nir/spirv: Lower gl_GlobalInvocationID correctly

Use nir_intrinsic_load_local_invocation_id, not
nir_intrinsic_load_invocation_id (missing 'local'), which is a geometry
shader built-in.

8 years agonir/spirv/cfg: Handle discard
Jason Ekstrand [Wed, 30 Dec 2015 03:23:25 +0000 (19:23 -0800)]
nir/spirv/cfg: Handle discard

8 years agonir/print: Handle variables with var->name == NULL
Jason Ekstrand [Wed, 30 Dec 2015 00:57:21 +0000 (16:57 -0800)]
nir/print: Handle variables with var->name == NULL

8 years agonir/inline_functions: Switch to inlining everything
Jason Ekstrand [Wed, 30 Dec 2015 00:57:01 +0000 (16:57 -0800)]
nir/inline_functions: Switch to inlining everything

8 years agonir/spirv/glsl450: Enumerate more built-in opcodes.
Kenneth Graunke [Wed, 30 Dec 2015 00:06:19 +0000 (16:06 -0800)]
nir/spirv/glsl450: Enumerate more built-in opcodes.

8 years agoanv/state: Fix reversed MIN vs. MAX in levelCount handling.
Kenneth Graunke [Tue, 29 Dec 2015 23:50:15 +0000 (15:50 -0800)]
anv/state: Fix reversed MIN vs. MAX in levelCount handling.

The point is to promote a levelCount of 0 to 1 before subtracting 1.
This needs MAX, not MIN.

8 years agonir/spirv: Use instr_rewrite_src for updating phi sources
Jason Ekstrand [Tue, 29 Dec 2015 23:44:37 +0000 (15:44 -0800)]
nir/spirv: Use instr_rewrite_src for updating phi sources

You can't just add a new source to a phi because use/def information won't
get updated properly.  Instead, you have to use one of the core helpers.
Some day, we may want to add a nir_phi_instr_add_src helper.

8 years agonir/validate: Don't validate the return deref for void function calls
Jason Ekstrand [Tue, 29 Dec 2015 23:35:29 +0000 (15:35 -0800)]
nir/validate: Don't validate the return deref for void function calls

8 years agonir/dominance: Handle unreachable blocks
Jason Ekstrand [Tue, 29 Dec 2015 23:25:43 +0000 (15:25 -0800)]
nir/dominance: Handle unreachable blocks

Previously, nir_dominance.c didn't properly handle unreachable blocks.
This can happen if, for instance, you have something like this:

loop {
   if (...) {
      break;
   } else {
      break;
   }
}

In this case, the block right after the if statement will be unreachable.
This commit makes two changes to handle this.  First, it removes an assert
and allows block->imm_dom to be null if the block is unreachable.  Second,
it properly skips unreachable blocks in calc_dom_frontier_cb.

8 years agonir/spirv/glsl450: Implement inverse hyperbolic trig built-ins.
Kenneth Graunke [Tue, 29 Dec 2015 23:13:46 +0000 (15:13 -0800)]
nir/spirv/glsl450: Implement inverse hyperbolic trig built-ins.

8 years agonir/spirv/glsl450: Implement Refract built-in.
Kenneth Graunke [Tue, 29 Dec 2015 08:28:42 +0000 (00:28 -0800)]
nir/spirv/glsl450: Implement Refract built-in.

8 years agonir/spirv/glsl450: Implement hyperbolic trig built-ins.
Kenneth Graunke [Tue, 29 Dec 2015 08:18:54 +0000 (00:18 -0800)]
nir/spirv/glsl450: Implement hyperbolic trig built-ins.

8 years agonir/spirv/glsl450: implement Reflect built-in.
Kenneth Graunke [Tue, 29 Dec 2015 08:10:39 +0000 (00:10 -0800)]
nir/spirv/glsl450: implement Reflect built-in.

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

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