mesa.git
12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

12 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

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

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

12 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

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

12 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

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

12 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>
12 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>
12 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

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

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

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

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

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

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

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

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

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

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

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

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

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

12 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

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

12 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

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

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

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

12 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

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

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

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

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

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

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

12 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()

12 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()

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

12 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

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

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

12 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>
12 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

12 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

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

12 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

12 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

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

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

12 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

12 years agomesa: support boolean and integer-based parameters in prog_parameter
Bryan Cain [Tue, 17 May 2011 22:13:20 +0000 (17:13 -0500)]
mesa: support boolean and integer-based parameters in prog_parameter

The functionality is not used by anything yet, and the glUniform functions will
need to be reworked before this can reach its full usefulness.  It is
nonetheless a step towards integer support in the state tracker and classic drivers.

12 years agogallium: add PIPE_SHADER_CAP_INTEGERS
Bryan Cain [Fri, 6 May 2011 02:10:28 +0000 (21:10 -0500)]
gallium: add PIPE_SHADER_CAP_INTEGERS

12 years agoglsl_to_tgsi: fix shaders with indirect addressing of temps
Bryan Cain [Tue, 3 May 2011 04:12:18 +0000 (23:12 -0500)]
glsl_to_tgsi: fix shaders with indirect addressing of temps

Fixes several Piglit tests, although it's a step backwards for optimization.

12 years agoglsl_to_tgsi: use TGSI opcodes when converting from GLSL IR
Bryan Cain [Mon, 2 May 2011 02:49:21 +0000 (21:49 -0500)]
glsl_to_tgsi: use TGSI opcodes when converting from GLSL IR

Before, the translator used Mesa IR opcodes (a holdover from ir_to_mesa) and
converted them to TGSI opcodes during TGSI emission.

12 years agoglsl_to_tgsi: support DDY (ir_unop_dFdy)
Bryan Cain [Sun, 1 May 2011 16:55:03 +0000 (11:55 -0500)]
glsl_to_tgsi: support DDY (ir_unop_dFdy)

12 years agoglsl_to_tgsi: lower noise opcodes when converting from GLSL IR, not when generating...
Bryan Cain [Sun, 1 May 2011 04:17:11 +0000 (23:17 -0500)]
glsl_to_tgsi: lower noise opcodes when converting from GLSL IR, not when generating TGSI

12 years agoglsl_to_tgsi: define the sampler objects used
Bryan Cain [Sun, 1 May 2011 02:17:38 +0000 (21:17 -0500)]
glsl_to_tgsi: define the sampler objects used

Fixes the Nexuiz title screen and the water in 0 A.D.

12 years agoglsl_to_tgsi: remove a bad assertion
Bryan Cain [Sat, 30 Apr 2011 18:44:32 +0000 (13:44 -0500)]
glsl_to_tgsi: remove a bad assertion

It was triggered by Alien Arena.

12 years agoglsl_to_tgsi: remove reads to output registers
Bryan Cain [Sat, 30 Apr 2011 18:03:33 +0000 (13:03 -0500)]
glsl_to_tgsi: remove reads to output registers

Fixes a regression in 0 A.D. introduced by 809a11c77073e999fd47.

12 years agoglsl_to_tgsi: stop generating Mesa IR
Bryan Cain [Sat, 30 Apr 2011 00:24:57 +0000 (19:24 -0500)]
glsl_to_tgsi: stop generating Mesa IR

Before, it was still generating unused Mesa IR as a remnant of ir_to_mesa, and
depended on some of the information from it.

12 years agomesa: fix segfault when no Mesa IR is generated
Bryan Cain [Sat, 30 Apr 2011 00:00:24 +0000 (19:00 -0500)]
mesa: fix segfault when no Mesa IR is generated

12 years agost/mesa: Add a GLSL IR to TGSI translator.
Bryan Cain [Tue, 26 Apr 2011 04:37:47 +0000 (23:37 -0500)]
st/mesa: Add a GLSL IR to TGSI translator.

It is still a work in progress at this point, but it produces working and
reasonably well-optimized code.

Originally based on ir_to_mesa and st_mesa_to_tgsi, but does not directly use
Mesa IR instructions in TGSI generation, instead generating TGSI from the
intermediate class glsl_to_tgsi_instruction.  It also has new optimization
passes to replace _mesa_optimize_program.

