* the last call might be destroyed. This behavior might change in the
* future.
*/
- boolean (*validate)(struct st_framebuffer_iface *stfbi,
+ boolean (*validate)(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out);
swap_fences_unref(struct dri_drawable *draw);
static boolean
-dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+dri_st_framebuffer_validate(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out)
{
+ struct dri_context *ctx = (struct dri_context *)stctx->st_manager_private;
struct dri_drawable *drawable =
(struct dri_drawable *) stfbi->st_manager_private;
struct dri_screen *screen = dri_screen(drawable->sPriv);
if (new_stamp && drawable->update_drawable_info)
drawable->update_drawable_info(drawable);
- drawable->allocate_textures(drawable, statts, count);
+ drawable->allocate_textures(ctx, drawable, statts, count);
/* add existing textures */
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
* exist. Used by the TFP extension.
*/
static void
-dri_drawable_validate_att(struct dri_drawable *drawable,
+dri_drawable_validate_att(struct dri_context *ctx,
+ struct dri_drawable *drawable,
enum st_attachment_type statt)
{
enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
drawable->texture_stamp = drawable->dPriv->lastStamp - 1;
- drawable->base.validate(&drawable->base, statts, count, NULL);
+ drawable->base.validate(ctx->st, &drawable->base, statts, count, NULL);
}
/**
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_resource *pt;
- dri_drawable_validate_att(drawable, ST_ATTACHMENT_FRONT_LEFT);
+ dri_drawable_validate_att(ctx, drawable, ST_ATTACHMENT_FRONT_LEFT);
/* Use the pipe resource associated with the X drawable */
pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
struct pipe_surface *drisw_surface;
/* hooks filled in by dri2 & drisw */
- void (*allocate_textures)(struct dri_drawable *drawable,
+ void (*allocate_textures)(struct dri_context *ctx,
+ struct dri_drawable *drawable,
const enum st_attachment_type *statts,
unsigned count);
* Process __DRIbuffer and convert them into pipe_resources.
*/
static void
-dri2_drawable_process_buffers(struct dri_drawable *drawable,
+dri2_drawable_process_buffers(struct dri_context *ctx,
+ struct dri_drawable *drawable,
__DRIbuffer *buffers, unsigned buffer_count,
const enum st_attachment_type *atts,
unsigned att_count)
struct winsys_handle whandle;
boolean alloc_depthstencil = FALSE;
unsigned i, j, bind;
- struct pipe_screen *pscreen = screen->base.screen;
- struct pipe_context *pipe = NULL;
if (drawable->old_num == buffer_count &&
drawable->old_w == dri_drawable->w &&
* The single-sample resources are not exposed
* to the state tracker.
*
- * We don't have a context here, so create one temporarily.
- * We may need to create a persistent context if creation and
- * destruction of the context becomes a bottleneck.
*/
- if (!pipe)
- pipe = pscreen->context_create(pscreen, NULL);
-
- dri_pipe_blit(pipe,
+ dri_pipe_blit(ctx->st->pipe,
drawable->msaa_textures[att],
drawable->textures[att]);
}
drawable->old_w = dri_drawable->w;
drawable->old_h = dri_drawable->h;
memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * buffer_count);
-
- if (pipe) {
- pipe->flush(pipe, NULL, 0);
- pipe->destroy(pipe);
- }
}
static __DRIbuffer *
*/
static void
-dri2_allocate_textures(struct dri_drawable *drawable,
+dri2_allocate_textures(struct dri_context *ctx,
+ struct dri_drawable *drawable,
const enum st_attachment_type *statts,
unsigned statts_count)
{
buffers = dri2_drawable_get_buffers(drawable, statts, &num_buffers);
if (buffers)
- dri2_drawable_process_buffers(drawable, buffers, num_buffers,
+ dri2_drawable_process_buffers(ctx, drawable, buffers, num_buffers,
statts, statts_count);
}
* framebuffer is resized or destroyed.
*/
static void
-drisw_allocate_textures(struct dri_drawable *drawable,
+drisw_allocate_textures(struct dri_context *stctx,
+ struct dri_drawable *drawable,
const enum st_attachment_type *statts,
unsigned count)
{
gsurf->client_buffer = buffer;
/* validate now so that it fails if the client buffer is invalid */
- if (!gsurf->stfbi->validate(gsurf->stfbi,
+ if (!gsurf->stfbi->validate(NULL, gsurf->stfbi,
&gsurf->stvis.render_buffer, 1, &ptex)) {
egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
FREE(gsurf);
}
static boolean
-egl_g3d_st_framebuffer_validate_pbuffer(struct st_framebuffer_iface *stfbi,
+egl_g3d_st_framebuffer_validate_pbuffer(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out)
}
static boolean
-egl_g3d_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+egl_g3d_st_framebuffer_validate(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out)
* \param out returns resources for each of the attachments
*/
static boolean
-xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+xmesa_st_framebuffer_validate(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out)
* its resources).
*/
static boolean
-osmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+osmesa_st_framebuffer_validate(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out)
if (stfb->iface_stamp != new_stamp) {
do {
/* validate the fb */
- if (!stfb->iface->validate(stfb->iface, &stfb->strb_att,
+ if (!stfb->iface->validate((struct st_context_iface *)ctx,
+ stfb->iface, &stfb->strb_att,
1, &pt) || !pt)
return;
}
static boolean
-stw_st_framebuffer_validate(struct st_framebuffer_iface *stfb,
+stw_st_framebuffer_validate(struct st_context_iface *stctx,
+ struct st_framebuffer_iface *stfb,
const enum st_attachment_type *statts,
unsigned count,
struct pipe_resource **out)
/* validate the fb */
do {
- if (!stfb->iface->validate(stfb->iface, stfb->statts,
+ if (!stfb->iface->validate(&st->iface, stfb->iface, stfb->statts,
stfb->num_statts, textures))
return;