Commit Graph

76907 Commits

Author SHA1 Message Date
Jason Ekstrand
d9dcfafacc nir/spirv: Use nir_build_alu for alu instructions 2015-12-28 10:35:31 -08:00
Jason Ekstrand
237f2f2d8b 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>
2015-12-28 09:59:53 -08:00
Jason Ekstrand
ea77b384e8 Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in tessellation and the store_var changes that go with it.
2015-12-27 23:23:05 -08:00
Jason Ekstrand
f948767471 nir/lower_returns: Better algorithm as per connor 2015-12-27 22:50:45 -08:00
Jason Ekstrand
3489f66056 nir: Add a cursor helper for getting a cursor after any phi nodes 2015-12-27 22:50:14 -08:00
Ilia Mirkin
109c348284 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>
2015-12-27 21:33:36 -05:00
Ilia Mirkin
28e07fdd4a nv50,nvc0: add a note when converting vertex elements using CPU
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-12-27 19:49:44 -05:00
Jason Ekstrand
c60456dfaa nir/gather_info: Handle multi-slot variables in io bitfields 2015-12-24 00:47:20 -08:00
Jason Ekstrand
bbebd2de13 nir: Add a helper for getting the bitmask for a variable's location 2015-12-24 00:47:20 -08:00
Jason Ekstrand
4ff4310a78 nir/types: Expose glsl_type::count_attribute_slots() 2015-12-24 00:47:19 -08:00
Jason Ekstrand
0bc1b0fd23 nir/lower_return: Do it for real this time 2015-12-24 00:47:19 -08:00
Jason Ekstrand
e1b1d58bec nir/cf: Make extracting or re-inserting nothing a no-op 2015-12-23 23:46:04 -08:00
Jason Ekstrand
eae352e75c nir: Add a function for comparing cursors 2015-12-23 18:09:42 -08:00
Connor Abbott
41c7912d04 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>
2015-12-23 20:46:48 -05:00
Jason Ekstrand
54c870ff61 nir/spirv: Add support for undefs in vtn_ssa_value() 2015-12-23 14:14:39 -08:00
Jason Ekstrand
2e823d5754 nir/spirv: Properly handle vector times matrix 2015-12-23 13:49:56 -08:00
Jason Ekstrand
452ba4db2b nir/spirv: Create the correct type if a matrix-vector multiply produces a vector 2015-12-23 13:49:56 -08:00
Jason Ekstrand
5b30132388 nir/spirv: Fix some mem_ctx issues with create_vec 2015-12-23 13:49:56 -08:00
Jason Ekstrand
66168a798b nir/spirv: Better document vtn_ssa_value.transposed 2015-12-23 13:49:56 -08:00
Jason Ekstrand
3b391892aa anv/descriptor_set: Use anv_foreach_stage 2015-12-23 13:49:56 -08:00
Jason Ekstrand
72ceb99bab anv: Mask out invalid stages in foreach_stage 2015-12-23 13:49:56 -08:00
Jason Ekstrand
5644b1cece nir/spirv: Handle LogicalNot 2015-12-23 13:49:56 -08:00
Jason Ekstrand
6219a69589 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.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
3ab1b7afa8 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.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
af74ce5a19 spirv/nir: Handle non-vector extractions in vtn_composite_extract 2015-12-23 13:49:56 -08:00
Jason Ekstrand
79b8b42081 nir/spirv: Handle function calls 2015-12-23 13:49:56 -08:00
Jason Ekstrand
95990c96cc nir: Create the params array in function_impl_create 2015-12-23 13:49:56 -08:00
Jason Ekstrand
a7f3e113ad 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.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
ac975b73cf anv/pipeline: Run lower_returns and inline_functions after spirv_to_nir 2015-12-23 13:49:56 -08:00
Jason Ekstrand
8fba4bf79f nir: Add a function inlining pass 2015-12-23 13:49:56 -08:00
Jason Ekstrand
b21db9cea5 nir/builder: Add a copy_deref_var helper 2015-12-23 13:49:56 -08:00
Jason Ekstrand
23cfa683d5 nir: move nir_copy_var from anv_nir_builder to nir_builder 2015-12-23 13:49:56 -08:00
Jason Ekstrand
4aac03fe61 nir/clone: Add support for cloning a single function_impl
This will be useful for things such as function inlining.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
98291b8f2c 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.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
86772c2488 nir/control_flow: Handle relinking top-level blocks
This can happen if a function ends in a return instruction and you remove
the return.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
1749e667ea 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.
2015-12-23 13:49:56 -08:00
Jason Ekstrand
413a9d3517 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.
2015-12-23 13:49:56 -08:00
Anuj Phogat
52865efc41 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>
2015-12-23 13:20:45 -08:00
Jordan Justen
8326eb13f2 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>
2015-12-22 23:54:02 -08:00
Rob Clark
843cec6d3a freedreno/ir3: spelling..
Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-12-23 00:28:24 -05:00
Rob Clark
dc21747838 nir/print: print variable constant-initializers
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-12-23 00:28:01 -05:00
Kenneth Graunke
6524897606 docs: Clarify that ARB_tessellation_shader is only done on i965/gen8+.
Requested by kisak on IRC.
2015-12-22 20:14:35 -08:00
Kenneth Graunke
209d130dd1 docs: Mark ARB_tessellation_shader as done on i965/gen8+. 2015-12-22 18:50:38 -08:00
Kenneth Graunke
7738f3a988 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>
2015-12-22 17:22:14 -08:00
Kenneth Graunke
794eb9d727 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>
2015-12-22 17:22:11 -08:00
Kenneth Graunke
01b1b44d31 i965: Defer input lowering for tessellation stages until specialization.
With tessellation shaders and SSO, we won't be able to always decide on
VUE map layouts at LinkProgram time.  Unfortunately, we have to delay it
until shader specialization time.