12 years agoglsl: improve the accuracy of the atan(x,y) builtin function.
Paul Berry [Wed, 27 Jul 2011 22:53:31 +0000 (15:53 -0700)]
glsl: improve the accuracy of the atan(x,y) builtin function.

The previous formula for atan(x,y) returned a value of +/- pi whenever
|x|<0.0001, and used a formula based on atan(y/x) otherwise.  This
broke in cases where both x and y were small (e.g. atan(1e-5, 1e-5)).

This patch modifies the formula so that it returns a value of +/- pi
whenever |x|<1e-8*|y|, and uses the formula based on atan(y/x)
otherwise.

12 years agoglsl: improve the accuracy of the asin() builtin function.
Paul Berry [Wed, 27 Jul 2011 21:34:12 +0000 (14:34 -0700)]
glsl: improve the accuracy of the asin() builtin function.

The previous formula for asin(x) was algebraically equivalent to:

sign(x)*(pi/2 - sqrt(1-|x|)*(A + B|x| + C|x|^2))

where A, B, and C were arbitrary constants determined by a curve fit.

This formula had a worst case absolute error of 0.00448, an unbounded
worst case relative error, and a discontinuity near x=0.

Changed the formula to:

sign(x)*(pi/2 - sqrt(1-|x|)*(pi/2 + (pi/4-1)|x| + A|x|^2 + B|x|^3))

where A and B are arbitrary constants determined by a curve fit.  This
has a worst case absolute error of 0.00039, a worst case relative
error of 0.000405, and no discontinuities.

I don't expect a significant performance degradation, since the extra
multiply-accumulate should be fast compared to the sqrt() computation.

Fixes piglit tests {vs,fs}-asin-float and {vs,fs}-atan-*

12 years agoglsl: Remove duplicate comment
Chad Versace [Mon, 1 Aug 2011 16:36:08 +0000 (09:36 -0700)]
glsl: Remove duplicate comment

Remove duplicate doxgen comment for
ir_function.cpp:parameter_lists_match().

Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agodarwin: Use machine/endian.h to determine endianness
Jeremy Huddleston [Sun, 31 Jul 2011 16:31:48 +0000 (09:31 -0700)]
darwin: Use machine/endian.h to determine endianness

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoFix PPC detection on darwin
Jeremy Huddleston [Sun, 31 Jul 2011 16:21:56 +0000 (09:21 -0700)]
Fix PPC detection on darwin

Fixes regression introduced by 7004582c1894ede839c44e292b413fe4916d7e9e

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
12 years agoglsl: Clarify ir_function::matching_sigature()
Chad Versace [Wed, 27 Jul 2011 19:37:51 +0000 (12:37 -0700)]
glsl: Clarify ir_function::matching_sigature()

The function used a variable named 'score', which was an outright lie.
A signature matches or it doesn't; there is no fuzzy scoring.

Change the return type of parameter_lists_match() to an enum, and
let ir_function::matching_sigature() switch on that enum.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoglsl: Fix conversions in array constructors
Chad Versace [Wed, 27 Jul 2011 20:00:02 +0000 (13:00 -0700)]
glsl: Fix conversions in array constructors

Array constructors obey narrower conversion rules than other constructors
[1] --- they use the implicit conversion rules [2] instead of the scalar
constructor conversions [3].  But process_array_constructor() was
incorrectly applying the broader rules.

[1] GLSL 1.50 spec, Section 5.4.4 Array Constructors, page 52 (58 of pdf)
[2] GLSL 1.50 spec, Section 4.1.10 Implicit Conversions, page 25 (31 of pdf)
[3] GLSL 1.50 spec, Section 5.4.1 Conversion, page 48 (54 of pdf)

To fix this, first check (with glsl_type::can_be_implicitly_converted_to)
if an implicit conversion is legal before performing the conversion.

Fixes:
piglit:spec/glsl-1.20/compiler/structure-and-array-operations/array-ctor-implicit-conversion-bool-float.vert
piglit:spec/glsl-1.20/compiler/structure-and-array-operations/array-ctor-implicit-conversion-bvec*-vec*.vert

Note: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoglsl: Remove ir_function.cpp:type_compare()
Chad Versace [Wed, 27 Jul 2011 19:32:10 +0000 (12:32 -0700)]
glsl: Remove ir_function.cpp:type_compare()

The function is no longer used and has been replaced by
glsl_type::can_implicitly_convert_to().

Note: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoglsl: Fix implicit conversions in non-constructor function calls
Chad Versace [Wed, 27 Jul 2011 19:31:10 +0000 (12:31 -0700)]
glsl: Fix implicit conversions in non-constructor function calls

Context
-------
In ast_function_expression::hir(), parameter_lists_match() checks if the
function call's actual parameter list matches the signature's parameter
list, where the match may require implicit conversion of some arguments.
To check if an implicit conversion exists between individual arguments,
type_compare() is used.

Problems
--------
type_compare() allowed the following illegal implicit conversions:
    bool -> float
    bvecN -> vecN

    int -> uint
    ivecN -> uvecN

    uint -> int
    uvecN -> ivecN

Change
------
type_compare() is buggy, so replace it with glsl_type::can_be_implicitly_converted_to().
This comprises a rewrite of parameter_lists_match().

Fixes piglit:spec/glsl-1.20/compiler/built-in-functions/outerProduct-bvec*.vert

Note: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agoglsl: Add method glsl_type::can_implicitly_convert_to()
Chad Versace [Wed, 27 Jul 2011 19:21:27 +0000 (12:21 -0700)]
glsl: Add method glsl_type::can_implicitly_convert_to()

This method checks if a source type is identical to or can be implicitly
converted to a target type according to the GLSL 1.20 spec, Section 4.1.10
Implicit Conversions.

The following commits use the method for a bugfix:
    glsl: Fix implicit conversions in non-constructor function calls
    glsl: Fix implicit conversions in array constructors

Note: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
12 years agomesa: minor comment changes in teximage.c
Brian Paul [Fri, 29 Jul 2011 22:49:55 +0000 (16:49 -0600)]
mesa: minor comment changes in teximage.c

12 years agomesa: add missing breaks for GL_TEXTURE_CUBE_MAP_SEAMLESS queries
Brian Paul [Fri, 29 Jul 2011 22:49:55 +0000 (16:49 -0600)]
mesa: add missing breaks for GL_TEXTURE_CUBE_MAP_SEAMLESS queries

And fix indentation.

NOTE: This is a candidate for the 7.11 branch.

12 years agoi965/fs: Allow register coalescing where the source is a uniform.
Eric Anholt [Fri, 22 Jul 2011 23:52:54 +0000 (16:52 -0700)]
i965/fs: Allow register coalescing where the source is a uniform.

Removes 0.8% of the fragment shader instructions on Unigine Tropics.

12 years agoi965/fs: Optimize a * 1.0 -> a.
Eric Anholt [Fri, 22 Jul 2011 23:45:15 +0000 (16:45 -0700)]
i965/fs: Optimize a * 1.0 -> a.

This appears in our instruction stream as a result of the
brw_vs_constval.c handling.

12 years agoi965/fs: If we see a RCP of a constant, try to constant fold it.
Eric Anholt [Fri, 22 Jul 2011 23:18:39 +0000 (16:18 -0700)]
i965/fs: If we see a RCP of a constant, try to constant fold it.

12 years agoi965/fs: Port texture projection avoidance optimization from the old backend.
Eric Anholt [Fri, 22 Jul 2011 22:56:46 +0000 (15:56 -0700)]
i965/fs: Port texture projection avoidance optimization from the old backend.

This is part of fixing a ~1% performance regression in OpenArena when
changing the fixed function fragment shader to using the new backend.
Right now this just avoids the LINTERP of the projector, not the math
using it.

12 years agoRevert "i965: Don't compute brw->wm.input_size_masks when it's unused."
Eric Anholt [Fri, 22 Jul 2011 22:48:53 +0000 (15:48 -0700)]
Revert "i965: Don't compute brw->wm.input_size_masks when it's unused."

This reverts commit 3412069e23b7fa5656262f3dd1aa86f66980594d.  We're
about to start using it in fragment shaders to handle avoiding
projection for fixed function.

12 years agoi965/fs: Stop using the exec_list iterator.
Eric Anholt [Fri, 29 Jul 2011 18:52:39 +0000 (11:52 -0700)]
i965/fs: Stop using the exec_list iterator.

The old style has gone out of favor in the project, but I kept copy
and pasting from existing iterator code.