Commit Graph

101 Commits

Author SHA1 Message Date
Matt Turner
2b7a972e3f Don't cast the return value of malloc/realloc
This patch has been generated by the following Coccinelle semantic
patch:

// Don't cast the return value of malloc/realloc.
//
// Casting the return value of malloc/realloc only stands to hide
// errors.

@@
type T;
expression E1, E2;
@@
- (T)
(
_mesa_align_calloc(E1, E2)
|
_mesa_align_malloc(E1, E2)
|
calloc(E1, E2)
|
malloc(E1)
|
realloc(E1, E2)
)
2012-09-05 22:28:50 -07:00
Brian Paul
fe72a069d1 mesa: s/FREE/free/
v2: replace instances in dri/common/ dirs

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-09-01 07:47:24 -06:00
Brian Paul
4fdac659f8 mesa: s/CALLOC/calloc/
v2: replace instances in dri/common/ dirs

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-09-01 07:47:24 -06:00
Pauli Nieminen
cbdc1d5354 swrast: Support sampler object for texture fetching state
swrast needs to pass sampler object into all texture fetching functions
to use correct sampling state when sampler object is bound to the unit.
The changes were made using half manual regular expression replace.

v2: Fix NULL deref in _swrast_choose_triangle(), because the _Current
    values aren't set yet, so we need to look at our texObj2D. (anholt)

Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-08-01 15:55:51 -07:00
Brian Paul
4bbab2275f tnl: remove ctx->Driver.Map/UnmapTexture() calls
ctx->Driver.MapTexture() always points to _swrast_map_texture().
We're already reaching into swrast from t_vb_program.c anyway.
This will let us remove the ctx->Driver.Map/UnmapTexture() functions.
2012-01-24 14:12:36 -07:00
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
Brian Paul
68da4b50e9 mesa: add swrast_texture_image::Buffer
In the past, swrast_texture_image::Data has been overloaded.  It could
either point to malloc'd memory storing texture data, or it could point
to a current mapping of GPU memory.

Now, Buffer always points to malloc'd memory (if we're not using GPU
memory) and Data always points to mapped memory.  The next step would
be to rename Data -> Map.

This change also involves adding swrast functions for mapping textures
and renderbuffers prior to rendering to setup the Data pointer.  Plus,
corresponding functions to unmap texures and renderbuffers.  This is
very much like similar code in the dri drivers.
2011-10-23 10:44:47 -06:00
Brian Paul
793d29d6d3 tnl: fix result vector allocation regression
We need to allocate all the output vectors.
Fixes a regression from commit f7f678331d
Fixes fd.o bugs 41441 and 41492.
2011-10-07 10:58:53 -06:00
Eric Anholt
f7f678331d tnl: Delay results allocation until we actually need them.
Decreases i965 peak memory allocation for a trivial shader program
from 23,483,048B to 21,932,128B, since we never actually use tnl for
rendering.
2011-10-01 22:16:06 -07:00
Brian Paul
9520f483b8 mesa: s/INLINE/inline/
INLINE is still seen in some files (some generated files, etc) but this
is a good start.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2011-10-01 08:16:36 -06:00
Brian Paul
652901e95b Merge branch 'draw-instanced'
Conflicts:
	src/gallium/auxiliary/draw/draw_llvm.c
	src/gallium/drivers/llvmpipe/lp_state_fs.c
	src/glsl/ir_set_program_inouts.cpp
	src/mesa/tnl/t_vb_program.c
2011-01-15 10:24:08 -07:00
Brian Paul
6577f753b2 tnl: a better way to initialize the gl_program_machine memory
This improves commit ef3f7e61b3

NOTE: This is a candidate for the 7.9 and 7.10 branches.
2010-12-13 08:11:58 -07:00
Vinson Lee
ef3f7e61b3 tnl: Initialize gl_program_machine memory in run_vp.
Fixes piglit valgrind glsl-array-bounds-04 failure (FDO bug 29946).

