mesa.git
13 years agost/mesa: don't resolve stencil twice
Christoph Bumiller [Fri, 5 Aug 2011 18:10:04 +0000 (20:10 +0200)]
st/mesa: don't resolve stencil twice

13 years agowinsys/radeon: disable use of the buffer busy-for-write flag
Marek Olšák [Sat, 6 Aug 2011 03:15:30 +0000 (05:15 +0200)]
winsys/radeon: disable use of the buffer busy-for-write flag

13 years agomesa: In validate_program(), initialize errMsg for safety.
Kenneth Graunke [Sun, 31 Jul 2011 04:26:26 +0000 (21:26 -0700)]
mesa: In validate_program(), initialize errMsg for safety.

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 <chad@chad-versace.us>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Fix warnings from gl_constant_parameter changes.
Eric Anholt [Fri, 5 Aug 2011 19:47:25 +0000 (12:47 -0700)]
intel: Fix warnings from gl_constant_parameter changes.

13 years agoglsl_to_tgsi: replace open-coded swizzle_for_size()
Bryan Cain [Fri, 5 Aug 2011 19:37:33 +0000 (14:37 -0500)]
glsl_to_tgsi: replace open-coded swizzle_for_size()

This is a port of commit 4c7e215c7bb to glsl_to_tgsi.

13 years agoglsl_to_tgsi: try to avoid emitting a MOV_SAT to saturate an expression tree
Bryan Cain [Fri, 5 Aug 2011 19:09:37 +0000 (14:09 -0500)]
glsl_to_tgsi: try to avoid emitting a MOV_SAT to saturate an expression tree

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).

13 years agoir_to_mesa: Replace open-coded swizzle_for_size()
Eric Anholt [Mon, 2 May 2011 23:27:46 +0000 (16:27 -0700)]
ir_to_mesa: Replace open-coded swizzle_for_size()

13 years agoglx/dri2: Paper over errors in DRI2Connect when indirect
Christopher James Halse Rogers [Thu, 4 Aug 2011 02:06:13 +0000 (12:06 +1000)]
glx/dri2: Paper over errors in DRI2Connect when indirect

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 <christopher.halse.rogers@canonical.com>
13 years agoir_to_mesa: Try to avoid emitting a MOV_SAT to saturate an expression tree.
Eric Anholt [Fri, 22 Jul 2011 20:54:15 +0000 (13:54 -0700)]
ir_to_mesa: Try to avoid emitting a MOV_SAT to saturate an expression tree.

Fixes a regression in codegen quality for ff_fragment_shader
conversion to GLSL -- glean texCombine produces 7.5% fewer Mesa IR
instructions.

13 years agoprog_optimize: Add support for saturates to _mesa_merge_mov_into_inst.
Eric Anholt [Fri, 22 Jul 2011 22:13:08 +0000 (15:13 -0700)]
prog_optimize: Add support for saturates to _mesa_merge_mov_into_inst.

This fixes the remaining regression from ff_fragment_shader in Mesa IR
instruction count, to now being a 1.9% win overall.

13 years agoi965: Add dumping for gen6 WM constants too.
Eric Anholt [Tue, 26 Jul 2011 01:15:25 +0000 (18:15 -0700)]
i965: Add dumping for gen6 WM constants too.

This looks just like the VS dump for now.

13 years agomesa: Remove dead "MemPool" field of gl_shader_state.
Eric Anholt [Thu, 28 Jul 2011 16:52:03 +0000 (09:52 -0700)]
mesa: Remove dead "MemPool" field of gl_shader_state.

13 years agoi965/fs: Don't upload unused uniform components.
Eric Anholt [Tue, 26 Jul 2011 01:13:04 +0000 (18:13 -0700)]
i965/fs: Don't upload unused uniform components.

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.

