mesa.git
14 years agosvga: Remove redundant svga_draw_range_elements.
Chia-I Wu [Sun, 1 Aug 2010 06:27:56 +0000 (14:27 +0800)]
svga: Remove redundant svga_draw_range_elements.

That is, implement draw_vbo directly.  As a result,
svga_swtnl_draw_range_elements is also replaced by svga_swtnl_draw_vbo.

This commit should not have any functional change.

14 years agodraw: Add draw_set_index_buffer and others.
Chia-I Wu [Wed, 25 Aug 2010 06:02:12 +0000 (14:02 +0800)]
draw: Add draw_set_index_buffer and others.

This commit adds draw_set_index_buffer, draw_set_mapped_index_buffer,
and draw_vbo.  The idea behind the new functions is that an index buffer
should be a state.

draw_arrays and draw_set_mapped_element_buffer are preserved, but the
latter will be removed soon.

14 years agonvfx: Clean up header file inclusion in nvfx_screen.h.
Vinson Lee [Wed, 25 Aug 2010 07:52:34 +0000 (00:52 -0700)]
nvfx: Clean up header file inclusion in nvfx_screen.h.

Remove nvfx_context.h.
Include p_compiler.h for INLINE symbol.

Fixes nvfx_context.h -> nvfx_screen.h -> nvfx_context.h include recursion.

14 years agonvfx: Include missing headers in nvfx_shader.h.
Vinson Lee [Wed, 25 Aug 2010 07:44:28 +0000 (00:44 -0700)]
nvfx: Include missing headers in nvfx_shader.h.

Include stdint.h for uint8_t symbol.
Include p_compiler.h for INLINE symbol.

14 years agoi965: Remove unnecessary header.
Vinson Lee [Wed, 25 Aug 2010 07:40:00 +0000 (00:40 -0700)]
i965: Remove unnecessary header.

14 years agor600: Include missing header in evergreen_fragprog.c.
Vinson Lee [Wed, 25 Aug 2010 07:29:19 +0000 (00:29 -0700)]
r600: Include missing header in evergreen_fragprog.c.

Include r600_emit.h for r600EmitShader and r600EmitShaderConsts symbols.

Fixes the following GCC warnings.
evergreen_fragprog.c: In function 'evergreenSetupFragmentProgram':
evergreen_fragprog.c:521: warning: implicit declaration of function 'r600EmitShader'
evergreen_fragprog.c:778: warning: implicit declaration of function 'r600EmitShaderConsts'

14 years agor600: Include missing header in evergreen_vertprog.c.
Vinson Lee [Wed, 25 Aug 2010 07:19:45 +0000 (00:19 -0700)]
r600: Include missing header in evergreen_vertprog.c.

Include r600_emit.h for r600EmitShader and r600EmitShaderConsts symbols.

Fixes the following GCC warnings.
evergreen_vertprog.c:614: warning: implicit declaration of function 'r600EmitShader'
evergreen_vertprog.c:701: warning: implicit declaration of function 'r600EmitShaderConsts'

14 years agogallivm: Include missing header in lp_bld_sample.h.
Vinson Lee [Wed, 25 Aug 2010 06:53:26 +0000 (23:53 -0700)]
gallivm: Include missing header in lp_bld_sample.h.

Include p_format.h for enum pipe_format symbol.

14 years agogallivm: Include missing header in lp_bld_pack.h.
Vinson Lee [Wed, 25 Aug 2010 06:50:45 +0000 (23:50 -0700)]
gallivm: Include missing header in lp_bld_pack.h.

Include p_compiler.h for boolean symbol.

14 years agor300/compiler: Silence uninitialized variable warning.
Vinson Lee [Wed, 25 Aug 2010 06:04:20 +0000 (23:04 -0700)]
r300/compiler: Silence uninitialized variable warning.

The variable loops would be used uninitialized if it ever processed a
RC_OPCODE_ENDLOOP case first.

This patch initalizes the loops variable to NULL and adds an assert at
the RC_OPCODE_ENDLOOP case that loops isn't NULL.

Silence the following GCC warning.
r3xx_vertprog.c: In function 'translate_vertex_program':
r3xx_vertprog.c:469: warning: 'loops' may be used uninitialized in this function

