aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* i965: Enable MESA_shader_integer_mix.Matt Turner2013-09-091-0/+1
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Implement MESA_shader_integer_mix extension.Matt Turner2013-09-096-8/+41
| | | | | | | Because why doesn't GLSL allow you to do this already? Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Use conditional-select in mix().Matt Turner2013-09-091-8/+8
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* i965: Add support for ir_triop_csel.Matt Turner2013-09-093-0/+13
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add conditional-select IR.Matt Turner2013-09-098-0/+38
| | | | | | | | | | | It's a ?: that operates per-component on vectors. Will be used in upcoming lowering pass for ldexp and the implementation of frexp. csel(selector, a, b): per-component result = selector ? a : b Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Rename ir_function_signature::builtin_info to builtin_avail.Kenneth Graunke2013-09-093-7/+7
| | | | | | | | | | | | builtin_info was originally going to be a structure containing a bunch of information, but after various rewrites, it turned into a boolean availability predicate. builtin_avail is a better name than builtin_info, since it doesn't store any information other than availability. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add missing type inference for ir_binop_bfm.Kenneth Graunke2013-09-091-0/+1
| | | | | | | | Matt noticed that this was missing. Nothing uses this currently. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Delete old built-in function generation code.Kenneth Graunke2013-09-09135-11595/+0
| | | | | | | | None of this is used anymore. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Paul Berry <[email protected]>
* glsl: Remove builtin_compiler from the build system.Kenneth Graunke2013-09-099-252/+23
| | | | | | | | | We don't actually use anything from builtin_function.cpp, so we don't need to generate it anymore. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Paul Berry <[email protected]>
* glsl: Switch to the new built-in function module.Kenneth Graunke2013-09-093-29/+4
| | | | | | | | All built-ins are now handled by the new code; the old system is dead. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Write a new built-in function module.Kenneth Graunke2013-09-093-0/+3528
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This creates a new replacement for the existing built-in function code. The new module lives in builtin_functions.cpp (not builtin_function.cpp) and exists in parallel with the existing system. It isn't used yet. The new built-in function code takes a significantly different approach: Instead of implementing built-ins via printed IR, build time scripts, and run time parsing, we now implement them directly in C++, using ir_builder. This translates to faster load times, and a much less complex build system. It also takes a different approach to built-in availability: each signature now stores a boolean predicate, which makes it easy to construct arbitrary expressions based on _mesa_glsl_parse_state's fields. This is much more flexible than the old system, and also easier to use. Built-ins are also now stored in a single gl_shader object, rather than being spread out across a number of shaders that need to be linked. When searching for a matching prototype, we simply consult the availability predicate. This also simplifies the code. v2: Incorporate Matt Turner's feedback: use the new fma() function rather than expr(). Don't expose textureQueryLOD() in GLSL 4.00 (since it was renamed to textureQueryLod()). Also correct some #undefs. v3: Incorporate Paul Berry's feedback: rename legacy to compatibility; add comments to explain a few things; fix uvec availability; include shaderobj.h instead of repeating the _mesa_new_shader prototype. v4: Fix lack of TEX_PROJECT on textureProjGrad[Offset] (caught by oglc). Add an out_var convenience function (more feedback by Matt Turner). v5: Rework availability predicates for Lod functions. They were broken. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Enthusiastically-acked-by: Paul Berry <[email protected]>
* glsl: Add optional parameters to the ir_factory constructor.Kenneth Graunke2013-09-091-3/+3
| | | | | | | | | | | | | | Each ir_factory needs an instruction list and memory context in order to be useful. Rather than creating an object and manually assigning these, we can just use optional parameters in the constructor. This makes it possible to create a ready-to-use factory in one line: ir_factory body(&sig->body, mem_ctx); Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add IR builder shortcuts for a bunch of random opcodes.Kenneth Graunke2013-09-092-0/+94
| | | | | | | | | | | | | | | Adding new convenience emitters makes it easier to generate IR involving these opcodes. bitfield_insert is particularly useful, since there is no expr() for quadops. v2: Add fma() and rename lrp() operands to x/y/a to match the GLSL specification (suggested by Matt Turner). Fix whitespace issues. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Expose IR builder support for arbitrary swizzling.Kenneth Graunke2013-09-091-0/+1
| | | | | | | | | | | | | | | | | IR builder already offers a lot of swizzling functions, such as swizzle_xxxx, swizzle_z, or swizzle_for_size. The swizzle_xxxx style is convenient if you statically know which components you want. swizzle_for_size is great if you want to select the first few components. However, if you want to select components based on, say, a loop counter, none of those are sufficient. IR builder actually already had support for arbitrary swizzling, but didn't expose it. This patch exposes that API. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add a new ir_builder::dotlike() function.Kenneth Graunke2013-09-092-0/+12
| | | | | | | | | | | | dotlike() uses ir_binop_mul for scalars, and ir_binop_dot for vectors. When generating built-in functions, we often want to use regular multiply for scalar signatures, and dot() for vector signatures. ir_binop_dot only works on vectors, so we have to switch opcodes, even if the code is otherwise identical. dotlike() makes this easy. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add IR builder support for generating return statements.Kenneth Graunke2013-09-092-0/+9
| | | | | | | | | We use "ret" as the function name since "return" is a C++ keyword, and "ir_return" is already a class name. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add IR builder support for conditional assignments.Kenneth Graunke2013-09-092-2/+17
| | | | | | | | | | | | | This adds two new signatures: assign(lhs, rhs, condition, writemask); assign(lhs, rhs, condition); All the other existing APIs still exist. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add IR builder support for triops.Kenneth Graunke2013-09-092-0/+9
| | | | | | | | | Now that we have the ir_expression constructor that does type inference, this is trivial to do. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add an ir_expression triop constructor with type inference.Kenneth Graunke2013-09-092-0/+36
| | | | | | | | | | | | We already have ir_expression constructors for unary and binary operations, which automatically infer the type based on the opcode and operand types. These are convenient and also required for ir_builder support. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add missing type inference support for ARB_gpu_shader5 unops.Kenneth Graunke2013-09-091-0/+4
| | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Initialize lod_info in the ir_texture constructor.Kenneth Graunke2013-09-091-0/+1
| | | | | | | | | | This isn't strictly necessary, since creators of ir_texture objects should set LOD when relevant. However, it's nice to have a NULL pointer in case they forget. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Skip unavailable built-ins when printing out similar candidates.Kenneth Graunke2013-09-091-0/+3
| | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Skip unavailable built-ins when matching signatures.Kenneth Graunke2013-09-091-0/+8
| | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Pass _mesa_glsl_parse_state into matching_signature and such.Kenneth Graunke2013-09-0912-21/+30
| | | | | | | | | | | | | | | | | | | | | | | During compilation, we'll use this to determine built-in availability. The plan is to have a single shader containing every built-in in every version of the language, but filter out the ones that aren't actually available to the shader being compiled. At link time, we don't actually need this filtering capability: we've already imported prototypes for every built-in that the shader actually calls, and they're flagged as is_builtin(). The linker doesn't import any additional prototypes, so it won't pull in any unavailable built-ins. When resolving prototypes to function definitions, the linker ensures the values of is_builtin() match, which means that a shader can't trick the linker into importing the body of an unavailable built-in by defining a suspiciously similar prototype. In other words, during linking, we can just pass in NULL. It will work out fine. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Add a method to tell whether a built-in is available.Kenneth Graunke2013-09-092-0/+20
| | | | | | | | | | | We can simply call the stored predicate function. If state is NULL, just report that the function is available. v2: Add a comment (requested by Paul Berry). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Mark _mesa_glsl_parse_state::is_version() as const.Kenneth Graunke2013-09-091-1/+1
| | | | | | | | | This promises the method won't modify the contents of the object. This allows us to call it even with a const pointer to the state. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Convert ir_function_signature::is_builtin to a method.Kenneth Graunke2013-09-096-10/+15
| | | | | | | | | | | A signature is a built-in if and only if builtin_info != NULL, so we don't actually need a separate flag bit. Making a boolean-valued method allows existing code to ask the same question while not worrying about the internal representation. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Store a predicate for whether a built-in signature is available.Kenneth Graunke2013-09-094-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | For the upcoming built-in function rewrite, we'll need to be able to answer "Is this built-in function signature available?". This is actually a somewhat complex question, since it depends on the language version, GLSL vs. GLSL ES, enabled extensions, and the current shader stage. Storing such a set of constraints in a structure would be painful, so instead we store a function pointer. When creating a signature, we simply point to a predicate that inspects _mesa_glsl_parse_state and answers whether the signature is available in the current shader. Unfortunately, IR reader doesn't actually know when built-in functions are available, so this patch makes it lie and say that they're always present. This allows us to hook up the new functionality; it just won't be useful until real data is populated. In the meantime, the existing profile mechanism ensures built-ins are available in the right places. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* i965/vec4: Only zero out unused message components when there are any.Kenneth Graunke2013-09-091-2/+4
| | | | | | | | | | | | | | | Otherwise, coordinates with four components would result in a MOV with a destination writemask that has no channels enabled: mov(8) g115<1>.F 0D { align16 WE_normal NoDDChk 1Q }; At best, this is stupid: we emit code that shouldn't do anything. Worse, it apparently causes GPU hangs (observable with Chris's textureGather test on CubeArrays.) Signed-off-by: Kenneth Graunke <[email protected]> Cc: Chris Forbes <[email protected]> Cc: [email protected]
* vbo: Implement new gs prim types in vbo_count_tessellated_primitives.Paul Berry2013-09-091-0/+12
| | | | Reviewed-by: Matt Turner <[email protected]>
* i965: Enable AMD_seamless_cubemap_per_textureIan Romanick2013-09-083-2/+3
| | | | | | | | | | | | | | | | The change is very small. Do seamless filtering if either the context enable is set or the sampler enable is set. The AMD_seamless_cubemap_per_texture says: "If TEXTURE_CUBE_MAP_SEAMLESS_ARB is emabled (sic) globally or the value of the texture's TEXTURE_CUBE_MAP_SEAMLESS_ARB parameter is TRUE, seamless cube map sampling is enabled..." Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Always use seamless cubemap filtering in GLES3Ian Romanick2013-09-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Appendix F.2 of the OpenGL ES 3.0.0 spec says: "OpenGL ES 3.0 requires that all cube map filtering be seamless. OpenGL ES 2.0 specified that a single cube map face be selected and used for filtering." Setting the field only in the context will work fine with sampler objects (and drivers that support AMD_seamless_cubemap_per_texture) because seamless filtering is used if *either* the context or the sampler enable it: "If TEXTURE_CUBE_MAP_SEAMLESS_ARB is emabled (sic) globally or the value of the texture's TEXTURE_CUBE_MAP_SEAMLESS_ARB parameter is TRUE, seamless cube map sampling is enabled..." Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reported-by: Maxence Le Dore <[email protected]> Thanked-by: Maxence Le Dore <[email protected]>
* mesa: Don't allow glSamplerParameteriv(GL_TEXTURE_CUBE_MAP_SEAMLESS) in ESIan Romanick2013-09-081-1/+2
| | | | | | | | | | There is no GL_TEXTURE_CUBE_MAP_SEAMLESS in any version of OpenGL ES or in any extension that applies to OpenGL ES. The same error check already occurs for glTexParameteri. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Cc: Maxence Le Dore <[email protected]>
* ilo: preliminary GEN 7.5 supportChia-I Wu2013-09-0810-107/+236
| | | | | This is based on grepping for brw->is_haswell in i965 to see how GEN 7.5 differs from GEN 7. Slightly tested with Xonotic and some Mesa demos.
* r600g: remove DMA paddingAlex Deucher2013-09-061-9/+0
| | | | | | | This is now handled in the winsys. Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
* radeon/winsys: pad IBs to a multiple of 8 DWsAlex Deucher2013-09-061-0/+30
| | | | | | | | | | | | | | | This aligns the gfx, compute, and dma IBs to 8 DW boundries. This aligns the the IB to the fetch size of the CP for optimal performance. Additionally, r6xx hardware requires at least 4 DW alignment to avoid a hw bug. This also aligns the DMA IBs to 8 DW which is required for the DMA engine. This alignment is already handled in the gallium driver, but that patch can be removed now that it's done in the winsys. Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Alex Deucher <[email protected]> CC: "9.2" <[email protected]> CC: "9.1" <[email protected]>
* gallium, intel: Implements new __DRI_IMAGE_USE_LINEAR and PIPE_BIND_LINEAR ↵Axel Davy2013-09-0611-6/+29
| | | | | | flags to enforce no tiling. Signed-off-by: Axel Davy <[email protected]>
* mesa: Ensure gl_query_object is fully initialized.Vinson Lee2013-09-061-1/+1
| | | | | | | | | | | | 278372b47e4db8a022d57f60302eec74819e9341 added the uninitialized pointer field gl_query_object:Label. A free of this pointer resulted in a crash. This patch fixes piglit regressions with swrast introduced by 6d8dd59cf53d2f47b817d79204a52bb3a46e8c77. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69047 Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* gallivm: support indirect registers on both dimensionsZack Rusin2013-09-063-8/+22
| | | | | | | | | | | We support indirect addressing only on the vertex index, but some shaders also use indirect addressing on attributes. This patch adds support for indirect addressing on both dimensions inside gs arrays. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* i915g: Document fall-through switchStéphane Marchesin2013-09-061-4/+3
| | | | Fixes warning reported by Coverity.
* i915g: Handle i915->batch == NULL correctly in flushStéphane Marchesin2013-09-061-1/+4
| | | | Fixes warning reported by Coverity.
* i915g: Remove useless comparisonStéphane Marchesin2013-09-061-3/+2
| | | | Fixes "Macro compares unsigned to 0" defect reported by Coverity.
* i915g: Fix initial array indexStéphane Marchesin2013-09-061-1/+1
| | | | Fixes "Out-of-bounds read" defect reported by Coverity.
* mesa: add GL_KHR_debug functions to dispatch_sanity.cppBrian Paul2013-09-061-0/+12
| | | | | | Fixes 'make check' failures. Reviewed-by: Ian Romanick <[email protected]>
* r600g/compute: Fix bug in compute memory poolTom Stellard2013-09-051-7/+2
| | | | | | | When adding a new buffer to the beginning of the memory pool, we were accidentally deleting the buffer that was first in the buffer list. This was caused by a bug in the memory pool's linked list implementation.
* r600g/compute: Don't flush the cs in pipe_context::launch_grid()Tom Stellard2013-09-051-10/+1
| | | | | | This is the state tracker's responsibility. Reviewed-by: Marek Olšák <[email protected]>
* i965: Remove never used DPA2 opcode.Matt Turner2013-09-051-1/+0
| | | | | | | | | | | DPA2 is listed in the "Defeatured Instructions" section of the 965 PRM, Volume 4: "The following instructions are removed from Gen4 implementation mainly due to implementation cost/schedule reasons. They are candidates for future generations." Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Remove never used RSR and RSL opcodes.Matt Turner2013-09-054-8/+0
| | | | | | | | | | | RSR and RSL are listed in the "Defeatured Instructions" section of the 965 PRM, Volume 4: "The following instructions are removed from Gen4 implementation mainly due to implementation cost/schedule reasons. They are candidates for future generations." Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: propagate max_array_access through function callsDominik Behr2013-09-051-0/+32
| | | | | | | | | | | | Fixes a bug where if an uniform array is passed to a function the accesses to the array are not propagated so later all but the first vector of the uniform array are removed in parcel_out_uniform_storage resulting in broken shaders and out of bounds access to arrays in brw::vec4_visitor::pack_uniform_registers. Cc: [email protected] Reviewed-and-Tested-by: Matt Turner <[email protected]> Signed-off-by: Dominik Behr <[email protected]>
* nv30: fix inconsistent setting of push->user_privIlia Mirkin2013-09-051-1/+1
| | | | | | | It's set to &nv30->bufctx everywhere else. Signed-off-by: Ilia Mirkin <[email protected]> Cc: "9.2" <[email protected]>