13 years agoi965/fs: Don't allocate the old backend's compile structs for our compile.
Eric Anholt [Thu, 28 Jul 2011 16:57:19 +0000 (09:57 -0700)]
i965/fs: Don't allocate the old backend's compile structs for our compile.

This saves some 35MB when the program only uses GLSL shaders.

13 years agowinsys/radeon: do the CS cleanup in the CS ioctl thread
Marek Olšák [Wed, 3 Aug 2011 19:01:31 +0000 (21:01 +0200)]
winsys/radeon: do the CS cleanup in the CS ioctl thread

13 years agowinsys/radeon: fix space checking
Marek Olšák [Wed, 3 Aug 2011 18:57:48 +0000 (20:57 +0200)]
winsys/radeon: fix space checking

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.

13 years agost/dri: remove an unused-but-set variable
Marek Olšák [Fri, 5 Aug 2011 05:07:46 +0000 (07:07 +0200)]
st/dri: remove an unused-but-set variable

13 years agost/dri: remove a dummy function dri2_create_context
Marek Olšák [Fri, 5 Aug 2011 05:02:25 +0000 (07:02 +0200)]
st/dri: remove a dummy function dri2_create_context

It does nothing besides calling dri_create_context with the same parameters.

13 years agost/mesa: remove unused-but-set variables in st_glsl_to_tgsi.cpp
Marek Olšák [Fri, 5 Aug 2011 04:57:07 +0000 (06:57 +0200)]
st/mesa: remove unused-but-set variables in st_glsl_to_tgsi.cpp

13 years agor300g: handle new CAPs
Marek Olšák [Fri, 5 Aug 2011 04:04:05 +0000 (06:04 +0200)]
r300g: handle new CAPs

13 years agor300g: adapt to the resource_resolve interface change
Marek Olšák [Fri, 5 Aug 2011 04:03:18 +0000 (06:03 +0200)]
r300g: adapt to the resource_resolve interface change

13 years agovbo: do not call _mesa_max_buffer_index in debug builds
Marek Olšák [Thu, 4 Aug 2011 05:38:13 +0000 (07:38 +0200)]
vbo: do not call _mesa_max_buffer_index in debug builds

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 <brianp@vmware.com>
13 years agoglsl: empty declarations should be valid
Chia-I Wu [Wed, 3 Aug 2011 15:39:07 +0000 (00:39 +0900)]
glsl: empty declarations should be valid

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 <chad@chad-versace.us>
Note: this is a candidate for the 7.11 branch.

13 years agomesa: Remove MSVC stdint typedefs from compiler.h.
Vinson Lee [Fri, 5 Aug 2011 01:04:44 +0000 (18:04 -0700)]
mesa: Remove MSVC stdint typedefs from compiler.h.

MSVC can now include the stdint.h at include/c99/stdint.h.

13 years agomesa: pass correct constant type to _mesa_fetch_state()
Brian Paul [Thu, 4 Aug 2011 22:01:27 +0000 (16:01 -0600)]
mesa: pass correct constant type to _mesa_fetch_state()

Fixes assorted warnings about float vs. gl_constant_value pointers.

13 years agomesa: use gl_constant_value type in ARB program parser
Brian Paul [Thu, 4 Aug 2011 22:00:06 +0000 (16:00 -0600)]
mesa: use gl_constant_value type in ARB program parser

13 years agomesa: use gl_constant_value type in _mesa_[Get]ProgramNamedParameter4fNV()
Brian Paul [Thu, 4 Aug 2011 21:55:50 +0000 (15:55 -0600)]
mesa: use gl_constant_value type in _mesa_[Get]ProgramNamedParameter4fNV()

13 years agomesa: add st_glsl_to_tgsi.cpp to Sconscript
Brian Paul [Thu, 4 Aug 2011 21:55:13 +0000 (15:55 -0600)]
mesa: add st_glsl_to_tgsi.cpp to Sconscript

13 years agomesa: fix out of bounds array access in rtgc debug code
Brian Paul [Thu, 4 Aug 2011 21:32:09 +0000 (15:32 -0600)]
mesa: fix out of bounds array access in rtgc debug code

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39841
This would only be hit if someone set RGTC_DEBUG=1.

13 years agomesa: don't use K&R style function pointer calls
Brian Paul [Thu, 4 Aug 2011 19:07:50 +0000 (13:07 -0600)]
mesa: don't use K&R style function pointer calls

13 years agoMerge branch 'glsl-to-tgsi'
Bryan Cain [Thu, 4 Aug 2011 20:43:34 +0000 (15:43 -0500)]
Merge branch 'glsl-to-tgsi'

Conflicts:
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_program.c

13 years agost/mesa: replace duplicated create_color_map_texture() function with shared function
Bryan Cain [Thu, 4 Aug 2011 15:15:54 +0000 (10:15 -0500)]
st/mesa: replace duplicated create_color_map_texture() function with shared function

13 years agoglsl_to_tgsi: remove debugging printf
Bryan Cain [Tue, 2 Aug 2011 16:36:44 +0000 (11:36 -0500)]
glsl_to_tgsi: remove debugging printf

13 years agost/mesa: silence int/float and double/float conversion warnings
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
st/mesa: silence int/float and double/float conversion warnings

13 years agost/mesa: move declaration before code
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
st/mesa: move declaration before code

13 years agomesa: minor comment updates in enable.c
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: minor comment updates in enable.c

13 years agomesa: whitespace, formatting fixes in GetTexParameter() code
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: whitespace, formatting fixes in GetTexParameter() code

13 years agomesa: add null ptr checks in GetTexParameterI[u]iv() functions
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: add null ptr checks in GetTexParameterI[u]iv() functions

13 years agomesa: condense GL_TEXTURE_RESIDENT query code
Brian Paul [Thu, 4 Aug 2011 14:22:31 +0000 (08:22 -0600)]
mesa: condense GL_TEXTURE_RESIDENT query code

13 years agomesa: make error handling in glGetTexParameter() a bit more concise
Brian Paul [Thu, 4 Aug 2011 14:22:30 +0000 (08:22 -0600)]
mesa: make error handling in glGetTexParameter() a bit more concise

13 years agonv50: implement resource_resolve with custom blit
Christoph Bumiller [Thu, 28 Jul 2011 13:54:53 +0000 (15:54 +0200)]
nv50: implement resource_resolve with custom blit

13 years agost/mesa: implement multisample resolve via BlitFramebuffer
Christoph Bumiller [Wed, 3 Aug 2011 14:01:41 +0000 (16:01 +0200)]
st/mesa: implement multisample resolve via BlitFramebuffer

13 years agogallium: extend resource_resolve to accommodate BlitFramebuffer
Christoph Bumiller [Wed, 3 Aug 2011 13:43:16 +0000 (15:43 +0200)]
gallium: extend resource_resolve to accommodate BlitFramebuffer

Resolve via glBlitFramebuffer allows resolving a sub-region of a
renderbuffer to a different location in any mipmap level of some
other texture, and, with a new extension, even scaling. Therefore,
location and size parameters are needed.

The mask parameter was added because resolving only depth or only
stencil of a combined buffer is possible as well.

Full information about the blit operation allows the drivers to
take the most efficient path they possibly can.

13 years agost/mesa: determine Const.MaxSamples in init_extensions
Christoph Bumiller [Thu, 28 Jul 2011 13:26:01 +0000 (15:26 +0200)]
st/mesa: determine Const.MaxSamples in init_extensions

v2: Check for non-pow2 sample counts as well.

13 years agoegl/gbm: Fix EGL_DEFAULT_DISPLAY
Benjamin Franzke [Wed, 29 Jun 2011 06:49:39 +0000 (08:49 +0200)]
egl/gbm: Fix EGL_DEFAULT_DISPLAY

