mesa.git
16 years agodraw: fix crlf
Keith Whitwell [Sun, 23 Mar 2008 21:31:23 +0000 (21:31 +0000)]
draw: fix crlf

16 years agodraw: rename emit functions to match pipe_format names
Keith Whitwell [Sun, 23 Mar 2008 21:31:14 +0000 (21:31 +0000)]
draw: rename emit functions to match pipe_format names

16 years agodraw: restructure fetch/emit as a pair of function calls
Keith Whitwell [Sun, 23 Mar 2008 20:36:00 +0000 (20:36 +0000)]
draw: restructure fetch/emit as a pair of function calls

16 years agogallium: Add util_gen_mipmap_filter().
Michal Krol [Sun, 23 Mar 2008 19:39:35 +0000 (20:39 +0100)]
gallium: Add util_gen_mipmap_filter().

We need a way to specify the type of minification filter
used to downsample mipmap levels.
The old util_gen_mipmap() retains its behaviour and uses
LINEAR filter.

16 years agogallium: Fix memory leak.
José Fonseca [Sun, 23 Mar 2008 19:38:11 +0000 (19:38 +0000)]
gallium: Fix memory leak.

pipe cso's were being destroyed, but the hash elements themselves not.

proper fix is IMHO add a destructor callback to cso_hash.

16 years agogallium: Remove the debug_mask_* stuff.
José Fonseca [Sun, 23 Mar 2008 18:57:35 +0000 (18:57 +0000)]
gallium: Remove the debug_mask_* stuff.

Overcomplex and not much different from using a global variable...

16 years agogallium: Fix typo.
José Fonseca [Sun, 23 Mar 2008 18:52:37 +0000 (18:52 +0000)]
gallium: Fix typo.

16 years agogallium: Memory debugging utilities.
José Fonseca [Sun, 23 Mar 2008 18:38:10 +0000 (18:38 +0000)]
gallium: Memory debugging utilities.

There are no known tools for windows kernel memory debugging, so this is a
simple set of malloc etc wrappers.

Enabled by default on win32 debug builds

16 years agogallium: wrap decls in extern "C"
José Fonseca [Sun, 23 Mar 2008 18:30:53 +0000 (18:30 +0000)]
gallium: wrap decls in extern "C"

16 years agodraw: fix some unsigned vs ushort confusion
Keith Whitwell [Sun, 23 Mar 2008 18:21:00 +0000 (18:21 +0000)]
draw:  fix some unsigned vs ushort confusion

Middle-end elements are ushort, but prior to that have to treat all
elements as unsigned to avoid wrapping and/or overruns.

16 years agogallium: beginnings of draw module vertex rework
Keith Whitwell [Sun, 23 Mar 2008 16:44:59 +0000 (16:44 +0000)]
gallium: beginnings of draw module vertex rework

Trying to put a structure in place that we can actually optimize.
Initially just implementing a passthrough mode, this will fairly soon
replace all the vertex_cache/prim_queue/shader_queue stuff that's so
hard to understand...

Split the vertex processing into a couple of distinct stages:
- Frontend
    - Prepares two lists of elements (fetch and draw) to be processed
      by the next stage.  This stage doesn't fetch or draw vertices, but
      makes the decision which to draw.  Multiple implementations of this
      will implement different strategies, currently just a vcache
      implementation.
- MiddleEnd
    - Takes the list of fetch elements, fetches them, runs the vertex
      shader, cliptest, viewport transform on them to produce a
      linear array of vertex_header vertices.
    - Passes that list of vertices, plus the draw_elements (which index
      into that list) onto the backend
- Backend
    - Either the existing primitive/clipping pipeline, or the vbuf_render
      hardware backend provided by the driver.

Currently, the middle-end is the old passthrough code, and it build hardware
vertices, not vertex_header vertices as above.  It may be that passthrough
is a special case in this respect.

16 years agogallium: fix a few more shader-related mem leaks
Brian [Sat, 22 Mar 2008 16:29:30 +0000 (10:29 -0600)]
gallium: fix a few more shader-related mem leaks

16 years agouse ctx->Driver.DeleteProgram() in a few more places
Brian [Sat, 22 Mar 2008 16:27:55 +0000 (10:27 -0600)]
use ctx->Driver.DeleteProgram() in a few more places

