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
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "main/imports.h"
|
#include "main/imports.h"
|
||||||
#include "main/image.h"
|
#include "main/image.h"
|
||||||
|
#include "main/bufferobj.h"
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
#include "main/texformat.h"
|
#include "main/texformat.h"
|
||||||
#include "shader/program.h"
|
#include "shader/program.h"
|
||||||
@@ -191,7 +192,6 @@ combined_bitmap_fragment_program(GLcontext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a texture which represents a bitmap image.
|
* Create a texture which represents a bitmap image.
|
||||||
*/
|
*/
|
||||||
@@ -224,19 +224,21 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
|
|||||||
assert( 0 );
|
assert( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PBO source... */
|
||||||
|
bitmap = _mesa_validate_and_map_bitmap_pbo(ctx, width, height,
|
||||||
|
unpack, bitmap);
|
||||||
|
if (!bitmap) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a texture.
|
* Create texture to hold bitmap pattern.
|
||||||
*/
|
*/
|
||||||
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, width, height,
|
pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, width, height,
|
||||||
1, 0);
|
1, 0);
|
||||||
if (!pt)
|
if (!pt) {
|
||||||
|
_mesa_unmap_bitmap_pbo(ctx, unpack);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (unpack->BufferObj && unpack->BufferObj->Name) {
|
|
||||||
/*
|
|
||||||
pt->region = buffer_object_region(unpack->BufferObj);
|
|
||||||
*/
|
|
||||||
printf("st_Bitmap (sourcing from PBO not implemented yet)\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
|
surface = screen->get_tex_surface(screen, pt, 0, 0, 0);
|
||||||
@@ -301,6 +303,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
|
|||||||
|
|
||||||
} /* row */
|
} /* row */
|
||||||
|
|
||||||
|
_mesa_unmap_bitmap_pbo(ctx, unpack);
|
||||||
|
|
||||||
/* Release surface */
|
/* Release surface */
|
||||||
pipe_surface_unmap(surface);
|
pipe_surface_unmap(surface);
|
||||||
pipe_surface_reference(&surface, NULL);
|
pipe_surface_reference(&surface, NULL);
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "main/imports.h"
|
#include "main/imports.h"
|
||||||
#include "main/image.h"
|
#include "main/image.h"
|
||||||
|
#include "main/bufferobj.h"
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
#include "main/texformat.h"
|
#include "main/texformat.h"
|
||||||
#include "shader/program.h"
|
#include "shader/program.h"
|
||||||
@@ -334,16 +335,17 @@ make_texture(struct st_context *st,
|
|||||||
assert(pipeFormat);
|
assert(pipeFormat);
|
||||||
cpp = st_sizeof_format(pipeFormat);
|
cpp = st_sizeof_format(pipeFormat);
|
||||||
|
|
||||||
pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height,
|
pixels = _mesa_validate_and_map_drawpix_pbo(ctx, width, height,
|
||||||
1, 0);
|
format, type,
|
||||||
if (!pt)
|
unpack, pixels);
|
||||||
|
if (!pixels)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (unpack->BufferObj && unpack->BufferObj->Name) {
|
pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, width, height,
|
||||||
/*
|
1, 0);
|
||||||
pt->region = buffer_object_region(unpack->BufferObj);
|
if (!pt) {
|
||||||
*/
|
_mesa_unmap_drapix_pbo(ctx, unpack);
|
||||||
printf("st_DrawPixels (sourcing from PBO not implemented yet)\n");
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -388,6 +390,8 @@ make_texture(struct st_context *st,
|
|||||||
ctx->_ImageTransferState = imageTransferStateSave;
|
ctx->_ImageTransferState = imageTransferStateSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mesa_unmap_drapix_pbo(ctx, unpack);
|
||||||
|
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,9 +840,9 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
|
|
||||||
bufferFormat = ps->format;
|
bufferFormat = ps->format;
|
||||||
|
|
||||||
if (any_fragment_ops(st) ||
|
if (1/*any_fragment_ops(st) ||
|
||||||
any_pixel_transfer_ops(st) ||
|
any_pixel_transfer_ops(st) ||
|
||||||
!compatible_formats(format, type, ps->format)) {
|
!compatible_formats(format, type, ps->format)*/) {
|
||||||
/* textured quad */
|
/* textured quad */
|
||||||
struct pipe_texture *pt
|
struct pipe_texture *pt
|
||||||
= make_texture(ctx->st, width, height, format, type, unpack, pixels);
|
= make_texture(ctx->st, width, height, format, type, unpack, pixels);
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "main/imports.h"
|
#include "main/imports.h"
|
||||||
|
#include "main/bufferobj.h"
|
||||||
#include "main/context.h"
|
#include "main/context.h"
|
||||||
#include "main/image.h"
|
#include "main/image.h"
|
||||||
|
|
||||||
@@ -126,7 +127,6 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do glReadPixels by getting rows from the framebuffer surface with
|
* Do glReadPixels by getting rows from the framebuffer surface with
|
||||||
* get_tile(). Convert to requested format/type with Mesa image routines.
|
* get_tile(). Convert to requested format/type with Mesa image routines.
|
||||||
@@ -155,18 +155,15 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dest = _mesa_validate_and_map_readpix_pbo(ctx, x, y, width, height,
|
||||||
|
format, type,
|
||||||
|
&clippedPacking, dest);
|
||||||
|
if (!dest)
|
||||||
|
return;
|
||||||
|
|
||||||
/* make sure rendering has completed */
|
/* make sure rendering has completed */
|
||||||
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
|
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE);
|
||||||
|
|
||||||
if (pack->BufferObj && pack->BufferObj->Name) {
|
|
||||||
/* reading into a PBO */
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* reading into user memory/buffer */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (format == GL_STENCIL_INDEX) {
|
if (format == GL_STENCIL_INDEX) {
|
||||||
st_read_stencil_pixels(ctx, x, y, width, height, type, pack, dest);
|
st_read_stencil_pixels(ctx, x, y, width, height, type, pack, dest);
|
||||||
return;
|
return;
|
||||||
@@ -285,6 +282,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mesa_unmap_readpix_pbo(ctx, &clippedPacking);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user