14 years agor300g: Add missing comma in SConscript.
Vinson Lee [Wed, 25 Aug 2010 05:28:21 +0000 (22:28 -0700)]
r300g: Add missing comma in SConscript.

This is a follow-on patch to commit
574ba4b5f50bfe661427327cd792a8a200559376.

Fixes r300g SCons build.

14 years agor300g: fix gl_PointCoord
Marek Olšák [Wed, 25 Aug 2010 02:55:01 +0000 (04:55 +0200)]
r300g: fix gl_PointCoord

Is this hackish or is this the correct way to use point_quad_rasterization?
Copied from nvfx.

14 years agor600: Include missing header in evergreen_render.c.
Vinson Lee [Wed, 25 Aug 2010 02:08:47 +0000 (19:08 -0700)]
r600: Include missing header in evergreen_render.c.

Fixes the following GCC warning.
evergreen_render.c: In function 'evergreenTryDrawPrims':
evergreen_render.c:836: error: implicit declaration of function 'evergreenSetupFragmentProgram'

14 years agor600: Remove unused variable.
Vinson Lee [Wed, 25 Aug 2010 02:04:19 +0000 (19:04 -0700)]
r600: Remove unused variable.

Silences the following GCC warning.
evergreen_state.c: In function 'evergreenSetBlendState':
evergreen_state.c:341: warning: unused variable 'id'

14 years agoi965: Fix printf format warnings on 32-bit builds.
Vinson Lee [Wed, 25 Aug 2010 01:51:56 +0000 (18:51 -0700)]
i965: Fix printf format warnings on 32-bit builds.

14 years agor600: Remove unused variable.
Vinson Lee [Wed, 25 Aug 2010 01:32:51 +0000 (18:32 -0700)]
r600: Remove unused variable.

Fixes the following GCC warning.
r600_emit.c In function 'r600AllocShaderConsts':
r600_emit.c:59: warning: unused variable 'out'

14 years agor600: Remove spaces between backslash and newline.
Vinson Lee [Wed, 25 Aug 2010 01:20:26 +0000 (18:20 -0700)]
r600: Remove spaces between backslash and newline.

Fixes the following GCC warnings.
r600_cmdbuf.h:201: warning: backslash and newline separated by space
r600_cmdbuf.h:202: warning: backslash and newline separated by space

14 years agor300g: eliminate unused constants in FS
Marek Olšák [Tue, 24 Aug 2010 00:51:20 +0000 (02:51 +0200)]
r300g: eliminate unused constants in FS

14 years agor300g: eliminate unused constants in VS
Marek Olšák [Mon, 23 Aug 2010 03:56:48 +0000 (05:56 +0200)]
r300g: eliminate unused constants in VS

14 years agor300g: clean up some mess in set_constant_buffer
Marek Olšák [Tue, 24 Aug 2010 21:05:09 +0000 (23:05 +0200)]
r300g: clean up some mess in set_constant_buffer

14 years agor300g: fix indentation
Marek Olšák [Mon, 23 Aug 2010 03:58:08 +0000 (05:58 +0200)]
r300g: fix indentation

14 years agor300/compiler: implement elimination of unused constants
Marek Olšák [Mon, 23 Aug 2010 03:48:39 +0000 (05:48 +0200)]
r300/compiler: implement elimination of unused constants

Wine likes to create a *lot* of constants, exceeding the size of the constant
file in hw.

14 years agor300/compiler: terminate vertex shader compilation immediately after an error
Marek Olšák [Sun, 22 Aug 2010 23:24:01 +0000 (01:24 +0200)]
r300/compiler: terminate vertex shader compilation immediately after an error

Also rename "compiler" to "c".

14 years agor300/compiler: fail to compile if we hit hw limits or an unimplemented feature
Marek Olšák [Sun, 22 Aug 2010 18:45:50 +0000 (20:45 +0200)]
r300/compiler: fail to compile if we hit hw limits or an unimplemented feature

i.e. relative addressing (mainly FS), saturate modifiers, exceeding
the maximum number of constants.

14 years agor300/compiler: handle indexable temporaries correctly in deadcode elimination
Marek Olšák [Sun, 22 Aug 2010 01:29:54 +0000 (03:29 +0200)]
r300/compiler: handle indexable temporaries correctly in deadcode elimination

14 years agor300/compiler: disable register allocation for indexable temporaries in VS
Marek Olšák [Sun, 22 Aug 2010 01:20:19 +0000 (03:20 +0200)]
r300/compiler: disable register allocation for indexable temporaries in VS

If there is relative addressing of temporaries, we cannot change register
indices, so skip register allocation entirely. To utilize register allocation
at least partially, we need separate indexable and non-indexable register
files in both TGSI and Mesa IR.

14 years agor300g: reset the index bias to 0 at the end of CS
Marek Olšák [Tue, 24 Aug 2010 15:16:44 +0000 (17:16 +0200)]
r300g: reset the index bias to 0 at the end of CS

14 years agoir_to_mesa: set IndirectRegisterFiles
Marek Olšák [Sun, 22 Aug 2010 01:15:00 +0000 (03:15 +0200)]
ir_to_mesa: set IndirectRegisterFiles

This fixes relative addressing of temporaries (and maybe others)
in all gallium drivers.

Acked on irc by Eric Anholt.

14 years agonvfx: Initialize variables on error path.
Vinson Lee [Wed, 25 Aug 2010 00:40:50 +0000 (17:40 -0700)]
nvfx: Initialize variables on error path.

14 years agoglsl: Set up uniform initializers by walking the shaders after linking.
Eric Anholt [Tue, 24 Aug 2010 22:43:56 +0000 (15:43 -0700)]
glsl: Set up uniform initializers by walking the shaders after linking.

Previously, uniform initializers were handled by ir_to_mesa as it made
its Parameters list.  However, uniform values are global to all
shaders, and the value set in one Parameters list wasn't propagated to
the other gl_program->Parameters lists.  By going back through the
general Mesa uniform handling, we make sure that all gl_programs get
updated values, and also successfully separate uniform initializer
handling from ir_to_mesa gl_program generation.

Fixes:
glsl-uniform-initializer-5.

14 years agoglsl: Don't dead-code eliminate a uniform initializer.
Eric Anholt [Tue, 24 Aug 2010 22:30:42 +0000 (15:30 -0700)]
glsl: Don't dead-code eliminate a uniform initializer.

Partial fix for glsl-uniform-initializer-5.

14 years agor300g: rename radeong_dri.so to r300_dri.so
Dave Airlie [Sun, 22 Aug 2010 07:28:20 +0000 (17:28 +1000)]
r300g: rename radeong_dri.so to r300_dri.so

acked on irc by Corbin + Marek.

14 years agomake: Use C++ compiler to link stdc++ library.
Brian Paul [Tue, 24 Aug 2010 19:18:09 +0000 (12:18 -0700)]
make: Use C++ compiler to link stdc++ library.

glxinfo and glxgears run on swrast and softpipe without undefined symbol
errors.

14 years agoconfigs: Remove -lstdc++ from default.
Vinson Lee [Tue, 24 Aug 2010 19:14:14 +0000 (12:14 -0700)]
configs: Remove -lstdc++ from default.

This patch undoes commit 9b7480cd95c2d1259e23bfb5549cefaa94ebaca1.

A follow-on patch will provide the proper fix.

14 years agor600g: Add support for PIPE_FORMAT_R32_FLOAT.
Henri Verbeet [Tue, 24 Aug 2010 18:51:20 +0000 (20:51 +0200)]
r600g: Add support for PIPE_FORMAT_R32_FLOAT.

14 years agoprog_execute: Implement OPCODE_TXL
Ian Romanick [Wed, 18 Aug 2010 00:40:20 +0000 (17:40 -0700)]
prog_execute: Implement OPCODE_TXL

Fixes bugzilla #29628

14 years agoglsl2: rename local variable_entry class
Brian Paul [Tue, 24 Aug 2010 16:21:25 +0000 (10:21 -0600)]
glsl2: rename local variable_entry class

With MSVC it seems that this class and its constructor is colliding
with the one in ir_variable_refcount.cpp.  Rename the class here to
avoid the collision.

This is a bit of a hack.  Can the two variable_entry classes be merged
and shared?

14 years agoglsl2: move constructor into .cpp file to work around compiler bug
Brian Paul [Tue, 24 Aug 2010 16:01:40 +0000 (10:01 -0600)]
glsl2: move constructor into .cpp file to work around compiler bug

Fixes fd.o bug 29770

The refcount==0 assertion only failed on some systems.  One example
being 32-bit Linux with gcc 4.4.4.

14 years agodocs: updated info about GLSL compiler
Brian Paul [Tue, 24 Aug 2010 15:02:05 +0000 (09:02 -0600)]
docs: updated info about GLSL compiler

Ian or Eric should review this and add/edit as needed.

14 years agodocs: list the new GLSL compiler
Brian Paul [Tue, 24 Aug 2010 15:01:54 +0000 (09:01 -0600)]
docs: list the new GLSL compiler

14 years agomesa: added isblank() for MSVC
Brian Paul [Tue, 24 Aug 2010 14:04:37 +0000 (08:04 -0600)]
mesa: added isblank() for MSVC

14 years agomesa: remove non-existant files from tarball list
Brian Paul [Tue, 24 Aug 2010 13:51:52 +0000 (07:51 -0600)]
mesa: remove non-existant files from tarball list

14 years agoglsl: Add assert to check variable_entry referenced_count after construction.
Vinson Lee [Tue, 24 Aug 2010 08:16:46 +0000 (01:16 -0700)]
glsl: Add assert to check variable_entry referenced_count after construction.

A variable_entry after construction should have its referenced_count
member set to 0. However, occassionally this isn't the case and
entry->referenced_count has been observed to be a garbage value. This
leads to crashes of several tests in the Piglit test suite.

This patch adds an assert to check that a variable_entry instance has
its referenced_count member initialized to 0 after construction.

14 years agonvfx: Remove unnecessary headers.
Vinson Lee [Tue, 24 Aug 2010 06:58:57 +0000 (23:58 -0700)]
nvfx: Remove unnecessary headers.

14 years agoglsl: make 'make clean' work properly.
Dave Airlie [Tue, 24 Aug 2010 06:10:28 +0000 (16:10 +1000)]
glsl: make 'make clean' work properly.

this has make clean remove all the objects.

14 years agoglsl: Silence unused variable warning.
Vinson Lee [Tue, 24 Aug 2010 05:27:49 +0000 (22:27 -0700)]
glsl: Silence unused variable warning.

The variable is used but only in the body of an assert.

14 years agor300g: Remove unused variable.
Vinson Lee [Tue, 24 Aug 2010 05:15:24 +0000 (22:15 -0700)]
r300g: Remove unused variable.

Fixes this GCC warning.
r300_render.c: In function 'r300_draw_flush_vbuf':
r300_render.c:988: warning: unused variable 'r300_render'

14 years agost/egl: Fix r300/r600 support in KMS backend.
Chia-I Wu [Mon, 23 Aug 2010 17:05:12 +0000 (01:05 +0800)]
st/egl: Fix r300/r600 support in KMS backend.

When the kernel driver name is radeon, ask the loader for r300 or r600
depending on the PCI ID.

14 years agotargets/egl: Check against drm_driver_descriptor::name.
Chia-I Wu [Mon, 23 Aug 2010 15:03:51 +0000 (23:03 +0800)]
targets/egl: Check against drm_driver_descriptor::name.

drm_driver_descriptor::driver_name is defined to be the name of the
kernel module.  We should check against drm_driver_descriptor::name
instead of drm_driver_descriptor::driver_name.

14 years agotargets/egl: add pipe_r600
Benjamin Franzke [Sun, 22 Aug 2010 16:24:12 +0000 (18:24 +0200)]
targets/egl: add pipe_r600

KNOWN ISSUE: eglShowScreenSurfaceMESA in st/egl/kms fails
but st/egl/x11 works

14 years agotargets/egl: rename pipe_radeon to pipe_r300
Benjamin Franzke [Sun, 22 Aug 2010 16:24:10 +0000 (18:24 +0200)]
targets/egl: rename pipe_radeon to pipe_r300

st/egl/x11/x11_screen.c requests a driver named r300 not radeon

KNOWN ISSUE: breaks st/egl/kms/
st/egl/kms requests a pipe named "radeon"
that will not be found now

so why not leaving pipe_radeon there?
that was possible as long we have only r300g.
now there is also r600g for which st/egl/kms also
requests a pipe named "radeon"
(possible solution in later commit)

