Commit Graph

139 Commits

Author SHA1 Message Date
Mathias Fröhlich
dca6a28a14 mesa: Make gl_program::InputsRead 64 bits.
Make gl_program::InputsRead a 64 bits bitfield.
Adapt the intel and radeon driver to handle a 64 bits
InputsRead value.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:35:44 +01:00
Vinson Lee
3210cad3f2 st/mesa: Fix memory leak on error path.
Fixes Coverity resource leak defect.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-11-07 20:41:21 -08:00
Brian Paul
af734468fe st/mesa: clean-up st_translate_interp() 2011-11-07 14:25:47 -07:00
Dave Airlie
4dfee0011a mesa/st: get interpolation mode from the fragment shader.
With the recent changes to interpolation stuff, we can now get the value
direct from the program instead of just being fail.

fixes some of the glsl-1.30 interpolation tests with softpipe

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-29 07:41:46 +01:00
Stéphane Marchesin
ddba509c16 mesa/st: Check for a NULL _LinkedShader[i] before using it.
The rest of the linker/glsl translation code checks for NULL, so I suppose we should check here too. Fixes crash on exit with i915g instanced drawing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-10-10 00:15:05 -07:00
Ian Romanick
77d67a44cc mesa: Simplify destroy_shader_program_variants_cb after previous refactors
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-07 16:39:51 -07:00
Ian Romanick
de772c4022 mesa: Use gl_shader_program::_LinkedShaders instead of FragmentProgram
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-07 16:39:50 -07:00
Ian Romanick
39348bf79f mesa: Use gl_shader_program::_LinkedShaders instead of GeometryProgram
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-07 16:39:50 -07:00
Ian Romanick
010cc547ca mesa: Use gl_shader_program::_LinkedShaders instead of VertexProgram
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-07 16:39:50 -07:00
Bryan Cain
ffb7d02154 st/mesa: inline st_prepare_fragment_program in st_translate_fragment_program
This reverts an unnecessary part of commit 4683529048 and fixes misrendering
and an assertion failure in Cogs.

Fixes freedesktop.org bug 39888.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-08-08 10:28:59 -05:00
Bryan Cain
4683529048 Merge branch 'glsl-to-tgsi'
Conflicts:
	src/mesa/state_tracker/st_atom_pixeltransfer.c
	src/mesa/state_tracker/st_program.c
2011-08-04 15:43:34 -05:00
Bryan Cain
44867da354 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.
2011-08-01 17:59:07 -05:00
Bryan Cain
f379d8f730 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.
2011-08-01 17:59:07 -05:00
Marek Olšák
2f02c2fe56 st/mesa: remove unused-but-set variables in st_program.c 2011-07-15 21:48:28 +02:00
Brian Paul
e37e196151 st/mesa: more helpful debug message in destroy_program_variants_cb() 2011-06-08 15:15:07 -06:00
Brian Paul
aa878f94ab st/mesa: use BITFIELD64_BIT() macro in a few more places 2011-03-15 18:21:35 -06:00
Brian Paul
7230e1a228 st/mesa: fix shader deletion regression
Fixes a regression from commit 5cbff0932e.
The problem is *some* glDrawPixels fragment programs need to be deleted,
but not all.  Use an explicit flag to indicate whether or not the program
needs to be deleted.

