mesa/st: move some fbo helpers around.

This inlines one, and moves the other to a more appropriate place

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
This commit is contained in:
Dave Airlie 2021-12-21 16:11:47 +10:00
parent 9c7e79c4b7
commit 018251908e
5 changed files with 21 additions and 25 deletions

View File

@ -300,7 +300,7 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context,
return NULL;
}
tex = st_get_renderbuffer_resource(rb);
tex = rb->texture;
if (!tex) {
*error = __DRI_IMAGE_ERROR_BAD_PARAMETER;
return NULL;

View File

@ -36,31 +36,8 @@
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
struct dd_function_table;
struct pipe_context;
static inline struct pipe_resource *
st_get_renderbuffer_resource(struct gl_renderbuffer *rb)
{
return rb->texture;
}
/**
* Cast wrapper to convert a struct gl_framebuffer to an gl_framebuffer.
* Return NULL if the struct gl_framebuffer is a user-created framebuffer.
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
static inline struct gl_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
if (fb && _mesa_is_winsys_fbo(fb) &&
fb != _mesa_get_incomplete_framebuffer())
return fb;
return NULL;
}
extern void
st_update_renderbuffer_surface(struct st_context *st,
struct gl_renderbuffer *strb);

View File

@ -27,7 +27,7 @@
#include "main/glheader.h"
#include "st_context.h"
#include "st_cb_fbo.h"
#include "st_manager.h"
#include "st_cb_viewport.h"
#include "pipe/p_state.h"

View File

@ -51,6 +51,7 @@
#include "st_cb_flush.h"
#include "st_manager.h"
#include "st_sampler_view.h"
#include "st_util.h"
#include "state_tracker/st_gl_api.h"

View File

@ -29,15 +29,33 @@
#define ST_MANAGER_H
#include "main/menums.h"
#include "main/fbobject.h"
#include "pipe/p_compiler.h"
struct st_context;
struct st_framebuffer;
struct st_framebuffer_interface;
struct gl_renderbuffer;
struct pipe_surface;
/**
* Cast wrapper to convert a struct gl_framebuffer to an gl_framebuffer.
* Return NULL if the struct gl_framebuffer is a user-created framebuffer.
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
static inline struct gl_framebuffer *
st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
if (fb && _mesa_is_winsys_fbo(fb) &&
fb != _mesa_get_incomplete_framebuffer())
return fb;
return NULL;
}
void
st_manager_flush_frontbuffer(struct st_context *st);