Commit graph

76843 commits

Author SHA1 Message Date
Jason Ekstrand
5afac62b28 nir/spirv: Handle OpLine 2015-12-30 17:45:43 -08:00
Jason Ekstrand
149f35bbba nir/spirv: Let OpEntryPoint act as an OpName 2015-12-30 17:45:43 -08:00
Jason Ekstrand
5f7f88524c nir/lower_outputs_to_temporaries: Take a nir_function entrypoint 2015-12-30 17:45:43 -08:00
Jason Ekstrand
0fe4580e64 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.
2015-12-30 17:45:43 -08:00
Jason Ekstrand
e993e45eb1 nir/spirv: Get the shader stage from the SPIR-V
Previously, we depended on it being passed in.
2015-12-30 17:45:43 -08:00
Jason Ekstrand
db3a64fcea nir/spirv: Use shader stage for determining variable locations 2015-12-30 17:45:43 -08:00
Jason Ekstrand
d7ae2200f9 nir/spirv: Get rid of default GS info
shaderc has been fixed for a while now.
2015-12-30 17:45:43 -08:00
Jason Ekstrand
d9c9a117dc nir/spirv: Handle execution modes as decorations
They're basically the same thing.
2015-12-30 17:45:43 -08:00
Jason Ekstrand
2b6bcaf91a nir/spirv: Separate handling of preamble from type/var/const instructions 2015-12-30 17:45:43 -08:00
Chad Versace
96d1baa88d 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.
2015-12-30 16:28:19 -08:00
Jason Ekstrand
07b4f17aaf nir/spirv/GLSL450: Add support for SAbs 2015-12-30 14:41:49 -08:00
Kenneth Graunke
e6cd0c0e1c nir/spirv: Implement IsInf and IsNan built-ins. 2015-12-30 14:10:44 -08:00
Jason Ekstrand
a7e827192b 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.
2015-12-30 14:03:47 -08:00
Kenneth Graunke
9f23116bfa Revert "nir/spirv: Update to the 1.0 GLSL.std.450 header"
This reverts commit b33f5d3889,
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.
2015-12-30 13:26:56 -08:00
Jason Ekstrand
e6fc170afb 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.
2015-12-30 11:40:38 -08:00
Jason Ekstrand
28243b2fba 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.
2015-12-30 10:37:57 -08:00
Jason Ekstrand
a0b2829f20 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.
2015-12-30 10:36:19 -08:00
Kristian Høgsberg Kristensen
91d93f7908 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.
2015-12-30 00:03:54 -08:00
Jason Ekstrand
451fe2670c nir/spirv/cfg: Handle discard 2015-12-29 19:23:25 -08:00
Jason Ekstrand
5693637faa nir/print: Handle variables with var->name == NULL 2015-12-29 16:58:00 -08:00
Jason Ekstrand
8cc55780fd nir/inline_functions: Switch to inlining everything 2015-12-29 16:58:00 -08:00
Kenneth Graunke
7cdcee3bed nir/spirv/glsl450: Enumerate more built-in opcodes. 2015-12-29 16:06:35 -08:00
Kenneth Graunke
ccd84848f0 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.
2015-12-29 15:51:14 -08:00
Jason Ekstrand
2a58cb03d0 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.
2015-12-29 15:44:39 -08:00
Jason Ekstrand
69d5838aee nir/validate: Don't validate the return deref for void function calls 2015-12-29 15:35:29 -08:00
Jason Ekstrand
51b04d03d5 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.
2015-12-29 15:29:27 -08:00
Kenneth Graunke
b4a1c9b506 nir/spirv/glsl450: Implement inverse hyperbolic trig built-ins. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
2ea111664c nir/spirv/glsl450: Implement Refract built-in. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
74529a2c50 nir/spirv/glsl450: Implement hyperbolic trig built-ins. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
0b1a436ac8 nir/spirv/glsl450: implement Reflect built-in. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
659a3623b0 nir/spirv/glsl450: Implement FaceForward built-in. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
b10af36d93 nir/spirv/glsl450: Implement SmoothStep. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
6a0fa2d758 nir/spirv/glsl450: Implement Cross built-in. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
083fd6ec2a nir/spirv/glsl450: Implement Clamp/SClamp/UClamp. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
034010924e nir/spirv/glsl450: Implement the Log built-in. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
ffc5ae7c9e nir/spirv/glsl450: Implement Exp built-in. 2015-12-29 15:27:03 -08:00
Kenneth Graunke
227e250005 nir/spirv/glsl450: Add a helper for doing fclamp(). 2015-12-29 15:27:03 -08:00
Kenneth Graunke
0f801752f2 nir/spirv/glsl450: Add helpers for calculating exp() and log(). 2015-12-29 15:27:03 -08:00
Kenneth Graunke
9c9edd1ce8 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.
2015-12-29 15:27:03 -08:00
Jason Ekstrand
5f04a61219 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.
2015-12-29 14:51:47 -08:00
Jason Ekstrand
6fa47c9c17 nir/builder: Add a nir_jump helper 2015-12-29 14:48:34 -08:00
Jason Ekstrand
37a38548d4 glsl/types.cpp: Fix function_key_compare 2015-12-29 14:32:10 -08:00
Jason Ekstrand
b33f5d3889 nir/spirv: Update to the 1.0 GLSL.std.450 header 2015-12-29 14:29:03 -08:00
Jason Ekstrand
a33fcc0fd4 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.
2015-12-29 13:53:41 -08:00
Jason Ekstrand
0119773ffc 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>
2015-12-29 13:44:05 -08:00
Jason Ekstrand
5dd4386b92 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.
2015-12-29 13:15:20 -08:00
Jason Ekstrand
e10b0e2b49 anv/pipeline: Use vs_prog_data.inputs_read when computing vb_used 2015-12-29 13:03:01 -08:00
Jason Ekstrand
0a2ab87947 nir/spirv: Move CF emit code into vtn_cfg.c 2015-12-29 12:50:31 -08:00
Jason Ekstrand
4e22cd2e32 nir/spirv: Add support for switch statements 2015-12-29 12:50:31 -08:00
Jason Ekstrand
cf555dc1c2 nir/spirv: A couple simple loop fixes 2015-12-29 12:50:31 -08:00