aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-03-18 16:33:08 +0100
committermarha <marha@users.sourceforge.net>2013-03-18 16:33:08 +0100
commit9c17f511266fff48a936633de280f271f0ce0c11 (patch)
treed34a68ecb0949f09e997031c66e1a3024903e3c8 /mesalib/src/mesa/main
parent514e0809a42027e2178bf0eccd526a08da60f399 (diff)
downloadvcxsrv-9c17f511266fff48a936633de280f271f0ce0c11.tar.gz
vcxsrv-9c17f511266fff48a936633de280f271f0ce0c11.tar.bz2
vcxsrv-9c17f511266fff48a936633de280f271f0ce0c11.zip
libX11 mesa git update 18 Mar 2013
libX11 commit f49bb2dd6d4ea45c55bd21acc0efe2b764441020 mesa commit 2da8ee16a8b126d15f34552916c77b203be326db
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/compiler.h56
-rw-r--r--mesalib/src/mesa/main/context.c16
-rw-r--r--mesalib/src/mesa/main/errors.c8
-rw-r--r--mesalib/src/mesa/main/fbobject.c4
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp45
-rw-r--r--mesalib/src/mesa/main/ffvertex_prog.c52
-rw-r--r--mesalib/src/mesa/main/mtypes.h275
-rw-r--r--mesalib/src/mesa/main/state.h2
-rw-r--r--mesalib/src/mesa/main/teximage.c22
-rw-r--r--mesalib/src/mesa/main/texstate.c2
-rw-r--r--mesalib/src/mesa/main/version.c2
-rw-r--r--mesalib/src/mesa/main/version.h11
12 files changed, 163 insertions, 332 deletions
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index b22b99485..48712485a 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -48,6 +48,8 @@
#include <float.h>
#include <stdarg.h>
+#include "c99_compat.h" /* inline, __func__, etc. */
+
#ifdef __cplusplus
extern "C" {
@@ -111,30 +113,7 @@ extern "C" {
-/**
- * Function inlining
- */
-#ifndef inline
-# ifdef __cplusplus
- /* C++ supports inline keyword */
-# elif defined(__GNUC__)
-# define inline __inline__
-# elif defined(_MSC_VER)
-# define inline __inline
-# elif defined(__ICL)
-# define inline __inline
-# elif defined(__INTEL_COMPILER)
- /* Intel compiler supports inline keyword */
-# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
-# define inline __inline
-# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
- /* C99 supports inline keyword */
-# elif (__STDC_VERSION__ >= 199901L)
- /* C99 supports inline keyword */
-# else
-# define inline
-# endif
-#endif
+/* XXX: Use standard `inline` keyword instead */
#ifndef INLINE
# define INLINE inline
#endif
@@ -177,35 +156,10 @@ extern "C" {
# endif
#endif
-/**
- * The __FUNCTION__ gcc variable is generally only used for debugging.
- * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
- * Don't define it if using a newer Windows compiler.
- */
+/* XXX: Use standard `__func__` instead */
#ifndef __FUNCTION__
-# if !defined(__GNUC__) && !defined(__xlC__) && \
- (!defined(_MSC_VER) || _MSC_VER < 1300)
-# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
- (defined(__SUNPRO_C) && defined(__C99FEATURES__))
-# define __FUNCTION__ __func__
-# else
-# define __FUNCTION__ "<unknown>"
-# endif
-# endif
+# define __FUNCTION__ __func__
#endif
-#ifndef __func__
-# if (__STDC_VERSION__ >= 199901L) || \
- (defined(__SUNPRO_C) && defined(__C99FEATURES__))
- /* __func__ is part of C99 */
-# elif defined(_MSC_VER)
-# if _MSC_VER >= 1300
-# define __func__ __FUNCTION__
-# else
-# define __func__ "<unknown>"
-# endif
-# endif
-#endif
-
/**
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index cdcf7adfa..053993421 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -344,23 +344,17 @@ dummy_enum_func(void)
{
gl_buffer_index bi = BUFFER_FRONT_LEFT;
gl_face_index fi = FACE_POS_X;
- gl_frag_attrib fa = FRAG_ATTRIB_WPOS;
gl_frag_result fr = FRAG_RESULT_DEPTH;
gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX;
gl_vert_attrib va = VERT_ATTRIB_POS;
- gl_vert_result vr = VERT_RESULT_HPOS;
- gl_geom_attrib ga = GEOM_ATTRIB_POSITION;
- gl_geom_result gr = GEOM_RESULT_POS;
+ gl_varying_slot vs = VARYING_SLOT_POS;
(void) bi;
(void) fi;
- (void) fa;
(void) fr;
(void) ti;
(void) va;
- (void) vr;
- (void) ga;
- (void) gr;
+ (void) vs;
}
@@ -410,7 +404,7 @@ one_time_init( struct gl_context *ctx )
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
if (MESA_VERBOSE != 0) {
_mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
- MESA_VERSION_STRING, __DATE__, __TIME__);
+ PACKAGE_VERSION, __DATE__, __TIME__);
}
#endif
@@ -677,9 +671,9 @@ static void
check_context_limits(struct gl_context *ctx)
{
/* check that we don't exceed the size of various bitfields */
- assert(VERT_RESULT_MAX <=
+ assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
- assert(FRAG_ATTRIB_MAX <=
+ assert(VARYING_SLOT_MAX <=
(8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield));
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 97f1b8a03..5c6a393e4 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -651,8 +651,8 @@ _mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type,
return;
}
- source = gl_enum_to_debug_severity(gl_source);
- type = gl_enum_to_debug_severity(gl_type);
+ source = gl_enum_to_debug_source(gl_source);
+ type = gl_enum_to_debug_type(gl_type);
severity = gl_enum_to_debug_severity(gl_severity);
control_app_messages(ctx, source, type, severity, count, ids, enabled);
@@ -848,8 +848,8 @@ _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... )
_mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
va_end( args );
fprintf(stderr, "Mesa %s implementation error: %s\n",
- MESA_VERSION_STRING, str);
- fprintf(stderr, "Please report at bugs.freedesktop.org\n");
+ PACKAGE_VERSION, str);
+ fprintf(stderr, "Please report at " PACKAGE_BUGREPORT "\n");
}
}
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index d6acc5896..0126e2930 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -3190,7 +3190,9 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
}
}
- if (!mask) {
+ if (!mask ||
+ (srcX1 - srcX0) == 0 || (srcY1 - srcY0) == 0 ||
+ (dstX1 - dstX0) == 0 || (dstY1 - dstY0) == 0) {
return;
}
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 02b4707f0..186988bbd 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -304,7 +304,6 @@ static GLuint translate_tex_src_bit( GLbitfield bit )
#define VERT_BIT_TEX_ANY (0xff << VERT_ATTRIB_TEX0)
-#define VERT_RESULT_TEX_ANY (0xff << VERT_RESULT_TEX0)
/**
* Identify all possible varying inputs. The fragment program will
@@ -334,7 +333,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
}
else if (ctx->RenderMode == GL_FEEDBACK) {
/* _NEW_RENDERMODE */
- fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
+ fp_inputs = (VARYING_BIT_COL0 | VARYING_BIT_TEX0);
}
else if (!(vertexProgram || vertexShader)) {
/* Fixed function vertex logic */
@@ -346,33 +345,33 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
*/
/* _NEW_POINT */
if (ctx->Point.PointSprite)
- varying_inputs |= FRAG_BITS_TEX_ANY;
+ varying_inputs |= VARYING_BITS_TEX_ANY;
/* First look at what values may be computed by the generated
* vertex program:
*/
/* _NEW_LIGHT */
if (ctx->Light.Enabled) {
- fp_inputs |= FRAG_BIT_COL0;
+ fp_inputs |= VARYING_BIT_COL0;
if (texenv_doing_secondary_color(ctx))
- fp_inputs |= FRAG_BIT_COL1;
+ fp_inputs |= VARYING_BIT_COL1;
}
/* _NEW_TEXTURE */
fp_inputs |= (ctx->Texture._TexGenEnabled |
- ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0;
+ ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0;
/* Then look at what might be varying as a result of enabled
* arrays, etc:
*/
if (varying_inputs & VERT_BIT_COLOR0)
- fp_inputs |= FRAG_BIT_COL0;
+ fp_inputs |= VARYING_BIT_COL0;
if (varying_inputs & VERT_BIT_COLOR1)
- fp_inputs |= FRAG_BIT_COL1;
+ fp_inputs |= VARYING_BIT_COL1;
fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0)
- << FRAG_ATTRIB_TEX0);
+ << VARYING_SLOT_TEX0);
}
else {
@@ -396,15 +395,15 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
*/
/* _NEW_POINT */
if (ctx->Point.PointSprite)
- vp_outputs |= FRAG_BITS_TEX_ANY;
+ vp_outputs |= VARYING_BITS_TEX_ANY;
- if (vp_outputs & (1 << VERT_RESULT_COL0))
- fp_inputs |= FRAG_BIT_COL0;
- if (vp_outputs & (1 << VERT_RESULT_COL1))
- fp_inputs |= FRAG_BIT_COL1;
+ if (vp_outputs & (1 << VARYING_SLOT_COL0))
+ fp_inputs |= VARYING_BIT_COL0;
+ if (vp_outputs & (1 << VARYING_SLOT_COL1))
+ fp_inputs |= VARYING_BIT_COL1;
- fp_inputs |= (((vp_outputs & VERT_RESULT_TEX_ANY) >> VERT_RESULT_TEX0)
- << FRAG_ATTRIB_TEX0);
+ fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0)
+ << VARYING_SLOT_TEX0);
}
return fp_inputs;
@@ -418,7 +417,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
{
GLuint i, j;
- GLbitfield inputs_referenced = FRAG_BIT_COL0;
+ GLbitfield inputs_referenced = VARYING_BIT_COL0;
const GLbitfield inputs_available = get_fp_input_mask( ctx );
GLuint keySize;
@@ -441,7 +440,7 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
key->unit[i].enabled = 1;
key->enabled_units |= (1<<i);
key->nr_enabled_units = i + 1;
- inputs_referenced |= FRAG_BIT_TEX(i);
+ inputs_referenced |= VARYING_BIT_TEX(i);
key->unit[i].source_index =
translate_tex_src_bit(texUnit->_ReallyEnabled);
@@ -483,14 +482,14 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
/* _NEW_LIGHT | _NEW_FOG */
if (texenv_doing_secondary_color(ctx)) {
key->separate_specular = 1;
- inputs_referenced |= FRAG_BIT_COL1;
+ inputs_referenced |= VARYING_BIT_COL1;
}
/* _NEW_FOG */
if (ctx->Fog.Enabled) {
key->fog_enabled = 1;
key->fog_mode = translate_fog_mode(ctx->Fog.Mode);
- inputs_referenced |= FRAG_BIT_FOGC; /* maybe */
+ inputs_referenced |= VARYING_BIT_FOGC; /* maybe */
}
/* _NEW_BUFFERS */
@@ -554,7 +553,7 @@ get_current_attrib(texenv_fragment_program *p, GLuint attrib)
static ir_rvalue *
get_gl_Color(texenv_fragment_program *p)
{
- if (p->state->inputs_available & FRAG_BIT_COL0) {
+ if (p->state->inputs_available & VARYING_BIT_COL0) {
ir_variable *var = p->shader->symbols->get_variable("gl_Color");
assert(var);
return new(p->mem_ctx) ir_dereference_variable(var);
@@ -919,7 +918,7 @@ static void load_texture( texenv_fragment_program *p, GLuint unit )
const GLuint texTarget = p->state->unit[unit].source_index;
ir_rvalue *texcoord;
- if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) {
+ if (!(p->state->inputs_available & (VARYING_BIT_TEX0 << unit))) {
texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit);
} else if (p->texcoord_tex[unit]) {
texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]);
@@ -1254,7 +1253,7 @@ emit_instructions(texenv_fragment_program *p)
p->emit(assign(spec_result, cf));
ir_rvalue *secondary;
- if (p->state->inputs_available & FRAG_BIT_COL1) {
+ if (p->state->inputs_available & VARYING_BIT_COL1) {
ir_variable *var =
p->shader->symbols->get_variable("gl_SecondaryColor");
assert(var);
diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c
index efdca015e..093bc6651 100644
--- a/mesalib/src/mesa/main/ffvertex_prog.c
+++ b/mesalib/src/mesa/main/ffvertex_prog.c
@@ -165,7 +165,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
if (ctx->RenderMode == GL_FEEDBACK) {
/* make sure the vertprog emits color and tex0 */
- key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0);
+ key->fragprog_inputs_read |= (VARYING_BIT_COL0 | VARYING_BIT_TEX0);
}
key->separate_specular = (ctx->Light.Model.ColorControl ==
@@ -456,7 +456,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
/**
- * \param input one of VERT_RESULT_x tokens.
+ * \param input one of VARYING_SLOT_x tokens.
*/
static struct ureg register_output( struct tnl_program *p, GLuint output )
{
@@ -833,7 +833,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
static void build_hpos( struct tnl_program *p )
{
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
- struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
+ struct ureg hpos = register_output( p, VARYING_SLOT_POS );
struct ureg mvp[4];
if (p->mvp_with_dp4) {
@@ -1088,22 +1088,22 @@ static void build_lighting( struct tnl_program *p )
/* If no lights, still need to emit the scenecolor.
*/
{
- struct ureg res0 = register_output( p, VERT_RESULT_COL0 );
+ struct ureg res0 = register_output( p, VARYING_SLOT_COL0 );
emit_op1(p, OPCODE_MOV, res0, 0, _col0);
}
if (separate) {
- struct ureg res1 = register_output( p, VERT_RESULT_COL1 );
+ struct ureg res1 = register_output( p, VARYING_SLOT_COL1 );
emit_op1(p, OPCODE_MOV, res1, 0, _col1);
}
if (twoside) {
- struct ureg res0 = register_output( p, VERT_RESULT_BFC0 );
+ struct ureg res0 = register_output( p, VARYING_SLOT_BFC0 );
emit_op1(p, OPCODE_MOV, res0, 0, _bfc0);
}
if (twoside && separate) {
- struct ureg res1 = register_output( p, VERT_RESULT_BFC1 );
+ struct ureg res1 = register_output( p, VARYING_SLOT_BFC1 );
emit_op1(p, OPCODE_MOV, res1, 0, _bfc1);
}
@@ -1189,14 +1189,14 @@ static void build_lighting( struct tnl_program *p )
if (separate) {
mask0 = WRITEMASK_XYZ;
mask1 = WRITEMASK_XYZ;
- res0 = register_output( p, VERT_RESULT_COL0 );
- res1 = register_output( p, VERT_RESULT_COL1 );
+ res0 = register_output( p, VARYING_SLOT_COL0 );
+ res1 = register_output( p, VARYING_SLOT_COL1 );
}
else {
mask0 = 0;
mask1 = WRITEMASK_XYZ;
res0 = _col0;
- res1 = register_output( p, VERT_RESULT_COL0 );
+ res1 = register_output( p, VARYING_SLOT_COL0 );
}
}
else {
@@ -1244,14 +1244,14 @@ static void build_lighting( struct tnl_program *p )
if (separate) {
mask0 = WRITEMASK_XYZ;
mask1 = WRITEMASK_XYZ;
- res0 = register_output( p, VERT_RESULT_BFC0 );
- res1 = register_output( p, VERT_RESULT_BFC1 );
+ res0 = register_output( p, VARYING_SLOT_BFC0 );
+ res1 = register_output( p, VARYING_SLOT_BFC1 );
}
else {
mask0 = 0;
mask1 = WRITEMASK_XYZ;
res0 = _bfc0;
- res1 = register_output( p, VERT_RESULT_BFC0 );
+ res1 = register_output( p, VARYING_SLOT_BFC0 );
}
}
else {
@@ -1306,7 +1306,7 @@ static void build_lighting( struct tnl_program *p )
static void build_fog( struct tnl_program *p )
{
- struct ureg fog = register_output(p, VERT_RESULT_FOGC);
+ struct ureg fog = register_output(p, VARYING_SLOT_FOGC);
struct ureg input;
if (p->state->fog_source_is_depth) {
@@ -1407,7 +1407,7 @@ static void build_texture_transform( struct tnl_program *p )
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
- if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
+ if (!(p->state->fragprog_inputs_read & VARYING_BIT_TEX(i)))
continue;
if (p->state->unit[i].coord_replace)
@@ -1417,7 +1417,7 @@ static void build_texture_transform( struct tnl_program *p )
p->state->unit[i].texmat_enabled) {
GLuint texmat_enabled = p->state->unit[i].texmat_enabled;
- struct ureg out = register_output(p, VERT_RESULT_TEX0 + i);
+ struct ureg out = register_output(p, VARYING_SLOT_TEX0 + i);
struct ureg out_texgen = undef;
if (p->state->unit[i].texgen_enabled) {
@@ -1512,7 +1512,7 @@ static void build_texture_transform( struct tnl_program *p )
release_temps(p);
}
else {
- emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
+ emit_passthrough(p, VERT_ATTRIB_TEX0+i, VARYING_SLOT_TEX0+i);
}
}
}
@@ -1526,7 +1526,7 @@ static void build_atten_pointsize( struct tnl_program *p )
struct ureg eye = get_eye_position_z(p);
struct ureg state_size = register_param2(p, STATE_INTERNAL, STATE_POINT_SIZE_CLAMPED);
struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
- struct ureg out = register_output(p, VERT_RESULT_PSIZ);
+ struct ureg out = register_output(p, VARYING_SLOT_PSIZ);
struct ureg ut = get_temp(p);
/* dist = |eyez| */
@@ -1562,7 +1562,7 @@ static void build_atten_pointsize( struct tnl_program *p )
static void build_array_pointsize( struct tnl_program *p )
{
struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE);
- struct ureg out = register_output(p, VERT_RESULT_PSIZ);
+ struct ureg out = register_output(p, VARYING_SLOT_PSIZ);
emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in);
}
@@ -1575,22 +1575,22 @@ static void build_tnl_program( struct tnl_program *p )
/* Lighting calculations:
*/
- if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) {
+ if (p->state->fragprog_inputs_read & (VARYING_BIT_COL0|VARYING_BIT_COL1)) {
if (p->state->light_global_enabled)
build_lighting(p);
else {
- if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
- emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
+ if (p->state->fragprog_inputs_read & VARYING_BIT_COL0)
+ emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0);
- if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
- emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
+ if (p->state->fragprog_inputs_read & VARYING_BIT_COL1)
+ emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1);
}
}
- if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC)
+ if (p->state->fragprog_inputs_read & VARYING_BIT_FOGC)
build_fog(p);
- if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY)
+ if (p->state->fragprog_inputs_read & VARYING_BITS_TEX_ANY)
build_texture_transform(p);
if (p->state->point_attenuated)
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 4f0951339..83b6c8984 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -209,212 +209,103 @@ typedef enum
/**
- * Indexes for vertex program result attributes. Note that
- * _mesa_vert_result_to_frag_attrib() and _mesa_frag_attrib_to_vert_result() make
- * assumptions about the layout of this enum.
- */
-typedef enum
-{
- VERT_RESULT_HPOS = 0,
- VERT_RESULT_COL0 = 1,
- VERT_RESULT_COL1 = 2,
- VERT_RESULT_FOGC = 3,
- VERT_RESULT_TEX0 = 4,
- VERT_RESULT_TEX1 = 5,
- VERT_RESULT_TEX2 = 6,
- VERT_RESULT_TEX3 = 7,
- VERT_RESULT_TEX4 = 8,
- VERT_RESULT_TEX5 = 9,
- VERT_RESULT_TEX6 = 10,
- VERT_RESULT_TEX7 = 11,
- VERT_RESULT_PSIZ = 12,
- VERT_RESULT_BFC0 = 13,
- VERT_RESULT_BFC1 = 14,
- VERT_RESULT_EDGE = 15,
- VERT_RESULT_CLIP_VERTEX = 16,
- VERT_RESULT_CLIP_DIST0 = 17,
- VERT_RESULT_CLIP_DIST1 = 18,
- VERT_RESULT_VAR0 = 19, /**< shader varying */
- VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
-} gl_vert_result;
-
-
-/*********************************************/
-
-/**
- * Indexes for geometry program attributes.
+ * Indexes for vertex shader outputs, geometry shader inputs/outputs, and
+ * fragment shader inputs.
+ *
+ * Note that some of these values are not available to all pipeline stages.
+ *
+ * When this enum is updated, the following code must be updated too:
+ * - vertResults (in prog_print.c's arb_output_attrib_string())
+ * - fragAttribs (in prog_print.c's arb_input_attrib_string())
+ * - _mesa_varying_slot_in_fs()
*/
typedef enum
{
- GEOM_ATTRIB_POSITION = 0,
- GEOM_ATTRIB_COLOR0 = 1,
- GEOM_ATTRIB_COLOR1 = 2,
- GEOM_ATTRIB_SECONDARY_COLOR0 = 3,
- GEOM_ATTRIB_SECONDARY_COLOR1 = 4,
- GEOM_ATTRIB_FOG_FRAG_COORD = 5,
- GEOM_ATTRIB_POINT_SIZE = 6,
- GEOM_ATTRIB_CLIP_VERTEX = 7,
- GEOM_ATTRIB_PRIMITIVE_ID = 8,
- GEOM_ATTRIB_TEX_COORD = 9,
-
- GEOM_ATTRIB_VAR0 = 16,
- GEOM_ATTRIB_MAX = (GEOM_ATTRIB_VAR0 + MAX_VARYING)
-} gl_geom_attrib;
-
-/**
- * Bitflags for geometry attributes.
- * These are used in bitfields in many places.
+ VARYING_SLOT_POS,
+ VARYING_SLOT_COL0, /* COL0 and COL1 must be contiguous */
+ VARYING_SLOT_COL1,
+ VARYING_SLOT_FOGC,
+ VARYING_SLOT_TEX0, /* TEX0-TEX7 must be contiguous */
+ VARYING_SLOT_TEX1,
+ VARYING_SLOT_TEX2,
+ VARYING_SLOT_TEX3,
+ VARYING_SLOT_TEX4,
+ VARYING_SLOT_TEX5,
+ VARYING_SLOT_TEX6,
+ VARYING_SLOT_TEX7,
+ VARYING_SLOT_PSIZ, /* Does not appear in FS */
+ VARYING_SLOT_BFC0, /* Does not appear in FS */
+ VARYING_SLOT_BFC1, /* Does not appear in FS */
+ VARYING_SLOT_EDGE, /* Does not appear in FS */
+ VARYING_SLOT_CLIP_VERTEX, /* Does not appear in FS */
+ VARYING_SLOT_CLIP_DIST0,
+ VARYING_SLOT_CLIP_DIST1,
+ VARYING_SLOT_PRIMITIVE_ID, /* Does not appear in VS */
+ VARYING_SLOT_LAYER, /* Appears only as GS output */
+ VARYING_SLOT_FACE, /* FS only */
+ VARYING_SLOT_PNTC, /* FS only */
+ VARYING_SLOT_VAR0, /* First generic varying slot */
+ VARYING_SLOT_MAX = VARYING_SLOT_VAR0 + MAX_VARYING
+} gl_varying_slot;
+
+
+/**
+ * Bitflags for varying slots.
*/
/*@{*/
-#define GEOM_BIT_COLOR0 (1 << GEOM_ATTRIB_COLOR0)
-#define GEOM_BIT_COLOR1 (1 << GEOM_ATTRIB_COLOR1)
-#define GEOM_BIT_SCOLOR0 (1 << GEOM_ATTRIB_SECONDARY_COLOR0)
-#define GEOM_BIT_SCOLOR1 (1 << GEOM_ATTRIB_SECONDARY_COLOR1)
-#define GEOM_BIT_TEX_COORD (1 << GEOM_ATTRIB_TEX_COORD)
-#define GEOM_BIT_FOG_COORD (1 << GEOM_ATTRIB_FOG_FRAG_COORD)
-#define GEOM_BIT_POSITION (1 << GEOM_ATTRIB_POSITION)
-#define GEOM_BIT_POINT_SIDE (1 << GEOM_ATTRIB_POINT_SIZE)
-#define GEOM_BIT_CLIP_VERTEX (1 << GEOM_ATTRIB_CLIP_VERTEX)
-#define GEOM_BIT_PRIM_ID (1 << GEOM_ATTRIB_PRIMITIVE_ID)
-#define GEOM_BIT_VAR0 (1 << GEOM_ATTRIB_VAR0)
-
-#define GEOM_BIT_VAR(g) (1 << (GEOM_BIT_VAR0 + (g)))
+#define VARYING_BIT_POS BITFIELD64_BIT(VARYING_SLOT_POS)
+#define VARYING_BIT_COL0 BITFIELD64_BIT(VARYING_SLOT_COL0)
+#define VARYING_BIT_COL1 BITFIELD64_BIT(VARYING_SLOT_COL1)
+#define VARYING_BIT_FOGC BITFIELD64_BIT(VARYING_SLOT_FOGC)
+#define VARYING_BIT_TEX0 BITFIELD64_BIT(VARYING_SLOT_TEX0)
+#define VARYING_BIT_TEX1 BITFIELD64_BIT(VARYING_SLOT_TEX1)
+#define VARYING_BIT_TEX2 BITFIELD64_BIT(VARYING_SLOT_TEX2)
+#define VARYING_BIT_TEX3 BITFIELD64_BIT(VARYING_SLOT_TEX3)
+#define VARYING_BIT_TEX4 BITFIELD64_BIT(VARYING_SLOT_TEX4)
+#define VARYING_BIT_TEX5 BITFIELD64_BIT(VARYING_SLOT_TEX5)
+#define VARYING_BIT_TEX6 BITFIELD64_BIT(VARYING_SLOT_TEX6)
+#define VARYING_BIT_TEX7 BITFIELD64_BIT(VARYING_SLOT_TEX7)
+#define VARYING_BIT_TEX(U) BITFIELD64_BIT(VARYING_SLOT_TEX0 + (U))
+#define VARYING_BITS_TEX_ANY BITFIELD64_RANGE(VARYING_SLOT_TEX0, \
+ MAX_TEXTURE_COORD_UNITS)
+#define VARYING_BIT_PSIZ BITFIELD64_BIT(VARYING_SLOT_PSIZ)
+#define VARYING_BIT_BFC0 BITFIELD64_BIT(VARYING_SLOT_BFC0)
+#define VARYING_BIT_BFC1 BITFIELD64_BIT(VARYING_SLOT_BFC1)
+#define VARYING_BIT_EDGE BITFIELD64_BIT(VARYING_SLOT_EDGE)
+#define VARYING_BIT_CLIP_VERTEX BITFIELD64_BIT(VARYING_SLOT_CLIP_VERTEX)
+#define VARYING_BIT_CLIP_DIST0 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST0)
+#define VARYING_BIT_CLIP_DIST1 BITFIELD64_BIT(VARYING_SLOT_CLIP_DIST1)
+#define VARYING_BIT_PRIMITIVE_ID BITFIELD64_BIT(VARYING_SLOT_PRIMITIVE_ID)
+#define VARYING_BIT_LAYER BITFIELD64_BIT(VARYING_SLOT_LAYER)
+#define VARYING_BIT_FACE BITFIELD64_BIT(VARYING_SLOT_FACE)
+#define VARYING_BIT_PNTC BITFIELD64_BIT(VARYING_SLOT_PNTC)
+#define VARYING_BIT_VAR(V) BITFIELD64_BIT(VARYING_SLOT_VAR0 + (V))
/*@}*/
+/*********************************************/
+
/**
- * Indexes for geometry program result attributes
- */
-typedef enum
-{
- GEOM_RESULT_POS = 0,
- GEOM_RESULT_COL0 = 1,
- GEOM_RESULT_COL1 = 2,
- GEOM_RESULT_SCOL0 = 3,
- GEOM_RESULT_SCOL1 = 4,
- GEOM_RESULT_FOGC = 5,
- GEOM_RESULT_TEX0 = 6,
- GEOM_RESULT_TEX1 = 7,
- GEOM_RESULT_TEX2 = 8,
- GEOM_RESULT_TEX3 = 9,
- GEOM_RESULT_TEX4 = 10,
- GEOM_RESULT_TEX5 = 11,
- GEOM_RESULT_TEX6 = 12,
- GEOM_RESULT_TEX7 = 13,
- GEOM_RESULT_PSIZ = 14,
- GEOM_RESULT_CLPV = 15,
- GEOM_RESULT_PRID = 16,
- GEOM_RESULT_LAYR = 17,
- GEOM_RESULT_VAR0 = 18, /**< shader varying, should really be 16 */
- /* ### we need to -2 because var0 is 18 instead 16 like in the others */
- GEOM_RESULT_MAX = (GEOM_RESULT_VAR0 + MAX_VARYING - 2)
-} gl_geom_result;
-
-
-/**
- * Indexes for fragment program input attributes. Note that
- * _mesa_vert_result_to_frag_attrib() and frag_attrib_to_vert_result() make
- * assumptions about the layout of this enum.
+ * Determine if the given gl_varying_slot appears in the fragment shader.
*/
-typedef enum
+static inline GLboolean
+_mesa_varying_slot_in_fs(gl_varying_slot slot)
{
- FRAG_ATTRIB_WPOS = 0,
- FRAG_ATTRIB_COL0 = 1,
- FRAG_ATTRIB_COL1 = 2,
- FRAG_ATTRIB_FOGC = 3,
- FRAG_ATTRIB_TEX0 = 4,
- FRAG_ATTRIB_TEX1 = 5,
- FRAG_ATTRIB_TEX2 = 6,
- FRAG_ATTRIB_TEX3 = 7,
- FRAG_ATTRIB_TEX4 = 8,
- FRAG_ATTRIB_TEX5 = 9,
- FRAG_ATTRIB_TEX6 = 10,
- FRAG_ATTRIB_TEX7 = 11,
- FRAG_ATTRIB_FACE = 12, /**< front/back face */
- FRAG_ATTRIB_PNTC = 13, /**< sprite/point coord */
- FRAG_ATTRIB_CLIP_DIST0 = 14,
- FRAG_ATTRIB_CLIP_DIST1 = 15,
- FRAG_ATTRIB_VAR0 = 16, /**< shader varying */
- FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
-} gl_frag_attrib;
-
-
-/**
- * Convert from a gl_vert_result value to the corresponding gl_frag_attrib.
- *
- * VERT_RESULT_HPOS is converted to FRAG_ATTRIB_WPOS.
- *
- * gl_vert_result values which have no corresponding gl_frag_attrib
- * (VERT_RESULT_PSIZ, VERT_RESULT_BFC0, VERT_RESULT_BFC1, and
- * VERT_RESULT_EDGE) are converted to a value of -1.
- */
-static inline int
-_mesa_vert_result_to_frag_attrib(gl_vert_result vert_result)
-{
- if (vert_result >= VERT_RESULT_CLIP_DIST0)
- return vert_result - VERT_RESULT_CLIP_DIST0 + FRAG_ATTRIB_CLIP_DIST0;
- else if (vert_result <= VERT_RESULT_TEX7)
- return vert_result;
- else
- return -1;
+ switch (slot) {
+ case VARYING_SLOT_PSIZ:
+ case VARYING_SLOT_BFC0:
+ case VARYING_SLOT_BFC1:
+ case VARYING_SLOT_EDGE:
+ case VARYING_SLOT_CLIP_VERTEX:
+ case VARYING_SLOT_LAYER:
+ return GL_FALSE;
+ default:
+ return GL_TRUE;
+ }
}
/**
- * Convert from a gl_frag_attrib value to the corresponding gl_vert_result.
- *
- * FRAG_ATTRIB_WPOS is converted to VERT_RESULT_HPOS.
- *
- * gl_frag_attrib values which have no corresponding gl_vert_result
- * (FRAG_ATTRIB_FACE and FRAG_ATTRIB_PNTC) are converted to a value of -1.
- */
-static inline int
-_mesa_frag_attrib_to_vert_result(gl_frag_attrib frag_attrib)
-{
- if (frag_attrib <= FRAG_ATTRIB_TEX7)
- return frag_attrib;
- else if (frag_attrib >= FRAG_ATTRIB_CLIP_DIST0)
- return frag_attrib - FRAG_ATTRIB_CLIP_DIST0 + VERT_RESULT_CLIP_DIST0;
- else
- return -1;
-}
-
-
-/**
- * Bitflags for fragment program input attributes.
- */
-/*@{*/
-#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
-#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
-#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
-#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
-#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE)
-#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC)
-#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
-#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
-#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
-#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
-#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
-#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
-#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
-#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
-#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0)
-
-#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U))
-#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V))
-
-#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \
- FRAG_BIT_TEX1| \
- FRAG_BIT_TEX2| \
- FRAG_BIT_TEX3| \
- FRAG_BIT_TEX4| \
- FRAG_BIT_TEX5| \
- FRAG_BIT_TEX6| \
- FRAG_BIT_TEX7)
-/*@}*/
-
-
-/**
* Fragment program results
*/
typedef enum
@@ -2065,7 +1956,7 @@ struct gl_fragment_program
* For inputs that do not have an interpolation qualifier specified in
* GLSL, the value is INTERP_QUALIFIER_NONE.
*/
- enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX];
+ enum glsl_interp_qualifier InterpQualifier[VARYING_SLOT_MAX];
/**
* Bitfield indicating, for each fragment shader input, 1 if that input
diff --git a/mesalib/src/mesa/main/state.h b/mesalib/src/mesa/main/state.h
index 29a254092..7b3121b4e 100644
--- a/mesalib/src/mesa/main/state.h
+++ b/mesalib/src/mesa/main/state.h
@@ -66,7 +66,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
if (ctx->FragmentProgram._Current &&
(ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
- (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1))
+ (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL1))
return GL_TRUE;
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 7d996da47..4042e7969 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -3495,19 +3495,21 @@ copyteximage(struct gl_context *ctx, GLuint dims,
_mesa_init_teximage_fields(ctx, texImage, width, height, 1,
border, internalFormat, texFormat);
- /* Allocate texture memory (no pixel data yet) */
- ctx->Driver.AllocTextureImageBuffer(ctx, texImage);
+ if (width && height) {
+ /* Allocate texture memory (no pixel data yet) */
+ ctx->Driver.AllocTextureImageBuffer(ctx, texImage);
- if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
- &width, &height)) {
- struct gl_renderbuffer *srcRb =
- get_copy_tex_image_source(ctx, texImage->TexFormat);
+ if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
+ &width, &height)) {
+ struct gl_renderbuffer *srcRb =
+ get_copy_tex_image_source(ctx, texImage->TexFormat);
- ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ,
- srcRb, srcX, srcY, width, height);
- }
+ ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ,
+ srcRb, srcX, srcY, width, height);
+ }
- check_gen_mipmap(ctx, target, texObj, level);
+ check_gen_mipmap(ctx, target, texObj, level);
+ }
_mesa_update_fbo_texture(ctx, texObj, face, level);
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 1bd9f911f..d44cd7cf9 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -661,7 +661,7 @@ update_texture_state( struct gl_context *ctx )
if (fprog) {
const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1;
ctx->Texture._EnabledCoordUnits
- = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask;
+ = (fprog->InputsRead >> VARYING_SLOT_TEX0) & coordMask;
}
else {
ctx->Texture._EnabledCoordUnits = enabledFragUnits;
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index c90318981..3d4af5923 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -99,7 +99,7 @@ create_version_string(struct gl_context *ctx, const char *prefix)
ctx->VersionString = malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
- "%s%u.%u%s Mesa " MESA_VERSION_STRING
+ "%s%u.%u%s Mesa " PACKAGE_VERSION
#ifdef MESA_GIT_SHA1
" (" MESA_GIT_SHA1 ")"
#endif
diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h
index c1cb3177d..b4f8d8590 100644
--- a/mesalib/src/mesa/main/version.h
+++ b/mesalib/src/mesa/main/version.h
@@ -31,17 +31,6 @@
struct gl_context;
-/* Mesa version */
-#define MESA_MAJOR 9
-#define MESA_MINOR 2
-#define MESA_PATCH 0
-#define MESA_VERSION_STRING "9.2-devel"
-
-/* To make version comparison easy */
-#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#define MESA_VERSION_CODE MESA_VERSION(MESA_MAJOR, MESA_MINOR, MESA_PATCH)
-
-
extern void
_mesa_compute_version(struct gl_context *ctx);