However, uniform lowering cannot be deferred - brw_codegen_*_prog()
reads nir->num_uniforms.  Fortunately, we don't need to defer it -
uniform, system value, atomic, and sampler lowering can safely stay
where it is.  This patch moves those to brw_lower_nir()'s only caller,
renames brw_lower_nir() to brw_nir_lower_io(), and introduces calls
to that.

For non-tessellation stages, I chose to call brw_nir_lower_io() from
brw_create_nir(), so it's still done at the same time.  There's no
need to defer it, and doing it at LinkProgram time is nice.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-22 17:22:10 -08:00
Kenneth Graunke
8bc073d601 i965: Automatically create a passthrough TCS when needed.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-22 17:22:09 -08:00
Kenneth Graunke
4ec3f0f4b9 i965: Start program_string_id from 1, not 0.
This way, I can safely use brw_tcs_prog_key::program_string_id == 0
to mean "not filled out because no program exists", which avoids the
need for adding an extra boolean to that struct.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-22 17:22:08 -08:00
Kenneth Graunke
2432643e89 i965: Create and set a new brw_tcs_prog_data::outputs_written field.
When the application hasn't supplied a TCS, and we have to create one,
we need to know what VS outputs to copy to TES inputs.

To do this, we create a new program key field, and set it to the TES
InputsRead bitfield.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-22 17:22:06 -08:00
Kenneth Graunke
239a4bdcd4 i965: Upload HS push constants whenever default tess. levels change.
When using tessellation on OpenGL without a TCS, default values for
gl_TessLevelOuter/gl_TessLevelInner are provided via the API.

Core Mesa will flag ctx->DriverFlags.NewDefaultTessLevels whenever those
values change.  We add a corresponding BRW_NEW_DEFAULT_TESS_LEVELS flag
and hook it up to HS push constants (which will be used to upload these
default values to the autogenerated TCS).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-12-22 17:22:05 -08:00