diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/x11/glx_pbuffer.c | 20 | ||||
-rw-r--r-- | src/glx/x11/glxhash.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta.c | 48 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_vertprog.c | 15 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 6 |
5 files changed, 53 insertions, 37 deletions
diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c index 01569213f2d..501500afc3d 100644 --- a/src/glx/x11/glx_pbuffer.c +++ b/src/glx/x11/glx_pbuffer.c @@ -39,6 +39,13 @@ #include "glxextensions.h" #include "glcontextmodes.h" +#define WARN_ONCE_GLX_1_3(a, b) { \ + static int warned=1; \ + if(warned) { \ + warn_GLX_1_3((a), b ); \ + warned=0; \ + } \ + } /** * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems. @@ -576,7 +583,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list) width = 0; height = 0; - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); for (i = 0; attrib_list[i * 2]; i++) { switch (attrib_list[i * 2]) { @@ -611,7 +618,7 @@ PUBLIC void glXQueryDrawable(Display * dpy, GLXDrawable drawable, int attribute, unsigned int *value) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); GetDrawableAttribute(dpy, drawable, attribute, value); } @@ -665,7 +672,7 @@ PUBLIC GLXPixmap glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); return CreateDrawable(dpy, (__GLcontextModes *) config, (Drawable) pixmap, attrib_list, X_GLXCreatePixmap); @@ -676,7 +683,7 @@ PUBLIC GLXWindow glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, const int *attrib_list) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); return CreateDrawable(dpy, (__GLcontextModes *) config, (Drawable) win, attrib_list, X_GLXCreateWindow); @@ -686,7 +693,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, PUBLIC void glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap); } @@ -695,7 +702,7 @@ glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) PUBLIC void glXDestroyWindow(Display * dpy, GLXWindow win) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow); } @@ -716,3 +723,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX, (Display * dpy, GLXDrawable drawable, unsigned long *mask), (dpy, drawable, mask), glXGetSelectedEvent) + diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c index 7d28ada49ca..6f2c51d39dd 100644 --- a/src/glx/x11/glxhash.c +++ b/src/glx/x11/glxhash.c @@ -77,6 +77,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #define HASH_MAGIC 0xdeadbeef #define HASH_DEBUG 0 diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 532b2c92635..21756786c54 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -236,7 +236,6 @@ struct copypix_state struct drawpix_state { GLuint ArrayObj; - GLuint VBO; GLuint StencilFP; /**< Fragment program for drawing stencil images */ GLuint DepthFP; /**< Fragment program for drawing depth images */ @@ -327,7 +326,6 @@ _mesa_meta_free(GLcontext *ctx) _mesa_DeleteVertexArraysAPPLE(1, &meta->CopyPix.ArrayObj); /* glDrawPixels */ - _mesa_DeleteBuffersARB(1, & meta->DrawPix.VBO); _mesa_DeleteVertexArraysAPPLE(1, &meta->DrawPix.ArrayObj); _mesa_DeletePrograms(1, &meta->DrawPix.DepthFP); _mesa_DeletePrograms(1, &meta->DrawPix.StencilFP); @@ -1585,6 +1583,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx, GLenum texIntFormat; GLboolean fallback, newTex; GLbitfield metaExtraSave = 0x0; + GLuint vbo; /* * Determine if we can do the glDrawPixels with texture mapping. @@ -1664,30 +1663,6 @@ _mesa_meta_DrawPixels(GLcontext *ctx, META_VIEWPORT | metaExtraSave)); - if (drawpix->ArrayObj == 0) { - /* one-time setup */ - - /* create vertex array object */ - _mesa_GenVertexArrays(1, &drawpix->ArrayObj); - _mesa_BindVertexArray(drawpix->ArrayObj); - - /* create vertex array buffer */ - _mesa_GenBuffersARB(1, &drawpix->VBO); - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawpix->VBO); - _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), - NULL, GL_DYNAMIC_DRAW_ARB); - - /* setup vertex arrays */ - _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s)); - _mesa_EnableClientState(GL_VERTEX_ARRAY); - _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); - } - else { - _mesa_BindVertexArray(drawpix->ArrayObj); - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawpix->VBO); - } - newTex = alloc_texture(tex, width, height, texIntFormat); /* vertex positions, texcoords (after texture allocation!) */ @@ -1718,10 +1693,25 @@ _mesa_meta_DrawPixels(GLcontext *ctx, verts[3].z = z; verts[3].s = 0.0F; verts[3].t = tex->Ttop; + } - /* upload new vertex data */ - _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + if (drawpix->ArrayObj == 0) { + /* one-time setup: create vertex array object */ + _mesa_GenVertexArrays(1, &drawpix->ArrayObj); } + _mesa_BindVertexArray(drawpix->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &vbo); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + verts, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s)); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); /* set given unpack params */ ctx->Unpack = *unpack; @@ -1792,6 +1782,8 @@ _mesa_meta_DrawPixels(GLcontext *ctx, _mesa_set_enable(ctx, tex->Target, GL_FALSE); + _mesa_DeleteBuffersARB(1, &vbo); + /* restore unpack params */ ctx->Unpack = unpackSave; diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 0cb7dde985b..2f7b67c1431 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -43,6 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "compiler/radeon_compiler.h" #include "compiler/radeon_nqssadce.h" #include "r300_context.h" +#include "r300_fragprog_common.h" #include "r300_state.h" /** @@ -298,6 +299,20 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx) struct r300_vertex_program *vp; vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; + + if (!r300->selected_fp) { + /* This can happen when GetProgramiv is called to check + * whether the program runs natively. + * + * To be honest, this is not a very good solution, + * but solving the problem of reporting good values + * for those queries is tough anyway considering that + * we recompile vertex programs based on the precise + * fragment program that is in use. + */ + r300SelectAndTranslateFragmentShader(ctx); + } + wanted_key.FpReads = r300->selected_fp->InputsRead; wanted_key.FogAttr = r300->selected_fp->fog_attr; wanted_key.WPosAttr = r300->selected_fp->wpos_attr; diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b95e00af5bb..189b5e16558 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1173,7 +1173,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, ASSERT(ctx->Driver.BufferData); if (!ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj )) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()"); } } @@ -1262,7 +1262,7 @@ _mesa_MapBufferARB(GLenum target, GLenum access) ASSERT(ctx->Driver.MapBuffer); map = ctx->Driver.MapBuffer( ctx, target, access, bufObj ); if (!map) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)"); return NULL; } else { @@ -1593,7 +1593,7 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, map = ctx->Driver.MapBufferRange(ctx, target, offset, length, access, bufObj); if (!map) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)"); } else { /* The driver callback should have set all these fields. |