Age | Commit message (Collapse) | Author |
|
Always test for PIPE_TRANSFER_READ/WRITE using the bit-wise and operator, and
add a pipe_transfer_buffer_flags() helper for getting the buffer usage flags
corresponding to them.
|
|
|
|
This commit adds functions to bind a pipe surface to a texture. This
allows texturing directly from the surface.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
|
|
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>
|
|
Also implement context member functions to optimize away those
flushes whenever possible.
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
|
The format field encodes compressed vs. uncompressed already. We can easily
check if a texture is compressed with pf_is_compressed(texture->format).
|
|
The format indicates compressed vs. uncompressed.
|
|
We can determine if the texture is compressed by checking the format.
|
|
|
|
|
|
Signed-off-by: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
|
I should have gotten most uses and implementation
correctly fixed, but things might break.
Feel free to blame me.
|
|
|
|
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().
|
|
Use loops to consolidate lots of texture object code.
|
|
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.
|
|
support.
|
|
|
|
|
|
|
|
Also, rename p_tile.[ch] to u_tile.[ch]
|
|
|
|
Some of the headers in src/mesa/main have pretty common names which
easily conflict with third-party code, e.g. config.h
|
|
|
|
The chars-per-pixel concept falls apart with compressed and yuv images,
where more than one pixel are coded in a single data block.
|
|
|
|
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...
|
|
For many envirionments it's necessary to allocate display targets
in a window-system friendly manner. Add facilities so that a driver
can tell if a texture is likely to be used to generate a display surface
and if use special allocation paths if necessary.
Hook up softpipe to call into the winsys->surface_alloc_storage()
routine in this case, though we probably want to change that interface
slightly also.
|
|
|
|
|
|
This allows us to remove most of the direct references to winsys in the state tracker.
|
|
Actually, the hack is still there and needs to be revisited, but I get a bit
further with compressed textures now.
|
|
|
|
make sure the tex format is actually supported by the driver.
|
|
These functions are now per-screen, not per-context.
|
|
This fixes at least one instance of dereferencing an invalid texture pointer.
|
|
Fixes gears being upside down on the box in demos/gearbox.
|
|
|
|
Remove pipe_texture->first_level (always implicitly zero). This means there's
never any unused mipmap levels at the top.
In the state tracker, we no longer re-layout mipmapped textures if the
MinLod/MaxLod texture parameters change. It's up to the driver to obey the
pipe_sampler->min/max_lod clamps.
|
|
Now, pass in a template object and return a new object.
|
|
|
|
- Remove put/get tile, just have users call put_tile_raw, etc directly.
- Remove surface_data call, just map it locally.
|
|
Also make enum pipe_format used in a couple more places.
|
|
It's state tracker specific / not really necessary anyway.
|
|
Directly use struct pipe_buffer_handle for storage and struct pipe_surface for
(un)mapping.
|
|
pipe->get_tex_surface() has to be used for access to texture image data.
|