mesa.git
9 years agonvc0: support MAX_SHADER_PATCH_VARYINGS
Ilia Mirkin [Sun, 21 Jun 2015 17:35:53 +0000 (13:35 -0400)]
nvc0: support MAX_SHADER_PATCH_VARYINGS

9 years agonvc0: preliminary tess support
Ilia Mirkin [Sat, 12 Jul 2014 19:40:14 +0000 (15:40 -0400)]
nvc0: preliminary tess support

Uncomment the various functionality that was already there and add in
obvious missing bits that parallel vp/gp/fp functionality.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agodocs/GL3.txt: update ARB_shader_subroutine status.
Dave Airlie [Wed, 22 Jul 2015 01:04:52 +0000 (11:04 +1000)]
docs/GL3.txt: update ARB_shader_subroutine status.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agost/mesa: enable shader subroutine
Dave Airlie [Mon, 20 Apr 2015 00:30:53 +0000 (10:30 +1000)]
st/mesa: enable shader subroutine

since this touches drivers, only enable it on gallium
for now for drivers reporting GLSL 1.30 or above.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agost/mesa: add subroutine bits (v1.1)
Dave Airlie [Mon, 20 Apr 2015 00:29:42 +0000 (10:29 +1000)]
st/mesa: add subroutine bits (v1.1)

Just add support for the subroutine type to the
glsl->tgsi convertor.

v1.1: add subroutine to int support.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: fill out the ARB_shader_subroutine APIs
Dave Airlie [Mon, 20 Apr 2015 00:29:12 +0000 (10:29 +1000)]
mesa: fill out the ARB_shader_subroutine APIs

This fleshes out the APIs, using the program resource
APIs where they should match.

It also sets the default values to valid subroutines.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoprogram: add subroutine uniform support (v1.1)
Dave Airlie [Mon, 20 Apr 2015 00:28:40 +0000 (10:28 +1000)]
program: add subroutine uniform support (v1.1)

Add support for the subroutine uniform type ir->mesa.cpp

v1.1: add subroutine to int to switch

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoprogram_resource: add subroutine support (v3.1)
Dave Airlie [Mon, 20 Apr 2015 00:27:58 +0000 (10:27 +1000)]
program_resource: add subroutine support (v3.1)

This fleshes out the ARB_program_query support for the
APIs that ARB_shader_subroutine introduces, leaving
some TODOs for later addition.

v2: reworked for lots of the ARB_program_interface_query
entry points and tests
v3: use common function to test for subroutine support
v3.1: add tess, fix missing breaks

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add uniform and program resource support (v2)
Dave Airlie [Mon, 20 Apr 2015 00:27:36 +0000 (10:27 +1000)]
glsl: add uniform and program resource support (v2)

This adds linker support for subroutine uniforms, they
have some subtle differences from real uniforms, we also hide
them and they are given internal uniform names.

This also adds the subroutine locations and subroutine uniforms
to the program resource tracking for later use.

v1.1: drop is_subroutine_def

v2: handle explicit location properly, ARB_explicit_location
has a lot of language for subroutine shaders.
Calculate a link time the number of compatible subroutines
for a uniform, to make program resource easier later.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa/mtypes: add gl_subroutine_function and uniform storage to shader (v2)
Dave Airlie [Tue, 21 Jul 2015 04:59:01 +0000 (14:59 +1000)]
mesa/mtypes: add gl_subroutine_function and uniform storage to shader (v2)

This adds the necessary storage for subroutine info to gl_shader.

v2: add comments, rename one member
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl/ir: add subroutine lowering pass (v2.3)
Dave Airlie [Thu, 23 Apr 2015 03:34:14 +0000 (13:34 +1000)]
glsl/ir: add subroutine lowering pass (v2.3)

This lowers the enhanced ir_call using the lookaside table
of subroutines into an if ladder. This initially was done
at the AST level but it caused some ordering issues so a separate
pass was required.

v2: clone return value derefs.
v2.1: update for subroutine->int convert.
v2.2: add a clone for the array index

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add ast/parser support for subroutine parsing storage (v3.2)
Dave Airlie [Mon, 1 Jun 2015 00:55:47 +0000 (10:55 +1000)]
glsl: add ast/parser support for subroutine parsing storage (v3.2)

This is the guts of the GLSL parser and AST support for
shader subroutines.

The code creates a subroutine type in the parser, and
uses that there to validate the identifiers. The parser
also distinguishes between subroutine types/function prototypes
/uniforms and subroutine defintions for functions.

Then in the AST conversion it recreates the types, and
stores the subroutine definition info or subroutine info
into the ir_function along with a side lookup table in
the parser state. It also converts subroutine calls into
the enhanced ir_call.

v2: move to handling method calls in
function handling not in field selection.
v3: merge Chris's previous parser patches in here, to
make it clearer what's changed in one place.
v3.1: add more documentation, drop unused include
v3.2: drop is_subroutine_def

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl/ir: allow ir_call to handle subroutine calling
Dave Airlie [Fri, 24 Apr 2015 00:47:03 +0000 (10:47 +1000)]
glsl/ir: allow ir_call to handle subroutine calling

This adds a ir_variable which contains the subroutine uniform
and an array rvalue for the deref of that uniform, these
are stored in the ir_call and lowered later.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl/ir: add subroutine information storage to ir_function (v1.1)
Dave Airlie [Mon, 20 Apr 2015 00:22:57 +0000 (10:22 +1000)]
glsl/ir: add subroutine information storage to ir_function (v1.1)

We need to store two sets of info into the ir_function,
if this is a function definition with a subroutine list
(subroutine_def) or if it a subroutine prototype.

v1.1: add some more documentation.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: add function to check if shader subroutines are enabled.
Dave Airlie [Thu, 23 Jul 2015 00:23:36 +0000 (10:23 +1000)]
mesa: add function to check if shader subroutines are enabled.

This checks if core profile and shader subroutine extension
is enabled.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: add inline conversion functions for ARB_shader_subroutine (v2)
Dave Airlie [Mon, 20 Apr 2015 00:20:06 +0000 (10:20 +1000)]
mesa: add inline conversion functions for ARB_shader_subroutine (v2)

This handles converting the shader stages to the internal
prefix along with the program resource interfaces.

v2: add tess support

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: don't eliminate subroutine types.
Dave Airlie [Tue, 21 Jul 2015 04:52:40 +0000 (14:52 +1000)]
glsl: don't eliminate subroutine types.

This stops dead code from removing subroutines types,
we need these for the queries to work properly.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl/types: add new subroutine type (v3.2)
Dave Airlie [Mon, 20 Apr 2015 00:16:55 +0000 (10:16 +1000)]
glsl/types: add new subroutine type (v3.2)

This type will be used to store the name of subroutine types

as in subroutine void myfunc(void);
will store myfunc into a subroutine type.

This is required to the parser can identify a subroutine
type in a uniform decleration as a valid type, and also for
looking up the type later.

Also add contains_subroutine method.

v2: handle subroutine to int comparisons, needed
for lowering pass.
v3: do subroutine to int with it's own IR
operation to avoid hacking on asserts (Kayden)
v3.1: fix warnings in this patch, fix nir,
fix tgsi
v3.2: fixup tests

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
tests: fix warnings

9 years agoglsl: Make `subroutine` a reserved keyword
Chris Forbes [Sun, 10 Aug 2014 09:38:23 +0000 (21:38 +1200)]
glsl: Make `subroutine` a reserved keyword

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodispatch_sanity: add shader subroutine to fix make check
Dave Airlie [Thu, 23 Jul 2015 00:49:12 +0000 (10:49 +1000)]
dispatch_sanity: add shader subroutine to fix make check

Add the shader subroutine to the core only API list,
and fixup dispatch_sanity to suit.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: Add extension plumbing and define for ARB_shader_subroutine
Chris Forbes [Sun, 10 Aug 2014 09:31:06 +0000 (21:31 +1200)]
glsl: Add extension plumbing and define for ARB_shader_subroutine

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: Add glGet support for ARB_shader_subroutine implementation limits
Chris Forbes [Sun, 10 Aug 2014 09:07:33 +0000 (21:07 +1200)]
mesa: Add glGet support for ARB_shader_subroutine implementation limits

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: Add extension tracking for arb_shader_subroutine (v2)
Chris Forbes [Sun, 10 Aug 2014 08:43:45 +0000 (20:43 +1200)]
mesa: Add extension tracking for arb_shader_subroutine (v2)

v2: [airlied]: merge version check update.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglapi: Add ARB_shader_subroutine functions and enums (v2)
Chris Forbes [Sun, 10 Aug 2014 08:38:53 +0000 (20:38 +1200)]
glapi: Add ARB_shader_subroutine functions and enums (v2)

v2: fix output="true" and LENGTH typo

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agomesa: Add stubs for ARB_shader_subroutine entrypoints
Chris Forbes [Sun, 10 Aug 2014 09:00:34 +0000 (21:00 +1200)]
mesa: Add stubs for ARB_shader_subroutine entrypoints

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agodispatch_sanity.cpp: remove commented out tess entries
Dave Airlie [Thu, 23 Jul 2015 00:39:47 +0000 (10:39 +1000)]
dispatch_sanity.cpp: remove commented out tess entries

These entries were put in the GL4.0 section, so removed the commented
out ones.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl/tests: fix varying_test since tess changes.
Dave Airlie [Thu, 23 Jul 2015 01:13:36 +0000 (11:13 +1000)]
glsl/tests: fix varying_test since tess changes.

This fixes make check since the tess changes.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965: fix warning since tess merge.
Dave Airlie [Thu, 23 Jul 2015 00:39:26 +0000 (10:39 +1000)]
i965: fix warning since tess merge.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoradeonsi: enable tessellation, update GL3.txt & release notes
Marek Olšák [Sun, 22 Feb 2015 17:46:53 +0000 (18:46 +0100)]
radeonsi: enable tessellation, update GL3.txt & release notes

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add scratch buffer support for tessellation shaders
Marek Olšák [Mon, 18 May 2015 12:41:35 +0000 (14:41 +0200)]
radeonsi: add scratch buffer support for tessellation shaders

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: update invariant registers for tessellation
Marek Olšák [Sun, 22 Feb 2015 17:16:02 +0000 (18:16 +0100)]
radeonsi: update invariant registers for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add assertions into draw_vbo and check tessellation
Marek Olšák [Sun, 22 Feb 2015 17:10:38 +0000 (18:10 +0100)]
radeonsi: add assertions into draw_vbo and check tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: set the rasterization primitive type for tessellation
Marek Olšák [Sun, 22 Feb 2015 17:09:18 +0000 (18:09 +0100)]
radeonsi: set the rasterization primitive type for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: set VGT_LS_HS_CONFIG for tessellation
Marek Olšák [Sun, 22 Feb 2015 17:07:51 +0000 (18:07 +0100)]
radeonsi: set VGT_LS_HS_CONFIG for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: update IA_MULTI_VGT_PARAM for tessellation
Marek Olšák [Sun, 22 Feb 2015 17:06:34 +0000 (18:06 +0100)]
radeonsi: update IA_MULTI_VGT_PARAM for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add derived tessellation state
Marek Olšák [Sun, 22 Feb 2015 17:01:18 +0000 (18:01 +0100)]
radeonsi: add derived tessellation state

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: implement a fixed-function tessellation control shader and its state
Marek Olšák [Sun, 17 May 2015 23:59:37 +0000 (01:59 +0200)]
radeonsi: implement a fixed-function tessellation control shader and its state

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: set up a ring buffer for tessellation factors
Marek Olšák [Sun, 22 Feb 2015 16:25:37 +0000 (17:25 +0100)]
radeonsi: set up a ring buffer for tessellation factors

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add tessellation shader states
Marek Olšák [Sun, 22 Feb 2015 16:07:34 +0000 (17:07 +0100)]
radeonsi: add tessellation shader states

