mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 06:18:24 +02:00
mesa: refactor: move _mesa_resizebuffers(), _mesa_ResizeBuffersMESA() to framebuffer.c
This commit is contained in:
parent
eade430682
commit
9091015a97
6 changed files with 88 additions and 83 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include "blend.h"
|
||||
#include "buffers.h"
|
||||
#include "bufferobj.h"
|
||||
#include "clear.h"
|
||||
#include "colormac.h"
|
||||
#include "colortab.h"
|
||||
#include "context.h"
|
||||
|
|
|
|||
|
|
@ -456,83 +456,6 @@ _mesa_ReadBuffer(GLenum buffer)
|
|||
}
|
||||
|
||||
|
||||
#if _HAVE_FULL_GL
|
||||
|
||||
/**
|
||||
* XXX THIS IS OBSOLETE - drivers should take care of detecting window
|
||||
* size changes and act accordingly, likely calling _mesa_resize_framebuffer().
|
||||
*
|
||||
* GL_MESA_resize_buffers extension.
|
||||
*
|
||||
* When this function is called, we'll ask the window system how large
|
||||
* the current window is. If it's a new size, we'll call the driver's
|
||||
* ResizeBuffers function. The driver will then resize its color buffers
|
||||
* as needed, and maybe call the swrast's routine for reallocating
|
||||
* swrast-managed depth/stencil/accum/etc buffers.
|
||||
* \note This function should only be called through the GL API, not
|
||||
* from device drivers (as was done in the past).
|
||||
*/
|
||||
|
||||
void _mesa_resizebuffers( GLcontext *ctx )
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glResizeBuffersMESA\n");
|
||||
|
||||
if (!ctx->Driver.GetBufferSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->WinSysDrawBuffer) {
|
||||
GLuint newWidth, newHeight;
|
||||
GLframebuffer *buffer = ctx->WinSysDrawBuffer;
|
||||
|
||||
assert(buffer->Name == 0);
|
||||
|
||||
/* ask device driver for size of output buffer */
|
||||
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
|
||||
|
||||
/* see if size of device driver's color buffer (window) has changed */
|
||||
if (buffer->Width != newWidth || buffer->Height != newHeight) {
|
||||
if (ctx->Driver.ResizeBuffers)
|
||||
ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->WinSysReadBuffer
|
||||
&& ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
|
||||
GLuint newWidth, newHeight;
|
||||
GLframebuffer *buffer = ctx->WinSysReadBuffer;
|
||||
|
||||
assert(buffer->Name == 0);
|
||||
|
||||
/* ask device driver for size of read buffer */
|
||||
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
|
||||
|
||||
/* see if size of device driver's color buffer (window) has changed */
|
||||
if (buffer->Width != newWidth || buffer->Height != newHeight) {
|
||||
if (ctx->Driver.ResizeBuffers)
|
||||
ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
|
||||
}
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* XXX THIS IS OBSOLETE
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_ResizeBuffersMESA( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (ctx->Extensions.MESA_resize_buffers)
|
||||
_mesa_resizebuffers( ctx );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* XXX move somewhere else someday?
|
||||
|
|
@ -553,8 +476,6 @@ _mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
|
|||
ctx->NewState |= _NEW_MULTISAMPLE;
|
||||
}
|
||||
|
||||
#endif /* _HAVE_FULL_GL */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -52,15 +52,11 @@ _mesa_readbuffer_update_fields(GLcontext *ctx, GLenum buffer);
|
|||
extern void GLAPIENTRY
|
||||
_mesa_ReadBuffer( GLenum mode );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_ResizeBuffersMESA( void );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
|
||||
|
||||
extern void
|
||||
_mesa_init_multisample(GLcontext *ctx);
|
||||
|
||||
extern void _mesa_resizebuffers( GLcontext *ctx );
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
#include "eval.h"
|
||||
#include "extensions.h"
|
||||
#include "feedback.h"
|
||||
#include "framebuffer.h"
|
||||
#include "get.h"
|
||||
#include "glapi/glapi.h"
|
||||
#include "hash.h"
|
||||
|
|
|
|||
|
|
@ -338,6 +338,84 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* XXX THIS IS OBSOLETE - drivers should take care of detecting window
|
||||
* size changes and act accordingly, likely calling _mesa_resize_framebuffer().
|
||||
*
|
||||
* GL_MESA_resize_buffers extension.
|
||||
*
|
||||
* When this function is called, we'll ask the window system how large
|
||||
* the current window is. If it's a new size, we'll call the driver's
|
||||
* ResizeBuffers function. The driver will then resize its color buffers
|
||||
* as needed, and maybe call the swrast's routine for reallocating
|
||||
* swrast-managed depth/stencil/accum/etc buffers.
|
||||
* \note This function should only be called through the GL API, not
|
||||
* from device drivers (as was done in the past).
|
||||
*/
|
||||
void
|
||||
_mesa_resizebuffers( GLcontext *ctx )
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glResizeBuffersMESA\n");
|
||||
|
||||
if (!ctx->Driver.GetBufferSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->WinSysDrawBuffer) {
|
||||
GLuint newWidth, newHeight;
|
||||
GLframebuffer *buffer = ctx->WinSysDrawBuffer;
|
||||
|
||||
assert(buffer->Name == 0);
|
||||
|
||||
/* ask device driver for size of output buffer */
|
||||
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
|
||||
|
||||
/* see if size of device driver's color buffer (window) has changed */
|
||||
if (buffer->Width != newWidth || buffer->Height != newHeight) {
|
||||
if (ctx->Driver.ResizeBuffers)
|
||||
ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->WinSysReadBuffer
|
||||
&& ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
|
||||
GLuint newWidth, newHeight;
|
||||
GLframebuffer *buffer = ctx->WinSysReadBuffer;
|
||||
|
||||
assert(buffer->Name == 0);
|
||||
|
||||
/* ask device driver for size of read buffer */
|
||||
ctx->Driver.GetBufferSize( buffer, &newWidth, &newHeight );
|
||||
|
||||
/* see if size of device driver's color buffer (window) has changed */
|
||||
if (buffer->Width != newWidth || buffer->Height != newHeight) {
|
||||
if (ctx->Driver.ResizeBuffers)
|
||||
ctx->Driver.ResizeBuffers(ctx, buffer, newWidth, newHeight );
|
||||
}
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_BUFFERS; /* to update scissor / window bounds */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* XXX THIS IS OBSOLETE
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_ResizeBuffersMESA( void )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (ctx->Extensions.MESA_resize_buffers)
|
||||
_mesa_resizebuffers( ctx );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Examine all the framebuffer's renderbuffers to update the Width/Height
|
||||
* fields of the framebuffer. If we have renderbuffers with different
|
||||
|
|
|
|||
|
|
@ -53,6 +53,14 @@ extern void
|
|||
_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
|
||||
GLuint width, GLuint height);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_resizebuffers( GLcontext *ctx );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_ResizeBuffersMESA( void );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_update_draw_buffer_bounds(GLcontext *ctx);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue