mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-11 08:00:13 +01:00
mesa/st: move st_ReadBuffer functionality into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
This commit is contained in:
parent
e9b12fe20e
commit
57dcaac31d
3 changed files with 17 additions and 32 deletions
|
|
@ -37,11 +37,15 @@
|
|||
#include "fbobject.h"
|
||||
#include "hash.h"
|
||||
#include "mtypes.h"
|
||||
#include "state.h"
|
||||
#include "util/bitscan.h"
|
||||
#include "util/u_math.h"
|
||||
#include "api_exec_decl.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_manager.h"
|
||||
#include "state_tracker/st_atom.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
|
||||
#define BAD_MASK ~0u
|
||||
|
||||
|
|
@ -932,7 +936,19 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
|
|||
|
||||
/* Call the device driver function only if fb is the bound read buffer */
|
||||
if (fb == ctx->ReadBuffer) {
|
||||
st_ReadBuffer(ctx, buffer);
|
||||
/* Check if we need to allocate a front color buffer.
|
||||
* Front buffers are often allocated on demand (other color buffers are
|
||||
* always allocated in advance).
|
||||
*/
|
||||
if ((fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT ||
|
||||
fb->_ColorReadBufferIndex == BUFFER_FRONT_RIGHT) &&
|
||||
fb->Attachment[fb->_ColorReadBufferIndex].Type == GL_NONE) {
|
||||
assert(_mesa_is_winsys_fbo(fb));
|
||||
/* add the buffer */
|
||||
st_manager_add_color_renderbuffer(st_context(ctx), fb, fb->_ColorReadBufferIndex);
|
||||
_mesa_update_state(ctx);
|
||||
st_validate_state(st_context(ctx), ST_PIPELINE_UPDATE_FRAMEBUFFER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -563,36 +563,6 @@ st_DrawBufferAllocate(struct gl_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via glReadBuffer. As with st_DrawBufferAllocate, we use this
|
||||
* function to check if we need to allocate a renderbuffer on demand.
|
||||
*/
|
||||
void
|
||||
st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct gl_framebuffer *fb = ctx->ReadBuffer;
|
||||
|
||||
(void) buffer;
|
||||
|
||||
/* Check if we need to allocate a front color buffer.
|
||||
* Front buffers are often allocated on demand (other color buffers are
|
||||
* always allocated in advance).
|
||||
*/
|
||||
if ((fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT ||
|
||||
fb->_ColorReadBufferIndex == BUFFER_FRONT_RIGHT) &&
|
||||
fb->Attachment[fb->_ColorReadBufferIndex].Type == GL_NONE) {
|
||||
assert(_mesa_is_winsys_fbo(fb));
|
||||
/* add the buffer */
|
||||
st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
|
||||
_mesa_update_state(ctx);
|
||||
st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called via ctx->Driver.MapRenderbuffer.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
|
|||
GLenum internalFormat,
|
||||
GLuint width, GLuint height);
|
||||
void st_DrawBufferAllocate(struct gl_context *ctx);
|
||||
void st_ReadBuffer(struct gl_context *ctx, GLenum buffer);
|
||||
|
||||
void st_MapRenderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue