aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/dlist.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-06-04 09:07:26 +0200
committermarha <marha@users.sourceforge.net>2013-06-04 09:07:26 +0200
commit150771e7aabf4c864b0b970c5b8d773634793abe (patch)
tree3d544cc0d8d06dd70e843d6ca7e4b0ef421d2758 /mesalib/src/mesa/main/dlist.c
parentfbe681216618af573ce29ca03b382b39b5919a52 (diff)
downloadvcxsrv-150771e7aabf4c864b0b970c5b8d773634793abe.tar.gz
vcxsrv-150771e7aabf4c864b0b970c5b8d773634793abe.tar.bz2
vcxsrv-150771e7aabf4c864b0b970c5b8d773634793abe.zip
xwininfo fontconfig libX11 libXau libXdmcp libXext mesa libXinerama libxcb libxcb/xcb-proto libfontenc pixman xkbcomp mkfontscale xkeyboard-config git update 4 Jun 2013
xserver commit c21344add2fc589df83b29be5831c36a372201bd libxcb commit 9ae84ad187e2ba440c40f44b8eb21c82c2fdbf12 libxcb/xcb-proto commit bdfedfa57a13ff805580cfacafc70f9cc55df363 xkeyboard-config commit dad9ade4e83d1ef5a517fcc4cc9ad3a79b47acce libX11 commit 8496122eb00ce6cd5d2308ee54f64b68c378e455 libXdmcp commit 0b443c1b769b9c9a3b45b4252afe07e18b709ff4 libXext commit d8366afbb0d2e4fbb1e419b1187f490522270bea libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a libXinerama commit 6e1d1dc328ba8162bba2f4694e7f3c706a1491ff libXau commit 899790011304c4029e15abf410e49ce7cec17e0a xkbcomp commit ed582f4fccd4e23abcfba8b3b03649fea6414f44 pixman commit 2acfac5f8e097ee2ae225d986f981b55d65dd152 mkfontscale commit 19e2cb7c6a3ec2c5b1bc0d24866fa685eef0ee13 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 fontconfig commit cd9b1033a68816a7acfbba1718ba0aa5888f6ec7 mesa commit 7bafd88c153e395274b632e7eae4bc9fc3aec1d2
Diffstat (limited to 'mesalib/src/mesa/main/dlist.c')
-rw-r--r--mesalib/src/mesa/main/dlist.c146
1 files changed, 73 insertions, 73 deletions
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 4b20d890d..18e3eb760 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -18,9 +18,10 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*/
@@ -37,7 +38,6 @@
#include "api_validate.h"
#include "atifragshader.h"
#include "config.h"
-#include "mfeatures.h"
#include "bufferobj.h"
#include "arrayobj.h"
#include "context.h"
@@ -69,6 +69,8 @@
#include "main/dispatch.h"
+#include "vbo/vbo.h"
+
/**
@@ -122,8 +124,7 @@ do { \
*/
#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval) \
do { \
- if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
- ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
+ if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
_mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
return retval; \
} \
@@ -137,8 +138,7 @@ do { \
*/
#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx) \
do { \
- if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
- ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
+ if (ctx->Driver.CurrentSavePrimitive <= PRIM_MAX) { \
_mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
return; \
} \
@@ -1356,7 +1356,14 @@ save_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
"glDrawElementsInstancedBaseVertexBaseInstance() during display list compile");
}
-static void invalidate_saved_current_state( struct gl_context *ctx )
+
+/**
+ * While building a display list we cache some OpenGL state.
+ * Under some circumstances we need to invalidate that state (immediately
+ * when we start compiling a list, or after glCallList(s)).
+ */
+static void
+invalidate_saved_current_state(struct gl_context *ctx)
{
GLint i;
@@ -1371,6 +1378,7 @@ static void invalidate_saved_current_state( struct gl_context *ctx )
ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
}
+
static void GLAPIENTRY
save_CallList(GLuint list)
{
@@ -3771,15 +3779,16 @@ save_ShadeModel(GLenum mode)
CALL_ShadeModel(ctx->Exec, (mode));
}
+ /* Don't compile this call if it's a no-op.
+ * By avoiding this state change we have a better chance of
+ * coalescing subsequent drawing commands into one batch.
+ */
if (ctx->ListState.Current.ShadeModel == mode)
return;
SAVE_FLUSH_VERTICES(ctx);
- /* Only save the value if we know the statechange will take effect:
- */
- if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END)
- ctx->ListState.Current.ShadeModel = mode;
+ ctx->ListState.Current.ShadeModel = mode;
n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
if (n) {
@@ -5645,28 +5654,20 @@ static void GLAPIENTRY
save_Begin(GLenum mode)
{
GET_CURRENT_CONTEXT(ctx);
- Node *n;
- GLboolean error = GL_FALSE;
- if (ctx->ExecuteFlag && !_mesa_valid_prim_mode(ctx, mode, "glBegin")) {
- error = GL_TRUE;
+ if (!_mesa_is_valid_prim_mode(ctx, mode)) {
+ /* compile this error into the display list */
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
}
- else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
- /* Typically the first begin. This may raise an error on
- * playback, depending on whether CallList is issued from inside
- * a begin/end or not.
- */
- ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
- }
- else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
- ctx->Driver.CurrentSavePrimitive = mode;
+ else if (_mesa_inside_dlist_begin_end(ctx)) {
+ /* compile this error into the display list */
+ _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive glBegin");
}
else {
- _mesa_compile_error(ctx, GL_INVALID_OPERATION, "recursive begin");
- error = GL_TRUE;
- }
+ Node *n;
+
+ ctx->Driver.CurrentSavePrimitive = mode;
- if (!error) {
/* Give the driver an opportunity to hook in an optimized
* display list compiler.
*/
@@ -5678,10 +5679,10 @@ save_Begin(GLenum mode)
if (n) {
n[1].e = mode;
}
- }
- if (ctx->ExecuteFlag) {
- CALL_Begin(ctx->Exec, (mode));
+ if (ctx->ExecuteFlag) {
+ CALL_Begin(ctx->Exec, (mode));
+ }
}
}
@@ -5702,7 +5703,7 @@ save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
- SAVE_FLUSH_VERTICES(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = alloc_instruction(ctx, OPCODE_RECTF, 4);
if (n) {
n[1].f = a;
@@ -7055,7 +7056,10 @@ save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
static void GLAPIENTRY
save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
{
- save_SamplerParameterfv(sampler, pname, &param);
+ GLfloat parray[4];
+ parray[0] = param;
+ parray[1] = parray[2] = parray[3] = 0.0F;
+ save_SamplerParameterfv(sampler, pname, parray);
}
static void GLAPIENTRY
@@ -8631,8 +8635,7 @@ _mesa_NewList(GLuint name, GLenum mode)
ctx->CompileFlag = GL_TRUE;
ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE);
- /* Reset acumulated list state:
- */
+ /* Reset accumulated list state */
invalidate_saved_current_state( ctx );
/* Allocate new display list */
@@ -8660,6 +8663,11 @@ _mesa_EndList(void)
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glEndList\n");
+ if (ctx->ExecuteFlag && _mesa_inside_dlist_begin_end(ctx)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glEndList() called inside glBegin/End");
+ }
+
/* Check that a list is under construction */
if (!ctx->ListState.CurrentList) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glEndList");
@@ -8817,6 +8825,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
_mesa_loopback_init_api_table(ctx, table);
+ /* VBO functions */
+ vbo_initialize_save_dispatch(ctx, table);
+
/* GL 1.0 */
SET_Accum(table, save_Accum);
SET_AlphaFunc(table, save_AlphaFunc);
@@ -8927,6 +8938,7 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_RasterPos4s(table, save_RasterPos4s);
SET_RasterPos4sv(table, save_RasterPos4sv);
SET_ReadBuffer(table, save_ReadBuffer);
+ SET_Rectf(table, save_Rectf);
SET_Rotated(table, save_Rotated);
SET_Rotatef(table, save_Rotatef);
SET_Scaled(table, save_Scaled);
@@ -9256,6 +9268,18 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
/* GL_ARB_uniform_buffer_object */
SET_UniformBlockBinding(table, save_UniformBlockBinding);
+
+ /* GL_ARB_draw_instanced */
+ SET_DrawArraysInstancedARB(table, save_DrawArraysInstancedARB);
+ SET_DrawElementsInstancedARB(table, save_DrawElementsInstancedARB);
+
+ /* GL_ARB_draw_elements_base_vertex */
+ SET_DrawElementsInstancedBaseVertex(table, save_DrawElementsInstancedBaseVertexARB);
+
+ /* GL_ARB_base_instance */
+ SET_DrawArraysInstancedBaseInstance(table, save_DrawArraysInstancedBaseInstance);
+ SET_DrawElementsInstancedBaseInstance(table, save_DrawElementsInstancedBaseInstance);
+ SET_DrawElementsInstancedBaseVertexBaseInstance(table, save_DrawElementsInstancedBaseVertexBaseInstance);
}
@@ -9548,14 +9572,15 @@ mesa_print_display_list(GLuint list)
/***** Initialization *****/
/**********************************************************************/
-void
-_mesa_save_vtxfmt_init(GLvertexformat * vfmt)
+static void
+save_vtxfmt_init(GLvertexformat * vfmt)
{
- _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
+ vfmt->ArrayElement = _ae_ArrayElement;
vfmt->Begin = save_Begin;
- _MESA_INIT_DLIST_VTXFMT(vfmt, save_);
+ vfmt->CallList = save_CallList;
+ vfmt->CallLists = save_CallLists;
vfmt->Color3f = save_Color3f;
vfmt->Color3fv = save_Color3fv;
@@ -9564,7 +9589,12 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
vfmt->EdgeFlag = save_EdgeFlag;
vfmt->End = save_End;
- _MESA_INIT_EVAL_VTXFMT(vfmt, save_);
+ vfmt->EvalCoord1f = save_EvalCoord1f;
+ vfmt->EvalCoord1fv = save_EvalCoord1fv;
+ vfmt->EvalCoord2f = save_EvalCoord2f;
+ vfmt->EvalCoord2fv = save_EvalCoord2fv;
+ vfmt->EvalPoint1 = save_EvalPoint1;
+ vfmt->EvalPoint2 = save_EvalPoint2;
vfmt->FogCoordfEXT = save_FogCoordfEXT;
vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
@@ -9605,36 +9635,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
-
- vfmt->Rectf = save_Rectf;
-
- /* GL_ARB_draw_instanced */
- vfmt->DrawArraysInstanced = save_DrawArraysInstancedARB;
- vfmt->DrawElementsInstanced = save_DrawElementsInstancedARB;
-
- /* GL_ARB_draw_elements_base_vertex */
- vfmt->DrawElementsInstancedBaseVertex = save_DrawElementsInstancedBaseVertexARB;
-
- /* GL_ARB_base_instance */
- vfmt->DrawArraysInstancedBaseInstance = save_DrawArraysInstancedBaseInstance;
- vfmt->DrawElementsInstancedBaseInstance = save_DrawElementsInstancedBaseInstance;
- vfmt->DrawElementsInstancedBaseVertexBaseInstance = save_DrawElementsInstancedBaseVertexBaseInstance;
-
- /* The driver is required to implement these as
- * 1) They can probably do a better job.
- * 2) A lot of new mechanisms would have to be added to this module
- * to support it. That code would probably never get used,
- * because of (1).
- */
-#if 0
- vfmt->DrawArrays = 0;
- vfmt->DrawElements = 0;
- vfmt->DrawRangeElements = 0;
- vfmt->MultiDrawElemementsEXT = 0;
- vfmt->DrawElementsBaseVertex = 0;
- vfmt->DrawRangeElementsBaseVertex = 0;
- vfmt->MultiDrawElemementsBaseVertex = 0;
-#endif
}
@@ -9674,7 +9674,7 @@ _mesa_init_display_list(struct gl_context *ctx)
/* Display List group */
ctx->List.ListBase = 0;
- _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
+ save_vtxfmt_init(&ctx->ListState.ListVtxfmt);
}