Commit Graph

49 Commits

Author SHA1 Message Date
Thomas Hellstrom
e50dd26ca6 gallium: Create OGL state tracker wrappers for various CPU access operations.
There are two usage types of buffer CPU accesses:
One where we try to use the buffer contents for multiple draw commands in
a batch. (batch := sequence of commands that are flushed together),
like incrementally adding bitmaps to a bitmap texture that is reallocated
on flush.
And one where we assume we can safely overwrite the old buffer contexts, like
glTexSubImage. In this case we need to make sure all old drawing commands
referencing the buffer are flushed before we map the buffer.
This is easily forgotten.

Add wrappers for the most common of these operations. The first type is
prefixed with "st_no_flush" and the second type is prefixed with
"st_cond_flush", where "cond" indicates that we attmpt to only flush
if there is indeed unflushed draw commands referencing the buffer.

Prefixed functions are
screen::get_tex_transfer
pipe_buffer_write
pipe_buffer_read
pipe_buffer_map

Please use the wrappers whenever possible.

Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-04-17 13:18:05 +02:00
Thomas Hellstrom
9b75627fab gallium: Make sure we flush before some texture / buffer operations.
Also implement context member functions to optimize away those
flushes whenever possible.

Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
2009-04-15 17:16:58 +02:00
Brian Paul
b7615e5240 st: implement GL_DEPTH_STENCIL format for glReadPixels and DrawPixels() 2009-04-07 17:32:29 -06:00
José Fonseca
8332925c3c mesa: Fix orientation adjustment for reading stencil pixels.
Fixes conform spcorner.c & spclear.c failure.
2009-04-06 20:38:37 +01:00
Brian Paul
c7eb423c49 mesa: remove the noClamp parameter to _mesa_pack_rgba_span_float()
It was only set to GL_TRUE in one place where it isn't really needed
(glGetTexImage(sRGB format)).
2009-04-03 17:28:35 -06:00
Roland Scheidegger
c6a6cc1918 mesa: add new signed rgba texture format
This is a (partial) backport of the signed texture format support in OGL 3.1.
Since it wasn't promoted from an existing extension roll our own.
2009-03-28 02:02:42 +01:00
José Fonseca
e0a55dc9da mesa: Support Z24S8 wherever S8Z24 is supported. 2009-03-27 19:51:33 +00:00
Michel Dänzer
5e27cd46c0 gallium: Unify reference counting.
The core reference counting code is centralized in p_refcnt.h.

This has some consequences related to struct pipe_buffer:

* The screen member of struct pipe_buffer must be initialized, or
  pipe_buffer_reference() will crash trying to destroy a buffer with reference
  count 0. u_simple_screen takes care of this, but I may have missed some of
  the drivers not using it.
* Except for rare exceptions deep in winsys code, buffers must always be
  allocated via pipe_buffer_create() or via screen->*buffer_create() rather
  than via winsys->*buffer_create().
2009-03-04 11:58:48 +01:00
Michel Dänzer
7c8836e9ef gallium: Various coordinate fixups for texture transfers.
Fixes glReadPixels, gl(Copy)TexSubImage, glCopyPixels.
2009-02-13 17:34:29 +01:00
Michel Dänzer
4617981ec7 gallium: No longer allow CPU mapping surfaces directly.
Instead, a new pipe_transfer object has to be created and mapped for
transferring data between the CPU and a texture. This gives the driver more
flexibility for textures in address spaces that aren't CPU accessible.

This is a first pass; softpipe/xlib builds and runs glxgears, but it only shows
a black window. Looks like something's off related to the Z buffer, so the
depth test always fails.
2009-02-05 19:41:18 +01:00
Keith Whitwell
d2c2e9316d gallium: avoid mapping same vertex buffer in subsequent frames
Quite a few util modules were maintaining a single vertex buffer over multiple
frames, and potentially reusing it in subsequent frames.  Unfortunately that
would force us into syncrhonous rendering as the buffer manager would be
forced to wait for the previous rendering to complete prior to allowing the
map.

This resolves that issue, but requires the state tracker to issue a few new
flush() calls at the end of each frame.
2008-12-12 16:57:39 +00:00
Brian Paul
4f25420bdd gallium: refactor/replace p_util.h with util/u_memory.h and util/u_math.h
Also, rename p_tile.[ch] to u_tile.[ch]
2008-08-24 17:48:55 -06:00
Brian Paul
84a496746e gallium: implement a fast-path for glReadPixels for common cases 2008-08-19 14:35:32 -06:00
José Fonseca
36dd89c8a7 util: Eliminate pipe from the arguments to pipe_get/put_tile_xxx functions.
You don't need a pipe_context * for this, and all other necessary info is
already inside pipe_surface.
2008-07-13 23:37:40 +09:00
José Fonseca
4ddd659679 gallium: Drop pipe_texture->cpp and pipe_surface->cpp.
The chars-per-pixel concept falls apart with compressed and yuv images,
where more than one pixel are coded in a single data block.
2008-06-27 19:37:56 +09:00
José Fonseca
18ec140ef2 mesa: Use appropriate unsigned/signed, float/integer types. 2008-06-24 11:34:46 +09:00
Brian Paul
54fbd8bbd4 Merge branch 'gallium-0.1' into gallium-tex-surfaces 2008-05-18 16:17:50 -06:00
Brian Paul
1de0af303a s/PIPE_FORMAT_U_S8/PIPE_FORMAT_S8_UNORM/ 2008-05-17 08:46:43 -06:00
Brian Paul
1a82d9648b gallium: fix some render to texture bugs
Before, we were sometimes rendering into a stale texture because
st_finalize_texture() would discard the old texture and create a new one.

