unsigned tex_usage,
unsigned geom_flags )
{
- struct sw_winsys *winsys = cell_screen(screen)->winsys;
-
- if (format == PIPE_FORMAT_DXT5_RGBA ||
- format == PIPE_FORMAT_A8B8G8R8_SRGB)
- return FALSE;
-
+ if (tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
+ if (!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
+ return FALSE;
+ }
+
- /* This is often a lie. Pull in logic from llvmpipe to fix.
- */
- return TRUE;
+ /* only a few formats are known to work at this time */
+ switch (format) {
+ case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_I8_UNORM:
+ return TRUE;
+ default:
+ return FALSE;
+ }
}
struct st_renderbuffer *rbRead;
void *driver_vp, *driver_fp;
struct pipe_texture *pt;
+ struct pipe_sampler_view *sv;
GLfloat *color;
enum pipe_format srcFormat, texFormat;
- int ptw, pth;
GLboolean invertTex = GL_FALSE;
GLint readX, readY, readW, readH;
- struct gl_pixelstore_attrib unpack = ctx->DefaultPacking;
+ struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
PIPE_BUFFER_USAGE_GPU_READ);
struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE );
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- psTex, /* dest surf */
- pack.SkipPixels, pack.SkipRows, /* dest pos */
- psRead, /* src surf */
- readX, readY, readW, readH); /* src region */
- } else {
- util_surface_copy(pipe, FALSE,
- psTex,
- pack.SkipPixels, pack.SkipRows,
- psRead,
- readX, readY, readW, readH);
- }
++
+ pipe->surface_copy(pipe,
+ psTex, /* dest surf */
- unpack.SkipPixels, unpack.SkipRows, /* dest pos */
++ pack.SkipPixels, pack.SkipRows, /* dest pos */
+ psRead, /* src surf */
+ readX, readY, readW, readH); /* src region */
if (0) {
/* debug */
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_rgba(ptTex, pack.SkipPixels, pack.SkipRows,
+ pipe_get_tile_rgba(pipe, ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_rgba(pipe, ptTex, unpack.SkipPixels, unpack.SkipRows,
++ pipe_put_tile_rgba(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
readW, readH, buf);
free(buf);
}
else {
/* GL_DEPTH */
GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
- pipe_get_tile_z(ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_z(ptTex, pack.SkipPixels, pack.SkipRows,
- readW, readH, buf);
+ pipe_get_tile_z(pipe, ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_z(pipe, ptTex, unpack.SkipPixels, unpack.SkipRows,
++ pipe_put_tile_z(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
+ readW, readH, buf);
free(buf);
}