ls_rsrc# will be emitted as part of the derived tessellation state

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: update si_get_vs_info and si_get_vs_state for tessellation
Marek Olšák [Sun, 22 Feb 2015 15:07:04 +0000 (16:07 +0100)]
radeonsi: update si_get_vs_info and si_get_vs_state for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add shader code generation for tessellation
Marek Olšák [Sun, 22 Feb 2015 14:09:35 +0000 (15:09 +0100)]
radeonsi: add shader code generation for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: implement TGSI_OPCODE_BARRIER
Marek Olšák [Mon, 6 Oct 2014 11:19:53 +0000 (13:19 +0200)]
radeonsi: implement TGSI_OPCODE_BARRIER

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: program VGT_SHADER_STAGES_EN for tessellation
Marek Olšák [Thu, 18 Sep 2014 22:16:12 +0000 (00:16 +0200)]
radeonsi: program VGT_SHADER_STAGES_EN for tessellation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add translation of PATCH primitives
Marek Olšák [Thu, 18 Sep 2014 21:39:44 +0000 (23:39 +0200)]
radeonsi: add translation of PATCH primitives

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add support for tessellation shader resources and samplers
Marek Olšák [Thu, 18 Sep 2014 20:54:40 +0000 (22:54 +0200)]
radeonsi: add support for tessellation shader resources and samplers

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add code for creating, binding and destroying tessellation shaders
Marek Olšák [Thu, 18 Sep 2014 20:50:52 +0000 (22:50 +0200)]
radeonsi: add code for creating, binding and destroying tessellation shaders

This doesn't do anything yet.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add debug flags for dumping tessellation shaders
Marek Olšák [Thu, 18 Sep 2014 20:26:02 +0000 (22:26 +0200)]
radeonsi: add debug flags for dumping tessellation shaders

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: rework how shader pointers to descriptors are set
Marek Olšák [Mon, 15 Sep 2014 21:34:28 +0000 (23:34 +0200)]
radeonsi: rework how shader pointers to descriptors are set

This is mainly needed for tessellation where a VS can be bound as VS, ES,
or LS, and TES (tess. evaluationshader) can be bound as VS or ES or neither.
Therefore we need the ability to move pointers to descriptors between
shaders arbitrarily.

The idea is that the context has a mapping from PIPE_SHADER_x to
SPI_SHADER_USER_DATA_x. After a shader is enabled or disabled,
si_shader_change_notify should be called to update this mapping accordingly.

There is a dirty flag for each shader pointer, but only one emit function
for all pointers in the whole context, whose code and logic is separated
from descriptors.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: rename build_streamout_store -> build_tbuffer_store_dwords
Marek Olšák [Sun, 22 Feb 2015 13:54:54 +0000 (14:54 +0100)]
radeonsi: rename build_streamout_store -> build_tbuffer_store_dwords

It will be reused later.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: separate primitive ID computation
Marek Olšák [Sun, 22 Feb 2015 13:46:20 +0000 (14:46 +0100)]
radeonsi: separate primitive ID computation

Support for new shader stages will be added here.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: move declaring streamout parameters to its own function
Marek Olšák [Sun, 22 Feb 2015 13:33:49 +0000 (14:33 +0100)]
radeonsi: move declaring streamout parameters to its own function

It will be reused later.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: make ES2GS offset sgpr location dynamic
Marek Olšák [Sun, 5 Oct 2014 22:17:42 +0000 (00:17 +0200)]
radeonsi: make ES2GS offset sgpr location dynamic

It will have a different location in the tessellation evaluation shader.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallium/radeon: expose emit_fetch
Marek Olšák [Tue, 3 Mar 2015 14:11:27 +0000 (15:11 +0100)]
gallium/radeon: expose emit_fetch

Radeonsi will use this.

9 years agogallium/radeon: expose LLVM functions implementing emit_store
Marek Olšák [Sun, 5 Oct 2014 18:20:18 +0000 (20:20 +0200)]
gallium/radeon: expose LLVM functions implementing emit_store

emit_store will be reimplemented for tessellation control shader outputs
where only radeon_llvm_saturate will be used, but radeonsi will want to
fall back to radeon_llvm_emit_store for other register types.

