summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl_types.h
Commit message (Collapse)AuthorAgeFilesLines
* glsl: add subpass image type (v2)Dave Airlie2016-09-161-2/+3
| | | | | | | | | | | | | | | | | | SPIR-V/Vulkan have a special image type for input attachments called the subpass type. It has different characteristics than other images types. The main one being it can only be an input image to fragment shaders and loads from it are relative to the frag coord. This adds support for it to the GLSL types. Unfortunately we've run out of space in the sampler dim in types, so we need to use another bit. v2: Fixup subpass input name (Jason) Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glsl: Document and enforce restriction on type valuesIan Romanick2016-07-051-0/+3
| | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl/types: rename is_dual_slot_double to is_dual_slot_64bit.Dave Airlie2016-06-091-3/+3
| | | | | | | In the future int64 support will have the same requirements. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Dave Airlie <airlied@redhat.com>
* compiler/types: add 64-bitness queries.Dave Airlie2016-06-091-0/+13
| | | | | | | | | | This adds an inline and type query for if a type is 64-bit. Fow now this is equivalent to double, but int64 will change this. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glsl: use enum glsl_interface_packing in more places. (v2)Dave Airlie2016-06-061-0/+8
| | | | | | | | | | | | | | | Although the glsl_types.h stores this in a bitfield, we should hide that from everyone else. Hide the cast in an accessor method and use the enum everywhere. This makes things a bit nicer in gdb, and improves type safety. v2: fix a few pieces of interface I missed that caused some piglit regressions. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
* glsl: handle implicit sized arrays in ssboDave Airlie2016-05-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code disallows unsized arrays except at the end of an SSBO but it is a bit overzealous in doing so. struct a { int b[]; int f[4]; }; is valid as long as b is implicitly sized within the shader, i.e. it is accessed only by integer indices. I've submitted some piglit tests to test for this. This also has no regressions on piglit on my Haswell. This fixes: GL45-CTS.shader_storage_buffer_object.basic-syntax GL45-CTS.shader_storage_buffer_object.basic-syntaxSSO This patch moves a chunk of the linker code down, so that we don't link the uniform blocks until after we've merged all the variables. The logic went something like: Removing the checks for last ssbo member unsized from the compiler and into the linker, meant doing the check in the link_uniform_blocks code. However to do that the array sizing had to happen first, so we knew that the only unsized arrays were in the last block. But array sizing required the variable to be merged, otherwise you'd get two different array sizes in different version of two variables, and one would get lost when merged. So the solution was to move array sizing up, after variable merging, but before uniform block visiting. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glsl: handle same struct redeclaration (v2)Dave Airlie2016-05-201-1/+3
| | | | | | | | | | | | | | | | This works around a bug in older version of UE4, where a shader defines the same structure twice. Although we aren't sure this is correct GLSL (it most likely isn't) there are enough UE4 based things out there we should deal with this. This drops the error to a warning if the struct names and contents match. v1.1: do better C++ on record_compare declaration (Rob) v2: restrict this to desktop GL only (Ian) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95005 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* glsl: Rename "vertex_input_slots" -> "is_vertex_input"Matt Turner2016-04-131-1/+1
| | | | | | | | | | | vertex_input_slots would be an appropriate name for an integer, but not a bool. Also remove a cond ? true : false from a count_attribute_slots() call site, noticed during the rename. Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
* glsl: add helper for counting varyingsTimothy Arceri2016-03-311-0/+6
| | | | | | | This will be used to get a count of the number of varying name strings we are required to generate for use with the query api. Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: add field to track if xfb_buffer is an explicit or implicit valueTimothy Arceri2016-03-311-0/+7
| | | | | | | | | Since any of the xfb_* qualifiers trigger the shader to be in transform feedback mode we need an extra field to track if the xfb_buffer on interface members was set explicitly since xfb_buffer will always have a default value. Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: add xfb_* qualifiers to glsl_struct_fieldTimothy Arceri2016-03-311-2/+14
| | | | | | | | | | | | | These will be used to hold qualifier values for interface and struct members. Support is added to the struct/interface constructors to copy these fields upon creation. We also update record_compare() to ensure we don't reuse a glsl_type with the wrong xfb_* qualifier values. Reviewed-by: Dave Airlie <airlied@redhat.com>
* glsl: add offset to glsl interface typeTimothy Arceri2016-03-051-0/+8
| | | | | | | | | | | | | | | | In this patch we also copy the offset value from the ast and implement offset linking rules by adding it to the record_compare() function. From Section 4.4.5 (Uniform and Shader Storage Block Layout Qualifiers) of the GLSL 4.50 spec: "Two blocks linked together in the same program with the same block name must have the exact same set of members qualified with offset and their integral-constant-expression values must be the same, or a link-time error results." Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
* glsl/types: Expose glsl_struct_field and glsl_function_param to CJason Ekstrand2016-02-131-4/+6
| | | | Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl/types: Add a helper for getting image typesJason Ekstrand2016-02-131-0/+2
| | | | Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl/types: Add support for function typesJason Ekstrand2016-02-131-1/+23
| | | | | | | | SPIR-V has a concept of a function type that's used fairly heavily. We could special-case function types in SPIR-V -> NIR but it's easier if we just add support to glsl_types. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl/types: Rename sampler_type to sampled_typeJason Ekstrand2016-02-131-1/+1
| | | | | | | | It's a bit more descriptive since it is the base type that you get when you sample from it. Also, the next commit adds a bare "sampler" type and we need glsl_type::sampler_type available for a public static member. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* glsl: always initialize image_* fields, copy them on interface initIlia Mirkin2016-01-291-1/+2
| | | | | | | | | Interfaces can have image properties set in case they are buffer interfaces. Make sure not to lose this information. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* nir: move glsl_types.{cpp,h} to compilerEmil Velikov2016-01-261-0/+887
Allows us to remove the SCons workaround :-) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>