aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-05 09:59:38 +0100
committermarha <marha@users.sourceforge.net>2012-03-05 09:59:38 +0100
commitffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a (patch)
tree233b818e67de2073647e46e91ac688c6b43d5917 /mesalib/src/mesa/main
parent15a500d3edb03668b43cc6898fafcda024d0f006 (diff)
downloadvcxsrv-ffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a.tar.gz
vcxsrv-ffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a.tar.bz2
vcxsrv-ffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a.zip
libfontenc xserver pixman mesa git update 5 Mar 2012
font-util-1.3.0 xclock-1.0.6 libXfont-1.4.5 inputproto-2.2
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/api_validate.c12
-rw-r--r--mesalib/src/mesa/main/bufferobj.c12
-rw-r--r--mesalib/src/mesa/main/dlist.c46
-rw-r--r--mesalib/src/mesa/main/enable.c6
-rw-r--r--mesalib/src/mesa/main/light.c169
-rw-r--r--mesalib/src/mesa/main/light.h23
-rw-r--r--mesalib/src/mesa/main/mtypes.h350
-rw-r--r--mesalib/src/mesa/main/teximage.c32
-rw-r--r--mesalib/src/mesa/main/varray.c10
-rw-r--r--mesalib/src/mesa/main/vtxfmt.c2
10 files changed, 263 insertions, 399 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 1ae491f25..4e94f47e3 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -383,6 +383,12 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
return GL_FALSE;
}
+ if (first < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDrawArraysInstanced(start=%d)", first);
+ return GL_FALSE;
+ }
+
if (!_mesa_valid_prim_mode(ctx, mode)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glDrawArraysInstanced(mode=0x%x)", mode);
@@ -399,12 +405,6 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
if (!check_valid_to_render(ctx, "glDrawArraysInstanced(invalid to render)"))
return GL_FALSE;
- if (ctx->CompileFlag) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawArraysInstanced(display list");
- return GL_FALSE;
- }
-
if (ctx->Const.CheckArrayBounds) {
if (first + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 2483f1905..eef10c422 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -1172,17 +1172,17 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
*params = _mesa_bufferobj_mapped(bufObj);
return;
case GL_BUFFER_ACCESS_FLAGS:
- if (ctx->VersionMajor < 3)
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = bufObj->AccessFlags;
return;
case GL_BUFFER_MAP_OFFSET:
- if (ctx->VersionMajor < 3)
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = (GLint) bufObj->Offset;
return;
case GL_BUFFER_MAP_LENGTH:
- if (ctx->VersionMajor < 3)
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = (GLint) bufObj->Length;
return;
@@ -1223,7 +1223,7 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
*params = simplified_access_mode(bufObj->AccessFlags);
return;
case GL_BUFFER_ACCESS_FLAGS:
- if (ctx->VersionMajor < 3)
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = bufObj->AccessFlags;
return;
@@ -1231,12 +1231,12 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
*params = _mesa_bufferobj_mapped(bufObj);
return;
case GL_BUFFER_MAP_OFFSET:
- if (ctx->VersionMajor < 3)
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = bufObj->Offset;
return;
case GL_BUFFER_MAP_LENGTH:
- if (ctx->VersionMajor < 3)
+ if (!ctx->Extensions.ARB_map_buffer_range)
goto invalid_pname;
*params = bufObj->Length;
return;
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 677debffc..3db7bebae 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -1300,6 +1300,43 @@ save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA)
}
+/* GL_ARB_draw_instanced. */
+static void GLAPIENTRY
+save_DrawArraysInstancedARB(GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawArraysInstanced() during display list compile");
+}
+
+static void GLAPIENTRY
+save_DrawElementsInstancedARB(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ GLsizei primcount)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElementsInstanced() during display list compile");
+}
+
+static void GLAPIENTRY
+save_DrawElementsInstancedBaseVertexARB(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ GLsizei primcount,
+ GLint basevertex)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawElementsInstancedBaseVertex() during display list compile");
+}
+
static void invalidate_saved_current_state( struct gl_context *ctx )
{
GLint i;
@@ -9672,8 +9709,6 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode,
modestride));
}
-
-
/**
* Setup the given dispatch table to point to Mesa's display list
* building functions.
@@ -10751,6 +10786,13 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt)
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;
+
/* 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
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index 270b24045..515dda952 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -118,7 +118,7 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
CHECK_EXTENSION(NV_vertex_program, cap);
{
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
- ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(ctx->Array.ArrayObj->VertexAttrib));
+ ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(arrayObj->VertexAttrib));
var = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled;
flag = VERT_BIT_GENERIC(n);
}
@@ -149,9 +149,9 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
*var = state;
if (state)
- ctx->Array.ArrayObj->_Enabled |= flag;
+ arrayObj->_Enabled |= flag;
else
- ctx->Array.ArrayObj->_Enabled &= ~flag;
+ arrayObj->_Enabled &= ~flag;
if (ctx->Driver.Enable) {
ctx->Driver.Enable( ctx, cap, state );
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index a16d0e998..962a3e689 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -161,11 +161,9 @@ _mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *pa
return;
FLUSH_VERTICES(ctx, _NEW_LIGHT);
light->SpotCutoff = params[0];
- light->_CosCutoffNeg = (GLfloat) (cos(light->SpotCutoff * DEG2RAD));
- if (light->_CosCutoffNeg < 0)
+ light->_CosCutoff = (GLfloat) (cos(light->SpotCutoff * DEG2RAD));
+ if (light->_CosCutoff < 0)
light->_CosCutoff = 0;
- else
- light->_CosCutoff = light->_CosCutoffNeg;
if (light->SpotCutoff != 180.0F)
light->_Flags |= LIGHT_SPOT;
else
@@ -623,11 +621,6 @@ _mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname,
-static void
-invalidate_shine_table( struct gl_context *ctx, GLuint side );
-
-
-
/* Update derived values following a change in ctx->Light.Material
*/
void
@@ -699,14 +692,6 @@ _mesa_update_material( struct gl_context *ctx, GLuint bitmask )
mat[MAT_ATTRIB_BACK_SPECULAR]);
}
}
-
- if (bitmask & MAT_BIT_FRONT_SHININESS) {
- invalidate_shine_table( ctx, 0 );
- }
-
- if (bitmask & MAT_BIT_BACK_SHININESS) {
- invalidate_shine_table( ctx, 1 );
- }
}
@@ -876,126 +861,6 @@ _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
-/**********************************************************************/
-/***** Lighting computation *****/
-/**********************************************************************/
-
-
-/*
- * Notes:
- * When two-sided lighting is enabled we compute the color (or index)
- * for both the front and back side of the primitive. Then, when the
- * orientation of the facet is later learned, we can determine which
- * color (or index) to use for rendering.
- *
- * KW: We now know orientation in advance and only shade for
- * the side or sides which are actually required.
- *
- * Variables:
- * n = normal vector
- * V = vertex position
- * P = light source position
- * Pe = (0,0,0,1)
- *
- * Precomputed:
- * IF P[3]==0 THEN
- * // light at infinity
- * IF local_viewer THEN
- * _VP_inf_norm = unit vector from V to P // Precompute
- * ELSE
- * // eye at infinity
- * _h_inf_norm = Normalize( VP + <0,0,1> ) // Precompute
- * ENDIF
- * ENDIF
- *
- * Functions:
- * Normalize( v ) = normalized vector v
- * Magnitude( v ) = length of vector v
- */
-
-
-
-/* Calculate a new shine table. Doing this here saves a branch in
- * lighting, and the cost of doing it early may be partially offset
- * by keeping a MRU cache of shine tables for various shine values.
- */
-static void
-invalidate_shine_table( struct gl_context *ctx, GLuint side )
-{
- ASSERT(side < 2);
- if (ctx->_ShineTable[side])
- ctx->_ShineTable[side]->refcount--;
- ctx->_ShineTable[side] = NULL;
-}
-
-
-static void
-validate_shine_table( struct gl_context *ctx, GLuint side, GLfloat shininess )
-{
- struct gl_shine_tab *list = ctx->_ShineTabList;
- struct gl_shine_tab *s;
-
- ASSERT(side < 2);
-
- foreach(s, list)
- if ( s->shininess == shininess )
- break;
-
- if (s == list) {
- GLint j;
- GLfloat *m;
-
- foreach(s, list)
- if (s->refcount == 0)
- break;
-
- m = s->tab;
- m[0] = 0.0;
- if (shininess == 0.0) {
- for (j = 1 ; j <= SHINE_TABLE_SIZE ; j++)
- m[j] = 1.0;
- }
- else {
- for (j = 1 ; j < SHINE_TABLE_SIZE ; j++) {
- GLdouble t, x = j / (GLfloat) (SHINE_TABLE_SIZE - 1);
- if (x < 0.005) /* underflow check */
- x = 0.005;
- t = pow(x, shininess);
- if (t > 1e-20)
- m[j] = (GLfloat) t;
- else
- m[j] = 0.0;
- }
- m[SHINE_TABLE_SIZE] = 1.0;
- }
-
- s->shininess = shininess;
- }
-
- if (ctx->_ShineTable[side])
- ctx->_ShineTable[side]->refcount--;
-
- ctx->_ShineTable[side] = s;
- move_to_tail( list, s );
- s->refcount++;
-}
-
-
-void
-_mesa_validate_all_lighting_tables( struct gl_context *ctx )
-{
- GLfloat shininess;
-
- shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_SHININESS][0];
- if (!ctx->_ShineTable[0] || ctx->_ShineTable[0]->shininess != shininess)
- validate_shine_table( ctx, 0, shininess );
-
- shininess = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_SHININESS][0];
- if (!ctx->_ShineTable[1] || ctx->_ShineTable[1]->shininess != shininess)
- validate_shine_table( ctx, 1, shininess );
-}
-
-
/**
* Examine current lighting parameters to determine if the optimized lighting
* function can be used.
@@ -1005,23 +870,23 @@ _mesa_validate_all_lighting_tables( struct gl_context *ctx )
void
_mesa_update_lighting( struct gl_context *ctx )
{
+ GLbitfield flags = 0;
struct gl_light *light;
ctx->Light._NeedEyeCoords = GL_FALSE;
- ctx->Light._Flags = 0;
if (!ctx->Light.Enabled)
return;
foreach(light, &ctx->Light.EnabledList) {
- ctx->Light._Flags |= light->_Flags;
+ flags |= light->_Flags;
}
ctx->Light._NeedVertices =
- ((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) ||
+ ((flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) ||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ||
ctx->Light.Model.LocalViewer);
- ctx->Light._NeedEyeCoords = ((ctx->Light._Flags & LIGHT_POSITIONAL) ||
+ ctx->Light._NeedEyeCoords = ((flags & LIGHT_POSITIONAL) ||
ctx->Light.Model.LocalViewer);
/* XXX: This test is overkill & needs to be fixed both for software and
@@ -1081,9 +946,6 @@ compute_light_positions( struct gl_context *ctx )
TRANSFORM_NORMAL( ctx->_EyeZDir, eye_z, ctx->ModelviewMatrixStack.Top->m );
}
- /* Make sure all the light tables are updated before the computation */
- _mesa_validate_all_lighting_tables(ctx);
-
foreach (light, &ctx->Light.EnabledList) {
if (ctx->_NeedEyeCoords) {
@@ -1260,7 +1122,6 @@ init_light( struct gl_light *l, GLuint n )
ASSIGN_3V( l->SpotDirection, 0.0, 0.0, -1.0 );
l->SpotExponent = 0.0;
l->SpotCutoff = 180.0;
- l->_CosCutoffNeg = -1.0f;
l->_CosCutoff = 0.0; /* KW: -ve values not admitted */
l->ConstantAttenuation = 1.0;
l->LinearAttenuation = 0.0;
@@ -1337,17 +1198,6 @@ _mesa_init_lighting( struct gl_context *ctx )
ctx->Light.ColorMaterialEnabled = GL_FALSE;
ctx->Light.ClampVertexColor = GL_TRUE;
- /* Lighting miscellaneous */
- ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab );
- make_empty_list( ctx->_ShineTabList );
- /* Allocate 10 (arbitrary) shininess lookup tables */
- for (i = 0 ; i < 10 ; i++) {
- struct gl_shine_tab *s = MALLOC_STRUCT( gl_shine_tab );
- s->shininess = -1;
- s->refcount = 0;
- insert_at_tail( ctx->_ShineTabList, s );
- }
-
/* Miscellaneous */
ctx->Light._NeedEyeCoords = GL_FALSE;
ctx->_NeedEyeCoords = GL_FALSE;
@@ -1362,11 +1212,4 @@ _mesa_init_lighting( struct gl_context *ctx )
void
_mesa_free_lighting_data( struct gl_context *ctx )
{
- struct gl_shine_tab *s, *tmps;
-
- /* Free lighting shininess exponentiation table */
- foreach_s( s, tmps, ctx->_ShineTabList ) {
- free( s );
- }
- free( ctx->_ShineTabList );
}
diff --git a/mesalib/src/mesa/main/light.h b/mesalib/src/mesa/main/light.h
index 996698793..c751d6d6b 100644
--- a/mesalib/src/mesa/main/light.h
+++ b/mesalib/src/mesa/main/light.h
@@ -87,33 +87,11 @@ extern void
_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params);
-/*
- * Compute dp ^ SpecularExponent.
- * Lerp between adjacent values in the f(x) lookup table, giving a
- * continuous function, with adequate overall accuracy. (Though still
- * pretty good compared to a straight lookup).
- */
-static inline GLfloat
-_mesa_lookup_shininess(const struct gl_context *ctx, GLuint face, GLfloat dp)
-{
- const struct gl_shine_tab *tab = ctx->_ShineTable[face];
- float f = dp * (SHINE_TABLE_SIZE - 1);
- int k = (int) f;
- if (k < 0 /* gcc may cast an overflow float value to negative int value */
- || k > SHINE_TABLE_SIZE - 2)
- return powf(dp, tab->shininess);
- else
- return tab->tab[k] + (f - k) * (tab->tab[k+1] - tab->tab[k]);
-}
-
-
extern GLuint _mesa_material_bitmask( struct gl_context *ctx,
GLenum face, GLenum pname,
GLuint legal,
const char * );
-extern void _mesa_validate_all_lighting_tables( struct gl_context *ctx );
-
extern void _mesa_update_lighting( struct gl_context *ctx );
extern void _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state );
@@ -132,7 +110,6 @@ extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag )
#else
#define _mesa_update_color_material( c, r ) ((void)0)
-#define _mesa_validate_all_lighting_tables( c ) ((void)0)
#define _mesa_material_bitmask( c, f, p, l, s ) 0
#define _mesa_init_lighting( c ) ((void)0)
#define _mesa_free_lighting_data( c ) ((void)0)
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 9200f3fc4..480b1cf28 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -77,6 +77,8 @@ struct gl_texture_object;
struct gl_context;
struct st_context;
struct gl_uniform_storage;
+struct prog_instruction;
+struct gl_program_parameter_list;
/*@}*/
@@ -86,19 +88,6 @@ struct gl_uniform_storage;
#define PRIM_UNKNOWN (GL_POLYGON+3)
-/**
- * Shader stages. Note that these will become 5 with tessellation.
- * These MUST have the same values as gallium's PIPE_SHADER_*
- */
-typedef enum
-{
- MESA_SHADER_VERTEX = 0,
- MESA_SHADER_FRAGMENT = 1,
- MESA_SHADER_GEOMETRY = 2,
- MESA_SHADER_TYPES = 3
-} gl_shader_type;
-
-
/**
* Indexes for vertex program attributes.
@@ -640,21 +629,6 @@ struct gl_config
/*@}*/
-#define EXP_TABLE_SIZE 512 /**< Specular exponent lookup table sizes */
-#define SHINE_TABLE_SIZE 256 /**< Material shininess lookup table sizes */
-
-/**
- * Material shininess lookup table.
- */
-struct gl_shine_tab
-{
- struct gl_shine_tab *next, *prev;
- GLfloat tab[SHINE_TABLE_SIZE+1];
- GLfloat shininess;
- GLuint refcount;
-};
-
-
/**
* Light source state.
*/
@@ -670,7 +644,6 @@ struct gl_light
GLfloat SpotDirection[4]; /**< spotlight direction in eye coordinates */
GLfloat SpotExponent;
GLfloat SpotCutoff; /**< in degrees */
- GLfloat _CosCutoffNeg; /**< = cos(SpotCutoff) */
GLfloat _CosCutoff; /**< = MAX(0, cos(SpotCutoff)) */
GLfloat ConstantAttenuation;
GLfloat LinearAttenuation;
@@ -916,23 +889,6 @@ struct gl_fog_attrib
};
-/**
- * \brief Layout qualifiers for gl_FragDepth.
- *
- * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with
- * a layout qualifier.
- *
- * \see enum ir_depth_layout
- */
-enum gl_frag_depth_layout {
- FRAG_DEPTH_LAYOUT_NONE, /**< No layout is specified. */
- FRAG_DEPTH_LAYOUT_ANY,
- FRAG_DEPTH_LAYOUT_GREATER,
- FRAG_DEPTH_LAYOUT_LESS,
- FRAG_DEPTH_LAYOUT_UNCHANGED
-};
-
-
/**
* Hint attribute group (GL_HINT_BIT).
*
@@ -995,7 +951,6 @@ struct gl_light_attrib
/*@{*/
GLboolean _NeedEyeCoords;
GLboolean _NeedVertices; /**< Use fast shader? */
- GLbitfield _Flags; /**< LIGHT_* flags, see above */
GLfloat _BaseColor[2][3];
/*@}*/
};
@@ -1773,6 +1728,107 @@ struct gl_evaluators
};
+struct gl_transform_feedback_varying_info
+{
+ char *Name;
+ GLenum Type;
+ GLint Size;
+};
+
+
+/**
+ * Per-output info vertex shaders for transform feedback.
+ */
+struct gl_transform_feedback_output
+{
+ unsigned OutputRegister;
+ unsigned OutputBuffer;
+ unsigned NumComponents;
+
+ /** offset (in DWORDs) of this output within the interleaved structure */
+ unsigned DstOffset;
+
+ /**
+ * Offset into the output register of the data to output. For example,
+ * if NumComponents is 2 and ComponentOffset is 1, then the data to
+ * offset is in the y and z components of the output register.
+ */
+ unsigned ComponentOffset;
+};
+
+
+/** Post-link transform feedback info. */
+struct gl_transform_feedback_info
+{
+ unsigned NumOutputs;
+
+ /**
+ * Number of transform feedback buffers in use by this program.
+ */
+ unsigned NumBuffers;
+
+ struct gl_transform_feedback_output *Outputs;
+
+ /** Transform feedback varyings used for the linking of this shader program.
+ *
+ * Use for glGetTransformFeedbackVarying().
+ */
+ struct gl_transform_feedback_varying_info *Varyings;
+ GLint NumVarying;
+
+ /**
+ * Total number of components stored in each buffer. This may be used by
+ * hardware back-ends to determine the correct stride when interleaving
+ * multiple transform feedback outputs in the same buffer.
+ */
+ unsigned BufferStride[MAX_FEEDBACK_ATTRIBS];
+};
+
+
+/**
+ * Transform feedback object state
+ */
+struct gl_transform_feedback_object
+{
+ GLuint Name; /**< AKA the object ID */
+ GLint RefCount;
+ GLboolean Active; /**< Is transform feedback enabled? */
+ GLboolean Paused; /**< Is transform feedback paused? */
+ GLboolean EndedAnytime; /**< Has EndTransformFeedback been called
+ at least once? */
+
+ /** The feedback buffers */
+ GLuint BufferNames[MAX_FEEDBACK_ATTRIBS];
+ struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS];
+
+ /** Start of feedback data in dest buffer */
+ GLintptr Offset[MAX_FEEDBACK_ATTRIBS];
+ /** Max data to put into dest buffer (in bytes) */
+ GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS];
+};
+
+
+/**
+ * Context state for transform feedback.
+ */
+struct gl_transform_feedback_state
+{
+ GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */
+
+ /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */
+ struct gl_buffer_object *CurrentBuffer;
+
+ /** The table of all transform feedback objects */
+ struct _mesa_HashTable *Objects;
+
+ /** The current xform-fb object (GL_TRANSFORM_FEEDBACK_BINDING) */
+ struct gl_transform_feedback_object *CurrentObject;
+
+ /** The default xform-fb object (Name==0) */
+ struct gl_transform_feedback_object *DefaultObject;
+};
+
+
/**
* Names of the various vertex/fragment program register files, etc.
*
@@ -1834,58 +1890,23 @@ enum glsl_interp_qualifier
};
-/** Vertex and fragment instructions */
-struct prog_instruction;
-struct gl_program_parameter_list;
-struct gl_uniform_list;
-
-struct gl_transform_feedback_varying_info {
- char *Name;
- GLenum Type;
- GLint Size;
-};
-
-struct gl_transform_feedback_output {
- unsigned OutputRegister;
- unsigned OutputBuffer;
- unsigned NumComponents;
-
- /** offset (in DWORDs) of this output within the interleaved structure */
- unsigned DstOffset;
-
- /**
- * Offset into the output register of the data to output. For example,
- * if NumComponents is 2 and ComponentOffset is 1, then the data to
- * offset is in the y and z components of the output register.
- */
- unsigned ComponentOffset;
+/**
+ * \brief Layout qualifiers for gl_FragDepth.
+ *
+ * Extension AMD_conservative_depth allows gl_FragDepth to be redeclared with
+ * a layout qualifier.
+ *
+ * \see enum ir_depth_layout
+ */
+enum gl_frag_depth_layout
+{
+ FRAG_DEPTH_LAYOUT_NONE, /**< No layout is specified. */
+ FRAG_DEPTH_LAYOUT_ANY,
+ FRAG_DEPTH_LAYOUT_GREATER,
+ FRAG_DEPTH_LAYOUT_LESS,
+ FRAG_DEPTH_LAYOUT_UNCHANGED
};
-/** Post-link transform feedback info. */
-struct gl_transform_feedback_info {
- unsigned NumOutputs;
-
- /**
- * Number of transform feedback buffers in use by this program.
- */
- unsigned NumBuffers;
-
- struct gl_transform_feedback_output *Outputs;
-
- /** Transform feedback varyings used for the linking of this shader program.
- *
- * Use for glGetTransformFeedbackVarying().
- */
- struct gl_transform_feedback_varying_info *Varyings;
- GLint NumVarying;
-
- /**
- * Total number of components stored in each buffer. This may be used by
- * hardware back-ends to determine the correct stride when interleaving
- * multiple transform feedback outputs in the same buffer.
- */
- unsigned BufferStride[MAX_FEEDBACK_ATTRIBS];
-};
/**
* Base class for any kind of program object
@@ -2128,57 +2149,6 @@ struct gl_ati_fragment_shader_state
};
-/**
- * Occlusion/timer query object.
- */
-struct gl_query_object
-{
- GLenum Target; /**< The query target, when active */
- GLuint Id; /**< hash table ID/name */
- GLuint64EXT Result; /**< the counter */
- GLboolean Active; /**< inside Begin/EndQuery */
- GLboolean Ready; /**< result is ready? */
-};
-
-
-/**
- * Context state for query objects.
- */
-struct gl_query_state
-{
- struct _mesa_HashTable *QueryObjects;
- struct gl_query_object *CurrentOcclusionObject; /* GL_ARB_occlusion_query */
- struct gl_query_object *CurrentTimerObject; /* GL_EXT_timer_query */
-
- /** GL_NV_conditional_render */
- struct gl_query_object *CondRenderQuery;
-
- /** GL_EXT_transform_feedback */
- struct gl_query_object *PrimitivesGenerated;
- struct gl_query_object *PrimitivesWritten;
-
- /** GL_ARB_timer_query */
- struct gl_query_object *TimeElapsed;
-
- GLenum CondRenderMode;
-};
-
-
-/** Sync object state */
-struct gl_sync_object {
- struct simple_node link;
- GLenum Type; /**< GL_SYNC_FENCE */
- GLuint Name; /**< Fence name */
- GLint RefCount; /**< Reference count */
- GLboolean DeletePending; /**< Object was deleted while there were still
- * live references (e.g., sync not yet finished)
- */
- GLenum SyncCondition;
- GLbitfield Flags; /**< Flags passed to glFenceSync */
- GLuint StatusFlag:1; /**< Has the sync object been signaled? */
-};
-
-
/** Set by #pragma directives */
struct gl_sl_pragmas
{
@@ -2235,6 +2205,19 @@ struct gl_shader
/**
+ * Shader stages. Note that these will become 5 with tessellation.
+ * These MUST have the same values as gallium's PIPE_SHADER_*
+ */
+typedef enum
+{
+ MESA_SHADER_VERTEX = 0,
+ MESA_SHADER_FRAGMENT = 1,
+ MESA_SHADER_GEOMETRY = 2,
+ MESA_SHADER_TYPES = 3
+} gl_shader_type;
+
+
+/**
* A GLSL program object.
* Basically a linked collection of vertex and fragment shaders.
*/
@@ -2392,6 +2375,7 @@ struct gl_shader_state
GLbitfield Flags; /**< Mask of GLSL_x flags */
};
+
/**
* Compiler options for a single GLSL shaders type
*/
@@ -2424,50 +2408,58 @@ struct gl_shader_compiler_options
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
};
+
/**
- * Transform feedback object state
+ * Occlusion/timer query object.
*/
-struct gl_transform_feedback_object
+struct gl_query_object
{
- GLuint Name; /**< AKA the object ID */
- GLint RefCount;
- GLboolean Active; /**< Is transform feedback enabled? */
- GLboolean Paused; /**< Is transform feedback paused? */
- GLboolean EndedAnytime; /**< Has EndTransformFeedback been called
- at least once? */
-
- /** The feedback buffers */
- GLuint BufferNames[MAX_FEEDBACK_ATTRIBS];
- struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS];
-
- /** Start of feedback data in dest buffer */
- GLintptr Offset[MAX_FEEDBACK_ATTRIBS];
- /** Max data to put into dest buffer (in bytes) */
- GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS];
+ GLenum Target; /**< The query target, when active */
+ GLuint Id; /**< hash table ID/name */
+ GLuint64EXT Result; /**< the counter */
+ GLboolean Active; /**< inside Begin/EndQuery */
+ GLboolean Ready; /**< result is ready? */
};
/**
- * Context state for transform feedback.
+ * Context state for query objects.
*/
-struct gl_transform_feedback
+struct gl_query_state
{
- GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */
+ struct _mesa_HashTable *QueryObjects;
+ struct gl_query_object *CurrentOcclusionObject; /* GL_ARB_occlusion_query */
+ struct gl_query_object *CurrentTimerObject; /* GL_EXT_timer_query */
- /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */
- struct gl_buffer_object *CurrentBuffer;
+ /** GL_NV_conditional_render */
+ struct gl_query_object *CondRenderQuery;
- /** The table of all transform feedback objects */
- struct _mesa_HashTable *Objects;
+ /** GL_EXT_transform_feedback */
+ struct gl_query_object *PrimitivesGenerated;
+ struct gl_query_object *PrimitivesWritten;
- /** The current xform-fb object (GL_TRANSFORM_FEEDBACK_BINDING) */
- struct gl_transform_feedback_object *CurrentObject;
+ /** GL_ARB_timer_query */
+ struct gl_query_object *TimeElapsed;
- /** The default xform-fb object (Name==0) */
- struct gl_transform_feedback_object *DefaultObject;
+ GLenum CondRenderMode;
};
+/** Sync object state */
+struct gl_sync_object
+{
+ struct simple_node link;
+ GLenum Type; /**< GL_SYNC_FENCE */
+ GLuint Name; /**< Fence name */
+ GLint RefCount; /**< Reference count */
+ GLboolean DeletePending; /**< Object was deleted while there were still
+ * live references (e.g., sync not yet finished)
+ */
+ GLenum SyncCondition;
+ GLbitfield Flags; /**< Flags passed to glFenceSync */
+ GLuint StatusFlag:1; /**< Has the sync object been signaled? */
+};
+
/**
* State which can be shared by multiple contexts:
@@ -3337,7 +3329,7 @@ struct gl_context
struct gl_query_state Query; /**< occlusion, timer queries */
- struct gl_transform_feedback TransformFeedback;
+ struct gl_transform_feedback_state TransformFeedback;
struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */
@@ -3380,10 +3372,6 @@ struct gl_context
GLuint TextureStateTimestamp; /**< detect changes to shared state */
- struct gl_shine_tab *_ShineTable[2]; /**< Active shine tables */
- struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */
- /**@}*/
-
struct gl_list_extensions *ListExt; /**< driver dlist extensions */
/** \name For debugging/development only */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 5328ae296..4fb81e62d 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1844,23 +1844,25 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
if (dimensions > 1) {
- if (yoffset < -((GLint)destTex->Border)) {
+ GLint yBorder = (target == GL_TEXTURE_1D_ARRAY) ? 0 : destTex->Border;
+ if (yoffset < -yBorder) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset)",
dimensions);
return GL_TRUE;
}
- if (yoffset + height > (GLint) (destTex->Height + destTex->Border)) {
+ if (yoffset + height > (GLint) destTex->Height + yBorder) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(yoffset+height)",
dimensions);
return GL_TRUE;
}
}
if (dimensions > 2) {
- if (zoffset < -((GLint)destTex->Border)) {
+ GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : destTex->Border;
+ if (zoffset < -zBorder) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
return GL_TRUE;
}
- if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) {
+ if (zoffset + depth > (GLint) destTex->Depth + zBorder) {
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
return GL_TRUE;
}
@@ -2163,13 +2165,14 @@ copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
if (dimensions > 1) {
- if (yoffset < -((GLint)teximage->Border)) {
+ GLint yBorder = (target == GL_TEXTURE_1D_ARRAY) ? 0 : teximage->Border;
+ if (yoffset < -yBorder) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset);
return GL_TRUE;
}
/* NOTE: we're adding the border here, not subtracting! */
- if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) {
+ if (yoffset + height > (GLint) teximage->Height + yBorder) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCopyTexSubImage%dD(yoffset+height)", dimensions);
return GL_TRUE;
@@ -2178,12 +2181,13 @@ copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
/* check z offset */
if (dimensions > 2) {
- if (zoffset < -((GLint)teximage->Border)) {
+ GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : teximage->Border;
+ if (zoffset < -zBorder) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCopyTexSubImage%dD(zoffset)", dimensions);
return GL_TRUE;
}
- if (zoffset > (GLint) (teximage->Depth + teximage->Border)) {
+ if (zoffset > (GLint) teximage->Depth + zBorder) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCopyTexSubImage%dD(zoffset+depth)", dimensions);
return GL_TRUE;
@@ -2759,10 +2763,12 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
/* If we have a border, offset=-1 is legal. Bias by border width. */
switch (dims) {
case 3:
- zoffset += texImage->Border;
+ if (target != GL_TEXTURE_2D_ARRAY)
+ zoffset += texImage->Border;
/* fall-through */
case 2:
- yoffset += texImage->Border;
+ if (target != GL_TEXTURE_1D_ARRAY)
+ yoffset += texImage->Border;
/* fall-through */
case 1:
xoffset += texImage->Border;
@@ -3034,10 +3040,12 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
/* If we have a border, offset=-1 is legal. Bias by border width. */
switch (dims) {
case 3:
- zoffset += texImage->Border;
+ if (target != GL_TEXTURE_2D_ARRAY)
+ zoffset += texImage->Border;
/* fall-through */
case 2:
- yoffset += texImage->Border;
+ if (target != GL_TEXTURE_1D_ARRAY)
+ yoffset += texImage->Border;
/* fall-through */
case 1:
xoffset += texImage->Border;
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 39d3a27e0..a402c7b22 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -1117,8 +1117,9 @@ _mesa_PrimitiveRestartIndex(GLuint index)
void GLAPIENTRY
_mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
{
+ struct gl_client_array *array;
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!ctx->Extensions.ARB_instanced_arrays) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribDivisor()");
@@ -1133,7 +1134,12 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->VertexAttrib));
- ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].InstanceDivisor = divisor;
+ array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)];
+ if (array->InstanceDivisor != divisor) {
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
+ array->InstanceDivisor = divisor;
+ ctx->Array.NewState |= VERT_BIT(VERT_ATTRIB_GENERIC(index));
+ }
}
diff --git a/mesalib/src/mesa/main/vtxfmt.c b/mesalib/src/mesa/main/vtxfmt.c
index f3cca937d..6fb016b9e 100644
--- a/mesalib/src/mesa/main/vtxfmt.c
+++ b/mesalib/src/mesa/main/vtxfmt.c
@@ -41,7 +41,7 @@
#if FEATURE_beginend
/**
- * Use the per-vertex functions found in <vfmt> to initialoze the given
+ * Use the per-vertex functions found in <vfmt> to initialize the given
* API dispatch table.
*/
static void