NOTE:
This is a candidate for the 7.10 branch.
This is a candidate for the 7.9 branch.
2010-12-10 14:24:05 -08:00
Brian Paul
a63486ac68 tnl: implement instanced drawing 2010-12-10 09:29:13 -07:00
Kristian Høgsberg
f9995b3075 Drop GLcontext typedef and use struct gl_context instead 2010-10-13 09:43:25 -04:00
Vinson Lee
f4511c4835 tnl: Reduce header file inclusion in t_context.h.
t_context.h
Remove m_matrix.h and m_xform.h.

t_vb_program.c
Include m_xform.h.

t_vb_render.c
Include m_xform.h.
2010-08-07 22:56:35 -07:00
Vinson Lee
3cc471e429 tnl: Remove unnecessary headers. 2010-07-31 00:55:13 -07:00
Brian Paul
ec2b92f98c mesa: rename src/mesa/shader/ to src/mesa/program/ 2010-06-10 23:23:13 -06:00
Kristian Høgsberg
99ae9e8d7d Drop macro wrappers for the aligned memory functions 2010-02-19 13:30:22 -05:00
Brian Paul
e197de56cd mesa: replace old MEMCPY macro with memcpy 2010-02-19 08:09:01 -07:00
Brian Paul
4ac9c80e5b mesa: change ctx->Driver.ProgramStringNotify() to return GLboolean
GL_TRUE indicates that the driver accepts the program.
GL_FALSE indicates the program can't be compiled/translated by the
driver for some reason (too many resources used, etc).

Propogate this result up to the GL API: set GL_INVALID_OPERATION
error if glProgramString() was called.  Set shader program link
status to GL_FALSE if glLinkProgram() was called.

At this point, drivers still don't do any program checking and
always return GL_TRUE.
2010-02-04 16:53:27 -07:00
Jakob Bornecrantz
b01ffb12ed Merge branch 'mesa_7_7_branch'
Conflicts:
	src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
	src/gallium/auxiliary/util/Makefile
	src/gallium/drivers/r300/r300_state_derived.c
2010-01-14 22:31:04 +00:00
Vinson Lee
264f4101cd tnl: Remove unnecessary header from t_vb_program.c. 2010-01-12 19:45:25 -08:00
Brian Paul
fd70841121 Merge branch 'mesa_7_7_branch'
Conflicts:

	src/mesa/drivers/dri/i965/brw_wm_emit.c
2010-01-08 08:21:12 -07:00
Brian Paul
8485811f10 tnl: set FOGC result to (f,0,0,1)
Fixed FDO bug 23397.
2010-01-06 17:43:56 -07:00
Eric Anholt
37c79d4d76 tnl: Replace deprecated FogCoordPtr with AttribPtr[_TNL_ATTRIB_FOG] 2009-11-19 11:47:05 +01:00
Eric Anholt
0a91878015 tnl: Replace deprecated ColorPtr[] with AttribPtr or new BackfaceColorPtr. 2009-11-19 11:47:05 +01:00
Eric Anholt
df582ca767 tnl: Replace deprecated TexCoordPtr with AttribPtr[_TNL_ATTRIB_TEX*] 2009-11-19 11:47:05 +01:00
Ian Romanick
5606dfb572 Merge branch 'outputswritten64'
Add a GLbitfield64 type and several macros to operate on 64-bit
fields.  The OutputsWritten field of gl_program is changed to use that
type.  This results in a fair amount of fallout in drivers that use
programs.

No changes are strictly necessary at this point as all bits used are
below the 32-bit boundary.  Fairly soon several bits will be added for
clip distances written by a vertex shader.  This will cause several
bits used for varyings to be pushed above the 32-bit boundary.  This
will affect any drivers that support GLSL.

At this point, only the i965 driver has been modified to support this
eventuality.

I did this as a "squash" merge.  There were several places through the
outputswritten64 branch where things were broken.  I foresee this
causing difficulties later for bisecting.  The history is still
available in the branch.

Conflicts:
	src/mesa/drivers/dri/i965/brw_wm.h
2009-11-17 16:25:38 -08:00
Ian Romanick
286611d990 Revert "Store clipping distance for user clip planes as part of vertex processing"
This reverts commit f058b25881.

This change is completely wrong in so many ways.  When clip distances
are generated as part of vertex processing, they must be interpolated
to perform clipping.  Geometric clipping goes right out the window.
2009-10-22 19:21:21 -07:00
Ian Romanick
f058b25881 Store clipping distance for user clip planes as part of vertex processing
Once the clipping distance is calculated and stored per vertex, the
distances can be re-used when clipping is actually performed.  This
doesn't have any immediate benefit, but it paves the way for
implementing gl_ClipDistance in vertex shaders and result.clip[] in
vertex programs.

This has not produces any oglconform regressions on my G31 system
which uses software TNL.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2009-10-13 15:15:20 -07:00
Brian Paul
3fed69eb16 mesa: move call to init_c_cliptest() from enable.c to tnl module.
Fixed gallium build breakage.
2009-09-09 08:54:38 -06:00
Eric Anholt
b4922b5331 mesa: Add support for ARB_depth_clamp.
This currently doesn't include fixing up the cliptests in the assembly
paths to support ARB_depth_clamp, so enabling depth_clamp forces the C path.
2009-09-08 14:30:15 -07:00
Brian Paul
53dfd5d870 tnl: if NAN_CHECK is enabled, also assert that pos.x != 0 2009-08-13 12:50:57 -06:00
Brian Paul
4f4280b435 tnl: add some floating point sanity checks (disabled) 2009-06-03 17:16:00 -06:00
Brian Paul
882cd6c839 mesa: remove MAX_VERTEX_PROGRAM_ATTRIBS
Use MAX_VERTEX_GENERIC_ATTRIBS instead.  No need for two #defines for
the same quantity.
2009-05-22 07:30:05 -06:00
Brian Paul
de2afd8688 swrast: do texture sampling/combining in floating point
The code's cleaner and a step toward supporting float-valued texture sampling.
Some optimizations for common cases can be added and re-enabled...
2009-04-01 20:17:19 -06:00
Brian Paul
634d2af2b0 init machine->Samplers (fixes vertex program texture fetches) 2008-07-01 08:49:12 -06:00
Brian
61fbc81657 New ctx->Driver.Map/UnmapTexture() functions for accessing textures from t_vb_program.c 2007-11-29 08:13:16 -07:00
Brian
a2ab143b75 cleanups, comments 2007-11-29 08:13:16 -07:00
Brian
a7e1b4456a Move _mesa_load_tracked_matrices() from TNL module to prog_statevars.c 2007-11-29 08:13:16 -07:00
Roland Scheidegger
dab7c810e9 fix position invariant vertex programs for sw-tnl
do the same math as for fixed function pipe, including
user clip planes.
(mostly resurrected from the dead t_vb_arbprogram.c code)
2007-11-15 00:52:38 +01:00
Brian
c223c6b663 Be more consistant with paths in #includes. Eventually, eliminate a bunch of -I flags. 2007-07-04 13:15:20 -06:00
Brian
60d136f63c changes to get DDX/DDY working again 2007-05-02 18:45:44 -06:00
Brian
04bda46739 Enable texture sampling for vertex programs/shaders.
This is a bit of a hack for now because the tnl module is using the swrast
module to fetch texels.  The texture fetch/filter code should probably be
moved into the main/ module since it doesn't really depend upon other
swrast code.
2007-04-17 15:56:46 -06:00
Roland Scheidegger
36949abec7 cleanups for t_vb_program.c
use VertexProgram._Current instead of VertexProgram.Current in a few more places.
Only fixup fogc and psiz in case this is really a nv program (others are fine
if undefined), and fix this case up so the values actually get written.
2007-04-17 14:01:42 +02:00
Brian
4b3835dadf unhook t_vb_arbprogram.c code - it's going away 2007-04-16 10:58:30 -06:00
Brian
d6d6d20b13 init machine->StackDepth=0 2007-03-27 16:06:47 -06:00
Brian
8b34b7da41 remove 'maxInst' parameter from _mesa_execute_program() 2007-02-25 18:26:50 -07:00
Brian
085d7d59f0 remove unused 'element' parameter from _mesa_execute_program() 2007-02-25 18:23:37 -07:00