14 years agomesa: Remove extraneous semicolon.
Chia-I Wu [Tue, 24 Aug 2010 03:49:55 +0000 (11:49 +0800)]
mesa: Remove extraneous semicolon.

14 years agost/dri: Remove unnecessary main/mtype.h.
Chia-I Wu [Mon, 23 Aug 2010 09:31:20 +0000 (17:31 +0800)]
st/dri: Remove unnecessary main/mtype.h.

14 years agost/wgl: Include main/core.h.
Chia-I Wu [Mon, 23 Aug 2010 09:31:27 +0000 (17:31 +0800)]
st/wgl: Include main/core.h.

Make st/wgl include only main/core.h from core mesa.

14 years agost/glx: Include main/core.h.
Chia-I Wu [Mon, 23 Aug 2010 09:31:38 +0000 (17:31 +0800)]
st/glx: Include main/core.h.

Make st/glx include only main/core.h from core mesa.

14 years agoglsl: Include main/core.h.
Chia-I Wu [Mon, 23 Aug 2010 09:51:42 +0000 (17:51 +0800)]
glsl: Include main/core.h.

Make glsl include only main/core.h from core mesa.

14 years agomesa: Add core.h.
Chia-I Wu [Mon, 23 Aug 2010 09:39:15 +0000 (17:39 +0800)]
mesa: Add core.h.