16 years agogallium: free samplers, textures in destroy()
Brian [Sat, 22 Mar 2008 15:42:59 +0000 (09:42 -0600)]
gallium: free samplers, textures in destroy()

16 years agogallium: remove temporary _screen suffix from function names
Brian [Sat, 22 Mar 2008 15:15:23 +0000 (09:15 -0600)]
gallium: remove temporary _screen suffix from function names

16 years agogallium: fix a few mem leaks when deleting programs
Brian [Sat, 22 Mar 2008 15:12:52 +0000 (09:12 -0600)]
gallium: fix a few mem leaks when deleting programs

16 years agogallium: fix mem leak (fee pstipple stage)
Brian [Sat, 22 Mar 2008 15:12:27 +0000 (09:12 -0600)]
gallium: fix mem leak (fee pstipple stage)

16 years agodelete default programs with ctx->Driver.DeleteProgram()
Brian [Sat, 22 Mar 2008 15:12:02 +0000 (09:12 -0600)]
delete default programs with ctx->Driver.DeleteProgram()

16 years agogallium: Remove pedantic asserts.
José Fonseca [Sat, 22 Mar 2008 10:05:55 +0000 (10:05 +0000)]
gallium: Remove pedantic asserts.

Move these to a higher level instead.

16 years agocell: Generate blend / depth test code when state atom is created
Ian Romanick [Fri, 21 Mar 2008 18:20:49 +0000 (11:20 -0700)]
cell: Generate blend / depth test code when state atom is created

Code generation should be performed when the device-specific state
atom is created, not when it is bound.

16 years agocell: Change code-gen for CONST_COLOR blend factor
Ian Romanick [Fri, 21 Mar 2008 18:15:49 +0000 (11:15 -0700)]
cell: Change code-gen for CONST_COLOR blend factor

Previously the constant color blend factor was compiled into the
generated code.  This meant that the code had to be regenerated each
time the constant color was changed.  This doesn't fit with the model
used in Gallium.

As-is, the code could be better.  The constant color is loaded for
every quad processed, even if it is not used.  Also, if a lot of (1-x)
blend factors are used, 1.0 will be loaded and reloaded into registers
many times.

16 years agoTabs to spaces
Ian Romanick [Fri, 21 Mar 2008 17:25:58 +0000 (10:25 -0700)]
Tabs to spaces

16 years agocell: Remove unnecessary default_blend work-around
Ian Romanick [Fri, 21 Mar 2008 17:23:52 +0000 (10:23 -0700)]
cell: Remove unnecessary default_blend work-around

I suspect that there was some other bug in the blend code-gen that
made this work-around necessary.

16 years agogallium: fix const buffer update bug
Brian [Fri, 21 Mar 2008 21:54:27 +0000 (15:54 -0600)]
gallium: fix const buffer update bug

If only glUniform is called between two renderings, the const buffers weren't
getting updated.  Need to set the _NEW_PROGRAM flag in st_upload_constants()
as that's the dirty flag set by glUniform.
Fixes glean tapi2 test.

16 years agoRefactor PBO validate/map code.
Brian [Fri, 21 Mar 2008 20:20:07 +0000 (14:20 -0600)]
Refactor PBO validate/map code.

We always need to do PBO validation, so do that in core Mesa before calling driv
er routine.
cherry-picked from Mesa/master.

16 years agogallium: implement PBO operations for glDraw/ReadPixels and glBitmap
Brian Paul [Fri, 21 Mar 2008 19:44:27 +0000 (13:44 -0600)]
gallium: implement PBO operations for glDraw/ReadPixels and glBitmap

At this time there are no optimizations for directly blitting between
buffer objects and surfaces (always go through mappings).
glean pbo test passes now

16 years agoadd a number of PBO validate/map/unmap functions
Brian Paul [Fri, 21 Mar 2008 19:43:07 +0000 (13:43 -0600)]
add a number of PBO validate/map/unmap functions

Helper functions for (some) drivers, including swrast.
cherry-picked from Mesa/master

16 years agoFix some PBO breakage.
Brian [Fri, 21 Mar 2008 18:32:48 +0000 (12:32 -0600)]
Fix some PBO breakage.

In _mesa_Bitmap, can't early return if bitmap ptr is NULL, it may be an offset
into a PBO.  Similarly for _mesa_GetTexImage.

16 years agoi915: added to-do note about setting the max_lod register to get proper min/mag filte...
Brian [Fri, 21 Mar 2008 16:03:23 +0000 (10:03 -0600)]
i915: added to-do note about setting the max_lod register to get proper min/mag filter selection

16 years agomesa: minor code re-org
Brian Paul [Fri, 21 Mar 2008 17:06:08 +0000 (11:06 -0600)]
mesa: minor code re-org

16 years agogallium: use is_format_supported(PIPE_FORMAT_DXT5_RGBA) to check if s3tc is supported
Brian Paul [Fri, 21 Mar 2008 17:05:02 +0000 (11:05 -0600)]
gallium: use is_format_supported(PIPE_FORMAT_DXT5_RGBA) to check if s3tc is supported

The PIPE_CAP_S3TC token will be deprecated.

16 years agogallium: added DXT formats (preliminary, will probably change)
Brian Paul [Fri, 21 Mar 2008 17:03:53 +0000 (11:03 -0600)]
gallium: added DXT formats (preliminary, will probably change)

16 years agogallium: use is_format_supported() to determine if GL_EXT_texture_sRGB is supported
Brian Paul [Fri, 21 Mar 2008 16:51:21 +0000 (10:51 -0600)]
gallium: use is_format_supported() to determine if GL_EXT_texture_sRGB is supported

16 years agogallium: document is_format_supported()'s type param
Brian Paul [Fri, 21 Mar 2008 16:50:26 +0000 (10:50 -0600)]
gallium: document is_format_supported()'s type param

16 years agogallium: PIPE_FORMAT_TYPE_ comments
Brian Paul [Fri, 21 Mar 2008 16:45:33 +0000 (10:45 -0600)]
gallium: PIPE_FORMAT_TYPE_ comments

16 years agogallium: added sRGB formats
Brian Paul [Fri, 21 Mar 2008 16:43:56 +0000 (10:43 -0600)]
gallium: added sRGB formats

16 years agogallium: additional comments, fix typos, etc
Brian Paul [Fri, 21 Mar 2008 16:38:56 +0000 (10:38 -0600)]
gallium: additional comments, fix typos, etc

16 years agogallium: Update scons build for state tracker files added/removed.
Michel Dänzer [Fri, 21 Mar 2008 12:14:06 +0000 (12:14 +0000)]
gallium: Update scons build for state tracker files added/removed.

16 years agocell: Fix several bugs in blend code-gen
Ian Romanick [Fri, 21 Mar 2008 01:17:48 +0000 (18:17 -0700)]
cell: Fix several bugs in blend code-gen

- Alpha factor set to a _COLOR mode was mishandled
- Cases when either dst factor or src factor was ZERO were mishandled
- MIN and MAX cases were backwards
- Case when blend was disabled was mishandled
- Incorrect comments about number of instructions generated

The tests blendminmax and blendsquare run correctly.

16 years agocell: Call the correct function to generate blending code
Ian Romanick [Fri, 21 Mar 2008 00:36:31 +0000 (17:36 -0700)]
cell: Call the correct function to generate blending code

Cut-and-paste for the lose. :(

16 years agocell: Fix bus error when there is no depth buffer
Ian Romanick [Fri, 21 Mar 2008 00:36:05 +0000 (17:36 -0700)]
cell: Fix bus error when there is no depth buffer

16 years agocell: Use code-gen for alpha blend
Ian Romanick [Thu, 20 Mar 2008 00:29:39 +0000 (17:29 -0700)]
cell: Use code-gen for alpha blend

So far this is only tested when GL_BLEND is disabled.

16 years agogallium: catch some out of memory conditions in the texture image code.
Brian Paul [Thu, 20 Mar 2008 23:08:07 +0000 (17:08 -0600)]
gallium: catch some out of memory conditions in the texture image code.

st_finalize_texture()'s return code now indicates success/fail instead of
presence of texture border (which we discard earlier).

16 years agogallium: set fb.width/height
Brian [Thu, 20 Mar 2008 21:22:20 +0000 (15:22 -0600)]
gallium: set fb.width/height

16 years agogallium: enable vp input semantic info
Brian [Thu, 20 Mar 2008 21:21:55 +0000 (15:21 -0600)]
gallium: enable vp input semantic info

16 years agogallium: use new framebuffer width, height fields
Brian [Thu, 20 Mar 2008 21:03:43 +0000 (15:03 -0600)]
gallium: use new framebuffer width, height fields

16 years agocell: use pipe_framebuffer_state.width, height
Brian [Thu, 20 Mar 2008 21:02:59 +0000 (15:02 -0600)]
cell: use pipe_framebuffer_state.width, height

16 years agogallium: assign framebuffer width, height
Brian [Thu, 20 Mar 2008 21:02:32 +0000 (15:02 -0600)]
gallium: assign framebuffer width, height

16 years agogallium: unused var silence warning
Brian [Thu, 20 Mar 2008 21:02:10 +0000 (15:02 -0600)]
gallium: unused var silence warning

16 years agogallium: added width, height to pipe_framebuffer_state
Brian [Thu, 20 Mar 2008 21:01:44 +0000 (15:01 -0600)]
gallium: added width, height to pipe_framebuffer_state

16 years agogallium: glBitmap code now separe from glDraw/CopyPixels code
Brian [Thu, 20 Mar 2008 20:50:17 +0000 (14:50 -0600)]
gallium: glBitmap code now separe from glDraw/CopyPixels code

Also, glBitmap now re-uses the vertex buffer to avoid frequent allocations/
deallocations.  And, use u_simple_shaders utility code.

16 years agogallium: glBitmap code now separated from glDraw/CopyPixels code
Brian [Thu, 20 Mar 2008 20:49:56 +0000 (14:49 -0600)]
gallium: glBitmap code now separated from glDraw/CopyPixels code

16 years agogallium: create one vertex buffer and re-use
Brian [Thu, 20 Mar 2008 20:27:14 +0000 (14:27 -0600)]
gallium: create one vertex buffer and re-use

16 years agogallium: use sizeof(vertex buffer)
Brian [Thu, 20 Mar 2008 20:26:51 +0000 (14:26 -0600)]
gallium: use sizeof(vertex buffer)

16 years agogallium: Y-invert blit depending on framebuffer orientation
Brian [Thu, 20 Mar 2008 20:20:25 +0000 (14:20 -0600)]
gallium: Y-invert blit depending on framebuffer orientation

16 years agogallium: in clear_with_quad() check fb orientation, invert Y if needed
Brian [Thu, 20 Mar 2008 20:17:06 +0000 (14:17 -0600)]
gallium: in clear_with_quad() check fb orientation, invert Y if needed

16 years agogallium: Give some chance for the table to actually grow.
José Fonseca [Thu, 20 Mar 2008 20:34:46 +0000 (20:34 +0000)]
gallium: Give some chance for the table to actually grow.

16 years agogallium: Fix build on Windows.
Michal Krol [Thu, 20 Mar 2008 19:34:03 +0000 (20:34 +0100)]
gallium: Fix build on Windows.

16 years agogallium: Fix build on Windows.
Michal Krol [Thu, 20 Mar 2008 19:25:40 +0000 (20:25 +0100)]
gallium: Fix build on Windows.

16 years agogallium: remove unused local var
Keith Whitwell [Thu, 20 Mar 2008 19:25:44 +0000 (19:25 +0000)]
gallium: remove unused local var

16 years agogallium: create one vertex buffer and re-use, also enable bypass_clipping
Brian [Thu, 20 Mar 2008 16:46:44 +0000 (10:46 -0600)]
gallium: create one vertex buffer and re-use, also enable bypass_clipping

Quad clears should be a little more efficient now.

16 years agogallium: create vertex buffer once and re-use.
Brian [Thu, 20 Mar 2008 16:44:51 +0000 (10:44 -0600)]
gallium: create vertex buffer once and re-use.

16 years agogallium: added util_draw_vertex_buffer()
Brian [Thu, 20 Mar 2008 16:44:27 +0000 (10:44 -0600)]
gallium: added util_draw_vertex_buffer()

16 years agogallium: temporarily disable the memcmp() in cso_set_framebuffer()
Brian [Thu, 20 Mar 2008 15:15:24 +0000 (09:15 -0600)]
gallium: temporarily disable the memcmp() in cso_set_framebuffer()

The memcmp() fails to detect buffer size changes...

16 years agogallium: use the utility pasthrough shaders
Brian [Thu, 20 Mar 2008 15:13:51 +0000 (09:13 -0600)]
gallium: use the utility pasthrough shaders

This avoids the Mesa->TGSI translation step.

16 years agogallium: added util_make_fragment_passthrough_shader()
Brian [Thu, 20 Mar 2008 15:11:27 +0000 (09:11 -0600)]
gallium: added util_make_fragment_passthrough_shader()

16 years agogallium: add debug facility to dump random blobs as hex
Keith Whitwell [Thu, 20 Mar 2008 13:10:32 +0000 (13:10 +0000)]
gallium: add debug facility to dump random blobs as hex

16 years agogallium: added fb_width/height fields to softpipe context
Brian Paul [Thu, 20 Mar 2008 00:10:09 +0000 (18:10 -0600)]
gallium: added fb_width/height fields to softpipe context

These are convenience fields.  Otherwise, we have to check cbuf[0] or zsbuf
in various places.

16 years agobetter text labels
Brian Paul [Wed, 19 Mar 2008 23:14:49 +0000 (17:14 -0600)]
better text labels

16 years agogallium: add face, dirtyLevels params to pipe->texture_update()
Brian Paul [Wed, 19 Mar 2008 23:08:16 +0000 (17:08 -0600)]
gallium: add face, dirtyLevels params to pipe->texture_update()

This provides better information about which images in texture object have changed.
Also, call texture_update() from more places previously missed.

16 years agogallium: need to set/save framebuffer state in st_context since we use it elsewhere
Brian Paul [Wed, 19 Mar 2008 23:04:49 +0000 (17:04 -0600)]
gallium: need to set/save framebuffer state in st_context since we use it elsewhere

16 years agogallium: fix bug in cso_single_sampler_done() in computation of nr_samplers
Brian Paul [Wed, 19 Mar 2008 22:41:54 +0000 (16:41 -0600)]
gallium: fix bug in cso_single_sampler_done() in computation of nr_samplers

Need to find highest used sampler so search from end toward beginning.

16 years agogallium: Fix broken logic.
José Fonseca [Wed, 19 Mar 2008 20:46:08 +0000 (20:46 +0000)]
gallium: Fix broken logic.

16 years agogallium: explict float casts
Keith Whitwell [Wed, 19 Mar 2008 17:35:42 +0000 (17:35 +0000)]
gallium: explict float casts

16 years agogallium: implement CSO save/restore functions for use by meta operations (blit, gen...
Brian [Wed, 19 Mar 2008 17:12:48 +0000 (11:12 -0600)]
gallium: implement CSO save/restore functions for use by meta operations (blit, gen-mipmaps, quad-clear, etc)

Also, additional cso_set_*() functions for viewport, framebuffer, blend color,
etc. state.

16 years agogallium: remove old commented-out code
Brian [Wed, 19 Mar 2008 16:43:35 +0000 (10:43 -0600)]
gallium: remove old commented-out code

16 years agogallium: set tc->surface_map = NULL after unmapping
Brian [Wed, 19 Mar 2008 14:53:02 +0000 (08:53 -0600)]
gallium: set tc->surface_map = NULL after unmapping

16 years agogallium: Add generic enum and flags dumping utility functions.
José Fonseca [Wed, 19 Mar 2008 16:41:07 +0000 (16:41 +0000)]
gallium: Add generic enum and flags dumping utility functions.

16 years agoset outputs_safe to 0 as it's possible for the code generation
Alan Hourihane [Wed, 19 Mar 2008 00:18:07 +0000 (00:18 +0000)]
set outputs_safe to 0 as it's possible for the code generation
to slip over the allocated memory for the vb.

16 years agoremove redundant init
Alan Hourihane [Wed, 19 Mar 2008 00:16:16 +0000 (00:16 +0000)]
remove redundant init

16 years agogallium: added braces to silence warning
Brian [Tue, 18 Mar 2008 23:19:57 +0000 (17:19 -0600)]
gallium: added braces to silence warning

16 years agogallium: plug in and init GL_EXT_framebuffer_blit function/extension
Brian [Tue, 18 Mar 2008 23:16:23 +0000 (17:16 -0600)]
gallium: plug in and init GL_EXT_framebuffer_blit function/extension

16 years agogallium: added st_cb_blit.c
Brian [Tue, 18 Mar 2008 23:16:12 +0000 (17:16 -0600)]
gallium: added st_cb_blit.c

16 years agogallium: s/copy_pixels_state/blit_state
Brian [Tue, 18 Mar 2008 23:15:25 +0000 (17:15 -0600)]
gallium: s/copy_pixels_state/blit_state

16 years agogallium: added cso_unset_*() functions
Brian [Tue, 18 Mar 2008 23:14:05 +0000 (17:14 -0600)]
gallium: added cso_unset_*() functions

If we go behind the CSO context's back and set pipe state directly we
need to invalidate the CSO's 'current' pointers.
This will be revisited...

16 years agogallium: glFramebufferBlitEXT() implementation
Brian [Tue, 18 Mar 2008 23:13:14 +0000 (17:13 -0600)]
gallium: glFramebufferBlitEXT() implementation

16 years agogallium: fix typos
Brian [Tue, 18 Mar 2008 23:12:51 +0000 (17:12 -0600)]
gallium: fix typos

16 years agogallium: new pixel blit code
Brian [Tue, 18 Mar 2008 23:04:59 +0000 (17:04 -0600)]
gallium: new pixel blit code

Copy rectangular region from one surface to another w/ scaling.
Disables most fragment operations.

16 years agogallium: protect against multi-#include
Brian [Tue, 18 Mar 2008 22:59:46 +0000 (16:59 -0600)]
gallium: protect against multi-#include

16 years agoadded u_simple_shaders.c
Brian [Tue, 18 Mar 2008 22:59:15 +0000 (16:59 -0600)]
added u_simple_shaders.c

16 years agogallium: make the gen_mipmap_state struct private
Brian [Tue, 18 Mar 2008 22:58:15 +0000 (16:58 -0600)]
gallium: make the gen_mipmap_state struct private

16 years agogallium: use new simple shader utility routines
Brian [Tue, 18 Mar 2008 22:57:23 +0000 (16:57 -0600)]
gallium: use new simple shader utility routines

16 years agogallium: utilities for creating simple vertex/fragment shaders
Brian [Tue, 18 Mar 2008 22:56:55 +0000 (16:56 -0600)]
gallium: utilities for creating simple vertex/fragment shaders

16 years agogallium: restore additional state after clearing with quad
Brian [Tue, 18 Mar 2008 21:15:02 +0000 (15:15 -0600)]
gallium: restore additional state after clearing with quad

16 years agocell: Fix various stencil test code-gen bugs
Ian Romanick [Tue, 18 Mar 2008 22:59:33 +0000 (15:59 -0700)]
cell: Fix various stencil test code-gen bugs

16 years agocell: Correctly load stencil for PIPE_FORMAT_S8Z24_UNORM
Ian Romanick [Tue, 18 Mar 2008 22:59:06 +0000 (15:59 -0700)]
cell: Correctly load stencil for PIPE_FORMAT_S8Z24_UNORM

16 years agogallium: make REALLOC a bit more like realloc
Keith Whitwell [Tue, 18 Mar 2008 13:10:51 +0000 (13:10 +0000)]
gallium: make REALLOC a bit more like realloc

16 years agocell: Fix depth read / write for s8z24.
Ian Romanick [Tue, 18 Mar 2008 18:47:37 +0000 (11:47 -0700)]
cell: Fix depth read / write for s8z24.

Stencil is still broken.

16 years agocell: Fix added whitespace errors.
Ian Romanick [Tue, 18 Mar 2008 17:29:14 +0000 (10:29 -0700)]
cell: Fix added whitespace errors.

16 years agocell: Minor changes to make stencil not crash
Ian Romanick [Tue, 18 Mar 2008 17:26:45 +0000 (10:26 -0700)]
cell: Minor changes to make stencil not crash

I'm not sure these are quite correct.  The reflect demo doesn't assert
anymore, but it doesn't produce correct results either.  SPE-based
vertex shader code needs to be disabled for relfect to run.