summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* i830: Add missing vtable entry for i830 from the hiz work.Carl Simonson2011-08-101-0/+7
|
* i965: Drop the reg/hw_reg distinction.Eric Anholt2011-08-105-36/+37
| | | | | | | "reg" was set in only one case, virtual GRFs pre register allocation, and would be unset and have hw_reg set after allocation. Since we never bothered with looking at virtual GRF number after allocation anyway, just use the same storage and avoid confusion.
* i965/fs: Factor out the register allocator setup to a separate function.Eric Anholt2011-08-102-66/+105
| | | | | | | Besides separating out a logical step of the giant register allocator function, this now communicates a bunch of the allocator information through entries in brw_context, which will make this code partially reusable for caching the expensive allocator setup.
* i965/fs: Simplify the register allocator using a map from RA reg to GRF.Eric Anholt2011-08-101-41/+38
| | | | | | | It's fewer pointers to track, and when we start caching the register set, should be algorithmically better in the cache hit case (lookup in a byte-per-register array, instead of a linear walk through desctiption of register classes to find how to translate that class).
* i965/fs: Eliminate the magic nature of virtual GRF 0.Eric Anholt2011-08-104-31/+17
| | | | | | | This was a debugging aid at one point -- virtual grf 0 should never be allocated, and it would be used if undefined register access occurred in codegen. However, it made the confusing register allocation code even more confusing by indexing things off of 1 all over.
* i965/fs: Use the new convenience interface for setting up reg conflicts.Eric Anholt2011-08-101-22/+7
| | | | | That code I wrote was impenetrable, and hard to write the first time. This makes things a lot more obvious.
* mesa: Add a convenience interface for register allocator conflicts setup.Eric Anholt2011-08-102-0/+23
|
* glsl_to_tgsi: improve assignment hackHenri Verbeet2011-08-091-3/+5
| | | | Fixes StarCraft 2 and Fallout 3 in Wine.
* r300g: silence some warnings about uninitialized variablesBrian Paul2011-08-093-6/+8
|
* svga: add missing switch case for PIPE_SHADER_CAP_INTEGERSBrian Paul2011-08-091-0/+2
|
* glx: move declarations before codeBrian Paul2011-08-091-3/+7
|
* swrast: silence unused var warningsFabio Pedretti2011-08-091-1/+1
| | | | Signed-off-by: Brian Paul <[email protected]>
* glsl: validate IR after linking (debug builds only)Paul Berry2011-08-081-0/+8
| | | | | | | | | | | | | | | | | | | | At least one of the invariants verified by IR validation concerns the relative ordering of toplevel constructs in the IR: references to global variables must come after the declarations of those global variables. Since linking affects the ordering of toplevel constructs in the IR, it's possible that a bug in the linker will cause invalid IR to be generated, even if all the pre-linked shaders are valid. (In fact, such a bug was fixed by the previous commit.) Bugs like this are easily masked by further optimization passes, particularly inlining. So to make them easier to track down, this patch addes an IR validation step right after linking, and before final optimization occurs. The validation only occurs on debug builds. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: When linking, emit functions at the tail of the final linked program.Paul Berry2011-08-081-2/+4
| | | | | | | | | | | | | | | | | | | | | When link_functions.cpp adds a new function to the final linked program, it needs to add it after any global variable declarations that the function refers to, otherwise the IR will be invalid (because variable declarations must occur before variable accesses). The easiest way to do that is to have the linker emit functions to the tail of the final linked program. The linker used to emit functions to the head of the final linked program, in an effort to keep callees sorted before their callers. However, this was not reliable: it didn't work for functions declared or defined in the same compilation unit as main, for diamond-shaped patterns in the call graph, or for some obscure cases involving overloaded functions. And no code currently relies on this sort order. No Piglit regressions with i965 Ironlake. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Check array size is const before asserting that no IR was generated.Paul Berry2011-08-081-5/+8
| | | | | | | | | | | | | process_array_type() contains an assertion to verify that no IR instructions are generated while processing the expression that specifies the size of the array. This assertion needs to happen _after_ checking whether the expression is constant. Otherwise we may crash on an illegal shader rather than reporting an error. Fixes piglit tests array-size-non-builtin-function.vert and array-size-with-side-effect.vert. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Constant-fold built-in functions before outputting IRPaul Berry2011-08-081-2/+14
| | | | | | | | | | | | | | Rearranged the logic for converting the ast for a function call to hir, so that we constant fold before emitting any IR. Previously we would emit some IR, and then only later detect whether we could constant fold. The unnecessary IR would usually get cleaned up by a later optimization step, however in the case of a builtin function being used to compute an array size, it was causing an assertion. Fixes Piglit test array-size-constant-relational.vert. Reviewed-by: Kenneth Graunke <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38625
* glsl: Emit function signatures at toplevel, even for built-ins.Paul Berry2011-08-084-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ast-to-hir conversion needs to emit function signatures in two circumstances: when a function declaration (or definition) is encountered, and when a built-in function is encountered. To avoid emitting a function signature in an illegal place (such as inside a function), emit_function() checked whether we were inside a function definition, and if so, emitted the signature before the function definition. However, this didn't cover the case of emitting function signatures for built-in functions when those built-in functions are called from inside the constant integer expression that specifies the length of a global array. This failed because when processing an array length, we are emitting IR into a dummy exec_list (see process_array_type() in ast_to_hir.cpp). process_array_type() later checks (via an assertion) that no instructions were emitted to the dummy exec_list, based on the reasonable assumption that we shouldn't need to emit instructions to calculate the value of a constant. This patch changes emit_function() so that it emits function signatures at toplevel in all cases. This partially fixes bug 38625 (https://bugs.freedesktop.org/show_bug.cgi?id=38625). The remainder of the fix is in the patch that follows. Reviewed-by: Kenneth Graunke <[email protected]>
* Revert "glsl: Skip processing the first function's body in do_dead_functions()."Paul Berry2011-08-081-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | opt_dead_functions contained a shortcut to skip processing the first function's body, based on the assumption that IR functions are topologically sorted, with callees always coming before their callers (therefore the first function cannot contain any calls). This assumption turns out not to be true in general. For example, the following code snippet gets translated to IR that violates this assumption: void f(); void g(); void f() { g(); } void g() { ... } In practice, the shortcut didn't cause bugs because of a coincidence of the circumstances in which opt_dead_functions is called: (a) we do inlining right before dead function elimination, and inlining (when successful) eliminates all calls. (b) for user-defined functions, inlining is always successful, because previous optimization passes (during compilation) have reduced them to a form that is eligible for inlining. (c) the function that appears first in the IR can't possibly call a built-in function, because built-in functions are always emitted before the function that calls them. It seems unnecessarily fragile to have opt_dead_functions depend on these coincidences. And the next patch in this series will break (c). So I'm reverting the shortcut. The consequence will be a slight increase in link time for complex shaders. This reverts commit c75427f4c8767e131e5fb3de44fbc9d904cb992d. Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa: inline st_prepare_fragment_program in st_translate_fragment_programBryan Cain2011-08-082-179/+162
| | | | | | | | | This reverts an unnecessary part of commit 4683529048ee and fixes misrendering and an assertion failure in Cogs. Fixes freedesktop.org bug 39888. Reviewed-by: Brian Paul <[email protected]>
* glsl: silence warning about trailing comma in enum listBrian Paul2011-08-081-1/+1
|
* gallium: silence warnings about trailing commas in enum listsBrian Paul2011-08-082-2/+2
|
* mesa: whitespace changesBrian Paul2011-08-081-5/+8
|
* d3d1x: adapt to resource_resolve interface changeChristoph Bumiller2011-08-071-3/+20
|
* nv50,nvc0: never convert in resource copy when format sizes matchChristoph Bumiller2011-08-072-2/+16
| | | | | | | If there are any cases left where the st thinks that RGBA -> BGRA will swap components, it will get what it deserves. Now the GPU's 2D engine goes unused. What a shame.
* st/mesa: don't resolve stencil twiceChristoph Bumiller2011-08-071-1/+3
|
* winsys/radeon: disable use of the buffer busy-for-write flagMarek Olšák2011-08-061-0/+12
|
* mesa: In validate_program(), initialize errMsg for safety.Kenneth Graunke2011-08-051-1/+1
| | | | | | | | | | | | | | | validate_program relies on validate_shader_program to fill in errMsg; empirically, there exist cases where that doesn't happen. While tracking those down may be worthwhile, initializing the string so we don't try to ralloc_strdup random garbage also seems wise. Fixes issues caught by valgrind while running some test case. NOTE: This is a candidate for stable release branches. Reviewed-by: Chad Versace <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* intel: Fix warnings from gl_constant_parameter changes.Eric Anholt2011-08-053-11/+9
|
* glsl_to_tgsi: replace open-coded swizzle_for_size()Bryan Cain2011-08-051-8/+1
| | | | This is a port of commit 4c7e215c7bb to glsl_to_tgsi.
* glsl_to_tgsi: try to avoid emitting a MOV_SAT to saturate an expression treeBryan Cain2011-08-051-6/+26
| | | | | This is a port of commit 62722d9 to glsl_to_tgsi, with minor aesthetic changes (moved the declaration and assignment of new_inst inside the if block).
* ir_to_mesa: Replace open-coded swizzle_for_size()Eric Anholt2011-08-051-8/+1
|
* glx/dri2: Paper over errors in DRI2Connect when indirectChristopher James Halse Rogers2011-08-051-0/+9
| | | | | | | | | | | | DRI2 will throw BadRequest for this when the client is not local, but DRI2 is an implementation detail and not something callers should have to know about. Silently swallow errors in this case, and just propagate the failure through DRI2Connect's return code. Note: This is a candidate for the stable release branches. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28125 Signed-off-by: Christopher James Halse Rogers <[email protected]>
* ir_to_mesa: Try to avoid emitting a MOV_SAT to saturate an expression tree.Eric Anholt2011-08-051-4/+24
| | | | | | Fixes a regression in codegen quality for ff_fragment_shader conversion to GLSL -- glean texCombine produces 7.5% fewer Mesa IR instructions.
* prog_optimize: Add support for saturates to _mesa_merge_mov_into_inst.Eric Anholt2011-08-051-3/+5
| | | | | This fixes the remaining regression from ff_fragment_shader in Mesa IR instruction count, to now being a 1.9% win overall.
* i965: Add dumping for gen6 WM constants too.Eric Anholt2011-08-053-1/+22
| | | | This looks just like the VS dump for now.
* mesa: Remove dead "MemPool" field of gl_shader_state.Eric Anholt2011-08-051-2/+0
|
* i965/fs: Don't upload unused uniform components.Eric Anholt2011-08-052-4/+95
| | | | | | | | | This saves both register space and upload bandwidth for unused values. Note that previously we were relying on the visitor not initially generating references to different sets of uniforms between the 8-wide and 16-wide code generation, and now we're relying on them dead-code eliminating the same stuff, too.
* i965/fs: Don't allocate the old backend's compile structs for our compile.Eric Anholt2011-08-051-4/+7
| | | | This saves some 35MB when the program only uses GLSL shaders.
* winsys/radeon: do the CS cleanup in the CS ioctl threadMarek Olšák2011-08-051-2/+4
|
* winsys/radeon: fix space checkingMarek Olšák2011-08-054-5/+36
| | | | | | | We should remove the relocations which caused a validation failure from the list, so that the kernel receives only the validated ones. NOTE: This is a candidate for the 7.11 branch.
* st/dri: remove an unused-but-set variableMarek Olšák2011-08-051-7/+0
|
* st/dri: remove a dummy function dri2_create_contextMarek Olšák2011-08-051-15/+1
| | | | It does nothing besides calling dri_create_context with the same parameters.
* st/mesa: remove unused-but-set variables in st_glsl_to_tgsi.cppMarek Olšák2011-08-051-3/+2
|
* r300g: handle new CAPsMarek Olšák2011-08-051-9/+4
|
* r300g: adapt to the resource_resolve interface changeMarek Olšák2011-08-051-21/+22
|
* vbo: do not call _mesa_max_buffer_index in debug buildsMarek Olšák2011-08-051-3/+1
| | | | | | | | | That code drops performance in Unigine Heaven and Tropics by a factor of 10. That's too crazy even for a debug build. NOTE: This is a candidate for the 7.11 branch. Reviewed-by: Brian Paul <[email protected]>
* glsl: empty declarations should be validChia-I Wu2011-08-052-12/+8
| | | | | | | | | | | | | | | Unlike C++, empty declarations such as float; should be valid. The spec is not explicit about this actually. Some apps that generate their shader sources may rely on this. This was noted when porting one of them to Linux from Windows. Reviewed-by: Chad Versace <[email protected]> Note: this is a candidate for the 7.11 branch.
* mesa: Remove MSVC stdint typedefs from compiler.h.Vinson Lee2011-08-041-23/+1
| | | | MSVC can now include the stdint.h at include/c99/stdint.h.
* mesa: pass correct constant type to _mesa_fetch_state()Brian Paul2011-08-041-1/+1
| | | | Fixes assorted warnings about float vs. gl_constant_value pointers.
* mesa: use gl_constant_value type in ARB program parserBrian Paul2011-08-042-29/+30
|