core.h is the public header of core mesa.  GLX, WGL, and GLSL are
supposed to include this header file.  It should be noted that headers
included by core.h must not perform feature tests (#if FEATURE_xxx).
Otherwise, we cannot, for example, mix a FEATURE_ES2 libmesagallium.a
with a FEATURE_GL libglsl.a.

14 years agotranslate_sse: clear state for each function emission
Luca Barbieri [Tue, 24 Aug 2010 02:16:42 +0000 (04:16 +0200)]
translate_sse: clear state for each function emission

Fixes #29771.

14 years agoglsl: Rely on talloc_autofree_context() instead of trying to free on our own.
Eric Anholt [Tue, 24 Aug 2010 00:16:25 +0000 (17:16 -0700)]
glsl: Rely on talloc_autofree_context() instead of trying to free on our own.

Because the static types talloc their names at dlopen time,
talloc_freeing the types at DRI driver screen teardown means that if
the screen gets brought back up again, the names will point at freed
memory.  talloc_autofree_context() exists to do just what we want
here: Free memory referenced across the program's lifetime so that we
avoid noise in memory leak checkers.

Fixes: bug #29722 (assertion failure in unigine).
14 years agointel: Add support for MAX_SAMPLES=1 EXT_framebuffer_multisample.
Eric Anholt [Mon, 23 Aug 2010 22:53:16 +0000 (15:53 -0700)]
intel: Add support for MAX_SAMPLES=1 EXT_framebuffer_multisample.

The spec specifically sets the minimum MAX_SAMPLES at 1 to allow exposing
the extension on all implementations, so do so.

14 years agoradeon: print chip family for evergreen in renderer string
Alex Deucher [Tue, 24 Aug 2010 00:18:28 +0000 (20:18 -0400)]
radeon: print chip family for evergreen in renderer string

14 years agor600g: add XPD support
Dave Airlie [Mon, 23 Aug 2010 23:56:22 +0000 (09:56 +1000)]
r600g: add XPD support

ported from r600c.

14 years agor600g: add CMP support.
Dave Airlie [Mon, 23 Aug 2010 23:18:32 +0000 (09:18 +1000)]
r600g: add CMP support.

ported from r600c, fixes fp-cmp, glsl1-sqrt*

14 years agonvfx: don't emit dummy commands on nv30
Luca Barbieri [Mon, 23 Aug 2010 22:03:28 +0000 (00:03 +0200)]
nvfx: don't emit dummy commands on nv30

Should fix errors on the original nv30, reported by pmdata.

14 years agoglsl: When unable to assign the initializer for a const variable, set it to 0.
Eric Anholt [Mon, 23 Aug 2010 21:54:06 +0000 (14:54 -0700)]
glsl: When unable to assign the initializer for a const variable, set it to 0.

This prevents assertion failures or cascading errors after we've
logged the fact that we were unable to handle the initializer.

Fixes unsized-array-non-const-index-2.vert

14 years agotranslate_sse: fix x86-64
Luca Barbieri [Mon, 23 Aug 2010 21:21:18 +0000 (23:21 +0200)]
translate_sse: fix x86-64

14 years agoglsl: Cleanly fail when a function has an unknown return type.
Eric Anholt [Mon, 23 Aug 2010 20:26:52 +0000 (13:26 -0700)]
glsl: Cleanly fail when a function has an unknown return type.

Bug #29608.

14 years agor600g: Add support for PIPE_CAP_DEPTH_CLAMP.
Henri Verbeet [Mon, 23 Aug 2010 19:13:59 +0000 (21:13 +0200)]
r600g: Add support for PIPE_CAP_DEPTH_CLAMP.

14 years agoglsl: Rebuild builtins for any() change.
Eric Anholt [Mon, 23 Aug 2010 19:54:55 +0000 (12:54 -0700)]
glsl: Rebuild builtins for any() change.

14 years agomesa: Add new ir_unop_any() expression operation.
Eric Anholt [Mon, 23 Aug 2010 19:21:33 +0000 (12:21 -0700)]
mesa: Add new ir_unop_any() expression operation.

The previous any() implementation would generate arg0.x || arg0.y ||
arg0.z.  Having an expression operation for this makes it easy for the
backend to generate something easier (DPn + SNE for 915 FS, .any
predication on 965 VS)

14 years agoglsl: Regenerate builtins with the new sorting.
Eric Anholt [Mon, 23 Aug 2010 19:39:35 +0000 (12:39 -0700)]
glsl: Regenerate builtins with the new sorting.

14 years agoir_to_mesa: Implement f2b by comparing the arg to 0, not the result.
Eric Anholt [Mon, 23 Aug 2010 19:53:39 +0000 (12:53 -0700)]
ir_to_mesa: Implement f2b by comparing the arg to 0, not the result.

Fixes: glsl-fs-any
14 years agoglsl: Count function call outvals as writing to variables for linker checks.
Eric Anholt [Mon, 23 Aug 2010 18:29:25 +0000 (11:29 -0700)]
glsl: Count function call outvals as writing to variables for linker checks.

Fixes: glsl-vs-position-outval. Bug #28138 (regnum online)
14 years agoglsl2: Include imports.h to get snprintf wrapper for MSVC
Ian Romanick [Fri, 13 Aug 2010 00:57:07 +0000 (17:57 -0700)]
glsl2: Include imports.h to get snprintf wrapper for MSVC

Signed-off-by: José Fonseca <jfonseca@vmware.com>
14 years agomesa: Fix msvc build of glsl.
Aras Pranckevicius [Mon, 23 Aug 2010 06:19:51 +0000 (09:19 +0300)]
mesa: Fix msvc build of glsl.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
14 years agoauxiliary: fix nvfx/nv50 primitive splitting for line loops
Luca Barbieri [Mon, 23 Aug 2010 19:43:11 +0000 (21:43 +0200)]
auxiliary: fix nvfx/nv50 primitive splitting for line loops

s->close_first was on the wrong side of the inequality.

Caught by blender.
Thanks to AndrewR for reporting this.

14 years agor600g: export one component per pixel + r7xx uncompression shader
Jerome Glisse [Mon, 23 Aug 2010 19:39:39 +0000 (15:39 -0400)]
r600g: export one component per pixel + r7xx uncompression shader

We need to always at least export one component (wether it's depth
or color. Add valid r7xx shader program for depth decompression.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
14 years agogenerate_builtins.py: Generate output in sorted order.
Kenneth Graunke [Mon, 23 Aug 2010 19:36:40 +0000 (12:36 -0700)]
generate_builtins.py: Generate output in sorted order.

14 years agonvfx: improve fp temp accounting
Luca Barbieri [Mon, 23 Aug 2010 18:27:40 +0000 (20:27 +0200)]
nvfx: improve fp temp accounting

14 years agotgsi: fix false CondStackTop==0 assertion
Brian Paul [Mon, 23 Aug 2010 00:40:48 +0000 (18:40 -0600)]
tgsi: fix false CondStackTop==0 assertion

14 years agoir_to_mesa: Fix constant array handling to return the temp we created.
Eric Anholt [Mon, 23 Aug 2010 17:57:54 +0000 (10:57 -0700)]
ir_to_mesa: Fix constant array handling to return the temp we created.

We ended up returning CONST[loc] rather than TEMP[loc2].  Things would
*usually* end up working out OK, since the constants often ended up
getting allocated to CONST[loc..loc+columns] with no swizzle.  But for
the case where the contigous temporary copy of the swizzled constant
vec4 args was actually needed, we'd end up reading some other constant
values, possibly including ones not actually allocated.

Fixes: glsl-varying-mat3x2.
14 years agoglcpp: Make standalone preprocessor work with a tty as stdin
Carl Worth [Mon, 23 Aug 2010 17:43:27 +0000 (10:43 -0700)]
glcpp: Make standalone preprocessor work with a tty as stdin

Previously glcpp would silently abort if it couldn't fstat the file being
read, (so it would work with stdin redirected from a file, but would not
work with stdin as a tty). The stat was so that glcpp could allocate
a buffer for the file content in a single call.

We now use talloc_realloc instead, (even if the fstat is
possible). This is theoretically less efficient, but quite irrelevant,
(particularly because the standalone preprocessor is used only for
testing).

14 years agoglcpp: Fix test suite to avoid flagging failed tests as valgrind errors.
Carl Worth [Mon, 23 Aug 2010 17:41:30 +0000 (10:41 -0700)]
glcpp: Fix test suite to avoid flagging failed tests as valgrind errors.

We recently added several tests that intentionally trigger
preprocessor errors. During valgrind-based testing, our test script
was noticing the non-zero return value from the preprocessor and
incorrectly flagging the valgrind-based test as failing.

To fix this, we make valgrind return an error code that is otherwise
unused by the preprocessor.

14 years agoglcpp: Fix segfault in standalone preprocessor for "file not found", etc.
Carl Worth [Mon, 23 Aug 2010 16:42:14 +0000 (09:42 -0700)]
glcpp: Fix segfault in standalone preprocessor for "file not found", etc.

This error message was missing so that the program would simply
segfault if the provided filename could not be opened for some reason.

While we're at it, we add explicit support for a filename of "-" to
indicate input from stdin.

14 years agoglcpp: Update generated glcpp-lex.c for the last two changes.
Carl Worth [Mon, 23 Aug 2010 16:35:24 +0000 (09:35 -0700)]
glcpp: Update generated glcpp-lex.c for the last two changes.

This fixes both "#line 0" and "#line XXX YYY" as described in the two
most recent commits.

14 years agoglcpp: Fix handling of "#line 0"
Carl Worth [Mon, 23 Aug 2010 16:31:42 +0000 (09:31 -0700)]
glcpp: Fix handling of "#line 0"

The existing DECIMAL_INTEGER pattern is the correct thing to use when
looking for a C decimal integer, (that is, a digit-sequence not
starting with 0 which would instead be an octal integer).

But for #line, we really want to accept any digit sequence, (including
"0"), and always interpret it as a decimal constant. So we add a new
DIGITS pattern for this case.

This should fix the compilation failure noted in bug #28138

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

(Though the generated file will not be updated until the next commit.)

14 years agoglcpp: Fix source numbers set with "#line LINE_NUMBER SOURCE_NUMBER"
Carl Worth [Mon, 23 Aug 2010 16:29:49 +0000 (09:29 -0700)]
glcpp: Fix source numbers set with "#line LINE_NUMBER SOURCE_NUMBER"

Previously, the YY_USER_ACTION was overwriting the yylloc->source value
in every action, (after that value had been carefully set by the handling
of the #line directive). Instead, we want to initialize it once in
YY_USER_INIT and then not touch it at all in YY_USER_ACTION.

14 years agoglcpp: Add new test for #line directive.
Carl Worth [Mon, 23 Aug 2010 16:26:44 +0000 (09:26 -0700)]
glcpp: Add new test for #line directive.

This test exposes two current bugs:

1. The source number is not being correctly emitted in error
   messages (instead, it's always 0).

2. A directive of "#line 0" is resulting in the following
   parse error:

preprocessor error: Invalid tokens after #

14 years agoglcpp: Update README file (new specifications and fewer limitations).
Carl Worth [Mon, 23 Aug 2010 16:06:11 +0000 (09:06 -0700)]
glcpp: Update README file (new specifications and fewer limitations).

The README file had grown a little bit stale. We've been using newer
versions of both the GLSL and C99 specifications, so list those. Also,
several of the documented known limitations have since been fixed, so
remove those.

14 years agoglcpp: Add test for the #error directive.
Carl Worth [Mon, 23 Aug 2010 15:54:06 +0000 (08:54 -0700)]
glcpp: Add test for the #error directive.

This directive is already implemented nicely, but wasn't previously tested.
It will be convenient to use this directive in further tests that rely
on error messages, (such as ensuring that #line correctly sets the line
number in the error message).

14 years agoglsl: Trim the size of uniform arrays to the maximum element used.
Eric Anholt [Mon, 23 Aug 2010 17:32:01 +0000 (10:32 -0700)]
glsl: Trim the size of uniform arrays to the maximum element used.

Fixes glsl-getactiveuniform-array-size.

14 years agomesa: Don't add 1 to GL_ACTIVE_UNIFORM_MAX_LENGTH.
Eric Anholt [Mon, 23 Aug 2010 16:47:15 +0000 (09:47 -0700)]
mesa: Don't add 1 to GL_ACTIVE_UNIFORM_MAX_LENGTH.

Fixes: glsl-getactiveuniform-length.
14 years agoutil: fix util_fill_rect to take util_color instead of u32 param
Roland Scheidegger [Mon, 23 Aug 2010 15:55:16 +0000 (17:55 +0200)]
util: fix util_fill_rect to take util_color instead of u32 param

util_fill_rect could not handle formats with more than 32 bits,
since the fill color was a uint32_t value. Fix this by using
a util_color union instead, and also expand the union so it
works with formats which have up to 256 bits (the max of any
format currently defined).

14 years agonvfx: emit bo relocations only when needed
Luca Barbieri [Mon, 23 Aug 2010 14:43:04 +0000 (16:43 +0200)]
nvfx: emit bo relocations only when needed

Should improve performance, possibly significantly.

14 years agoglsl2: Add missing sig_iter.next() to the no-constant-folding-to-outvals fix.
Eric Anholt [Mon, 23 Aug 2010 14:05:07 +0000 (07:05 -0700)]
glsl2: Add missing sig_iter.next() to the no-constant-folding-to-outvals fix.

14 years agonvfx: match Gallium's gl_PointCoord brokenness
Luca Barbieri [Mon, 23 Aug 2010 13:20:31 +0000 (15:20 +0200)]
nvfx: match Gallium's gl_PointCoord brokenness

Gallium always puts gl_PointCoord in GENERIC[0] if
point_quad_rasterization is enabled.

This is silly, but for now it makes mesa-demos/glsl/pointcoord work.

14 years agonvfx: support clip planes sensibly and fix them on nv30
Luca Barbieri [Sun, 22 Aug 2010 22:31:08 +0000 (00:31 +0200)]
nvfx: support clip planes sensibly and fix them on nv30

Before, we were discarding the compiled vertex program on each
vertex program change.

Now we compile the program as if there were 6 clip planes and
dynamically patch in an "end program" bit at the right place.

Also, nv30 should now work.

14 years agor300g: avoid stall in no-tcl drawing when mapping vbo
Dave Airlie [Mon, 23 Aug 2010 10:28:02 +0000 (20:28 +1000)]
r300g: avoid stall in no-tcl drawing when mapping vbo

the current code reuses the same vbo over and over, however after a flush
we'd stall and wait for mapping on the vbo when we should just fire and forget.

On a gears test this brings me from ~620 to ~750 on my rv530 in swtcl mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoglapi: Clean up header inclusions.
Chia-I Wu [Mon, 23 Aug 2010 08:13:12 +0000 (16:13 +0800)]
glapi: Clean up header inclusions.

Do not rely on PUBLIC being defined in glapi.h.  Do not include core
mesa headers.

14 years agomesa: Assorted fixes for es_generator.py on win32.
Chia-I Wu [Sat, 21 Aug 2010 10:20:39 +0000 (18:20 +0800)]
mesa: Assorted fixes for es_generator.py on win32.

Fix mixed use of GL_APIENTRY and GLAPIENTRY.  Parameter list of a function
prototype should never be empty.