[Mesa-dev] [PATCH 18/31] mesa: flush vertices before changing viewports
Marek Olšák
maraeo at gmail.com
Mon Jun 12 16:55:43 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
Cc: 17.1 <mesa-stable at lists.freedesktop.org>
---
src/mesa/main/viewport.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index bd58044..6d3e576 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -33,20 +33,22 @@
#include "enums.h"
#include "macros.h"
#include "mtypes.h"
#include "viewport.h"
static void
set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
GLfloat x, GLfloat y,
GLfloat width, GLfloat height)
{
+ FLUSH_VERTICES(ctx, _NEW_VIEWPORT);
+
/* clamp width and height to the implementation dependent range */
width = MIN2(width, (GLfloat) ctx->Const.MaxViewportWidth);
height = MIN2(height, (GLfloat) ctx->Const.MaxViewportHeight);
/* The GL_ARB_viewport_array spec says:
*
* "The location of the viewport's bottom-left corner, given by (x,y),
* are clamped to be within the implementation-dependent viewport
* bounds range. The viewport bounds range [min, max] tuple may be
* determined by calling GetFloatv with the symbolic constant
@@ -64,21 +66,20 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx,
if (ctx->ViewportArray[idx].X == x &&
ctx->ViewportArray[idx].Width == width &&
ctx->ViewportArray[idx].Y == y &&
ctx->ViewportArray[idx].Height == height)
return;
ctx->ViewportArray[idx].X = x;
ctx->ViewportArray[idx].Width = width;
ctx->ViewportArray[idx].Y = y;
ctx->ViewportArray[idx].Height = height;
- ctx->NewState |= _NEW_VIEWPORT;
}
struct gl_viewport_inputs {
GLfloat X, Y; /**< position */
GLfloat Width, Height; /**< size */
};
struct gl_depthrange_inputs {
GLdouble Near, Far; /**< Depth buffer range */
};
@@ -233,23 +234,24 @@ _mesa_ViewportIndexedfv(GLuint index, const GLfloat *v)
}
static void
set_depth_range_no_notify(struct gl_context *ctx, unsigned idx,
GLclampd nearval, GLclampd farval)
{
if (ctx->ViewportArray[idx].Near == nearval &&
ctx->ViewportArray[idx].Far == farval)
return;
+ FLUSH_VERTICES(ctx, _NEW_VIEWPORT);
+
ctx->ViewportArray[idx].Near = CLAMP(nearval, 0.0, 1.0);
ctx->ViewportArray[idx].Far = CLAMP(farval, 0.0, 1.0);
- ctx->NewState |= _NEW_VIEWPORT;
}
void
_mesa_set_depth_range(struct gl_context *ctx, unsigned idx,
GLclampd nearval, GLclampd farval)
{
set_depth_range_no_notify(ctx, idx, nearval, farval);
if (ctx->Driver.DepthRange)
ctx->Driver.DepthRange(ctx);
--
2.7.4
More information about the mesa-dev
mailing list