Moved st_update_framebuffer atom after texture validation so that we
can create a new renderbuffer surface if the texture changes.

Also, split texture validation into two parts: finalize_textures and
update_textures.  Do finalize_textures first to avoid getting into the
situtation where we're doing a pipe->surface_copy() mid-way through
state validation.

Some debug code still in place, but disabled...
2008-05-07 16:44:33 -06:00
Brian Paul
296378b6c8 gallium: create drawing surfaces as GPU_READ/WRITE only
Create different temporary surfaces for CPU_READ/WRITE when needed (such as
for glReadPixels, glAccum, some glCopy/DrawPixels, glCopyTexSubImage, etc).
2008-05-06 13:48:27 -06:00
Keith Whitwell
c9ed86a964 gallium: tex surface checkpoint 2008-05-01 12:00:45 +01:00
Brian Paul
7f5e9d3f07 gallium: check for PIPE_FORMAT_X8Z24_UNORM format 2008-04-28 09:40:26 -06:00
Brian Paul
7a8ad75c89 gallium: fix readback of z16 values 2008-04-10 10:30:46 -06:00
Brian Paul
311e402684 gallium: more elaborate tracking of front color buffer state
This fixes the case where the app calls SwapBuffers then calls glReadPixels
to read the front color buffer.  We now keep track of when the front buffer
is a _logically_ copy of the back buffer (after SwapBuffers) and read from
the back color buffer instead of the front.
2008-04-09 18:39:51 -06:00
Brian Paul
e8823bb7df gallium: include st_cb_bitmap.h to silence warning 2008-04-03 12:52:55 -06:00
Brian Paul
0bc2e2c9cd gallium: call st_flush_bitmap_cache() 2008-04-03 12:01:53 -06:00
Michel Dänzer
4abe1eb980 gallium: Change pipe->flush() interface to optionally return a fence.
The cell driver still uses an internal CELL_FLUSH_WAIT flag, in the long run
proper fencing should be implemented for it.
2008-03-26 09:36:40 +00:00
Brian
a39091bc5b 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.
2008-03-21 14:20:07 -06:00
Brian Paul
f1626f0bfd 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
2008-03-21 13:44:27 -06:00
José Fonseca
6acd63a498 Code reorganization: update build.
Update the Makefiles and includes for the new paths.

Note that there hasn't been no separation of the Makefiles yet, and make is
jumping all over the place. That will be taken care shortly. But for now, make
should work. It was tested with linux and linux-dri. Linux-cell and linux-llvm
might require some minor tweaks.
2008-02-15 17:50:12 +09:00
Brian
9af687c530 gallium: fix/finish glReadPixels(GL_DEPTH_COMPONENT).
This fixes demos/reflect ('d' key) and tests/zreaddraw.c
2008-02-12 17:44:57 -07:00
Michel Dänzer
2014e0bacb Remove pipe->get/put_tile_rgba.
pipe_get/put_tile_rgba() now use pipe->get/put_tile internally.

Also simplify the <format>_get/put_tile_rgba() helper functions and clean up
some inconsitencies in them.
2008-01-14 18:12:58 +01:00
Michel Dänzer
c76efb96b4 Remove mapping fields from struct pipe_surface.
It's now the responsibility of surface users to keep track of their mappings.
2008-01-14 18:12:58 +01:00
Keith Whitwell
a85535b7cb gallium: make state tracker explictly ask for rendercache flushes 2007-12-20 13:47:46 +00:00
Brian
d3e05111c8 Replace "duplicate" formats 2007-12-07 16:15:14 -07:00
Michel Dänzer
b859cdf6f1 Eliminate struct pipe_region.
Directly use struct pipe_buffer_handle for storage and struct pipe_surface for
(un)mapping.
2007-12-07 12:30:35 +01:00
Michel Dänzer
11a80160fd Move dimensions from struct pipe_region to struct pipe_surface. 2007-11-29 16:41:39 +01:00
Brian
0191570f02 initial support for PIPE_FORMAT_Z24_S8 2007-11-20 08:30:10 -07:00
Brian
ee80e0b620 Move the get/put_tile() functions to pipe_context.
The _rgba versions are temporary until the state tracker is updated.
2007-10-25 20:32:45 -06:00
Brian
68b88fab88 fix function name 2007-10-18 14:20:38 -06:00
Brian
8f3fb395ff make read_stencil_pixels() non-static 2007-10-18 12:31:05 -06:00
Brian
e48ea92510 fix addressing error in read_stencil_pixels() 2007-10-17 14:56:55 -06:00
Brian
69466c60a5 GL_STENCIL_INDEX support 2007-10-13 12:29:11 -06:00
Brian
eb389aaf72 get_tile() of Z surfaces returns floats now 2007-10-13 09:05:20 -06:00
Brian
a9f0330061 basic support for reading GL_DEPTH_COMPONENT 2007-10-03 13:50:11 -06:00
Brian
4698483f84 Added st_fb_orientation() function to determine the up/down orientation of the framebuffer. 2007-08-13 18:20:04 -06:00
Brian
eb450bbb40 flush pipe before reading image 2007-08-13 13:56:30 -06:00
Brian
04ee3cecdf readpixels handles any format/type/packing/transfer ops now 2007-08-10 15:29:41 -06:00
Brian
c943dab9a3 glReadPixels 2007-08-10 11:37:05 -06:00