This exposes both functions.

9 years agost/mesa: enable tessellation if the driver supports it
Marek Olšák [Sun, 22 Feb 2015 18:50:42 +0000 (19:50 +0100)]
st/mesa: enable tessellation if the driver supports it

9 years agost/mesa: set default tessellation levels
Marek Olšák [Mon, 18 May 2015 10:49:10 +0000 (12:49 +0200)]
st/mesa: set default tessellation levels

9 years agost/mesa: add barrier support
Ilia Mirkin [Sun, 7 Sep 2014 22:36:06 +0000 (18:36 -0400)]
st/mesa: add barrier support

9 years agost/mesa: disable copy propagation for tessellation shaders
Ilia Mirkin [Tue, 22 Jul 2014 00:45:29 +0000 (20:45 -0400)]
st/mesa: disable copy propagation for tessellation shaders

This can't work due to shared inputs and outputs and barriers.

9 years agost/mesa: set vertices_per_patch when drawing
Ilia Mirkin [Mon, 21 Jul 2014 22:49:40 +0000 (18:49 -0400)]
st/mesa: set vertices_per_patch when drawing

9 years agost/mesa: add 2d indexing support to outputs
Ilia Mirkin [Sun, 13 Jul 2014 19:02:53 +0000 (15:02 -0400)]
st/mesa: add 2d indexing support to outputs

9 years agost/mesa: handle tessellation 2D varyings correctly
Marek Olšák [Sun, 22 Feb 2015 19:47:31 +0000 (20:47 +0100)]
st/mesa: handle tessellation 2D varyings correctly

9 years agost/mesa: lower gl_TessLevel from float[] to vecn
Ilia Mirkin [Sun, 13 Jul 2014 00:09:06 +0000 (20:09 -0400)]
st/mesa: lower gl_TessLevel from float[] to vecn

9 years agost/mesa: query shader CAPs for tessellation
Ilia Mirkin [Sat, 12 Jul 2014 21:28:24 +0000 (17:28 -0400)]
st/mesa: query shader CAPs for tessellation

The MaxTessPatchComponents query added by Marek.

9 years agost/mesa: add texture updates for tessellation programs
Ilia Mirkin [Sat, 12 Jul 2014 21:15:51 +0000 (17:15 -0400)]
st/mesa: add texture updates for tessellation programs

9 years agost/mesa: handle constbufs/ubos for tessellation shaders
Ilia Mirkin [Sat, 12 Jul 2014 21:10:59 +0000 (17:10 -0400)]
st/mesa: handle constbufs/ubos for tessellation shaders

9 years agost/mesa: add conversion for tessellation shaders
Marek Olšák [Sun, 22 Feb 2015 19:44:39 +0000 (20:44 +0100)]
st/mesa: add conversion for tessellation shaders

Based on code from Ilia Mirkin <imirkin@alum.mit.edu>.

9 years agost/mesa: add tessellation shader states
Ilia Mirkin [Sat, 12 Jul 2014 02:11:21 +0000 (22:11 -0400)]
st/mesa: add tessellation shader states

additional fixes by Marek

9 years agomesa: implement GL_IS_PER_PATCH
Marek Olšák [Tue, 16 Jun 2015 11:07:04 +0000 (13:07 +0200)]
mesa: implement GL_IS_PER_PATCH

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: use separate varying slots for patch varyings
Marek Olšák [Sat, 13 Jun 2015 11:50:12 +0000 (13:50 +0200)]
glsl: use separate varying slots for patch varyings

The idea is to allow 32 normal varyings and 32 patch varyings,
a total of 64. Previously, only a total of 32 was allowed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: fix locations of 2-dimensional varyings without varying packing (v2)
Marek Olšák [Sat, 16 May 2015 19:12:54 +0000 (21:12 +0200)]
glsl: fix locations of 2-dimensional varyings without varying packing (v2)