This should fix http://bugs.freedesktop.org/show_bug.cgi?id=34049
2011-02-08 18:23:59 -07:00
Thomas Hellstrom
8042470057 mesa/st: Plug a fragment program variant parameter leak
Fixes a minor memory leak with the "engine" mesa demo.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-02-08 08:13:39 -07:00
Brian Paul
5cbff0932e st/mesa: free the temporary bitmap/drawpix shader code
Fixes a per-shader memory leak when drawing glBitmaps, glDrawPixels
or glCopyPixels.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-08 08:10:22 -07:00
Vinson Lee
edc09358f7 st/mesa: Include mfeatures.h in files that perform feature tests. 2011-01-09 01:04:19 -08:00
Brian Paul
c94996f057 st/mesa: skip glDrawPixels/glBitmap-related code for ES build
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32560
2011-01-04 08:28:17 -07:00
Dave Airlie
07498075b5 mesa/st: set the color write cbuf property for fragColor writes 2010-12-24 07:19:58 +10:00
Brian Paul
aa5ba96d29 st/mesa: s/varient/variant 2010-12-16 10:18:23 -07:00
Brian Paul
a8ca30bc58 st/mesa: fix incorrect prev pointer in destroy_program_variants() 2010-12-14 14:15:22 -07:00
Brian Paul
68c41a25b4 st/mesa: rename the varient release functions 2010-12-14 12:17:10 -07:00
Brian Paul
c21807d2f7 st/mesa: add geom program code in destroy_program_variants() 2010-12-13 17:29:56 -07:00
Brian Paul
4312569410 st/mesa: use st_fragment_program() instead of cast 2010-12-13 17:25:29 -07:00
Brian Paul
83d50c3ee1 st/mesa: minor re-indenting 2010-12-13 17:20:56 -07:00
Brian Paul
3d203b6100 Squashed commit of the following (st-mesa-per-context-shaders branch):
commit 4f106f44a32eaddb6cf3fea6ba5ee9787bff609a
Author: Brian Paul <brianp@vmware.com>
Date:   Mon Dec 13 14:06:08 2010 -0700

    st/mesa: reorganize vertex program translation code

    Now it looks like the fragment and geometry program code.
    Also remove the serial number fields from programs.  It was used to
    determine when new translations were needed.  Now the variant key is
    used for that.  And the st_program_string_notify() callback removes all
    variants when the program's code is changed.

commit e12d6791c5e4bff60bb2e6c04414b1b4d1325f3e
Author: Brian Paul <brianp@vmware.com>
Date:   Mon Dec 13 13:38:12 2010 -0700

    st/mesa: implement geometry shader varients

    Only needed in order to support per-context gallium shaders.

commit c5751c673644808ab069259a852f24c4c0e92b9d
Author: Brian Paul <brianp@vmware.com>
Date:   Sun Dec 12 15:28:57 2010 -0700

    st/mesa: restore glDraw/CopyPixels using new fragment program variants

    Clean up the logic for fragment programs for glDraw/CopyPixels.  We now
    generate fragment program variants for glDraw/CopyPixels as needed which
    do texture sampling, pixel scale/bias, pixelmap lookups, etc.

commit 7b0bb99bab6547f503a0176b5c0aef1482b02c97
Author: Brian Paul <brianp@vmware.com>
Date:   Fri Dec 10 17:03:23 2010 -0700

    st/mesa: checkpoint: implement fragment program variants

    The fragment programs variants are per-context, as the vertex programs.

    NOTE: glDrawPixels is totally broken at this point.

commit 2cc926183f957f8abac18d71276dd5bbd1f27be2
Author: Brian Paul <brianp@vmware.com>
Date:   Fri Dec 10 14:59:32 2010 -0700

    st/mesa: make vertex shader variants per-context

    Gallium shaders are per-context but OpenGL shaders aren't.  So we need
    to make a different variant for each context.

    During context tear-down we need to walk over all shaders/programs and
    free all variants for the context being destroyed.
2010-12-13 17:20:53 -07:00
Marek Olšák
c0c929cdac st/mesa: initialize key in st_vp_varient
This fixes endless vertex shader recompilations in find_translated_vp
if the shader contains an edge flag output.

NOTE: This is a candidate for the 7.9 branch.

Signed-off-by Brian Paul <brianp@vmware.com>
2010-12-05 17:38:19 +01:00
Vinson Lee
a54ab4960b st/mesa: Silence uninitialized variable warning.
Fixes this GCC warning.
state_tracker/st_program.c: In function 'st_print_shaders':
state_tracker/st_program.c:735: warning: 'sh' may be used uninitialized in this function
2010-10-28 06:08:19 -07:00
Ian Romanick
84eba3ef71 Track separate programs for each stage
The assumption is that all stages are the same program or that
varyings are passed between stages using built-in varyings.
2010-10-27 13:35:53 -07:00
Kristian Høgsberg
f9995b3075 Drop GLcontext typedef and use struct gl_context instead 2010-10-13 09:43:25 -04:00
Dave Airlie
ef8bb7ada9 st/mesa: use shader stencil export to accelerate shader drawpixels.
If the pipe driver has shader stencil export we can accelerate DrawPixels
using it. It tries to pick an S8 texture and works its way to X24S8 and S8X24
if that isn't supported.
2010-10-13 09:30:04 +10:00
Brian Paul
e22e3927b0 gallium: rework handling of sprite_coord_enable state
Implement the pipe_rasterizer_state::sprite_coord_enable field
in the draw module (and softpipe) according to what's specified
in the documentation.

