Commit graph

74852 commits

Author SHA1 Message Date
Jason Ekstrand
8bcba083db anv: Update the README
Adds a note that we support SPIR-V revision 32.  Also, we now support
geometry shaders.
2015-10-28 12:30:34 -07:00
Jason Ekstrand
12feda0c09 Revert "nir/intrinsic: Allow up to four indices"
This reverts commit 5eccd0b4b9.

This was only needed for the store_ssbo_vk_indirect intrinsic
2015-10-27 13:44:14 -07:00
Jason Ekstrand
423e7a55cc Revert "nir/intrinsics: Add new Vulkan load/store intrinsics"
This reverts commit 24bcc89c8f.

Now that we have the new vulkan_resource_index intrinsic, these variants of
the classic UBO/SSBO instrinsics aren't needed.
2015-10-27 13:43:25 -07:00
Jason Ekstrand
a6be53223e anv/nir: Work with the new vulkan_resource_index intrinsic 2015-10-27 13:42:51 -07:00
Jason Ekstrand
3d44b3aaa6 nir/spirv: Use the new vulkan_resource_index intrinsic
This is instead of using the _vk versions of UBO/SSBO load/store intrinsics
2015-10-27 13:41:59 -07:00
Jason Ekstrand
800a9706f0 nir: Add a vulkan_resource_index intrinsic 2015-10-27 13:41:08 -07:00
Jason Ekstrand
37b6afb3d9 Add a todo comment about intput_slots_valid in the FS shader key 2015-10-26 16:25:02 -07:00
Jason Ekstrand
ab6ed2e1ac anv/gen8_pipeline: Emit a real 3DSTATE_SBE_SWIZ packet 2015-10-26 16:25:02 -07:00
Jason Ekstrand
9006e555ce anv/pipeline: Bump the size of the pipeline batch to accomodate GS
The 1k batch size wasn't big enough for a full pipeline setup including
geometry shaders.  Some day we should make it dynamic.
2015-10-23 16:50:31 -07:00
Jason Ekstrand
4c59ee808f anv/gen8_pipeline: Various 3DSTATE_GS fixes 2015-10-23 16:49:26 -07:00
Jason Ekstrand
8aba8cf513 anv/pipeline: Use separate-shader 2015-10-23 10:53:00 -07:00
Jason Ekstrand
760c4b894d anv/pipeline: Pull separate_shader from NIR for vue map setup 2015-10-23 10:48:52 -07:00
Jason Ekstrand
ee8c67abe8 nir/spirv: Add support for builtins in arrays 2015-10-22 17:58:20 -07:00
Jason Ekstrand
9fe907ec79 nir/spirv: Make the builtins array distinguish between in and out 2015-10-22 17:54:24 -07:00
Jason Ekstrand
d11ea76168 nir/spirv: Make vtn_get_builtin_location smarter
Instead of just stomping on the mode, it now validates asserts that the
previously set mode is correct and only changes it if needed.  We need to
do this because, in geometry shaders, there are some builtins that can be
either an input or an output depending on context.  We can get that
information from the SPIR-V source but we can't throw it away.
2015-10-22 17:45:41 -07:00
Jason Ekstrand
9abef3e817 nir/spirv: Make get_builtin_variable take a nir_variable_mode
We'll want this in a moment for validation but, for now, it just gets
stompped by get_builtin_variable.
2015-10-22 17:28:25 -07:00
Jason Ekstrand
2ce6636c75 nir/spirv: Remove the vtn_type argument from _vtn_variable_load/store
Now that builtins are handled in deref chains, we don't really need this
anymore.
2015-10-22 16:56:42 -07:00
Jason Ekstrand
f23d951083 nir/validate: Add better validation of load/store types 2015-10-22 16:53:01 -07:00
Jason Ekstrand
82c579e314 anv/gen8: Set the correct maximum number of GS threads
This equation was pulled from mesa gen8_gs_state.c
2015-10-21 21:51:18 -07:00
Jason Ekstrand
d0e8c78407 anv/pipeline: set the gs_vertex_count in compile_gs
This was missed in the initial enabling commit.
2015-10-21 21:50:47 -07:00
Jason Ekstrand
8af2a09956 anv/pipeline: Make the has_push_constants computation more accurate
The computation used to only look for uniforms that weren't samplers.  Now
it also filters out arrays of samplers.
2015-10-21 21:50:16 -07:00
Jason Ekstrand
0329a252bd nir/spirv: Add defaults for GS input/output primitive types
These are supposed to be specified in the SPIR-V source as SpvExecutionMode
enums but glslang isn't giving them to us.  A bug has been filed:

https://github.com/KhronosGroup/glslang/issues/84
2015-10-21 21:46:22 -07:00
Jason Ekstrand
4032549885 i965/vec4: Handle returns at the end of functions 2015-10-21 20:42:23 -07:00
Jason Ekstrand
5f29dacda2 i965: Move get_hw_prim_for_gl_prim to brw_util.c 2015-10-21 20:40:28 -07:00
Jason Ekstrand
ea23cb3543 nir/spirv: Add capabilities and decorations for basic geometry shaders 2015-10-21 20:36:25 -07:00
Jason Ekstrand
d538fe849d anv/pipeline: Add back basic geometry shader support
Now that we've done the refactoring upstream, it's much easier to to get
hooked up.  We haven't tested things well enough to know that we're setting
up the GPU state correctly for them yet but at least we can compile them now.
2015-10-21 18:45:48 -07:00
Jason Ekstrand
164abff0c0 nir/spirv: Add support for more CS system values 2015-10-21 18:39:06 -07:00
Jason Ekstrand
5790ee2bbb nir/spirv: Add support for various barrier type instructions 2015-10-21 18:17:11 -07:00
Jason Ekstrand
3d35e4361f Fix a couple of dereferences 2015-10-21 18:16:50 -07:00
Jason Ekstrand
55a7ee730c spirv/nir: Add more stage asserts 2015-10-21 18:00:05 -07:00
Jason Ekstrand
27393c8630 nir/spirv: Add support for GS metadata 2015-10-21 17:58:34 -07:00
Jason Ekstrand
a8ffd6e72c nir/gather_info: Add more info for geometry shaders 2015-10-21 17:42:47 -07:00
Jason Ekstrand
fed60e3c73 Merge remote-tracking branch 'mesa-public/master' into vulkan 2015-10-21 17:40:13 -07:00
Kenneth Graunke
48c76eae8e i965: Implement gl_InvocationID.
It's stored in bits 31:27 of g1 (along with the URB handles).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:58 -07:00
Kenneth Graunke
c5ae34f38f i965: Implement nir_intrinsic_load_primitive.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:56 -07:00
Kenneth Graunke
b3ebf03b84 i965: Add a fs_visitor constructor that takes a brw_gs_compile.
Unlike the vs/wm structs, brw_gs_compile is actually useful: it contains
the input VUE map and information about the control data headers.
Passing this in allows us to share that code in brw_gs.c, and calculate
them before deciding on vec4 vs. scalar mode, as it's independent of
that choice.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:54 -07:00
Kenneth Graunke
55dfd39b5f i965: Add a brw->scalar_gs flag controlled by INTEL_SCALAR_GS=1.
This patch introduces a brw->scalar_gs flag, similar to brw->scalar_vs,
which controls whether or not to use SIMD8 geometry shaders.

For now, we control it via a new environment variable, INTEL_SCALAR_GS.
This provides a convenient way to try it out.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:53 -07:00
Kenneth Graunke
ac0a33666b i965: Make emit_urb_writes() reserve space for GS header information.
Geometry shaders have additional header data at the beginning of their
output URB entries.  Shaders that use EndPrimitive() or multiple streams
have a control data header; shaders with a dynamic vertex count have an
additional vec4 slot to hold the 32-bit vertex count (and 96 bits of
padding).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:52 -07:00
Kenneth Graunke
cb755996d9 i965: Make emit_urb_writes() only set EOT for the VS.
The GS will emit a bunch of vertices, and we don't want to do an EOT
prematurely.  We'll emit GS_OPCODE_THREAD_END when we want to terminate
the thread.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:50 -07:00
Kenneth Graunke
6ae419b94d i965: Make fs_visitor::emit_urb_writes reusable for scalar GS.
GS doesn't have ClampVertexColor, and we don't want to go through VS
structures.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:49 -07:00
Kenneth Graunke
72d84ae7ce i965: Introduce a brw_vue_prog_data::include_vue_handles flag.
Tessellation shaders and SIMD8 geometry shaders may need to resort to
the pull model for inputs at times.  When set, the state upload code
will tell the hardware to provide URB handles for input data.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:48 -07:00
Kenneth Graunke
ac98888afd i965: Introduce a new SHADER_OPCODE_URB_READ_SIMD8 opcode.
In scalar mode, geometry shader inputs can easily take up hundreds of
registers.  This makes pushing VUE entries impractical; we'll need to
resort to the pull model in some cases.

To support this, we introduce a new opcode corresponding to the "URB
Read SIMD8" message.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:46 -07:00
Kenneth Graunke
bea7522782 i965: Introduce new SHADER_OPCODE_URB_WRITE_SIMD8_MASKED/PER_SLOT opcodes.
In the vec4 backend, we have a vec4_instruction::urb_write_flags field.
There are many kinds of flags for SIMD4x2 messages.

However, there are really only two (per-slot offset, use channel masks)
for SIMD8 messages.  Rather than adding a boolean flag for per-slot
offsets (polluting all instructions), I decided to just make three new
opcodes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2015-10-21 14:27:41 -07:00
Jason Ekstrand
0e57694745 i965/gs: Do prog_data setup and other calculations in brw_compile_gs
This commit moves the large pile of setup calculations we have to do for
geometry shaders out of brw_gs_emit and into brw_compile_gs.  This has a
couple of nice implications.  First, it's less work that the caller of
brw_compile_gs has to do.  Second, it's consistent with the vertex and
fragment stages.  Finally, it allows us to put brw_gs_compile back behind
the API boundary where it belongs.

v2 (Jason Ekstrand):
 - Pull the changes to use nir info into a separate patch
 - Put brw_gs_compile into brw_shader.h rather than brw_vec4_gs_visitor.h
   so that we can use it for scalar GS.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00
Jason Ekstrand
f3bc73073a i965/gs: Use NIR info for setting up prog_data
Previously, we were pulling bits from GL data structures in order to set up
the prog_data.  However, in this brave new world of NIR, we want to be
pulling it out of the NIR shader whenever possible.  This way, we can move
all this setup code into brw_compile_gs without depending on the old GL
stuff.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00
Jason Ekstrand
fac9b21e03 i965/gs: Pull prog_data out of brw_gs_compile
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00
Jason Ekstrand
6ac2bbec16 i965/gs: Use NIR instead of the brw_geometry_program for GS metadata
With this, we can remove the geometry program from brw_gs_compile.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00
Jason Ekstrand
72148de217 i965/gs: Move the mem_ctx argument to brw_compile_gs
This makes it better match the other brw_compile_* functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00
Jason Ekstrand
8e8b527b27 i965/gs: Set static_vertex_count unconditionally on GEN8+
We always have NIR, so there's no reason for the check.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00
Jason Ekstrand
2686477d37 nir: Constify nir_gs_count_vertices
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-10-21 14:20:32 -07:00