v2: renamed producer/consumer_type -> producer/consumer_stage

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: don't demote tess control shader outputs
Marek Olšák [Fri, 3 Oct 2014 22:13:42 +0000 (00:13 +0200)]
glsl: don't demote tess control shader outputs

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: disable varying packing between tessellation shaders
Marek Olšák [Fri, 3 Oct 2014 22:15:33 +0000 (00:15 +0200)]
glsl: disable varying packing between tessellation shaders

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: allow indexing of gl_out with a non-const if length isn't known
Marek Olšák [Tue, 16 Jun 2015 00:43:55 +0000 (02:43 +0200)]
glsl: allow indexing of gl_out with a non-const if length isn't known

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: allow redeclaration of TCS gl_out[]
Chris Forbes [Fri, 12 Sep 2014 09:27:26 +0000 (21:27 +1200)]
glsl: allow redeclaration of TCS gl_out[]

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: validate restrictions on use of barrier()
Chris Forbes [Sun, 7 Sep 2014 09:42:50 +0000 (21:42 +1200)]
glsl: validate restrictions on use of barrier()

With the exception of always-taken switch cases (which are
indistinguishable from straight line code in our IR), this
disallows use of the builtin barrier() function in all the
places it may not appear.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: allow barrier() in tessellation control shaders
Marek Olšák [Sun, 14 Jun 2015 18:14:22 +0000 (20:14 +0200)]
glsl: allow barrier() in tessellation control shaders

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: analyze TES usage of gl_ClipDistance
Chris Forbes [Tue, 9 Sep 2014 07:25:02 +0000 (19:25 +1200)]
glsl: analyze TES usage of gl_ClipDistance

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: push vertex count determination down one level
Chris Forbes [Sun, 7 Sep 2014 06:19:15 +0000 (18:19 +1200)]
glsl: push vertex count determination down one level

We have the prog here, so we don't need the caller to work this out for
us.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: pass shader stage to lower_output_reads and handle tess control
Ilia Mirkin [Tue, 22 Jul 2014 01:59:37 +0000 (21:59 -0400)]
glsl: pass shader stage to lower_output_reads and handle tess control

Tessellation control outputs can be read in directly without first
having been written. Accessing these will require some special logic
anyways, so just let them through.

V2: Never lower tess control output reads, whether patch or not -- both
can be read back by other threads.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: properly size unsized arrays in tess stages
Chris Forbes [Mon, 1 Sep 2014 08:48:09 +0000 (20:48 +1200)]
glsl: properly size unsized arrays in tess stages

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: restrict indexing for writes to TCS outputs to gl_InvocationID
Chris Forbes [Sun, 31 Aug 2014 07:35:46 +0000 (19:35 +1200)]
glsl: restrict indexing for writes to TCS outputs to gl_InvocationID

Marek: handle ir_swizzle

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add builtin constants for ARB_tessellation_shader
Chris Forbes [Sun, 17 Aug 2014 10:37:16 +0000 (22:37 +1200)]
glsl: add builtin constants for ARB_tessellation_shader

Limits from other extensions added by Marek.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: allow nonconst indexing of arrays where we can work out an implicit size
Chris Forbes [Sun, 24 Aug 2014 04:46:40 +0000 (16:46 +1200)]
glsl: allow nonconst indexing of arrays where we can work out an implicit size

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: relax unsized input/output block arrays for TCS/TES
Chris Forbes [Mon, 18 Aug 2014 09:51:46 +0000 (21:51 +1200)]
glsl: relax unsized input/output block arrays for TCS/TES

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add the tessellation extension to the list for the "layout" qualifier
Marek Olšák [Mon, 15 Jun 2015 23:32:28 +0000 (01:32 +0200)]
glsl: add the tessellation extension to the list for the "layout" qualifier

This is technically not needed, but it makes the compiler return a better
error message if tessellation is used with GLSL < 1.50.

Instead of:
    error: syntax error, unexpected NEW_IDENTIFIER, expecting $end
It returns:
    error: #version 150 layout qualifier `triangles' used

And the tessellation spec says:
    OpenGL 3.2 and GLSL 1.50 are required.
So it makes perfect sense.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: don't lower variable indexing on non-patch tessellation inputs/outputs
Marek Olšák [Thu, 28 May 2015 21:24:08 +0000 (23:24 +0200)]
glsl: don't lower variable indexing on non-patch tessellation inputs/outputs

There is no way to lower them, because the array sizes are unknown
at compile time.

Based on a patch from: Fabian Bieler <fabianbieler@fastmail.fm>

v2: add comments

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: make stand-alone compiler work with tessellation shaders.
Fabian Bieler [Thu, 20 Mar 2014 21:34:42 +0000 (22:34 +0100)]
glsl: make stand-alone compiler work with tessellation shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add "in" or "out" prefix to name when flattening interface blocks
Fabian Bieler [Thu, 20 Mar 2014 21:37:37 +0000 (22:37 +0100)]
glsl: add "in" or "out" prefix to name when flattening interface blocks

This is to prevent a name conflict in tessellation shaders built-in interface
blocks.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: lower gl_TessLevel* from float[n] to vecn.
Fabian Bieler [Mon, 10 Mar 2014 16:55:36 +0000 (17:55 +0100)]
glsl: lower gl_TessLevel* from float[n] to vecn.

Similar to gl_ClipDistance -> gl_ClipDistanceMESA

v2: - renamed is_mesa_var to lowered_builtin_array_variable
    - moved LowerTessLevel into gl_constants
    - cosmetic changes in lower_tess_level.cpp

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: make lower_clip_distance work with tessellation shaders.
Fabian Bieler [Thu, 20 Mar 2014 21:33:05 +0000 (22:33 +0100)]
glsl: make lower_clip_distance work with tessellation shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: allow linking of tessellation shaders.
Chris Forbes [Sun, 21 Sep 2014 01:33:14 +0000 (13:33 +1200)]
glsl: allow linking of tessellation shaders.

Marek: require a tess eval shader if a tess control shader is present

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add the patch in/out qualifier (v2)
Fabian Bieler [Wed, 5 Mar 2014 12:43:17 +0000 (13:43 +0100)]
glsl: add the patch in/out qualifier (v2)

v2: Dropped some unrelated reordering in glsl_parser.yy as Ken suggested.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add tessellation shader defines and built-in variables.
Fabian Bieler [Thu, 20 Mar 2014 21:41:40 +0000 (22:41 +0100)]
glsl: add tessellation shader defines and built-in variables.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add tessellation shader parsing support (v2)
Fabian Bieler [Thu, 20 Mar 2014 21:44:43 +0000 (22:44 +0100)]
glsl: add tessellation shader parsing support (v2)

v2: Fixed things that Ken suggested.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: don't allow drawing with tess ctrl shader and without tess eval shader
Marek Olšák [Thu, 28 May 2015 20:08:55 +0000 (22:08 +0200)]
mesa: don't allow drawing with tess ctrl shader and without tess eval shader

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: handle tessellation shaders in use_shader_program
Marek Olšák [Wed, 22 Apr 2015 21:05:34 +0000 (23:05 +0200)]
mesa: handle tessellation shaders in use_shader_program

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: add program interface queries for tessellation shaders
Marek Olšák [Sat, 13 Jun 2015 23:21:02 +0000 (01:21 +0200)]
mesa: add program interface queries for tessellation shaders

Based on a patch by Chris Forbes <chrisf@ijw.co.nz>.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: add misc tessellation shader stuff
Fabian Bieler [Fri, 7 Mar 2014 09:39:39 +0000 (10:39 +0100)]
mesa: add misc tessellation shader stuff

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: add tessellation shader getters (v3)
Fabian Bieler [Fri, 7 Mar 2014 09:39:18 +0000 (10:39 +0100)]
mesa: add tessellation shader getters (v3)

Tessellation dependencies added by Marek.

v2: require tessellation in addition to atomics/images for some glGet queries

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: allow setting of patch parameters.
Marek Olšák [Sat, 13 Jun 2015 21:06:06 +0000 (23:06 +0200)]
mesa: allow setting of patch parameters.

Based on a patch from Fabian Bieler <fabianbieler@fastmail.fm>.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>