projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
svga: update constant buffer code for GBS
[mesa.git]
/
src
/
glx
/
indirect_vertex_array.c
diff --git
a/src/glx/indirect_vertex_array.c
b/src/glx/indirect_vertex_array.c
index 372618de4f2be04251be53fd8c35f780d802db44..0025cbbd078135110c2bf3622f7f0676d4fe77dd 100644
(file)
--- a/
src/glx/indirect_vertex_array.c
+++ b/
src/glx/indirect_vertex_array.c
@@
-115,14
+115,10
@@
__glXFreeVertexArrayState(struct glx_context * gc)
struct array_state_vector *arrays = state->array_state;
if (arrays) {
struct array_state_vector *arrays = state->array_state;
if (arrays) {
- if (arrays->stack) {
- free(arrays->stack);
- arrays->stack = NULL;
- }
- if (arrays->arrays) {
- free(arrays->arrays);
- arrays->arrays = NULL;
- }
+ free(arrays->stack);
+ arrays->stack = NULL;
+ free(arrays->arrays);
+ arrays->arrays = NULL;
free(arrays);
state->array_state = NULL;
}
free(arrays);
state->array_state = NULL;
}
@@
-139,9
+135,6
@@
__glXFreeVertexArrayState(struct glx_context * gc)
* struct glx_context::server_minor, and __GLXcontext::server_major have been
* initialized. These values are used to determine what vertex arrays are
* supported.
* struct glx_context::server_minor, and __GLXcontext::server_major have been
* initialized. These values are used to determine what vertex arrays are
* supported.
- *
- * \bug
- * Return values from malloc are not properly tested.
*/
void
__glXInitVertexArrayState(struct glx_context * gc)
*/
void
__glXInitVertexArrayState(struct glx_context * gc)
@@
-158,7
+151,11
@@
__glXInitVertexArrayState(struct glx_context * gc)
arrays = calloc(1, sizeof(struct array_state_vector));
arrays = calloc(1, sizeof(struct array_state_vector));
- state->array_state = arrays;
+
+ if (arrays == NULL) {
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
arrays->new_DrawArrays_possible = GL_FALSE;
arrays->old_DrawArrays_possible = !state->NoDrawArraysProtocol;
arrays->new_DrawArrays_possible = GL_FALSE;
@@
-208,6
+205,12
@@
__glXInitVertexArrayState(struct glx_context * gc)
arrays->num_arrays = array_count;
arrays->arrays = calloc(array_count, sizeof(struct array_state));
arrays->num_arrays = array_count;
arrays->arrays = calloc(array_count, sizeof(struct array_state));
+ if (arrays->arrays == NULL) {
+ free(arrays);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+
arrays->arrays[0].data_type = GL_FLOAT;
arrays->arrays[0].count = 3;
arrays->arrays[0].key = GL_NORMAL_ARRAY;
arrays->arrays[0].data_type = GL_FLOAT;
arrays->arrays[0].count = 3;
arrays->arrays[0].key = GL_NORMAL_ARRAY;
@@
-293,6
+296,18
@@
__glXInitVertexArrayState(struct glx_context * gc)
arrays->stack = malloc(sizeof(struct array_stack_state)
* arrays->num_arrays
* __GL_CLIENT_ATTRIB_STACK_DEPTH);
arrays->stack = malloc(sizeof(struct array_stack_state)
* arrays->num_arrays
* __GL_CLIENT_ATTRIB_STACK_DEPTH);
+
+ if (arrays->stack == NULL) {
+ free(arrays->arrays);
+ free(arrays);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ return;
+ }
+
+ /* Everything went ok so we put vertex array state in place
+ * in context.
+ */
+ state->array_state = arrays;
}
}
@@
-1034,8
+1049,8
@@
__indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
void
void
-__indirect_glMultiDrawArrays
EXT(GLenum mode, GLint * first, GLsizei * coun
t,
- GLsizei primcount)
+__indirect_glMultiDrawArrays
(GLenum mode, const GLint *firs
t,
+
const GLsizei *count,
GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
@@
-1060,7
+1075,7
@@
__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
void
__indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
void
__indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count,
- GLenum type, const GLvoid ** indices,
+ GLenum type, const GLvoid *
const
* indices,
GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
@@
-1466,7
+1481,7
@@
__indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
void
void
-__indirect_glSecondaryColorPointer
EXT
(GLint size, GLenum type, GLsizei stride,
+__indirect_glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid * pointer)
{
uint16_t opcode;
const GLvoid * pointer)
{
uint16_t opcode;
@@
-1526,7
+1541,7
@@
__indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride,
void
void
-__indirect_glFogCoordPointer
EXT
(GLenum type, GLsizei stride,
+__indirect_glFogCoordPointer(GLenum type, GLsizei stride,
const GLvoid * pointer)
{
uint16_t opcode;
const GLvoid * pointer)
{
uint16_t opcode;
@@
-1568,7
+1583,7
@@
__indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride,
void
void
-__indirect_glVertexAttribPointer
ARB
(GLuint index, GLint size,
+__indirect_glVertexAttribPointer(GLuint index, GLint size,
GLenum type, GLboolean normalized,
GLsizei stride, const GLvoid * pointer)
{
GLenum type, GLboolean normalized,
GLsizei stride, const GLvoid * pointer)
{
@@
-1705,7
+1720,7
@@
__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
case GL_SHORT:
case GL_FLOAT:
case GL_DOUBLE:
case GL_SHORT:
case GL_FLOAT:
case GL_DOUBLE:
- __indirect_glVertexAttribPointer
ARB
(index, size, type,
+ __indirect_glVertexAttribPointer(index, size, type,
normalized, stride, pointer);
return;
default:
normalized, stride, pointer);
return;
default:
@@
-1716,7
+1731,7
@@
__indirect_glVertexAttribPointerNV(GLuint index, GLint size,
void
void
-__indirect_glClientActiveTexture
ARB
(GLenum texture)
+__indirect_glClientActiveTexture(GLenum texture)
{
struct glx_context *const gc = __glXGetCurrentContext();
__GLXattribute *const state =
{
struct glx_context *const gc = __glXGetCurrentContext();
__GLXattribute *const state =
@@
-1965,13
+1980,13
@@
__glXPopArrayState(__GLXattribute * state)
stack[i].user_stride, stack[i].data);
break;
case GL_SECONDARY_COLOR_ARRAY:
stack[i].user_stride, stack[i].data);
break;
case GL_SECONDARY_COLOR_ARRAY:
- __indirect_glSecondaryColorPointer
EXT
(stack[i].count,
+ __indirect_glSecondaryColorPointer(stack[i].count,
stack[i].data_type,
stack[i].user_stride,
stack[i].data);
break;
case GL_FOG_COORDINATE_ARRAY:
stack[i].data_type,
stack[i].user_stride,
stack[i].data);
break;
case GL_FOG_COORDINATE_ARRAY:
- __indirect_glFogCoordPointer
EXT
(stack[i].data_type,
+ __indirect_glFogCoordPointer(stack[i].data_type,
stack[i].user_stride, stack[i].data);
break;
stack[i].user_stride, stack[i].data);
break;