13 years agogbm: link gbm_gallium_drm.so against math library
Benjamin Franzke [Thu, 4 Aug 2011 11:37:42 +0000 (13:37 +0200)]
gbm: link gbm_gallium_drm.so against math library

This avoids the following runtime error with EGL on platforms that
require linking with libm for nontrivial math functions:

failed to load module: /xorg/lib64/gbm/gbm_gallium_drm.so: undefined
symbol: powf

(Based on Kristóf RALOVICHs patch and Ian's suggestions in
http://lists.freedesktop.org/archives/mesa-dev/2011-August/010036.html)

13 years agogbm/dri: avoid crash in dri_screen_create
RALOVICH, Kristóf [Sun, 31 Jul 2011 21:49:43 +0000 (23:49 +0200)]
gbm/dri: avoid crash in dri_screen_create

13 years agor600g: remove more of unused code
Marek Olšák [Thu, 4 Aug 2011 01:23:12 +0000 (03:23 +0200)]
r600g: remove more of unused code

This is a follow-up to f6df430a85141f6a384c18079fb5b2ad848dac0d.

13 years agor600g: take into account force_add_cf in pops
Vadim Girlin [Wed, 3 Aug 2011 11:35:02 +0000 (15:35 +0400)]
r600g: take into account force_add_cf in pops

When we have two ENDIFs in a row, we shouldn't modify the pop_count
for the same alu clause twice.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38163

Note: this is a candidate for the 7.11 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 years agor600g: use backend mask for occlusion queries
Vadim Girlin [Tue, 2 Aug 2011 21:04:19 +0000 (01:04 +0400)]
r600g: use backend mask for occlusion queries

Use backend_map kernel query if supported, otherwise analyze ZPASS_DONE
results to get the mask.

Fixes lockups with predicated rendering due to incorrect query buffer
initialization on some cards.

Note: this is a candidate for the 7.11 branch.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 years agowinsys/radeon: remove dummy function pb_buffer
Marek Olšák [Tue, 2 Aug 2011 22:52:55 +0000 (00:52 +0200)]
winsys/radeon: remove dummy function pb_buffer

13 years agoutil: fix a typo in util_format_swizzle_4f
Marek Olšák [Tue, 2 Aug 2011 23:13:06 +0000 (01:13 +0200)]
util: fix a typo in util_format_swizzle_4f

Reported by Gustaw Smolarczyk.

13 years agoradeon: Remove some remaining set-but-unused variables.
Eric Anholt [Tue, 2 Aug 2011 20:49:05 +0000 (13:49 -0700)]
radeon: Remove some remaining set-but-unused variables.

These looked more like copy-and-paste to me than the others (which
looked more like possibly someone forgot to write some code in a
refactor), so I didn't verify where they came from.

13 years agoradeon: Remove set-but-unused variables in radeon_lock.c
Eric Anholt [Tue, 2 Aug 2011 20:47:18 +0000 (13:47 -0700)]
radeon: Remove set-but-unused variables in radeon_lock.c

These have been unused since this function's introduction in the FBO
support development around 2009.

13 years agoradeon: Remove set-but-unused variables in radeonSetTexBuffer2() variants.
Eric Anholt [Tue, 2 Aug 2011 20:41:59 +0000 (13:41 -0700)]
radeon: Remove set-but-unused variables in radeonSetTexBuffer2() variants.

These have been unused since 2009.

13 years agoradeon: Remove set-but-unused log2depth variable.
Eric Anholt [Tue, 2 Aug 2011 20:39:43 +0000 (13:39 -0700)]
radeon: Remove set-but-unused log2depth variable.

r100 doesn't support 3D GL_EXT_texture3D.

13 years agoradeon: Remove set-but-unused color_mask variable.
Eric Anholt [Tue, 2 Aug 2011 20:36:57 +0000 (13:36 -0700)]
radeon: Remove set-but-unused color_mask variable.

This has been around since the initial import in 2003 and never used.

13 years agointel: Fix unused variable warning.
Eric Anholt [Mon, 1 Aug 2011 23:06:59 +0000 (16:06 -0700)]
intel: Fix unused variable warning.

13 years agor600g: remove dummy function r600_bo_offset
Marek Olšák [Sat, 23 Jul 2011 02:29:59 +0000 (04:29 +0200)]
r600g: remove dummy function r600_bo_offset

Always returned 0.

13 years agor600g: remove unused code
Marek Olšák [Fri, 22 Jul 2011 16:45:30 +0000 (18:45 +0200)]
r600g: remove unused code

13 years agogallium/util: add functions for manipulating swizzles
Marek Olšák [Mon, 1 Aug 2011 23:04:58 +0000 (01:04 +0200)]
gallium/util: add functions for manipulating swizzles

Some of those have been in drivers already.

13 years agoi915: Only emit program errors when INTEL_DEBUG=wm or INTEL_DEBUG=fallbacks
Ian Romanick [Thu, 10 Feb 2011 21:20:26 +0000 (13:20 -0800)]
i915: Only emit program errors when INTEL_DEBUG=wm or INTEL_DEBUG=fallbacks

This makes piglit a lot more happy.  The errors are logged when
INTEL_DEBUG=fallbacks because the application is about to hit a big
software fallback.  We frequently ask people to run applications that
are hitting software fallbacks with INTEL_DEBUG=fallbacks so the we
can help them debug the reason for the software fallback.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi915: Fail without crashing if a Mesa IR program uses too many registers
Ian Romanick [Mon, 25 Jul 2011 23:41:39 +0000 (16:41 -0700)]
i915: Fail without crashing if a Mesa IR program uses too many registers

This can only happen in GLSL shaders because assembly shaders that use
too many temps are rejected by core Mesa.  It is easiest to make this
happen with shaders that contain flow-control that could not be lowered.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Emit warnings instead of errors for IR that can't be lowered
Ian Romanick [Mon, 25 Jul 2011 22:58:07 +0000 (15:58 -0700)]
ir_to_mesa: Emit warnings instead of errors for IR that can't be lowered

Rely on the driver to do the right thing.  This probably means falling
back to software.  Page 88 of the OpenGL 2.1 spec specifically says:

    "A shader should not fail to compile, and a program object should
    not fail to link due to lack of instruction space or lack of
    temporary variables. Implementations should ensure that all valid
    shaders and program objects may be successfully compiled, linked
    and executed."

There is no provision for saying "No" to a valid shader that is
difficult for the hardware to handle, so stop doing that.

On i915 this causes a large number of piglit tests to change from FAIL
to WARN.  The warning is because the driver still emits messages to
stderr like "i915_program_error: Unsupported opcode: BGNLOOP".

It also fixes ES2 conformance CorrectFull_frag and CorrectParse1_frag
on i915 (and probably other hardware that can't handle loops).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoir_to_mesa: Use Add linker_error instead of fail_link
Ian Romanick [Mon, 25 Jul 2011 22:55:59 +0000 (15:55 -0700)]
ir_to_mesa: Use Add linker_error instead of fail_link

The functions were almost identical.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Ensure that gl_shader_program::InfoLog is never NULL
Ian Romanick [Thu, 28 Jul 2011 22:10:17 +0000 (15:10 -0700)]
mesa: Ensure that gl_shader_program::InfoLog is never NULL

This prevents assertion failures in ralloc_strcat.  The ralloc_free in
_mesa_free_shader_program_data can be omitted because freeing the
gl_shader_program in _mesa_delete_shader_program will take care of
this automatically.

A bunch of this code could use a refactor to use ralloc a bit more
effectively.  A bunch of the things that are allocated with malloc and
owned by the gl_shader_program should be allocated with ralloc (using
the gl_shader_program as the context).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agolinker: Make linker_{error,warning} generally available
Ian Romanick [Thu, 28 Jul 2011 21:09:06 +0000 (14:09 -0700)]
linker: Make linker_{error,warning} generally available

linker_warning is a new function.  It's identical to linker_error
except that it doesn't set LinkStatus=false and it prepends "warning: "
on messages instead of "error: ".

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agolinker: Make linker_error set LinkStatus to false
Ian Romanick [Thu, 28 Jul 2011 21:04:09 +0000 (14:04 -0700)]
linker: Make linker_error set LinkStatus to false

Remove the other places that set LinkStatus to false since they all
immediately follow a call to linker_error.  The function linker_error
was previously known as linker_error_printf.  The name was changed
because it may seem surprising that a printf function will set an
error flag.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965/gen5+: Fix incorrect miptree layout for non-power-of-two cubemaps.
Kenneth Graunke [Sat, 30 Jul 2011 23:44:49 +0000 (16:44 -0700)]
i965/gen5+: Fix incorrect miptree layout for non-power-of-two cubemaps.

For power-of-two sizes, h0 == mt->height0 since it's already a multiple
of two.  However, for NPOT, they're different; h1 should be computed
based on the original size.

Fixes piglit test "cubemap npot" and oglconform test "textureNPOT".

NOTE: This is a candidate for stable release branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl_to_tgsi: copy reladdr in st_src_reg(st_dst_reg) constructor
Bryan Cain [Wed, 27 Jul 2011 21:39:40 +0000 (16:39 -0500)]
glsl_to_tgsi: copy reladdr in st_src_reg(st_dst_reg) constructor

This is a glsl_to_tgsi port of commit f7cd9a858c04.

13 years agoglsl_to_tgsi: add each relative address to the previous
Bryan Cain [Wed, 27 Jul 2011 21:36:10 +0000 (16:36 -0500)]
glsl_to_tgsi: add each relative address to the previous

This is a glsl_to_tgsi port of commit d6e1a8f71437.

13 years agoglsl_to_tgsi: lower all ir_quadop_vector expressions
Bryan Cain [Wed, 27 Jul 2011 20:45:16 +0000 (15:45 -0500)]
glsl_to_tgsi: lower all ir_quadop_vector expressions

Unlike Mesa IR, TGSI doesn't have a SWZ opcode.

13 years agoglsl_to_tgsi: rework immediate tracking to not use gl_program_parameter_list
Bryan Cain [Wed, 27 Jul 2011 20:20:19 +0000 (15:20 -0500)]
glsl_to_tgsi: rework immediate tracking to not use gl_program_parameter_list

13 years agoglsl_to_tgsi: update comments
Bryan Cain [Fri, 22 Jul 2011 18:24:42 +0000 (13:24 -0500)]
glsl_to_tgsi: update comments

13 years agoglsl_to_tgsi: make coding style more consistent
Bryan Cain [Fri, 22 Jul 2011 18:23:26 +0000 (13:23 -0500)]
glsl_to_tgsi: make coding style more consistent

13 years agoglsl_to_tgsi: make assignment hack safer
Bryan Cain [Thu, 21 Jul 2011 21:29:56 +0000 (16:29 -0500)]
glsl_to_tgsi: make assignment hack safer

Fixes an assertion failure in piglit test glsl-texcoord-array.

13 years agoglsl_to_tgsi: separate immediates from array constants during IR translation
Bryan Cain [Thu, 21 Jul 2011 20:49:26 +0000 (15:49 -0500)]
glsl_to_tgsi: separate immediates from array constants during IR translation

Before, if any uniform or constant array was accessed with indirect
addressing, st_translate_program() would emit uniform constants in the place
of immediates.  This behavior was unavoidable with ir_to_mesa/mesa_to_tgsi, but
glsl_to_tgsi can work around it since the GLSL IR backend and the TGSI
emission are both inside the state tracker.

13 years agoglsl_to_tgsi: fix mistakes in get_pixel_transfer_visitor()
Bryan Cain [Sun, 10 Jul 2011 22:36:04 +0000 (17:36 -0500)]
glsl_to_tgsi: fix mistakes in get_pixel_transfer_visitor()

I noticed these issues while working on get_bitmap_visitor().

13 years agost/mesa, glsl_to_tgsi: support glBitmap with a GLSL fragment shader active
Bryan Cain [Sun, 10 Jul 2011 22:17:38 +0000 (17:17 -0500)]
st/mesa, glsl_to_tgsi: support glBitmap with a GLSL fragment shader active

13 years agost/mesa, glsl_to_tgsi: support glDrawPixels/glCopyPixels with a GLSL fragment shader...
Bryan Cain [Sat, 9 Jul 2011 02:12:08 +0000 (21:12 -0500)]
st/mesa, glsl_to_tgsi: support glDrawPixels/glCopyPixels with a GLSL fragment shader active

Since this was previously implemented using Mesa IR and _mesa_combine_programs,
this commit adds a new code path that works with glsl_to_tgsi.

13 years agoglsl_to_tgsi: replace MAX_PROGRAM_TEMPS (256) with MAX_TEMPS (4096)
Bryan Cain [Mon, 4 Jul 2011 13:44:12 +0000 (08:44 -0500)]
glsl_to_tgsi: replace MAX_PROGRAM_TEMPS (256) with MAX_TEMPS (4096)

13 years agor200, r600c, i965: fix build
Bryan Cain [Thu, 30 Jun 2011 18:42:37 +0000 (13:42 -0500)]
r200, r600c, i965: fix build

13 years agoglsl_to_tgsi: always run copy_propagate() and eliminate_dead_code_advanced()
Bryan Cain [Mon, 27 Jun 2011 22:40:10 +0000 (17:40 -0500)]
glsl_to_tgsi: always run copy_propagate() and eliminate_dead_code_advanced()

These two passes are written to handle indirect addressing properly.

13 years agoglsl_to_tgsi: fix mistake in new dead code elimination pass
Bryan Cain [Mon, 27 Jun 2011 22:25:50 +0000 (17:25 -0500)]
glsl_to_tgsi: fix mistake in new dead code elimination pass

The conditions of IF opcodes were not being counted as reads, which sometimes
led to the condition register being wrong or undefined.

13 years agoglsl_to_tgsi: improve assignment handling
Bryan Cain [Mon, 27 Jun 2011 22:11:07 +0000 (17:11 -0500)]
glsl_to_tgsi: improve assignment handling

This is a hack, but it's better than emitting an unnecessary MOV instruction
and hoping the optimization passes clean it up.

13 years agoglsl_to_tgsi: improve eliminate_dead_code_advanced()
Bryan Cain [Sat, 25 Jun 2011 04:17:30 +0000 (23:17 -0500)]
glsl_to_tgsi: improve eliminate_dead_code_advanced()

13 years agoglsl_to_tgsi: use the correct writemask in try_emit_mad() and try_emit_sat()
Bryan Cain [Sat, 25 Jun 2011 03:32:26 +0000 (22:32 -0500)]
glsl_to_tgsi: use the correct writemask in try_emit_mad() and try_emit_sat()

13 years agoglsl_to_tgsi: use a more specific condition for gl_FragDepth hack in generating assig...
Bryan Cain [Sat, 25 Jun 2011 01:37:53 +0000 (20:37 -0500)]
glsl_to_tgsi: use a more specific condition for gl_FragDepth hack in generating assignments

This reduces the number of instructions in the fragment shader of
glsl-fs-atan-2 from 174 to 146 with EmitNoIfs enabled.

13 years agoglsl_to_tgsi: add a better, more advanced dead code elimination pass
Bryan Cain [Fri, 24 Jun 2011 23:45:04 +0000 (18:45 -0500)]
glsl_to_tgsi: add a better, more advanced dead code elimination pass

13 years agoglsl_to_tgsi: remove handling of XPD opcode in compile_tgsi_instruction()
Bryan Cain [Fri, 24 Jun 2011 00:53:37 +0000 (19:53 -0500)]
glsl_to_tgsi: remove handling of XPD opcode in compile_tgsi_instruction()

The opcode is never emitted by the glsl_to_tgsi_visitor, so its special case in
compile_tgsi_instruction() was dead code.

13 years agoglsl_to_tgsi: use swizzle_for_size for src reg in conditional moves
Bryan Cain [Fri, 24 Jun 2011 00:35:36 +0000 (19:35 -0500)]
glsl_to_tgsi: use swizzle_for_size for src reg in conditional moves

This prevents the copy propagation pass from being confused by undefined
channels and thus missing optimization opportunities.

13 years agoglsl_to_tgsi: execute merge_registers() after eliminate_dead_code()
Emil Velikov [Tue, 21 Jun 2011 20:52:19 +0000 (21:52 +0100)]
glsl_to_tgsi: execute merge_registers() after eliminate_dead_code()

Fixes a regression unintentionally introduced by "glsl_to_tgsi: fix shaders with
indirect addressing of temps" that caused missing leaves in 3dmark01 test 4 (Nature)
and missing/displaced textures on human models in Counter-Strike: Source.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Bryan Cain <bryancain3@gmail.com>
13 years agoglsl_to_tgsi: implement simplify_cmp pass needed by r300g
Bryan Cain [Thu, 16 Jun 2011 23:36:16 +0000 (18:36 -0500)]
glsl_to_tgsi: implement simplify_cmp pass needed by r300g

13 years agoglsl_to_tgsi: fix compile error with g++ 4.6
Bryan Cain [Thu, 16 Jun 2011 18:42:57 +0000 (13:42 -0500)]
glsl_to_tgsi: fix compile error with g++ 4.6

13 years agoglsl: remove glsl_type::get_vec4_type()
Bryan Cain [Wed, 15 Jun 2011 22:31:51 +0000 (17:31 -0500)]
glsl: remove glsl_type::get_vec4_type()

Thanks to Kenneth Graunke for pointing out that glsl_type::get_instance(base, 4, 1)
is the same as glsl_type::get_vec4_type(base).

The function was only used in st_glsl_to_tgsi, and this commit replaces that usage
with get_instance.

13 years agoglsl_to_tgsi: silence compiler warning
Bryan Cain [Wed, 15 Jun 2011 19:45:03 +0000 (14:45 -0500)]
glsl_to_tgsi: silence compiler warning

13 years agoglsl_to_tgsi: finish some loose ends
Bryan Cain [Tue, 14 Jun 2011 23:17:40 +0000 (18:17 -0500)]
glsl_to_tgsi: finish some loose ends

13 years agoglsl-to-tgsi: fix piglit tests
Bryan Cain [Tue, 14 Jun 2011 22:38:14 +0000 (17:38 -0500)]
glsl-to-tgsi: fix piglit tests

This commit fixes all of the piglit tests regressed by "mesa, glsl_to_tgsi: add
native support for integers in shaders" on softpipe.

13 years agomesa, glsl_to_tgsi: add native support for integers in shaders
Bryan Cain [Mon, 13 Jun 2011 23:12:56 +0000 (18:12 -0500)]
mesa, glsl_to_tgsi: add native support for integers in shaders

Disabled by default on all drivers.  To enable it, change ctx->GLSLVersion to 130
in st_extensions.c.  Currently, softpipe is the only driver with integer support.

13 years agotgsi: add support for TGSI_OPCODE_MOD in tgsi_exec
Bryan Cain [Mon, 13 Jun 2011 22:52:54 +0000 (17:52 -0500)]
tgsi: add support for TGSI_OPCODE_MOD in tgsi_exec