aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-05-08 00:18:25 +0200
committermarha <marha@users.sourceforge.net>2014-05-08 00:18:25 +0200
commit683155917770af9e63a938bc450df25d1904d567 (patch)
tree5eb9d2d0bba27ed4e8afe58c195d1918282c343b /mesalib/src/mesa/vbo
parentea0cd87ecbe9fc3c5503ccad7f87a895a458d6d4 (diff)
downloadvcxsrv-683155917770af9e63a938bc450df25d1904d567.tar.gz
vcxsrv-683155917770af9e63a938bc450df25d1904d567.tar.bz2
vcxsrv-683155917770af9e63a938bc450df25d1904d567.zip
xserver xcb-proto mesa pixman xkeyboard-config git update 7 May 2014
xserver commit a5b9757142a2ab471ca26651dce9cc5f5e351f3d libxcb commit d978a4f69b30b630f28d07f1003cf290284d24d8 libxcb/xcb-proto commit 389889e2f95af19e7fc7ac89e7faeb2f28652415 xkeyboard-config commit 3e54f31b1f118f00c240f59d72d7ddb685c6db79 libX11 commit 8be4610939b833587954957f5963eb4191b43d19 libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854 libXext commit 11aad96bd689d54156064d2e81213dc827a689d1 libfontenc commit 0037a42107b952c9d903719615747e760e4e7247 libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909 libXau commit 1e4635be11154dd8262f37b379511bd627defa2a xkbcomp commit d4e02a09258063c6d024c3ccd42d6b22212e6e18 pixman commit 91f32ce961bc85f98b3372b95681ad8918d24b18 xextproto commit 66afec3f49e8eb0d4c2e9af7088fc3116d4bafd7 randrproto commit a4a6694c059d74247c16527eef4a0ec9f56bbef6 glproto commit f84853d97d5749308992412a215fa518b6536eb3 mkfontscale commit 399db42a151687f1181ae23d28a76d31125a2853 xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13 libXft commit 4acfdaf95adb0a05c2a25550bdde036c865902f4 libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63 libxtrans commit a57a7f62242e1ea972b81414741729bf3dbae0a4 fontconfig commit 81664fe54f117e4781fda5a30429b51858302e91 mesa commit 9ced3fc649ec04710a5f5c855bfb582b898cff83
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo_attrib_tmp.h45
-rw-r--r--mesalib/src/mesa/vbo/vbo_rebase.c23
2 files changed, 44 insertions, 24 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
index a2ea6d0c8..ec66934fc 100644
--- a/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/mesalib/src/mesa/vbo/vbo_attrib_tmp.h
@@ -26,6 +26,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
#include "util/u_format_r11g11b10f.h"
+#include "main/varray.h"
/* float */
#define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
@@ -499,7 +500,7 @@ static void GLAPIENTRY
TAG(VertexAttrib1fARB)(GLuint index, GLfloat x)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR1F(0, x);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR1F(VBO_ATTRIB_GENERIC0 + index, x);
@@ -511,7 +512,7 @@ static void GLAPIENTRY
TAG(VertexAttrib1fvARB)(GLuint index, const GLfloat * v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR1FV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR1FV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -523,7 +524,7 @@ static void GLAPIENTRY
TAG(VertexAttrib2fARB)(GLuint index, GLfloat x, GLfloat y)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR2F(0, x, y);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR2F(VBO_ATTRIB_GENERIC0 + index, x, y);
@@ -535,7 +536,7 @@ static void GLAPIENTRY
TAG(VertexAttrib2fvARB)(GLuint index, const GLfloat * v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR2FV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR2FV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -547,7 +548,7 @@ static void GLAPIENTRY
TAG(VertexAttrib3fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR3F(0, x, y, z);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR3F(VBO_ATTRIB_GENERIC0 + index, x, y, z);
@@ -559,7 +560,7 @@ static void GLAPIENTRY
TAG(VertexAttrib3fvARB)(GLuint index, const GLfloat * v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR3FV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR3FV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -571,7 +572,7 @@ static void GLAPIENTRY
TAG(VertexAttrib4fARB)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR4F(0, x, y, z, w);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR4F(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
@@ -583,7 +584,7 @@ static void GLAPIENTRY
TAG(VertexAttrib4fvARB)(GLuint index, const GLfloat * v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR4FV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR4FV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -600,7 +601,7 @@ static void GLAPIENTRY
TAG(VertexAttribI1i)(GLuint index, GLint x)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR1I(0, x);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR1I(VBO_ATTRIB_GENERIC0 + index, x);
@@ -612,7 +613,7 @@ static void GLAPIENTRY
TAG(VertexAttribI2i)(GLuint index, GLint x, GLint y)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR2I(0, x, y);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR2I(VBO_ATTRIB_GENERIC0 + index, x, y);
@@ -624,7 +625,7 @@ static void GLAPIENTRY
TAG(VertexAttribI3i)(GLuint index, GLint x, GLint y, GLint z)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR3I(0, x, y, z);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR3I(VBO_ATTRIB_GENERIC0 + index, x, y, z);
@@ -636,7 +637,7 @@ static void GLAPIENTRY
TAG(VertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR4I(0, x, y, z, w);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR4I(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
@@ -648,7 +649,7 @@ static void GLAPIENTRY
TAG(VertexAttribI2iv)(GLuint index, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR2IV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR2IV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -660,7 +661,7 @@ static void GLAPIENTRY
TAG(VertexAttribI3iv)(GLuint index, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR3IV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR3IV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -672,7 +673,7 @@ static void GLAPIENTRY
TAG(VertexAttribI4iv)(GLuint index, const GLint *v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR4IV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR4IV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -689,7 +690,7 @@ static void GLAPIENTRY
TAG(VertexAttribI1ui)(GLuint index, GLuint x)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR1UI(0, x);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR1UI(VBO_ATTRIB_GENERIC0 + index, x);
@@ -701,7 +702,7 @@ static void GLAPIENTRY
TAG(VertexAttribI2ui)(GLuint index, GLuint x, GLuint y)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR2UI(0, x, y);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR2UI(VBO_ATTRIB_GENERIC0 + index, x, y);
@@ -713,7 +714,7 @@ static void GLAPIENTRY
TAG(VertexAttribI3ui)(GLuint index, GLuint x, GLuint y, GLuint z)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR3UI(0, x, y, z);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR3UI(VBO_ATTRIB_GENERIC0 + index, x, y, z);
@@ -725,7 +726,7 @@ static void GLAPIENTRY
TAG(VertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR4UI(0, x, y, z, w);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR4UI(VBO_ATTRIB_GENERIC0 + index, x, y, z, w);
@@ -737,7 +738,7 @@ static void GLAPIENTRY
TAG(VertexAttribI2uiv)(GLuint index, const GLuint *v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR2UIV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR2UIV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -749,7 +750,7 @@ static void GLAPIENTRY
TAG(VertexAttribI3uiv)(GLuint index, const GLuint *v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR3UIV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR3UIV(VBO_ATTRIB_GENERIC0 + index, v);
@@ -761,7 +762,7 @@ static void GLAPIENTRY
TAG(VertexAttribI4uiv)(GLuint index, const GLuint *v)
{
GET_CURRENT_CONTEXT(ctx);
- if (index == 0)
+ if (index == 0 && _mesa_attr_zero_aliases_vertex(ctx))
ATTR4UIV(0, v);
else if (index < MAX_VERTEX_GENERIC_ATTRIBS)
ATTR4UIV(VBO_ATTRIB_GENERIC0 + index, v);
diff --git a/mesalib/src/mesa/vbo/vbo_rebase.c b/mesalib/src/mesa/vbo/vbo_rebase.c
index f3fe5f757..82a0b8e2b 100644
--- a/mesalib/src/mesa/vbo/vbo_rebase.c
+++ b/mesalib/src/mesa/vbo/vbo_rebase.c
@@ -58,9 +58,14 @@ static void *rebase_##TYPE( const void *ptr, \
GLuint count, \
TYPE min_index ) \
{ \
- const TYPE *in = (TYPE *)ptr; \
- TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \
GLuint i; \
+ const TYPE *in = (TYPE *)ptr; \
+ TYPE *tmp_indices = malloc(count * sizeof(TYPE)); \
+ \
+ if (tmp_indices == NULL) { \
+ _mesa_error_no_memory(__func__); \
+ return NULL; \
+ } \
\
for (i = 0; i < count; i++) \
tmp_indices[i] = in[i] - min_index; \
@@ -148,6 +153,11 @@ void vbo_rebase_prims( struct gl_context *ctx,
*/
tmp_prims = malloc(sizeof(*prim) * nr_prims);
+ if (tmp_prims == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
for (i = 0; i < nr_prims; i++) {
tmp_prims[i] = prim[i];
tmp_prims[i].basevertex -= min_index;
@@ -186,6 +196,10 @@ void vbo_rebase_prims( struct gl_context *ctx,
if (map_ib)
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
+ if (tmp_indices == NULL) {
+ return;
+ }
+
tmp_ib.obj = ctx->Shared->NullBufferObj;
tmp_ib.ptr = tmp_indices;
tmp_ib.count = ib->count;
@@ -198,6 +212,11 @@ void vbo_rebase_prims( struct gl_context *ctx,
*/
tmp_prims = malloc(sizeof(*prim) * nr_prims);
+ if (tmp_prims == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
for (i = 0; i < nr_prims; i++) {
/* If this fails, it could indicate an application error:
*/