summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-04-12 16:13:33 +0800
committerChia-I Wu <olv@lunarg.com>2010-04-13 15:15:43 +0800
commitda8412ec19ad00627ae9139dc02f46f344bbb6ac (patch)
tree2d94aaab96316afb0267251d978830812ed701af /src/mesa
parenta1dbd009d4a725b432a08093dc52486f896915d9 (diff)
st/mesa: Drop st_public support.
There is no user of st_public now.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/sources.mak1
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c18
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c1
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c1
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c110
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c18
-rw-r--r--src/mesa/state_tracker/st_cb_flush.h7
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c14
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c1
-rw-r--r--src/mesa/state_tracker/st_context.c51
-rw-r--r--src/mesa/state_tracker/st_context.h15
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c408
-rw-r--r--src/mesa/state_tracker/st_inlines.h2
-rw-r--r--src/mesa/state_tracker/st_manager.c20
-rw-r--r--src/mesa/state_tracker/st_public.h152
-rw-r--r--src/mesa/state_tracker/st_texture.c221
16 files changed, 22 insertions, 1018 deletions
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index f6d52b8e0f..d9ebb51a6d 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -214,7 +214,6 @@ STATETRACKER_SOURCES = \
state_tracker/st_draw_feedback.c \
state_tracker/st_extensions.c \
state_tracker/st_format.c \
- state_tracker/st_framebuffer.c \
state_tracker/st_gen_mipmap.c \
state_tracker/st_manager.c \
state_tracker/st_mesa_to_tgsi.c \
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index d33ddc83f6..1cd5546337 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -34,7 +34,6 @@
#include "st_context.h"
#include "st_atom.h"
#include "st_cb_fbo.h"
-#include "st_public.h"
#include "st_texture.h"
#include "pipe/p_context.h"
#include "cso_cache/cso_context.h"
@@ -155,23 +154,6 @@ update_framebuffer_state( struct st_context *st )
}
cso_set_framebuffer(st->cso_context, framebuffer);
-
- if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
- if (st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) {
- /* copy back color buffer to front color buffer */
- struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
- struct pipe_surface *surf_front, *surf_back;
- (void) st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT, &surf_front);
- (void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back);
-
- st->pipe->surface_copy(st->pipe,
- surf_front, 0, 0, /* dest */
- surf_back, 0, 0, /* src */
- fb->Width, fb->Height);
- }
- /* we're assuming we'll really draw to the front buffer */
- st->frontbuffer_status = FRONT_STATUS_DIRTY;
- }
}
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index a693141921..2732969d95 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -38,7 +38,6 @@
#include "st_context.h"
#include "st_cb_accum.h"
#include "st_cb_fbo.h"
-#include "st_public.h"
#include "st_texture.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index eb9ba0557d..2f77aff7a6 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -43,7 +43,6 @@
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
#include "st_program.h"
-#include "st_public.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index d50970f7e4..aec487b001 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -45,8 +45,8 @@
#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_cb_fbo.h"
+#include "st_cb_flush.h"
#include "st_format.h"
-#include "st_public.h"
#include "st_texture.h"
#include "st_manager.h"
@@ -490,111 +490,6 @@ st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
/**
- * Copy back color buffer to front color buffer.
- */
-static void
-copy_back_to_front(struct st_context *st,
- struct gl_framebuffer *fb,
- gl_buffer_index frontIndex,
- gl_buffer_index backIndex)
-
-{
- struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
- struct pipe_surface *surf_front, *surf_back;
-
- (void) st_get_framebuffer_surface(stfb, frontIndex, &surf_front);
- (void) st_get_framebuffer_surface(stfb, backIndex, &surf_back);
-
- if (surf_front && surf_back) {
- st->pipe->surface_copy(st->pipe,
- surf_front, 0, 0, /* dest */
- surf_back, 0, 0, /* src */
- fb->Width, fb->Height);
- }
-}
-
-
-/**
- * Check if we're drawing into, or read from, a front color buffer. If the
- * front buffer is missing, create it now.
- *
- * The back color buffer must exist since we'll use its format/samples info
- * for creating the front buffer.
- *
- * \param frontIndex either BUFFER_FRONT_LEFT or BUFFER_FRONT_RIGHT
- * \param backIndex either BUFFER_BACK_LEFT or BUFFER_BACK_RIGHT
- */
-static void
-check_create_front_buffer(GLcontext *ctx, struct gl_framebuffer *fb,
- gl_buffer_index frontIndex,
- gl_buffer_index backIndex)
-{
- if (fb->Attachment[frontIndex].Renderbuffer == NULL) {
- GLboolean create = GL_FALSE;
-
- /* check if drawing to or reading from front buffer */
- if (fb->_ColorReadBufferIndex == frontIndex) {
- create = GL_TRUE;
- }
- else {
- GLuint b;
- for (b = 0; b < fb->_NumColorDrawBuffers; b++) {
- if (fb->_ColorDrawBufferIndexes[b] == frontIndex) {
- create = GL_TRUE;
- break;
- }
- }
- }
-
- if (create) {
- struct st_renderbuffer *back;
- struct gl_renderbuffer *front;
- enum pipe_format colorFormat;
- uint samples;
-
- if (0)
- _mesa_debug(ctx, "Allocate new front buffer\n");
-
- /* get back renderbuffer info */
- back = st_renderbuffer(fb->Attachment[backIndex].Renderbuffer);
- colorFormat = back->format;
- samples = back->Base.NumSamples;
-
- /* create front renderbuffer */
- front = st_new_renderbuffer_fb(colorFormat, samples, FALSE);
- _mesa_add_renderbuffer(fb, frontIndex, front);
-
- /* alloc texture/surface for new front buffer */
- front->AllocStorage(ctx, front, front->InternalFormat,
- fb->Width, fb->Height);
-
- /* initialize the front color buffer contents by copying
- * the back buffer.
- */
- copy_back_to_front(ctx->st, fb, frontIndex, backIndex);
- }
- }
-}
-
-
-/**
- * If front left/right color buffers are missing, create them now.
- */
-static void
-check_create_front_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
-{
- /* check if we need to create the front left buffer now */
- check_create_front_buffer(ctx, fb, BUFFER_FRONT_LEFT, BUFFER_BACK_LEFT);
-
- if (fb->Visual.stereoMode) {
- check_create_front_buffer(ctx, fb, BUFFER_FRONT_RIGHT, BUFFER_BACK_RIGHT);
- }
-
- st_invalidate_state(ctx, _NEW_BUFFERS);
-}
-
-
-/**
* Called via glDrawBuffer.
*/
static void
@@ -611,8 +506,6 @@ st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers)
gl_buffer_index idx = fb->_ColorDrawBufferIndexes[i];
st_manager_add_color_renderbuffer(ctx->st, fb, idx);
}
-
- check_create_front_buffers(ctx, ctx->DrawBuffer);
}
@@ -628,7 +521,6 @@ st_ReadBuffer(GLcontext *ctx, GLenum buffer)
/* add the renderbuffer on demand */
st_manager_add_color_renderbuffer(ctx->st, fb, fb->_ColorReadBufferIndex);
- check_create_front_buffers(ctx, fb);
}
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 30e7afcf2a..415e8f3d2a 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -39,7 +39,6 @@
#include "st_cb_flush.h"
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
-#include "st_public.h"
#include "st_manager.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
@@ -52,15 +51,10 @@
static INLINE GLboolean
is_front_buffer_dirty(struct st_context *st)
{
- if (st->frontbuffer_status == FRONT_STATUS_DIRTY) {
- return GL_TRUE;
- }
- else {
- GLframebuffer *fb = st->ctx->DrawBuffer;
- struct st_renderbuffer *strb
- = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
- return strb && strb->defined;
- }
+ GLframebuffer *fb = st->ctx->DrawBuffer;
+ struct st_renderbuffer *strb
+ = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ return strb && strb->defined;
}
@@ -78,10 +72,6 @@ display_front_buffer(struct st_context *st)
/* Hook for copying "fake" frontbuffer if necessary:
*/
st_manager_flush_frontbuffer(st);
-
- /*
- st->frontbuffer_status = FRONT_STATUS_UNDEFINED;
- */
}
}
diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h
index c26f779225..7fca0176a3 100644
--- a/src/mesa/state_tracker/st_cb_flush.h
+++ b/src/mesa/state_tracker/st_cb_flush.h
@@ -33,6 +33,13 @@
extern void
st_init_flush_functions(struct dd_function_table *functions);
+extern void
+st_flush(struct st_context *st, uint pipeFlushFlags,
+ struct pipe_fence_handle **fence);
+
+extern void
+st_finish(struct st_context *st);
+
#endif /* ST_CB_FLUSH_H */
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 3c06221c87..67c3b9adbb 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -48,7 +48,6 @@
#include "st_atom.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
-#include "st_public.h"
#include "st_texture.h"
#include "st_inlines.h"
@@ -170,7 +169,6 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
/**
* Return renderbuffer to use for reading color pixels for glRead/CopyPixel
* commands.
- * Special care is needed for the front buffer.
*/
struct st_renderbuffer *
st_get_color_read_renderbuffer(GLcontext *ctx)
@@ -178,18 +176,6 @@ st_get_color_read_renderbuffer(GLcontext *ctx)
struct gl_framebuffer *fb = ctx->ReadBuffer;
struct st_renderbuffer *strb =
st_renderbuffer(fb->_ColorReadBuffer);
- struct st_renderbuffer *front =
- st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
-
- if (strb == front
- && ctx->st->frontbuffer_status == FRONT_STATUS_COPY_OF_BACK) {
- /* reading from front color buffer, which is a logical copy of the
- * back color buffer.
- */
- struct st_renderbuffer *back =
- st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
- strb = back;
- }
return strb;
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index ce112f6795..196bf1325f 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -49,7 +49,6 @@
#include "state_tracker/st_cb_fbo.h"
#include "state_tracker/st_cb_texture.h"
#include "state_tracker/st_format.h"
-#include "state_tracker/st_public.h"
#include "state_tracker/st_texture.h"
#include "state_tracker/st_gen_mipmap.h"
#include "state_tracker/st_inlines.h"
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 0a1503fc69..c753fdca34 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -31,7 +31,6 @@
#include "shader/shader_api.h"
#include "glapi/glapi.h"
#include "st_context.h"
-#include "st_public.h"
#include "st_debug.h"
#include "st_cb_accum.h"
#include "st_cb_bitmap.h"
@@ -288,56 +287,6 @@ void st_destroy_context( struct st_context *st )
}
-GLboolean
-st_make_current(struct st_context *st,
- struct st_framebuffer *draw,
- struct st_framebuffer *read,
- void *winsys_drawable_handle )
-{
- /* Call this periodically to detect when the user has begun using
- * GL rendering from multiple threads.
- */
- _glapi_check_multithread();
-
- if (st) {
- if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base)) {
- st->pipe->priv = NULL;
- return GL_FALSE;
- }
-
- _mesa_check_init_viewport(st->ctx, draw->InitWidth, draw->InitHeight);
- st->winsys_drawable_handle = winsys_drawable_handle;
-
- return GL_TRUE;
- }
- else {
- return _mesa_make_current(NULL, NULL, NULL);
- }
-}
-
-struct st_context *st_get_current(void)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- return (ctx == NULL) ? NULL : ctx->st;
-}
-
-void st_copy_context_state(struct st_context *dst,
- struct st_context *src,
- uint mask)
-{
- _mesa_copy_context(dst->ctx, src->ctx, mask);
-}
-
-
-
-st_proc st_get_proc_address(const char *procname)
-{
- return (st_proc) _glapi_get_proc_address(procname);
-}
-
-
-
void st_init_driver_functions(struct dd_function_table *functions)
{
_mesa_init_glsl_driver_functions(functions);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index f28d5aa3ed..dfee490b54 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -46,12 +46,6 @@ struct blit_state;
struct bitmap_cache;
-/** XXX we'd like to get rid of these */
-#define FRONT_STATUS_UNDEFINED 0
-#define FRONT_STATUS_DIRTY 1
-#define FRONT_STATUS_COPY_OF_BACK 2
-
-
#define ST_NEW_MESA 0x1 /* Mesa state has changed */
#define ST_NEW_FRAGMENT_PROGRAM 0x2
#define ST_NEW_VERTEX_PROGRAM 0x4
@@ -116,8 +110,6 @@ struct st_context
struct gl_fragment_program *fragment_program;
} cb;
- GLuint frontbuffer_status; /**< one of FRONT_STATUS_ (XXX to be removed) */
-
char vendor[100];
char renderer[100];
@@ -259,5 +251,12 @@ st_fb_orientation(const struct gl_framebuffer *fb)
extern int
st_get_msaa(void);
+extern struct st_context *
+st_create_context(struct pipe_context *pipe, const __GLcontextModes *visual,
+ struct st_context *share);
+
+extern void
+st_destroy_context(struct st_context *st);
+
#endif
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
deleted file mode 100644
index 819b4487ac..0000000000
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "main/imports.h"
-#include "main/buffers.h"
-#include "main/context.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "st_context.h"
-#include "st_cb_fbo.h"
-#include "st_public.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-
-
-struct st_framebuffer *
-st_create_framebuffer( const __GLcontextModes *visual,
- enum pipe_format colorFormat,
- enum pipe_format depthFormat,
- enum pipe_format stencilFormat,
- uint width, uint height,
- void *private)
-{
- struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer);
- if (stfb) {
- int samples = st_get_msaa();
- int i;
-
- if (visual->sampleBuffers)
- samples = visual->samples;
-
- _mesa_initialize_window_framebuffer(&stfb->Base, visual);
-
- if (visual->doubleBufferMode) {
- struct gl_renderbuffer *rb
- = st_new_renderbuffer_fb(colorFormat, samples, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_BACK_LEFT, rb);
- }
- else {
- /* Only allocate front buffer right now if we're single buffered.
- * If double-buffered, allocate front buffer on demand later.
- * See check_create_front_buffers() and st_set_framebuffer_surface().
- */
- struct gl_renderbuffer *rb
- = st_new_renderbuffer_fb(colorFormat, samples, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb);
- }
-
- if (depthFormat == stencilFormat && depthFormat != PIPE_FORMAT_NONE) {
- /* combined depth/stencil buffer */
- struct gl_renderbuffer *depthStencilRb
- = st_new_renderbuffer_fb(depthFormat, samples, FALSE);
- /* note: bind RB to two attachment points */
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthStencilRb);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, depthStencilRb);
- }
- else {
- /* separate depth and/or stencil */
-
- if (visual->depthBits == 32) {
- /* 32-bit depth buffer */
- struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(depthFormat, samples, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
- }
- else if (visual->depthBits == 24) {
- /* 24-bit depth buffer, ignore stencil bits */
- struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(depthFormat, samples, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
- }
- else if (visual->depthBits > 0) {
- /* 16-bit depth buffer */
- struct gl_renderbuffer *depthRb
- = st_new_renderbuffer_fb(depthFormat, samples, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, depthRb);
- }
-
- if (visual->stencilBits > 0) {
- /* 8-bit stencil */
- struct gl_renderbuffer *stencilRb
- = st_new_renderbuffer_fb(stencilFormat, samples, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, stencilRb);
- }
- }
-
- if (visual->accumRedBits > 0) {
- /* 16-bit/channel accum */
- /* TODO: query the pipe screen for accumulation buffer format support */
- struct gl_renderbuffer *accumRb
- = st_new_renderbuffer_fb(PIPE_FORMAT_R16G16B16A16_SNORM, 0, TRUE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_ACCUM, accumRb);
- }
-
- for (i = 0; i < visual->numAuxBuffers; i++) {
- struct gl_renderbuffer *aux
- = st_new_renderbuffer_fb(colorFormat, 0, FALSE);
- _mesa_add_renderbuffer(&stfb->Base, BUFFER_AUX0 + i, aux);
- }
-
- stfb->Base.Initialized = GL_TRUE;
- stfb->InitWidth = width;
- stfb->InitHeight = height;
- stfb->Private = private;
- }
- return stfb;
-}
-
-
-void st_resize_framebuffer( struct st_framebuffer *stfb,
- uint width, uint height )
-{
- if (stfb->Base.Width != width || stfb->Base.Height != height) {
- GET_CURRENT_CONTEXT(ctx);
- if (ctx) {
- _mesa_check_init_viewport(ctx, width, height);
-
- _mesa_resize_framebuffer(ctx, &stfb->Base, width, height);
-
- assert(stfb->Base.Width == width);
- assert(stfb->Base.Height == height);
- }
- }
-}
-
-
-void st_unreference_framebuffer( struct st_framebuffer *stfb )
-{
- _mesa_reference_framebuffer((struct gl_framebuffer **) &stfb, NULL);
-}
-
-
-
-/**
- * Set/replace a framebuffer surface.
- * The user of the state tracker can use this instead of
- * st_resize_framebuffer() to provide new surfaces when a window is resized.
- * \param surfIndex an ST_SURFACE_x index
- */
-void
-st_set_framebuffer_surface(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_surface *surf)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct st_renderbuffer *strb;
-
- /* sanity checks */
- assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT);
- assert(ST_SURFACE_BACK_LEFT == BUFFER_BACK_LEFT);
- assert(ST_SURFACE_FRONT_RIGHT == BUFFER_FRONT_RIGHT);
- assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT);
- assert(ST_SURFACE_DEPTH == BUFFER_DEPTH);
-
- assert(surfIndex < BUFFER_COUNT);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
-
- if (!strb) {
- /* create new renderbuffer for this surface now */
- const GLuint numSamples = stfb->Base.Visual.samples;
- struct gl_renderbuffer *rb =
- st_new_renderbuffer_fb(surf->format, numSamples, FALSE);
- if (!rb) {
- /* out of memory */
- _mesa_warning(ctx, "Out of memory allocating renderbuffer");
- return;
- }
- _mesa_add_renderbuffer(&stfb->Base, surfIndex, rb);
- strb = st_renderbuffer(rb);
- }
-
- /* replace the renderbuffer's surface/texture pointers */
- pipe_surface_reference( &strb->surface, surf );
- pipe_resource_reference( &strb->texture, surf->texture );
- pipe_sampler_view_reference(&strb->sampler_view, NULL);
-
- if (ctx) {
- /* If ctx isn't set, we've likely not made current yet.
- * But when we do, we need to start setting this dirty bit
- * to ensure the renderbuffer attachements are up-to-date
- * via update_framebuffer.
- * Core Mesa's state validation will update the parent framebuffer's
- * size info, etc.
- */
- ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
- ctx->NewState |= _NEW_BUFFERS;
- }
-
- /* update renderbuffer's width/height */
- strb->Base.Width = surf->width;
- strb->Base.Height = surf->height;
-}
-
-
-
-/**
- * Return the pipe_surface for the given renderbuffer.
- */
-int
-st_get_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface **surface)
-{
- struct st_renderbuffer *strb;
-
- assert(surfIndex <= ST_SURFACE_DEPTH);
-
- /* sanity checks, ST tokens should match Mesa tokens */
- assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT);
- assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
- if (strb) {
- *surface = strb->surface;
- return GL_TRUE;
- }
-
- *surface = NULL;
- return GL_FALSE;
-}
-
-int
-st_get_framebuffer_texture(struct st_framebuffer *stfb, uint surfIndex, struct pipe_resource **texture)
-{
- struct st_renderbuffer *strb;
-
- assert(surfIndex <= ST_SURFACE_DEPTH);
-
- /* sanity checks, ST tokens should match Mesa tokens */
- assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT);
- assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
- if (strb) {
- *texture = strb->texture;
- return GL_TRUE;
- }
-
- *texture = NULL;
- return GL_FALSE;
-}
-
-/**
- * This function is to be called prior to SwapBuffers on the given
- * framebuffer. It checks if the current context is bound to the framebuffer
- * and flushes rendering if needed.
- */
-void
-st_notify_swapbuffers(struct st_framebuffer *stfb)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (ctx && ctx->DrawBuffer == &stfb->Base) {
- st_flush( ctx->st,
- PIPE_FLUSH_RENDER_CACHE |
- PIPE_FLUSH_SWAPBUFFERS |
- PIPE_FLUSH_FRAME,
- NULL );
- if (st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer))
- ctx->st->frontbuffer_status = FRONT_STATUS_COPY_OF_BACK;
- }
-}
-
-
-/**
- * Swap the front/back color buffers. Exchange the front/back pointers
- * and update some derived state.
- * No need to call st_notify_swapbuffers() first.
- *
- * For a single-buffered framebuffer, no swap occurs, but we still return
- * the pointer(s) to the front color buffer(s).
- *
- * \param front_left returns pointer to front-left renderbuffer after swap
- * \param front_right returns pointer to front-right renderbuffer after swap
- */
-void
-st_swapbuffers(struct st_framebuffer *stfb,
- struct pipe_surface **front_left,
- struct pipe_surface **front_right)
-{
- struct gl_framebuffer *fb = &stfb->Base;
-
- GET_CURRENT_CONTEXT(ctx);
-
- if (ctx && ctx->DrawBuffer == &stfb->Base) {
- st_flush( ctx->st,
- PIPE_FLUSH_RENDER_CACHE |
- PIPE_FLUSH_SWAPBUFFERS |
- PIPE_FLUSH_FRAME,
- NULL );
- }
-
- if (!fb->Visual.doubleBufferMode) {
- /* single buffer mode - return pointers to front surfaces */
- if (front_left) {
- struct st_renderbuffer *strb =
- st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
- *front_left = strb->surface;
- }
- if (front_right) {
- struct st_renderbuffer *strb =
- st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer);
- *front_right = strb ? strb->surface : NULL;
- }
- return;
- }
-
- /* swap left buffers */
- if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer &&
- fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer) {
- struct gl_renderbuffer *rbTemp;
- rbTemp = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
- fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer =
- fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer;
- fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer = rbTemp;
- if (front_left) {
- struct st_renderbuffer *strb =
- st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
- *front_left = strb->surface;
- }
- /* mark back buffer contents as undefined */
- {
- struct st_renderbuffer *back =
- st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
- back->defined = GL_FALSE;
- }
- }
- else {
- /* no front buffer, display the back buffer */
- if (front_left) {
- struct st_renderbuffer *strb =
- st_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
- *front_left = strb->surface;
- }
- }
-
- /* swap right buffers (for stereo) */
- if (fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer &&
- fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer) {
- struct gl_renderbuffer *rbTemp;
- rbTemp = fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer;
- fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer =
- fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer;
- fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer = rbTemp;
- if (front_right) {
- struct st_renderbuffer *strb =
- st_renderbuffer(fb->Attachment[BUFFER_FRONT_RIGHT].Renderbuffer);
- *front_right = strb->surface;
- }
- /* mark back buffer contents as undefined */
- {
- struct st_renderbuffer *back =
- st_renderbuffer(fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer);
- back->defined = GL_FALSE;
- }
- }
- else {
- /* no front right buffer, display back right buffer (if exists) */
- if (front_right) {
- struct st_renderbuffer *strb =
- st_renderbuffer(fb->Attachment[BUFFER_BACK_RIGHT].Renderbuffer);
- *front_right = strb ? strb->surface : NULL;
- }
- }
-
- /* Update the _ColorDrawBuffers[] array and _ColorReadBuffer pointer */
- _mesa_update_framebuffer(ctx);
-
- /* Make sure we draw into the new back surface */
- st_invalidate_state(ctx, _NEW_BUFFERS);
-}
-
-
-void *st_framebuffer_private( struct st_framebuffer *stfb )
-{
- return stfb->Private;
-}
-
-void st_get_framebuffer_dimensions( struct st_framebuffer *stfb,
- uint *width,
- uint *height)
-{
- *width = stfb->Base.Width;
- *height = stfb->Base.Height;
-}
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index 32584b25c2..3bf7ba185e 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -42,7 +42,7 @@
#include "st_context.h"
#include "st_texture.h"
-#include "st_public.h"
+#include "st_cb_flush.h"
static INLINE struct pipe_transfer *
st_cond_flush_get_tex_transfer(struct st_context *st,
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 8a6c8256ff..26f9554c9e 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -710,14 +710,6 @@ st_manager_flush_frontbuffer(struct st_context *st)
if (!strb)
return;
- /* st_public.h */
- if (!stfb->iface) {
- struct pipe_surface *front_surf = strb->surface;
- st->pipe->screen->flush_frontbuffer(st->pipe->screen,
- front_surf, st->winsys_drawable_handle);
- return;
- }
-
stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
}
@@ -758,14 +750,6 @@ st_manager_validate_framebuffers(struct st_context *st)
struct st_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer);
struct st_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer);
- /* st_public.h */
- if ((stdraw && !stdraw->iface) || (stread && !stread->iface)) {
- struct pipe_screen *screen = st->pipe->screen;
- if (screen->update_buffer)
- screen->update_buffer(screen, st->pipe->priv);
- return;
- }
-
if (stdraw)
st_framebuffer_validate(stdraw, st);
if (stread && stread != stdraw)
@@ -781,8 +765,8 @@ st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
{
struct st_framebuffer *stfb = st_ws_framebuffer(fb);
- /* FBO or st_public.h */
- if (!stfb || !stfb->iface)
+ /* FBO */
+ if (!stfb)
return FALSE;
if (stfb->Base.Attachment[idx].Renderbuffer)
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
deleted file mode 100644
index 18f82132b9..0000000000
--- a/src/mesa/state_tracker/st_public.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef ST_PUBLIC_H
-#define ST_PUBLIC_H
-
-#include "GL/gl.h"
-#include "GL/internal/glcore.h" /* for __GLcontextModes */
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_format.h"
-
-/** Renderbuffer surfaces (should match Mesa names) */
-#define ST_SURFACE_FRONT_LEFT 0
-#define ST_SURFACE_BACK_LEFT 1
-#define ST_SURFACE_FRONT_RIGHT 2
-#define ST_SURFACE_BACK_RIGHT 3
-#define ST_SURFACE_DEPTH 4
-
-#define ST_TEXTURE_2D 0x2
-#define ST_TEXTURE_RECT 0x4
-
-#define ST_TEXTURE_RGB 0x1
-#define ST_TEXTURE_RGBA 0x2
-
-
-struct st_context;
-struct st_framebuffer;
-struct pipe_context;
-struct pipe_fence_handle;
-struct pipe_surface;
-struct pipe_resource;
-
-
-PUBLIC
-struct st_context *st_create_context(struct pipe_context *pipe,
- const __GLcontextModes *visual,
- struct st_context *share);
-
-PUBLIC
-void st_destroy_context( struct st_context *st );
-
-PUBLIC
-void st_copy_context_state(struct st_context *dst, struct st_context *src,
- uint mask);
-
-PUBLIC
-struct st_framebuffer *st_create_framebuffer( const __GLcontextModes *visual,
- enum pipe_format colorFormat,
- enum pipe_format depthFormat,
- enum pipe_format stencilFormat,
- uint width, uint height,
- void *privateData);
-
-PUBLIC
-void st_resize_framebuffer( struct st_framebuffer *stfb,
- uint width, uint height );
-
-PUBLIC
-void st_set_framebuffer_surface(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_surface *surf);
-
-PUBLIC
-void st_get_framebuffer_dimensions( struct st_framebuffer *stfb,
- uint *width, uint *height);
-
-PUBLIC
-int st_get_framebuffer_surface(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_surface **surface);
-
-PUBLIC
-int st_get_framebuffer_texture(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_resource **texture);
-
-PUBLIC
-void *st_framebuffer_private( struct st_framebuffer *stfb );
-
-PUBLIC
-void st_unreference_framebuffer( struct st_framebuffer *stfb );
-
-PUBLIC
-GLboolean st_make_current(struct st_context *st,
- struct st_framebuffer *draw,
- struct st_framebuffer *read,
- void *winsys_drawable_handle);
-
-PUBLIC
-struct st_context *st_get_current(void);
-
-PUBLIC
-void st_flush( struct st_context *st, uint pipeFlushFlags,
- struct pipe_fence_handle **fence );
-PUBLIC
-void st_finish( struct st_context *st );
-
-PUBLIC
-void st_notify_swapbuffers(struct st_framebuffer *stfb);
-
-PUBLIC
-void st_swapbuffers(struct st_framebuffer *stfb,
- struct pipe_surface **front_left,
- struct pipe_surface **front_right);
-
-PUBLIC
-int st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
- enum pipe_format format);
-PUBLIC
-int st_unbind_texture_surface(struct pipe_surface *ps, int target, int level);
-
-/** Redirect rendering into stfb's surface to a texture image */
-PUBLIC
-int st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,
- int target, int format, int level);
-
-/** Undo surface-to-texture binding */
-PUBLIC
-int st_release_teximage(struct st_framebuffer *stfb, uint surfIndex,
- int target, int format, int level);
-
-
-/** Generic function type */
-typedef void (*st_proc)();
-
-PUBLIC
-st_proc st_get_proc_address(const char *procname);
-
-
-#endif
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index a623eed50a..c80736ffd7 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -27,7 +27,6 @@
#include "st_context.h"
#include "st_format.h"
-#include "st_public.h"
#include "st_texture.h"
#include "st_cb_fbo.h"
#include "st_inlines.h"
@@ -357,226 +356,6 @@ st_texture_image_copy(struct pipe_context *pipe,
}
-/**
- * Bind a pipe surface to a texture object. After the call,
- * the texture object is marked dirty and will be (re-)validated.
- *
- * If this is the first surface bound, the texture object is said to
- * switch from normal to surface based. It will be cleared first in
- * this case.
- *
- * \param ps pipe surface to be unbound
- * \param target texture target
- * \param level image level
- * \param format internal format of the texture
- */
-int
-st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
- enum pipe_format format)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- struct st_texture_object *stObj;
- struct st_texture_image *stImage;
- GLenum internalFormat;
-
- switch (target) {
- case ST_TEXTURE_2D:
- target = GL_TEXTURE_2D;
- break;
- case ST_TEXTURE_RECT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- default:
- return 0;
- }
-
- /* map pipe format to base format for now */
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
- internalFormat = GL_RGBA;
- else
- internalFormat = GL_RGB;
-
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
- _mesa_lock_texture(ctx, texObj);
-
- stObj = st_texture_object(texObj);
- /* switch to surface based */
- if (!stObj->surface_based) {
- _mesa_clear_texture_object(ctx, texObj);
- stObj->surface_based = GL_TRUE;
- }
-
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
- stImage = st_texture_image(texImage);
-
- _mesa_init_teximage_fields(ctx, target, texImage,
- ps->width, ps->height, 1, 0, internalFormat);
- texImage->TexFormat = st_ChooseTextureFormat(ctx, internalFormat,
- GL_RGBA, GL_UNSIGNED_BYTE);
- _mesa_set_fetch_functions(texImage, 2);
- pipe_resource_reference(&stImage->pt, ps->texture);
-
- _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
- _mesa_unlock_texture(ctx, texObj);
-
- return 1;
-}
-
-
-/**
- * Unbind a pipe surface from a texture object. After the call,
- * the texture object is marked dirty and will be (re-)validated.
- *
- * \param ps pipe surface to be unbound
- * \param target texture target
- * \param level image level
- */
-int
-st_unbind_texture_surface(struct pipe_surface *ps, int target, int level)
-{
- GET_CURRENT_CONTEXT(ctx);
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- struct st_texture_object *stObj;
- struct st_texture_image *stImage;
-
- switch (target) {
- case ST_TEXTURE_2D:
- target = GL_TEXTURE_2D;
- break;
- case ST_TEXTURE_RECT:
- target = GL_TEXTURE_RECTANGLE_ARB;
- break;
- default:
- return 0;
- }
-
- texObj = _mesa_select_tex_object(ctx, texUnit, target);
-
- _mesa_lock_texture(ctx, texObj);
-
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
- stObj = st_texture_object(texObj);
- stImage = st_texture_image(texImage);
-
- /* Make sure the pipe surface is still bound. The texture object is still
- * considered surface based even if this is the last bound surface. */
- if (stImage->pt == ps->texture) {
- pipe_resource_reference(&stImage->pt, NULL);
- _mesa_clear_texture_image(ctx, texImage);
-
- _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
- }
-
- _mesa_unlock_texture(ctx, texObj);
-
- return 1;
-}
-
-
-/** Redirect rendering into stfb's surface to a texture image */
-int
-st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,
- int target, int format, int level)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct st_context *st = ctx->st;
- struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
- const GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
- struct st_texture_image *stImage;
- struct st_renderbuffer *strb;
- GLint face = 0, slice = 0;
-
- assert(surfIndex <= ST_SURFACE_DEPTH);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
-
- if (strb->texture_save || strb->surface_save) {
- /* Error! */
- return 0;
- }
-
- if (target == ST_TEXTURE_2D) {
- texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX];
- texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, level);
- stImage = st_texture_image(texImage);
- }
- else {
- /* unsupported target */
- return 0;
- }
-
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
- /* save the renderbuffer's surface/texture info */
- pipe_resource_reference(&strb->texture_save, strb->texture);
- pipe_surface_reference(&strb->surface_save, strb->surface);
- pipe_sampler_view_reference(&strb->sampler_view_save, strb->sampler_view);
-
- /* plug in new surface/texture info */
- pipe_resource_reference(&strb->texture, stImage->pt);
-
- /* XXX: Shouldn't we release reference to old surface here?
- */
-
- strb->surface = screen->get_tex_surface(screen, strb->texture,
- face, level, slice,
- (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION));
-
- pipe_sampler_view_reference(&strb->sampler_view, NULL);
-
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
-
- return 1;
-}
-
-
-/** Undo surface-to-texture binding */
-int
-st_release_teximage(struct st_framebuffer *stfb, uint surfIndex,
- int target, int format, int level)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct st_context *st = ctx->st;
- struct st_renderbuffer *strb;
-
- assert(surfIndex <= ST_SURFACE_DEPTH);
-
- strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer);
-
- if (!strb->texture_save || !strb->surface_save) {
- /* Error! */
- return 0;
- }
-
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-
- /* free tex surface, restore original */
- pipe_surface_reference(&strb->surface, strb->surface_save);
- pipe_resource_reference(&strb->texture, strb->texture_save);
- pipe_sampler_view_reference(&strb->sampler_view, strb->sampler_view_save);
-
- pipe_surface_reference(&strb->surface_save, NULL);
- pipe_resource_reference(&strb->texture_save, NULL);
- pipe_sampler_view_reference(&strb->sampler_view, NULL);
-
- st->dirty.st |= ST_NEW_FRAMEBUFFER;
-
- return 1;
-}
-
void
st_teximage_flush_before_map(struct st_context *st,
struct pipe_resource *pt,