aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* i965: Enable the GL_ARB_shading_language_420pack extension on Gen6+.Kenneth Graunke2013-07-181-0/+1
| | | | | | | | While all the work is in the shared GLSL compiler, this extension requires GLSL 1.30, which is currently only supported on Gen6+. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Handle the binding qualifier for UBO variables.Kenneth Graunke2013-07-181-0/+10
| | | | | | | | | | | | | layout(binding = N) is equivalent to calling glUniformBlockBinding(_,N). This currently only handles the GLSL 1.40 case - no interface names, no arrays of uniform blocks. This is okay since we don't yet support GLSL 1.50, and don't expose ARB_shading_language_420pack in ES 3.0. v2: Move into the other function; use binding, not constant_value. Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
* glsl: Propagate UBO binding qualifier into UBO member variables.Kenneth Graunke2013-07-181-0/+7
| | | | | | | | | | | | | Without an instance name, there is no ir_variable representing the actual uniform block declaration. When the linker goes to set uniform initializers, it only sees the members as ir_variables; never the block. So, unfortunately, the members need to know about the binding. There has to be a better way to do this. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Handle the binding qualifier for arrays of samplers.Kenneth Graunke2013-07-181-0/+25
| | | | | | | | | | | | | | | | | | | | | Normally, uniform array variables are initialized by array literals. That is, val->type->array_elements >= storage->array_elements. However, samplers are different. Consider a declaration such as: layout(binding = 5) uniform sampler2D[3]; The initializer value is a single integer (5), while the storage has 3 array elements. The proper behavior here is to increment one for each element; they should be initialized to 5, 6, and 7. This patch introduces new code for sampler types which handles both arrays of samplers and single samplers correctly. v2: Move into the other function; use binding, not constant_value. Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Paul Berry <[email protected]>
* glsl: Add plumbing for handling uniform binding qualifiers.Kenneth Graunke2013-07-181-3/+23
| | | | | | | | | | | | | | | Sampler uniforms and uniform blocks do not have a var->constant_value. Instead, they have an integer var->binding value. This makes extending set_uniform_initializer() somewhat problematic: it assumes that there is an ir_constant * which represents the initializer, and that it's safe to dereference that without any NULL checks. Instead, this patch creates an analogous function for binding qualifiers, and calls one or the other as appropriate. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Delete unused code for handling samplers in array-initializers.Kenneth Graunke2013-07-181-14/+0
| | | | | | | | | | | | | | | | | | | | | | There is existing code to handle sampler uniform initializers. Prior to GLSL 4.20's "binding" keyword, sampler uniforms don't have initializers at all, so this is somewhat surprising. The existing code is broken into two cases: one where both the variable and initializer are arrays, and a second where the variable and initializer are scalars. The first case should never occur, since array-typed initializers do not exist for sampler uniforms. Even with the binding keyword, the initializer is a single integer which represents the texture unit to use for the first array element. The second is apparently used for some fixed-function code. v2: Rewrite the commit message - suggested by Paul. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Cross-validate explicit binding points.Kenneth Graunke2013-07-181-0/+19
| | | | | | | | | | All compilation units need to agree on the binding point, if they specify one at all. v2: Use binding, not constant_value. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Propagate explicit binding information from AST to IR.Kenneth Graunke2013-07-181-2/+5
| | | | | | | | | | | | | | Rather than creating a new "binding" field in ir_variable, we reuse constant_value since the linker code for handling uniform initializers uses that. Since UBOs and samplers can't otherwise have initializers/constant values, there shouldn't be a conflict. v2: Propagate the new binding variable around too. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add ir_variable fields for explicit bindings.Kenneth Graunke2013-07-182-0/+17
| | | | | | | | | | These are not used yet, but they exist and are copied appropriately. v2: Add an explicit "int binding" variable rather than reusing constant_value, as suggested by Paul Berry. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add validation for the "binding" qualifier.Kenneth Graunke2013-07-181-0/+81
| | | | | | | | | | | | | The "binding" qualifier only applies to UBO blocks and samplers, along with arrays of those types. (It would also apply to images and atomic counters, but we don't support those yet.) This also validates sampler bindings against the maximum number of texture units, and UBO bindings against the number of uniform buffer binding points. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Parse the "binding" keyword and store it in ast_type_qualifier.Kenneth Graunke2013-07-183-1/+25
| | | | | | | | | Nothing actually uses this yet. v2: Remove >= 0 checks. They'll be handled in later validation. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Have the lexer return LAYOUT_TOK if 420pack is enabled.Kenneth Graunke2013-07-181-1/+2
| | | | | | | GL_ARB_shading_language_420pack also provides layout qualifiers. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Use has_layout() rather than a partial open coded version.Kenneth Graunke2013-07-181-7/+1
| | | | | | | | | | | | | | | | | The idea of this code is to disallow layout(...) sections with the deprecated "varying" or "attribute" keywords, unless a few select extensions are enabled which allow a more relaxed check. In order to detect a layout(...) section, the code checks for a number of layout qualifiers. However, it failed to check for all of them, which could lead to layout(...) not being detected when it should. By replacing this with has_layout(), we properly check for all layout qualifiers, and also guarantees that new qualifiers added in the future will not be forgotten. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Relax auxiliary storage ordering requirements with 420pack.Kenneth Graunke2013-07-181-1/+2
| | | | | | | | These were already semi-relaxed, since the storage qualifier rule already skipped when 420pack was enabled. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Handle centroid qualifier ordering in C code, not the parser.Kenneth Graunke2013-07-181-20/+30
| | | | | | | | | | | | | The GL_ARB_shading_language_420pack extension/GLSL 4.20 split centroid off into a new category, "auxiliary storage qualifiers," and allow these to be placed anywhere in the series. So we have to stop recognizing "centroid in"/"centroid out"/"centroid varying" in the grammar and get more creative. The same approach used before works here, too. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Allow precision qualifiers to be flexibly ordered with 420pack.Kenneth Graunke2013-07-181-2/+2
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Move precision handling to be part of qualifier handling.Kenneth Graunke2013-07-183-36/+52
| | | | | | | | | This is necessary for the parser to be able to accept precision qualifiers not immediately adjacent to the type, such as "const highp inout float foo". Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Change is_precision_statement to default_precision != none.Kenneth Graunke2013-07-183-7/+8
| | | | | | | | | | | | | | | | | | | | | | Currently, we store precision in ast_type_specifier, rather than ast_type_qualifier. This works because precision is the last qualifier, and immediately adjacent to the type. Default precision statements (such as "precision highp float") are represented as ast_type_specifier objects, with a boolean to indicate that it's a default precision statement rather than an ordinary type. ast_type_specifier::precision will be moving to ast_type_qualifier soon, in order to support arbitrary qualifier ordering. However, we still need to store a "this is a precision statement" flag /and/ the default precision in ast_type_specifier. This patch changes the boolean into a new field, default_precision. If default_precision != ast_precision_none, it's a precision statement with the specified precision. Otherwise, it's an ordinary type. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Disable ordering checks for const parameters with 420pack.Kenneth Graunke2013-07-181-1/+1
| | | | | | | This makes the complier accept both "const in" and "in const". Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Handle "const" as a parameter qualifier.Kenneth Graunke2013-07-181-29/+14
| | | | | | | | This will make it easy to support both "const in" and "in const", as required by GLSL 4.20/ARB_shading_language_420pack. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Refactor parameter qualifier handling.Kenneth Graunke2013-07-181-1/+12
| | | | | | | | | | | "Parameter direction qualifier" is a new term I invented just now; it's not part of any GLSL specification. This paves the way handling multiple parameter qualifiers, in any order, as required by GLSL 4.20/ARB_shading_language_420pack. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Use merge_qualifier() when processing qualifier lists.Kenneth Graunke2013-07-181-3/+3
| | | | | | | | | | | | | | | | | | | Most of ast_type_qualifier is simply a bitfield (represented as a structure of unsigned:1 bits in a union with an unsigned). However, it also contains ARB_explicit_attrib_location's location/index fields. In the past, this has worked by simply returning the layout qualifier's ast_type_qualifier and merging the other bits into it. However, that's not obvious until you break it by switching $1 and $2. Using merge_qualifier() copies them appropriately, and also properly overrides layout qualifiers. It also checks for duplicate qualifiers, which renders some of the checks in the previous patch unnecessary. However, those checks provide better error messages, such as "Duplicate interpolation qualifier", rather than just "duplicate qualifier". Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Allow duplicate layout qualifiers with 420pack.Kenneth Graunke2013-07-181-1/+1
| | | | | | | The new 4.20 rules explicitly allow multiple layout(...) sections. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Disable ordering checks on most qualifiers for 420pack.Kenneth Graunke2013-07-181-2/+3
| | | | | | | | | This makes the compiler accept invariant, storage, layout, and interpolation qualifiers in any order when ARB_shading_language_420pack is enabled. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Handle most qualifier ordering in C code rather than the grammar.Kenneth Graunke2013-07-181-18/+92
| | | | | | | | | | | | | | | | | The GL_ARB_shading_language_420pack extension/GLSL 4.20 allow qualifiers to be specified in (basically) any order. In order to support this, we can't hardcode the ordering restrictions in the grammar. This patch alters the grammar to accept invariant, storage, layout, and interpolation qualifiers in any order, but adds C code to enforce the ordering requirements. In the 420pack case, we should be able to simply skip the error checks. As a bonus, this also lets us generate decent error messages, rather than Bison's awful "unexpected TOKEN" errors. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add a new ast_type_qualifier::has_auxiliary_storage() method.Kenneth Graunke2013-07-182-0/+11
| | | | | | | | | | | | "Auxiliary storage qualifiers" is the new term given to "centroid", "patch", and "sample" by GLSL 4.20/GL_ARB_shading_language_420pack. Even though we only support "centroid", it's useful to add this now so that all auxiliary storage qualifiers get handled in the right places once they're eventually supported. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add a new ast_type_qualifier::has_storage() method.Kenneth Graunke2013-07-182-0/+16
| | | | | | | | | | | | | | | | This makes it easy to check if any storage qualifiers are set. "centroid" is not considered a storage qualifier. In the old language rules, you can't specify "centroid" by itself; it's always "centroid in", "centroid out", or "centroid varying." So one of the other storage qualifiers will always be set; there's no need to specifically check for centroid. In the new 4.20 rules, centroid is an auxiliary storage qualifier, not a storage qualifier. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Add a new ast_type_qualifier::has_layout() method.Kenneth Graunke2013-07-182-0/+23
| | | | | | | This makes it easy to check if any layout qualifiers are set. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i965: Combine URB code emission into a single group.Kenneth Graunke2013-07-181-10/+2
| | | | | | | | | | | | | | | | All four URB packets need to be programmed together in order for the GPU state to be valid. Putting them in separate BEGIN..ADVANCE blocks is risky: if we're nearing the end of a batch, the batch could be flushed inbetween two of the commands, causing the URB programming to be split into two batchbuffers. This -might- be okay with hardware contexts, but it offers no advantages over keeping them together, and has a potential for hangs. Putting them into a single BEGIN..ADVANCE block ensures they'll be kept in the same batch, which seems wise. Signed-off-by: Kenneth Graunke <[email protected]>
* i965/hsw: Change L3 MOCS for depth, hiz, and stencilChad Versace2013-07-182-4/+9
| | | | | | | | Change from "not cacheable" to "cacheable" in L3. Do so for the draw upload path and blorp. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* i965/hsw: Change L3 MOCS of 3DSTATE_CONSTANT_VS/PSChad Versace2013-07-183-3/+9
| | | | | | | | | | Change from "not cacheable" to "cacheable" in L3. Do so for the draw upload path and blorp. In blorp, change only the PS packet, because the VS packet is disabled. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* i965/hsw: Change L3 MOCS of SURFACE_STATChad Versace2013-07-182-2/+8
| | | | | | | | Change from "not cacheable" to "cacheable" in L3. Do so for the draw upload path and blorp. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* i965/hsw: Change L3 MOCS of 3DSTATE_VERTEX_BUFFERSChad Versace2013-07-182-0/+6
| | | | | | | | Change from "not cacheable" to "cacheable" in L3. Do so for the draw upload path and blorp. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* glx: Enable floating-point fbconfig extensionsTomasz Lis2013-07-182-0/+4
| | | | | Signed-off-by: Tomasz Lis <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* egl: Drop configs with unknown or invalide __DRI_ATTRIB_RENDER_TYPEIan Romanick2013-07-181-1/+1
| | | | | | | Some render types, such as floating-point, aren't valid with EGL. Return NULL in those cases to drop them. Signed-off-by: Ian Romanick <[email protected]>
* dri: Introduce new flags in __DRI_ATTRIB_RENDER_TYPETomasz Lis2013-07-184-8/+10
| | | | | | | | | | | | | | Mark __DRI_ATTRIB_FLOAT_MODE as deprecated, and introduce new flags to __DRI_ATTRIB_RENDER_TYPE for float modes. Both signed float (fbconfig_float) and unsigned (packed_float) are introduced. The old attribute should be set for both float modes. v2 (idr): Require that the render mode from the DRI attributes matches the render mode of the config exactly. This is the behavior of the old code. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Require proper drawableType in init_fbconfig_for_chooserTomasz Lis2013-07-181-1/+6
| | | | | | | | Make sure that init_fbconfig_for_chooser sets correct value of drawableType for visual configs and fbconfigs. Signed-off-by: Tomasz Lis <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Validate the GLX_RENDER_TYPE valueTomasz Lis2013-07-187-1/+59
| | | | | | | | | | | | | Correctly handle the value of renderType in GLX context. In case of the value being incorrect, context creation fails. v2 (idr): indirect_create_context is just a memory allocator, so don't validate the GLX_RENDER_TYPE there. Fixes regressions in several GLX_ARB_create_context piglit tests. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Store the RENDER_TYPE in indirect renderingTomasz Lis2013-07-186-25/+41
| | | | | | | | | | | | v2 (idr): Open-code the check for GLX_RENDER_TYPE. dri2_convert_glx_attribs can't be called from here because that function only exists in direct-rendering builds. Also add a stub version of indirect_create_context_attribs to tests/fake_glx_screen.cpp to prevent 'make check' regressions. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Handling RENDER_TYPE in glXCreateContext and init_fbconfig_for_chooserTomasz Lis2013-07-181-4/+28
| | | | | | | | Set the correct values of renderType in glXCreateContext and init_fbconfig_for_chooser. Signed-off-by: Tomasz Lis <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Changes to visual configs initialization.Tomasz Lis2013-07-182-5/+30
| | | | | | | | | | | | | | | | | | | | Correctly handle the value of renderType and drawableType in fbconfig. Modify glXInitializeVisualConfigFromTags to read the parameter value, or detect it if it's not there. v2 (idr): If there was no GLX_RENDER_TYPE property, set the type based purely on the rgbMode as the previous code did. It is impossible for floatMode to be set at this point, so we can't have a float config. The previous code regressed a large number of piglit GLX tests because those tests don't set GLX_RENDER_TYPE in the glXChooseConfig call. Restoring the old behavior for that case fixes those regressions. Also fix handling of GLX_DONT_CARE for GLX_RENDER_TYPE. Fixes a regression in glx-dont-care-mask. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Retrieve the value of RENDER_TYPE from GLX attribs arrayTomasz Lis2013-07-184-13/+13
| | | | | | | | | | | | | Make sure that context creation routines are provided with the value of RENDER_TYPE retrieved from GLX attribs. v2 (idr): Minor formatting changes. Change type of dri2_convert_glx_attribs render_type parameter to uint32_t to silence some GCC warnings. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glx: Store the value of renderType while creating contextTomasz Lis2013-07-184-2/+17
| | | | | | | | | | | | | Make sure that renderType property value is stored in GLX context while it's being created. Further patches will be provided to make the value correspond to fbconfig's renderType. v2 (idr): Move a hunk from the next patch to this patch to prevent a build break. Signed-off-by: Tomasz Lis <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* i965: Add #defines for Memory Object Control State fields on Gen7-7.5.Kenneth Graunke2013-07-181-0/+26
| | | | | | | | | | | The L3 controls are identical on all platforms, but LLC differs: - Ivybridge has a "cache in LLC" flag - Baytrail has no LLC, but instead has a snoop bit: "data accesses in this page must be snooped in the CPU caches." - Haswell has writeback/uncached flags for LLC and eLLC (eDRAM). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl/linker: Use correct array length when linking inter-stage uniforms and ↵Fabian Bieler2013-07-181-1/+1
| | | | | | | | varyings. Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Fabian Bieler <[email protected]>
* gen_matypes: fix cross-compiling with gccMike Frysinger2013-07-184-6/+55
| | | | | | | | | | | | | | The current gen_matypes logic assumes that the host compiler will produce information that is useful for the target compiler. Unfortunately, this is not the case whenever cross-compiling. When we detect that we're cross-compiling and using GCC, use the target compiler to produce assembly from the gen_matypes.c source, then process it with a shell script to create a usable header. This is similar to how the linux kernel creates its asm-offsets.c file. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Mike Frysinger <[email protected]>
* ax_prog_flex.m4: change grep syntax to accept e.g. flex.realAndreas Oberritter2013-07-181-1/+1
| | | | | | | | This is required in case a wrapper or symlink is used. This patch has also been sent upstream, awaiting moderation. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Andreas Oberritter <[email protected]>
* builtin_compiler/build: Avoid using libtool if cross compilingJonathan Liu2013-07-181-0/+13
| | | | | | | | | | | | Adds the dependencies of builtin_compiler as sources when cross compiling instead of using libtool to share compilation with src/glsl. The builtin_compiler executable is built for the host when cross compiling so it doesn't make sense to share compilation with src/glsl built for the target in this case. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44618 Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Jonathan Liu <[email protected]>
* i965: Add MOCS shift and mask for SURFACE_STATE entries.Kenneth Graunke2013-07-181-0/+3
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* llvmpipe: clamp inputs for srgb render buffersRoland Scheidegger2013-07-181-0/+35
| | | | | | | | | | | | | | | Usually with fixed point renderbuffers clamping is done as part of conversion. However, since we blend in float format, we essentially skip all conversion steps pre-blend but since this is still a fixed point renderbuffer we must still clamp the inputs in this case. Makes no difference for piglit though. Obviously we could skip this if fragment color clamping is enabled, but a) this is deprecated in OpenGL (d3d never had it) and b) we don't support it natively so it gets baked into the shader. Also add some comment about logic ops being broken for srgb, luckily no test tries to do that as there's no easy fix... Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Zack Rusin <[email protected]>