The draw module can now add any number of extra vertex attributes
to a post-transformed vertex and generate texcoords for those
attributes per sprite_coord_enable.  Auto-generated texcoords
for sprites only worked for one texcoord unit before.

The frag shader gl_PointCoord input is now implemented like any
other generic/texcoord attribute.

The draw module now needs to be informed about fragment shaders
since we need to look at the fragment shader's inputs to know
which ones need auto-generated texcoords.

Only softpipe has been updated so far.
2010-09-17 18:45:13 -06:00
Marek Olšák
83baa8a6c5 st/mesa: remove output register reads inside shaders
This is a GLSL2 regression fix.
2010-08-16 02:19:18 +02:00
Vinson Lee
1b8aa2176c st/mesa: Clean up header file inclusion in st_mesa_to_tgsi.h.
st_mesa_to_tgsi.h
Replace tgsi_ureg.h with a forward declaration.
Include p_compiler.h for ubyte symbol.

st_program.c
Include tgsi_ureg.h directly.
2010-08-05 17:15:25 -07:00
Zack Rusin
425870c5fd mesa: get the translation from mesa 2d regs to tgsi working
first working version of arb_geometry_shader4
2010-07-10 02:02:35 -04:00
Zack Rusin
7c42390453 gs: inject const int gl_VerticesIn at link time 2010-07-08 00:28:29 -04:00
Zack Rusin
0d68d01347 mesa: make the arguments in the asm statemants optional
geometry shaders emit/end functions don't take any arguments
2010-06-29 21:45:41 -04:00
Zack Rusin
da7bd6a90e mesa: initial support for ARB_geometry_shader4
laying down the foundation for everything and implementing most of the
stuff.
linking, gl_VerticesIn and multidimensional inputs are left.
2010-06-28 22:53:21 -04:00
Brian Paul
ec2b92f98c mesa: rename src/mesa/shader/ to src/mesa/program/ 2010-06-10 23:23:13 -06:00
Chia-I Wu
d9f38e1a71 st/mesa: Do not use draw module in OpenGL ES build.
This removes references to symbols in draw module for OpenGL ES build.
As OpenGL ES does not support feedback/selection mode, draw module is
used in pathes that will never be reached.  However, if the symbols are
referenced, it will bloat the final shared libraries unnecessarily.
This is serious when LLVM is enabled.
2010-05-12 15:46:28 +08:00
Brian Paul
ce0844b44c st/mesa: move/improve Mesa GPU program debugging
Print the program (plus its parameters) before calling
st_translate_mesa_program() in case we die in that function.
2010-04-28 10:24:58 -06:00
Ben Skeggs
b46750d601 st/mesa: use BITFIELD64_BIT to access shader OutputsWritten in more places 2010-03-31 23:34:30 +10:00
Vinson Lee
b7eed19efe st/mesa: Fix memory leak on out-of-memory error path. 2010-02-21 15:10:50 -08:00
Brian Paul
e90bc2e2ce st/mesa: move per-fragment shader fields to local vars 2010-02-14 21:57:14 -07:00
Brian Paul
b9b4e7724e st/mesa: rename state -> tgsi, updated comments 2010-02-12 15:42:10 -07:00
Brian Paul
dd98a979b6 st/mesa: remove special-case cyl-wrap code
Cylinder wrap mode works with perspective interpolation now.
2010-02-09 15:32:56 +01:00
Brian Paul
ae4dde6598 st/mesa: check for PROG_PARAM_BIT_CYL_WRAP flag 2010-02-09 15:32:43 +01:00