summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Death to array dereferences of vectors!Ian Romanick2013-05-133-169/+32
| | | | | | | | | | | | | | | | Now that all the places that used to generate array derefeneces of vectors have been changed to generate either ir_binop_vector_extract or ir_triop_vector_insert (or both), remove all support for dealing with this deprecated construct. As an added safeguard, modify ir_validate to reject ir_dereference_array of a vector. v2: Convert tabs to spaces. Suggested by Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Generate correct ir_binop_vector_extract code for out and inout parametersIan Romanick2013-05-131-47/+102
| | | | | | | | | | | | | | Like with type conversions on out parameters, some extra copies need to occur to handle these cases. The fundamental problem is that ir_binop_vector_extract is not an lvalue, but out and inout parameters must be lvalues. A previous patch delt with a similar problem in the LHS of ir_assignment. v2: Convert tabs to spaces. Suggested by Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Use vector-insert and vector-extract on elements of gl_ClipDistanceMESAIan Romanick2013-05-131-6/+60
| | | | | | | | | | | | | | | | | Variable indexing into vectors using ir_dereference_array is being removed, so this lowering pass has to generate something different. v2: Convert tabs to spaces. Suggested by Eric. v3: Simplify code slightly by assuming that elements of gl_ClipDistanceMESA will always be vec4. Suggested by Paul. v4: Fairly substantial rewrite based on the rewrite of "glsl: Convert lower_clip_distance_visitor to be an ir_rvalue_visitor" Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Remove some stale comments about ir_callIan Romanick2013-05-131-6/+2
| | | | | | | | | ir_call was changed long ago to be a statement rather than an expression. That makes this comment no longer valid. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Convert lower_clip_distance_visitor to be an ir_rvalue_visitorIan Romanick2013-05-131-23/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now the lower_clip_distance_visitor lowers variable indexing into gl_ClipDistance into variable indexing into both the array gl_ClipDistanceMESA and the vectors of that array. For example, gl_ClipDistance[i] = f; becomes gl_ClipDistanceMESA[i >> 2][i & 3] = f; However, variable indexing into vectors using ir_dereference_array is being removed. Instead, ir_expression with ir_triop_vector_insert will be used. The above code will become gl_ClipDistanceMESA[i >> 2] = vector_insert(gl_ClipDistanceMESA[i >> 2], i & 3, f); In order to do this, an ir_rvalue_visitor will need to be used. This commit is really just a refactor to get ready for that. v4: Split the least amount of refactor from the rest of the code changes. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: Generate ir_binop_vector_extract for indexing of vectorsIan Romanick2013-05-131-4/+16
| | | | | | | | | | | | Now ir_dereference_array of a vector will never occur in the RHS of an expression. v2: Add back the { } around the if-statement body to make it more readable. Suggested by Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Convert ir_binop_vector_extract in the LHS to ir_triop_vector_insertIan Romanick2013-05-131-0/+24
| | | | | | | | | | | | | The ast_array_index code can't know whether to generate an ir_binop_vector_extract or an ir_triop_vector_insert. Instead it will always generate ir_binop_vector_extract, and the LHS and RHS have to be re-written. v2: Convert tabs to spaces. Suggested by Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add lowering pass for ir_triop_vector_insertIan Romanick2013-05-137-0/+145
| | | | | | | | | | | | | | | | | | This will eventually replace do_vec_index_to_cond_assign. This lowering pass is called in all the places where do_vec_index_to_cond_assign or do_vec_index_to_swizzle is called. v2: Use WRITEMASK_* instead of integer literals. Use a more concise method of generating broadcast_index. Both suggested by Eric. v3: Use a series of scalar compares instead of a single vector compare. Suggested by Eric and Ken. It still uses 'if (cond) v.x = y;' instead of conditional assignments because ir_builder doesn't do conditional assignments, and I'd rather keep the code simple. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Lower ir_binop_vector_extract to conditional movesIan Romanick2013-05-131-1/+31
| | | | | | | | | | | | Lower ir_binop_vector_extract with a non-constant index to a series of conditional moves. This is exactly like ir_dereference_array of a vector with a non-constant index. v2: Convert tabs to spaces. Suggested by Eric. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Lower ir_binop_vector_extract to swizzleIan Romanick2013-05-131-0/+45
| | | | | | | | | | | | | | | | | Lower ir_binop_vector_extract with a constant index to a swizzle. This is exactly like ir_dereference_array of a vector with a constant index. v2: Convert tabs to spaces. Suggested by Eric. v3: Correctly call convert_vector_extract_to_swizzle in ir_vec_index_to_swizzle_visitor::visit_enter(ir_call *ir). Suggested by Ken. v4: Use CLAMP instead of MIN2(MAX2()). Suggested by Ken. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Refactor part of convert_vec_index_to_cond_assignIan Romanick2013-05-131-20/+37
| | | | | | | | | | | | | | | | | | Use a first function that extract the vector being indexed and the index from the deref. Call the second function that does the real work. Coming patches will add a new ir_expression for variable indexing into a vector. Having the lowering pass split into two functions will make it much easier to lower the new ir_expression. v2: Convert tabs to spaces. Suggested by Eric. v3: Move some bits from a later patch back to this patch so that it actually compiles. Suggested by Ken. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add ir_triop_vector_insertIan Romanick2013-05-135-1/+46
| | | | | | | | | | | | | | | The new opcode is used to generate a new vector with a single field from the source vector replaced. This will eventually replace ir_dereference_array of vectors in the LHS of assignments. v2: Convert tabs to spaces. Suggested by Eric. v3: Add constant expression handling for ir_triop_vector_insert. This prevents the constant matrix inversion tests from regressing. Duh. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add ir_binop_vector_extractIan Romanick2013-05-135-5/+55
| | | | | | | | | | | | | | | | | | | | The new opcode is used to get a single field from a vector. The field index may not be constant. This will eventually replace ir_dereference_array of vectors. This is similar to the extractelement instruction in LLVM IR. http://llvm.org/docs/LangRef.html#extractelement-instruction v2: Convert tabs to spaces. Suggested by Eric. v3: Add array index range checking to ir_binop_vector_extract constant expression handling. Suggested by Ken. v4: Use CLAMP instead of MIN2(MAX2()). Suggested by Ken. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix "make check" breakage after adding options to do_common_optimization.Paul Berry2013-05-131-5/+9
| | | | | | | | | | Commit b765740 (glsl: Pass struct shader_compiler_options into do_common_optimization.) added a new parameter to do_common_optimization() but didn't update test_optpass.cpp, causing "make check" to break. This patch makes the proper updates to test_optpass.cpp so that the build succeeds again.
* glsl: Add a pass to flip matrix/vector multiplies to use dot products.Kenneth Graunke2013-05-124-0/+128
| | | | | | | | | | | | | | | | | | | | | | This pass flips (matrix * vector) operations to (vector * matrixTranspose) for certain built-in matrices (currently gl_ModelViewProjectionMatrix and gl_TextureMatrix). This is equivalent, but results in dot products rather than multiplies and adds. On some hardware, this is more efficient. This pass is conditionalized on ctx->mvp_with_dp4, the flag drivers set to indicate they prefer dot products. Improves performance in Lightsmark by 1.01131% +/- 0.162069% (n = 10) on a Haswell GT2 system. Passes Piglit on Ivybridge. v2: Use struct gl_shader_compiler_options instead of plumbing through another boolean flag for this purpose. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* i965/vs: Set the PreferDP4 shader compiler option.Kenneth Graunke2013-05-121-0/+2
| | | | | | | | | | | | | | | Doing matrix multiplies with DP4s is fewer instructions than MUL/ADD, especially since we don't support MAD in the vertex shader. Not observed to improve performance in any fixed function applications, but is useful for the next patch. I've left this unset for the fragment shader because the scalar backend can't use DP4 and does have MAD support. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Move the mvp_with_dp4 flag to ShaderCompilerOptions.Kenneth Graunke2013-05-128-28/+11
| | | | | | | | | | | | | | | This flag essentially tells the compiler whether it prefers dot products or multiply/adds for matrix operations. As such, ShaderCompilerOptions seems like the right place for it. This also lets us specify it on a per-stage basis. This patch makes all existing users set the flag for the Vertex Shader stage only, as it's currently only used for fixed-function vertex programs. That will change soon, and I wanted to preserve the existing behavior. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Pass struct shader_compiler_options into do_common_optimization.Kenneth Graunke2013-05-128-9/+21
| | | | | | | | | | | | | do_common_optimization may need to make choices about whether to emit certain kinds of instructions. gl_context::ShaderCompilerOptions contains exactly that information, so it makes sense to pass it in. Rather than passing the whole array, pass the structure for the stage that's currently being worked on. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Initialize ctx->ShaderCompilerOptions in standalone scaffolding.Kenneth Graunke2013-05-121-0/+12
| | | | | | | | This code is copied from _mesa_init_shader_state(). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Copy _mesa_shader_type_to_index() to standalone scaffolding.Kenneth Graunke2013-05-121-0/+17
| | | | | | | | | We can't include shaderobj.h from the standalone utilities, so we unfortunately have to copy this function. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Add comments about bit-ordering of new XRGB/XBGR formats.Kenneth Graunke2013-05-121-15/+15
| | | | | | | | | | | | | Marek added these new formats in commit f9fa725690c470daf308, but without comments relating to the packing. Sometimes the naming is confusing, so these comments are helpful in determining whether two formats are compatible. The new comments are based on my reading of format_unpack.c. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: remove dependency on _NEW_BUFFER_OBJECT for vertex arraysMarek Olšák2013-05-112-3/+3
| | | | | | | _NEW_BUFFER_OBJECT means glBufferData was called. We can just set our own flag in BufferData. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: don't check for _NEW_PROGRAM when binding UBOsMarek Olšák2013-05-111-2/+2
| | | | | | Probably copied from i965. However st/mesa has its flags ST_NEW_xxx_PROGRAM. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: fix a couple of issues in st_bind_ubosMarek Olšák2013-05-111-4/+16
| | | | | | | | | | | | - don't reference a buffer for a local variable (that's never useful unless it can be the only reference to the buffer) - check if the buffer is not NULL - set buffer_size as specified with BindBufferRange NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Fredrik Höglund <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* st/mesa: restore the transfer_inline_write path for BufferDataMarek Olšák2013-05-111-0/+15
| | | | | | Version 2 that shouldn't crash. Reviewed-by: Brian Paul <[email protected]>
* st/mesa: initialize Const.MaxColorAttachmentsMarek Olšák2013-05-111-7/+3
| | | | | | NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <[email protected]>
* gallium: add PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE for GLMarek Olšák2013-05-1112-2/+23
| | | | | | v2: fix typo 65535 -> 65536 Reviewed-by: Brian Paul <[email protected]>
* st/mesa: consolidate setting MaxTextureImageUnitsMarek Olšák2013-05-111-15/+11
| | | | Reviewed-by: Brian Paul <[email protected]>
* st/mesa: initialize all program constants and UBO limitsMarek Olšák2013-05-111-21/+43
| | | | | | | | Also simplify UBO support checking. NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Brian Paul <[email protected]>
* glsl: fix the value of gl_MaxFragmentUniformVectorsMarek Olšák2013-05-111-1/+1
| | | | | | | NOTE: This is a candidate for the 9.1 branch. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: add & use a new driver flag for UBO updates instead of _NEW_BUFFER_OBJECTMarek Olšák2013-05-1113-14/+41
| | | | | | | v2: move the flagging from intel_bufferobj_data to intel_bufferobj_alloc_buffer Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: skip _MaxElement computation unless driver needs strict bounds checkingMarek Olšák2013-05-112-4/+26
| | | | | | | | | | | | If Const.CheckArrayBounds is false, the only code using _MaxElement is glDrawRangeElements, so I changed it and explained in the code why _MaxElement is not very useful there. BTW, the big magic number was copied to the letter from _mesa_update_array_max_element. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused gl_array_object::NewArrayMarek Olšák2013-05-114-10/+0
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused gl_constants::MaxColorTableSizeMarek Olšák2013-05-113-6/+0
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: unify MaxVertexVaryingComponents and MaxGeometryVaryingComponentsMarek Olšák2013-05-115-9/+5
| | | | | | | | | The limits should not be different and OpenGL requires both to be at least 32, which is also the maximum limit on radeon. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: move max texture image unit constants to gl_program_constantsMarek Olšák2013-05-1127-63/+61
| | | | | | | | | | Const.MaxTextureImageUnits -> Const.FragmentProgram.MaxTextureImageUnits Const.MaxVertexTextureImageUnits -> Const.VertexProgram.MaxTextureImageUnits etc. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: consolidate definitions of max texture image unitsMarek Olšák2013-05-113-9/+5
| | | | | | | Shaders are unified on most hardware (= same limits in all stages). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* ilo: Initialize read_back in transfer_map_sys.Vinson Lee2013-05-101-1/+1
| | | | | | | Fixes "Uninitialized scalar variable" defect reported by Coverity. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Chia-I Wu <[email protected]>
* r600g: increase array size for shader inputs and outputsMarek Olšák2013-05-102-2/+4
| | | | | | | and add assertions to prevent buffer overflow. This fixes corruption of the r600_shader struct. NOTE: This is a candidate for the stable branches.
* targets/dri-i915: Force c++ linker in all casesChí-Thanh Christopher Nguyễn2013-05-091-8/+2
| | | | | | NOTE: This is a candidate for the 9.1 branch. Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=461696 Reviewed-by: Andreas Boll <[email protected]>
* i965: Actually use the user timeout in glClientWaitSync.Ben Widawsky2013-05-091-9/+1
| | | | | | | | | | Use the new libdrm functionality to actually do timed waits on the sync object. Signed-off-by: Ben Widawsky <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* i965: make GT3 machines work as GT3 instead of GT2Paulo Zanoni2013-05-092-37/+41
| | | | | | | | | | | | | We were not allowed to say the "GT3" name, but we really needed to have the PCI IDs because too many people had such machines, so we had to make the GT3 machines work as GT2. Let's just say that GT2_PLUS was a short for GT2_PLUS_1 :) NOTE: This is a candidate for stable branches. Signed-off-by: Paulo Zanoni <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* i965: Add chipset limits for the Haswell GT3 variant.Kenneth Graunke2013-05-091-0/+6
| | | | | | | NOTE: This is a candidate for stable branches. Signed-off-by: Kenneth Graunke <[email protected]> Signed-off-by: Eugeni Dodonov <[email protected]>
* i965: Update URB partitioning code for Haswell's GT3 variant.Kenneth Graunke2013-05-091-8/+17
| | | | | | | | | | | | | | Haswell's GT3 variant offers 32kB of URB space for push constants, while GT1 and GT2 match Ivybridge, providing 16kB. Update the code to reserve the full 32kB on GT3. v2: Specify push constant size correctly. I thought GT3 reinterpreted the value as multiples of 2kB, but it doesn't. You simply have to program an even number. NOTE: This is a candidate for stable branches. Signed-off-by: Kenneth Graunke <[email protected]>
* i965: Delete dead intel_span.c symlink.Kenneth Graunke2013-05-091-1/+0
|
* i965/vs: Make virtual grf live intervals actually cover their used range.Eric Anholt2013-05-094-63/+31
| | | | | | | | This is the same change as the previous commit to the FS. A very few VSes are regressed by 1 or 2 instructions, which look recoverable with a bit more dead code elimination. Reviewed-by: Ian Romanick <[email protected]>
* i965/fs: Make virtual grf live intervals actually cover their used range.Eric Anholt2013-05-096-72/+38
| | | | | | | | | | | | | | | | | | Previously, we would sometimes not consider a write to a register to extend the end of the interval, nor would we consider a read before a write to extend the start. This made for a bunch of complicated logic related to how to treat the results when dead code might be present. Instead, just extend the interval and fix dead code elimination to know how to remove it. Interestingly, this actually results in a tiny bit more optimization: total instructions in shared programs: 1391220 -> 1390799 (-0.03%) instructions in affected programs: 14037 -> 13616 (-3.00%) v2: Fix a theoretical problem with the simd16 workaround if dst == src, where we would revert the bump of the live range. Reviewed-by: Ian Romanick <[email protected]> (v1)
* ilo: Add support for HW primitive restart.Courtney Goeltzenleuchter2013-05-103-2/+194
| | | | | | | | | Now tells Gallium that ilo supports primitive restart. Updated ilo_draw_vbo to be able to check that the indexed primitive being rendered can actually be supported in HW. If not, will break up into individual prims similar to what Mesa does. [olv: a minor fix after rebasing and formatting]
* svga: misc whitespace and comment fixes in svga_cmd.cBrian Paul2013-05-091-82/+82
|
* st/mesa: generate GL_OUT_OF_MEMORY if we can't create the index bufferBrian Paul2013-05-091-1/+1
| | | | | | | | | | | Before, if we failed to allocate the index buffer we'd silently return from st_draw_vbo() without drawing anything. We should raise GL_OUT_OF_MEMORY to give some indication that something went wrong. Note: This is a candidate for the stable branches. Reviewed-by: Marek Olšák <[email protected]>