i915: stop using util_framebuffer_init
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36416>
This commit is contained in:
committed by
Marge Bot
parent
391945d90b
commit
ea6262ca15
@@ -152,7 +152,7 @@ i915_destroy(struct pipe_context *pipe)
|
||||
i915->iws->batchbuffer_destroy(i915->batch);
|
||||
|
||||
/* unbind framebuffer */
|
||||
util_framebuffer_init(pipe, NULL, i915->fb_cbufs, &i915->fb_zsbuf);
|
||||
i915_framebuffer_init(pipe, NULL, i915->fb_cbufs, &i915->fb_zsbuf);
|
||||
util_unreference_framebuffer_state(&i915->framebuffer);
|
||||
|
||||
/* unbind constant buffers */
|
||||
|
||||
@@ -431,6 +431,8 @@ void i915_init_string_functions(struct i915_context *i915);
|
||||
struct pipe_context *i915_create_context(struct pipe_screen *screen, void *priv,
|
||||
unsigned flags);
|
||||
|
||||
void
|
||||
i915_framebuffer_init(struct pipe_context *pctx, const struct pipe_framebuffer_state *fb, struct pipe_surface **cbufs, struct pipe_surface **zsbuf);
|
||||
/***********************************************************************
|
||||
* Inline conversion functions. These are better-typed than the
|
||||
* macros used previously:
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "i915_resource.h"
|
||||
#include "i915_state.h"
|
||||
#include "i915_state_inlines.h"
|
||||
#include "i915_surface.h"
|
||||
|
||||
static void i915_delete_fs_state(struct pipe_context *pipe, void *shader);
|
||||
|
||||
@@ -861,13 +862,51 @@ i915_sampler_view_destroy(struct pipe_context *pipe,
|
||||
FREE(view);
|
||||
}
|
||||
|
||||
void
|
||||
i915_framebuffer_init(struct pipe_context *pctx, const struct pipe_framebuffer_state *fb, struct pipe_surface **cbufs, struct pipe_surface **zsbuf)
|
||||
{
|
||||
if (fb) {
|
||||
for (unsigned i = 0; i < fb->nr_cbufs; i++) {
|
||||
if (cbufs[i] && pipe_surface_equal(&fb->cbufs[i], cbufs[i]))
|
||||
continue;
|
||||
|
||||
struct pipe_surface *psurf = fb->cbufs[i].texture ? i915_create_surface(pctx, fb->cbufs[i].texture, &fb->cbufs[i]) : NULL;
|
||||
if (cbufs[i])
|
||||
i915_surface_destroy(pctx, cbufs[i]);
|
||||
cbufs[i] = psurf;
|
||||
}
|
||||
|
||||
for (unsigned i = fb->nr_cbufs; i < 1; i++) {
|
||||
if (cbufs[i])
|
||||
i915_surface_destroy(pctx, cbufs[i]);
|
||||
cbufs[i] = NULL;
|
||||
}
|
||||
|
||||
if (*zsbuf && pipe_surface_equal(&fb->zsbuf, *zsbuf))
|
||||
return;
|
||||
struct pipe_surface *zsurf = fb->zsbuf.texture ? i915_create_surface(pctx, fb->zsbuf.texture, &fb->zsbuf) : NULL;
|
||||
if (*zsbuf)
|
||||
i915_surface_destroy(pctx, *zsbuf);
|
||||
*zsbuf = zsurf;
|
||||
} else {
|
||||
for (unsigned i = 0; i < 1; i++) {
|
||||
if (cbufs[i])
|
||||
i915_surface_destroy(pctx, cbufs[i]);
|
||||
cbufs[i] = NULL;
|
||||
}
|
||||
if (*zsbuf)
|
||||
i915_surface_destroy(pctx, *zsbuf);
|
||||
*zsbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
i915_set_framebuffer_state(struct pipe_context *pipe,
|
||||
const struct pipe_framebuffer_state *fb)
|
||||
{
|
||||
struct i915_context *i915 = i915_context(pipe);
|
||||
|
||||
util_framebuffer_init(pipe, fb, i915->fb_cbufs, &i915->fb_zsbuf);
|
||||
i915_framebuffer_init(pipe, fb, i915->fb_cbufs, &i915->fb_zsbuf);
|
||||
util_copy_framebuffer_state(&i915->framebuffer, fb);
|
||||
if (fb->nr_cbufs) {
|
||||
struct i915_surface *surf = i915_surface(i915->fb_cbufs[0]);
|
||||
|
||||
@@ -432,7 +432,7 @@ i915_create_surface_custom(struct pipe_context *ctx, struct pipe_resource *pt,
|
||||
return ps;
|
||||
}
|
||||
|
||||
static struct pipe_surface *
|
||||
struct pipe_surface *
|
||||
i915_create_surface(struct pipe_context *ctx, struct pipe_resource *pt,
|
||||
const struct pipe_surface *surf_tmpl)
|
||||
{
|
||||
@@ -440,7 +440,7 @@ i915_create_surface(struct pipe_context *ctx, struct pipe_resource *pt,
|
||||
pt->height0);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
i915_surface_destroy(struct pipe_context *ctx, struct pipe_surface *surf)
|
||||
{
|
||||
pipe_resource_reference(&surf->texture, NULL);
|
||||
@@ -461,6 +461,4 @@ i915_init_surface_functions(struct i915_context *i915)
|
||||
}
|
||||
i915->base.blit = i915_blit;
|
||||
i915->base.flush_resource = i915_flush_resource;
|
||||
i915->base.create_surface = i915_create_surface;
|
||||
i915->base.surface_destroy = i915_surface_destroy;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,15 @@
|
||||
|
||||
struct i915_context;
|
||||
struct i915_screen;
|
||||
struct pipe_surface;
|
||||
struct pipe_resource;
|
||||
struct pipe_context;
|
||||
|
||||
struct pipe_surface *
|
||||
i915_create_surface(struct pipe_context *ctx, struct pipe_resource *pt,
|
||||
const struct pipe_surface *surf_tmpl);
|
||||
void
|
||||
i915_surface_destroy(struct pipe_context *ctx, struct pipe_surface *surf);
|
||||
void i915_init_surface_functions(struct i915_context *i915);
|
||||
|
||||
#endif /* I915_SCREEN_H */
|
||||
|
||||
Reference in New Issue
Block a user