diff options
author | marha <marha@users.sourceforge.net> | 2011-12-23 11:12:22 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-12-23 11:12:22 +0100 |
commit | 6f6a4d4a600eabf5d6a624eb5b0e98ee67afb52d (patch) | |
tree | 8dc28411ab42ebb9183bc090c10024a39fc669d6 /mesalib/src | |
parent | 22891980a76b862bfcda406521b454f072090fb8 (diff) | |
parent | e22891346b85a7db40dec7260a100f90b451cbc8 (diff) | |
download | vcxsrv-6f6a4d4a600eabf5d6a624eb5b0e98ee67afb52d.tar.gz vcxsrv-6f6a4d4a600eabf5d6a624eb5b0e98ee67afb52d.tar.bz2 vcxsrv-6f6a4d4a600eabf5d6a624eb5b0e98ee67afb52d.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_reqsize.c
xorg-server/glx/indirect_reqsize.h
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.c
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/mi/mieq.c
Diffstat (limited to 'mesalib/src')
-rw-r--r-- | mesalib/src/glsl/linker.cpp | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/accum.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/clear.c | 14 | ||||
-rw-r--r-- | mesalib/src/mesa/main/drawpix.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/enable.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/main/format_unpack.c | 134 | ||||
-rw-r--r-- | mesalib/src/mesa/main/get.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/imports.h | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/mtypes.h | 20 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.h | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/main/transformfeedback.c | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_print.c | 74 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_rasterizer.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/vbo/vbo_exec.c | 232 | ||||
-rw-r--r-- | mesalib/src/mesa/x86/gen_matypes.c | 481 |
21 files changed, 660 insertions, 385 deletions
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index b8a7126e3..65870087b 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -1598,7 +1598,9 @@ tfeedback_decl::store(struct gl_shader_program *prog, info->Outputs[info->NumOutputs].OutputRegister = this->location + v; info->Outputs[info->NumOutputs].NumComponents = this->vector_elements; info->Outputs[info->NumOutputs].OutputBuffer = buffer; + info->Outputs[info->NumOutputs].DstOffset = info->BufferStride[buffer]; ++info->NumOutputs; + info->BufferStride[buffer] += this->vector_elements; } return true; } @@ -1863,7 +1865,8 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, tfeedback_decl *tfeedback_decls) { unsigned total_tfeedback_components = 0; - prog->LinkedTransformFeedback.NumOutputs = 0; + memset(&prog->LinkedTransformFeedback, 0, + sizeof(prog->LinkedTransformFeedback)); for (unsigned i = 0; i < num_tfeedback_decls; ++i) { unsigned buffer = prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS ? i : 0; diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 1683c85e9..c5c59ebee 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -985,6 +985,16 @@ _mesa_meta_end(struct gl_context *ctx) /** + * Determine whether Mesa is currently in a meta state. + */ +GLboolean +_mesa_meta_in_progress(struct gl_context *ctx) +{ + return ctx->Meta->SaveStackDepth != 0; +} + + +/** * Convert Z from a normalized value in the range [0, 1] to an object-space * Z coordinate in [-1, +1] so that drawing at the new Z position with the * default/identity ortho projection results in the original Z value. diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index 719813984..d13796ebe 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -69,6 +69,9 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state); extern void _mesa_meta_end(struct gl_context *ctx); +extern GLboolean +_mesa_meta_in_progress(struct gl_context *ctx); + extern void _mesa_meta_BlitFramebuffer(struct gl_context *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c index eb06bbb6e..a8c30c223 100644 --- a/mesalib/src/mesa/main/accum.c +++ b/mesalib/src/mesa/main/accum.c @@ -100,7 +100,7 @@ _mesa_Accum( GLenum op, GLfloat value ) return; } - if (ctx->TransformFeedback.RasterDiscard) + if (ctx->RasterDiscard) return; if (ctx->RenderMode == GL_RENDER) { diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c index 2e27c951b..bd5c01224 100644 --- a/mesalib/src/mesa/main/clear.c +++ b/mesalib/src/mesa/main/clear.c @@ -200,7 +200,7 @@ _mesa_Clear( GLbitfield mask ) ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax) return; - if (ctx->TransformFeedback.RasterDiscard) + if (ctx->RasterDiscard) return; if (ctx->RenderMode == GL_RENDER) { @@ -338,7 +338,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) drawbuffer); return; } - else if (!ctx->TransformFeedback.RasterDiscard) { + else if (!ctx->RasterDiscard) { /* Save current stencil clear value, set to 'value', do the * stencil clear and restore the clear value. * XXX in the future we may have a new ctx->Driver.ClearBuffer() @@ -362,7 +362,7 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) drawbuffer); return; } - else if (mask && !ctx->TransformFeedback.RasterDiscard) { + else if (mask && !ctx->RasterDiscard) { union gl_color_union clearSave; /* save color */ @@ -432,7 +432,7 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) drawbuffer); return; } - else if (mask && !ctx->TransformFeedback.RasterDiscard) { + else if (mask && !ctx->RasterDiscard) { union gl_color_union clearSave; /* save color */ @@ -513,7 +513,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) drawbuffer); return; } - else if (!ctx->TransformFeedback.RasterDiscard) { + else if (!ctx->RasterDiscard) { /* Save current depth clear value, set to 'value', do the * depth clear and restore the clear value. * XXX in the future we may have a new ctx->Driver.ClearBuffer() @@ -538,7 +538,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) drawbuffer); return; } - else if (mask && !ctx->TransformFeedback.RasterDiscard) { + else if (mask && !ctx->RasterDiscard) { union gl_color_union clearSave; /* save color */ @@ -615,7 +615,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer, return; } - if (ctx->TransformFeedback.RasterDiscard) + if (ctx->RasterDiscard) return; if (ctx->NewState) { diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c index c9e714b21..9f5b0b36e 100644 --- a/mesalib/src/mesa/main/drawpix.c +++ b/mesalib/src/mesa/main/drawpix.c @@ -98,7 +98,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, goto end; /* the error code was recorded */ } - if (ctx->TransformFeedback.RasterDiscard) { + if (ctx->RasterDiscard) { goto end; } @@ -210,7 +210,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, goto end; } - if (ctx->TransformFeedback.RasterDiscard) { + if (ctx->RasterDiscard) { goto end; } @@ -268,7 +268,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, return; } - if (ctx->TransformFeedback.RasterDiscard) + if (ctx->RasterDiscard) return; if (ctx->RenderMode == GL_RENDER) { diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index 6461ac1b3..270b24045 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -889,9 +889,9 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) #if FEATURE_EXT_transform_feedback case GL_RASTERIZER_DISCARD: CHECK_EXTENSION(EXT_transform_feedback, cap); - if (ctx->TransformFeedback.RasterDiscard != state) { - FLUSH_VERTICES(ctx, _NEW_TRANSFORM); - ctx->TransformFeedback.RasterDiscard = state; + if (ctx->RasterDiscard != state) { + FLUSH_VERTICES(ctx, _NEW_RASTERIZER_DISCARD); + ctx->RasterDiscard = state; } break; #endif @@ -1403,7 +1403,7 @@ _mesa_IsEnabled( GLenum cap ) #if FEATURE_EXT_transform_feedback case GL_RASTERIZER_DISCARD: CHECK_EXTENSION(EXT_transform_feedback); - return ctx->TransformFeedback.RasterDiscard; + return ctx->RasterDiscard; #endif /* GL_NV_primitive_restart */ diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 32d198ce8..a22ff5a61 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -1581,6 +1581,58 @@ unpack_int_rgba_RGBA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) } static void +unpack_int_rgba_RGBA_UINT16(const GLushort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void +unpack_int_rgba_RGBA_INT16(const GLshort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void +unpack_int_rgba_RGBA_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void +unpack_int_rgba_RGBA_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 4 + 0]; + dst[i][1] = src[i * 4 + 1]; + dst[i][2] = src[i * 4 + 2]; + dst[i][3] = src[i * 4 + 3]; + } +} + +static void unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -1594,6 +1646,58 @@ unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) } static void +unpack_int_rgba_RGB_UINT16(const GLushort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_RGB_INT16(const GLshort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_RGB_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_RGB_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = src[i * 3 + 0]; + dst[i][1] = src[i * 3 + 1]; + dst[i][2] = src[i * 3 + 2]; + dst[i][3] = 1; + } +} + +static void unpack_int_rgba_RG_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -1677,10 +1781,40 @@ _mesa_unpack_int_rgba_row(gl_format format, GLuint n, case MESA_FORMAT_RGBA_INT32: unpack_int_rgba_RGBA_UINT32(src, dst, n); break; + + case MESA_FORMAT_RGBA_UINT16: + unpack_int_rgba_RGBA_UINT16(src, dst, n); + break; + case MESA_FORMAT_RGBA_INT16: + unpack_int_rgba_RGBA_INT16(src, dst, n); + break; + + case MESA_FORMAT_RGBA_UINT8: + unpack_int_rgba_RGBA_UINT8(src, dst, n); + break; + case MESA_FORMAT_RGBA_INT8: + unpack_int_rgba_RGBA_INT8(src, dst, n); + break; + case MESA_FORMAT_RGB_UINT32: case MESA_FORMAT_RGB_INT32: unpack_int_rgba_RGB_UINT32(src, dst, n); break; + + case MESA_FORMAT_RGB_UINT16: + unpack_int_rgba_RGB_UINT16(src, dst, n); + break; + case MESA_FORMAT_RGB_INT16: + unpack_int_rgba_RGB_INT16(src, dst, n); + break; + + case MESA_FORMAT_RGB_UINT8: + unpack_int_rgba_RGB_UINT8(src, dst, n); + break; + case MESA_FORMAT_RGB_INT8: + unpack_int_rgba_RGB_INT8(src, dst, n); + break; + case MESA_FORMAT_RG_UINT32: case MESA_FORMAT_RG_INT32: unpack_int_rgba_RG_UINT32(src, dst, n); diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 4df6afe36..0c9d6b391 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -1204,7 +1204,7 @@ static const struct value_desc values[] = { /* GL_EXT_transform_feedback */ { GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_EXT_transform_feedback }, - { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(TransformFeedback.RasterDiscard), + { GL_RASTERIZER_DISCARD, CONTEXT_BOOL(RasterDiscard), extra_EXT_transform_feedback }, { GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 797f35742..d5e3859f8 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -568,7 +568,7 @@ _mesa_init_sqrt_table(void); #ifdef __GNUC__ -#if defined(__MINGW32__) || defined(ANDROID) +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) #define ffs __builtin_ffs #define ffsll __builtin_ffsll #endif diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 0e29dc0dc..3d3b006d5 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1821,7 +1821,17 @@ struct gl_transform_feedback_info { unsigned OutputRegister; unsigned OutputBuffer; unsigned NumComponents; + + /** offset (in DWORDs) of this output within the interleaved structure */ + unsigned DstOffset; } Outputs[MAX_PROGRAM_OUTPUTS]; + + /** + * 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]; }; /** @@ -2376,8 +2386,6 @@ struct gl_transform_feedback { GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */ - GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */ - /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */ struct gl_buffer_object *CurrentBuffer; @@ -3065,6 +3073,12 @@ struct gl_matrix_stack #define _NEW_FRAG_CLAMP (1 << 29) #define _NEW_TRANSFORM_FEEDBACK (1 << 30) /**< gl_context::TransformFeedback */ #define _NEW_ALL ~0 + +/** + * We use _NEW_TRANSFORM for GL_RASTERIZER_DISCARD. This #define is for + * clarity. + */ +#define _NEW_RASTERIZER_DISCARD _NEW_TRANSFORM /*@}*/ @@ -3397,6 +3411,8 @@ struct gl_context */ GLboolean mvp_with_dp4; + GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */ + /** * \name Hooks for module contexts. * diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index eccc0fd39..18a7b87c0 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -541,18 +541,18 @@ _mesa_tex_target_to_face(GLenum target) /** - * Store a gl_texture_image pointer in a gl_texture_object structure - * according to the target and level parameters. + * Install gl_texture_image in a gl_texture_object according to the target + * and level parameters. * * \param tObj texture object. * \param target texture target. * \param level image level. * \param texImage texture image. */ -void -_mesa_set_tex_image(struct gl_texture_object *tObj, - GLenum target, GLint level, - struct gl_texture_image *texImage) +static void +set_tex_image(struct gl_texture_object *tObj, + GLenum target, GLint level, + struct gl_texture_image *texImage) { const GLuint face = _mesa_tex_target_to_face(target); @@ -604,6 +604,7 @@ _mesa_delete_texture_image(struct gl_context *ctx, */ ASSERT(ctx->Driver.FreeTextureImageBuffer); ctx->Driver.FreeTextureImageBuffer( ctx, texImage ); + free(texImage); } @@ -804,7 +805,7 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj, return NULL; } - _mesa_set_tex_image(texObj, target, level, texImage); + set_tex_image(texObj, target, level, texImage); } return texImage; diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index d756646ce..0354c9ac5 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -90,12 +90,6 @@ _mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage); -extern void -_mesa_set_tex_image(struct gl_texture_object *tObj, - GLenum target, GLint level, - struct gl_texture_image *texImage); - - extern struct gl_texture_object * _mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit, diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 824f66a35..53c09e265 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -404,7 +404,11 @@ bind_buffer_range(struct gl_context *ctx, GLuint index, { struct gl_transform_feedback_object *obj = ctx->TransformFeedback.CurrentObject; - FLUSH_VERTICES(ctx, _NEW_TRANSFORM_FEEDBACK); + + /* Note: no need to FLUSH_VERTICES or flag _NEW_TRANSFORM_FEEDBACK, because + * transform feedback buffers can't be changed while transform feedback is + * active. + */ /* The general binding point */ _mesa_reference_buffer_object(ctx, @@ -473,7 +477,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index, return; } - if (offset + size >= bufObj->Size) { + if (offset + size > bufObj->Size) { _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(offset + size %d > buffer size %d)", (int) (offset + size), (int) (bufObj->Size)); diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index b4d142fa9..352a80f27 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -95,15 +95,15 @@ arb_input_attrib_string(GLint index, GLenum progType) /* * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. */ - const char *vertAttribs[] = { + static const char *const vertAttribs[] = { "vertex.position", "vertex.weight", "vertex.normal", "vertex.color.primary", "vertex.color.secondary", "vertex.fogcoord", - "vertex.(six)", - "vertex.(seven)", + "vertex.(six)", /* VERT_ATTRIB_COLOR_INDEX */ + "vertex.(seven)", /* VERT_ATTRIB_EDGEFLAG */ "vertex.texcoord[0]", "vertex.texcoord[1]", "vertex.texcoord[2]", @@ -112,7 +112,7 @@ arb_input_attrib_string(GLint index, GLenum progType) "vertex.texcoord[5]", "vertex.texcoord[6]", "vertex.texcoord[7]", - "vertex.pointsize", + "vertex.(sixteen)", /* VERT_ATTRIB_POINT_SIZE */ "vertex.attrib[0]", "vertex.attrib[1]", "vertex.attrib[2]", @@ -128,9 +128,9 @@ arb_input_attrib_string(GLint index, GLenum progType) "vertex.attrib[12]", "vertex.attrib[13]", "vertex.attrib[14]", - "vertex.attrib[15]" + "vertex.attrib[15]" /* MAX_VARYING = 16 */ }; - const char *fragAttribs[] = { + static const char *const fragAttribs[] = { "fragment.position", "fragment.color.primary", "fragment.color.secondary", @@ -143,6 +143,10 @@ arb_input_attrib_string(GLint index, GLenum progType) "fragment.texcoord[5]", "fragment.texcoord[6]", "fragment.texcoord[7]", + "fragment.(twelve)", /* FRAG_ATTRIB_FACE */ + "fragment.(thirteen)", /* FRAG_ATTRIB_PNTC */ + "fragment.(fourteen)", /* FRAG_ATTRIB_CLIP_DIST0 */ + "fragment.(fifteen)", /* FRAG_ATTRIB_CLIP_DIST1 */ "fragment.varying[0]", "fragment.varying[1]", "fragment.varying[2]", @@ -150,18 +154,31 @@ arb_input_attrib_string(GLint index, GLenum progType) "fragment.varying[4]", "fragment.varying[5]", "fragment.varying[6]", - "fragment.varying[7]" + "fragment.varying[7]", + "fragment.varying[8]", + "fragment.varying[9]", + "fragment.varying[10]", + "fragment.varying[11]", + "fragment.varying[12]", + "fragment.varying[13]", + "fragment.varying[14]", + "fragment.varying[15]" /* MAX_VARYING = 16 */ }; /* sanity checks */ + STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX); + STATIC_ASSERT(Elements(fragAttribs) == FRAG_ATTRIB_MAX); assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0); assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0); + assert(strcmp(fragAttribs[FRAG_ATTRIB_TEX0], "fragment.texcoord[0]") == 0); + assert(strcmp(fragAttribs[FRAG_ATTRIB_VAR0+15], "fragment.varying[15]") == 0); if (progType == GL_VERTEX_PROGRAM_ARB) { assert(index < Elements(vertAttribs)); return vertAttribs[index]; } else { + assert(progType == GL_FRAGMENT_PROGRAM_ARB); assert(index < Elements(fragAttribs)); return fragAttribs[index]; } @@ -214,7 +231,7 @@ arb_output_attrib_string(GLint index, GLenum progType) /* * These strings should match the VERT_RESULT_x and FRAG_RESULT_x tokens. */ - const char *vertResults[] = { + static const char *const vertResults[] = { "result.position", "result.color.primary", "result.color.secondary", @@ -227,6 +244,13 @@ arb_output_attrib_string(GLint index, GLenum progType) "result.texcoord[5]", "result.texcoord[6]", "result.texcoord[7]", + "result.pointsize", /* VERT_RESULT_PSIZ */ + "result.(thirteen)", /* VERT_RESULT_BFC0 */ + "result.(fourteen)", /* VERT_RESULT_BFC1 */ + "result.(fifteen)", /* VERT_RESULT_EDGE */ + "result.(sixteen)", /* VERT_RESULT_CLIP_VERTEX */ + "result.(seventeen)", /* VERT_RESULT_CLIP_DIST0 */ + "result.(eighteen)", /* VERT_RESULT_CLIP_DIST1 */ "result.varying[0]", "result.varying[1]", "result.varying[2]", @@ -234,23 +258,43 @@ arb_output_attrib_string(GLint index, GLenum progType) "result.varying[4]", "result.varying[5]", "result.varying[6]", - "result.varying[7]" + "result.varying[7]", + "result.varying[8]", + "result.varying[9]", + "result.varying[10]", + "result.varying[11]", + "result.varying[12]", + "result.varying[13]", + "result.varying[14]", + "result.varying[15]" /* MAX_VARYING = 16 */ }; - const char *fragResults[] = { - "result.color", - "result.color(half)", - "result.depth", - "result.color[0]", + static const char *const fragResults[] = { + "result.depth", /* FRAG_RESULT_DEPTH */ + "result.(one)", /* FRAG_RESULT_STENCIL */ + "result.color", /* FRAG_RESULT_COLOR */ + "result.color[0]", /* FRAG_RESULT_DATA0 (named for GLSL's gl_FragData) */ "result.color[1]", "result.color[2]", - "result.color[3]" + "result.color[3]", + "result.color[4]", + "result.color[5]", + "result.color[6]", + "result.color[7]" /* MAX_DRAW_BUFFERS = 8 */ }; + /* sanity checks */ + STATIC_ASSERT(Elements(vertResults) == VERT_RESULT_MAX); + STATIC_ASSERT(Elements(fragResults) == FRAG_RESULT_MAX); + assert(strcmp(vertResults[VERT_RESULT_HPOS], "result.position") == 0); + assert(strcmp(vertResults[VERT_RESULT_VAR0], "result.varying[0]") == 0); + assert(strcmp(fragResults[FRAG_RESULT_DATA0], "result.color[0]") == 0); + if (progType == GL_VERTEX_PROGRAM_ARB) { assert(index < Elements(vertResults)); return vertResults[index]; } else { + assert(progType == GL_FRAGMENT_PROGRAM_ARB); assert(index < Elements(fragResults)); return fragResults[index]; } diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 4aa0b4e2a..2d6ad45ba 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -258,8 +258,8 @@ static void update_raster_state( struct st_context *st ) raster->clamp_fragment_color = ctx->Color._ClampFragmentColor; raster->gl_rasterization_rules = 1; - /* _NEW_TRANSFORM */ - raster->rasterizer_discard = ctx->TransformFeedback.RasterDiscard; + /* _NEW_RASTERIZER_DISCARD */ + raster->rasterizer_discard = ctx->RasterDiscard; cso_set_rasterizer(st->cso_context, raster); } @@ -276,7 +276,7 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM), /* mesa state dependencies*/ + _NEW_RASTERIZER_DISCARD), /* mesa state dependencies*/ ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ }, update_raster_state /* update function */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 47a178b8b..dc17d76a5 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -263,6 +263,12 @@ void st_init_extensions(struct st_context *st) ctx->Const.GLSLVersion = 120; _mesa_override_glsl_version(st->ctx); + /* Extensions that only depend on the GLSL version: + */ + if (ctx->Const.GLSLVersion >= 130) { + ctx->Extensions.ARB_conservative_depth = GL_TRUE; + } + /* * Extensions that are supported by all Gallium drivers: */ diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b929806ad..77aa0d17b 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3786,6 +3786,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, * new visitor. */ foreach_iter(exec_list_iterator, iter, original->instructions) { glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get(); + glsl_to_tgsi_instruction *newinst; st_src_reg src_regs[3]; if (inst->dst.file == PROGRAM_OUTPUT) @@ -3803,7 +3804,8 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, prog->InputsRead |= BITFIELD64_BIT(src_regs[i].index); } - v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); + newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); + newinst->tex_target = inst->tex_target; } /* Make modifications to fragment program info. */ @@ -3867,6 +3869,7 @@ get_bitmap_visitor(struct st_fragment_program *fp, * new visitor. */ foreach_iter(exec_list_iterator, iter, original->instructions) { glsl_to_tgsi_instruction *inst = (glsl_to_tgsi_instruction *)iter.get(); + glsl_to_tgsi_instruction *newinst; st_src_reg src_regs[3]; if (inst->dst.file == PROGRAM_OUTPUT) @@ -3878,7 +3881,8 @@ get_bitmap_visitor(struct st_fragment_program *fp, prog->InputsRead |= BITFIELD64_BIT(src_regs[i].index); } - v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); + newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); + newinst->tex_target = inst->tex_target; } /* Make modifications to fragment program info. */ diff --git a/mesalib/src/mesa/vbo/vbo.h b/mesalib/src/mesa/vbo/vbo.h index f357657af..7384790e3 100644 --- a/mesalib/src/mesa/vbo/vbo.h +++ b/mesalib/src/mesa/vbo/vbo.h @@ -137,6 +137,9 @@ void vbo_check_buffers_are_unmapped(struct gl_context *ctx); void vbo_bind_arrays(struct gl_context *ctx); +size_t +count_tessellated_primitives(const struct _mesa_prim *prim); + void GLAPIENTRY _es_Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a); diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c index 7793aa238..05c3ec1ae 100644 --- a/mesalib/src/mesa/vbo/vbo_exec.c +++ b/mesalib/src/mesa/vbo/vbo_exec.c @@ -1,92 +1,140 @@ -/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-
-#include "main/api_arrayelt.h"
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "main/vtxfmt.h"
-#include "vbo_context.h"
-
-
-
-void vbo_exec_init( struct gl_context *ctx )
-{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-
- exec->ctx = ctx;
-
- /* Initialize the arrayelt helper
- */
- if (!ctx->aelt_context &&
- !_ae_create_context( ctx ))
- return;
-
- vbo_exec_vtx_init( exec );
- vbo_exec_array_init( exec );
-
- /* Hook our functions into exec and compile dispatch tables.
- */
- _mesa_install_exec_vtxfmt( ctx, &exec->vtxfmt );
-
- ctx->Driver.NeedFlush = 0;
- ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
- ctx->Driver.BeginVertices = vbo_exec_BeginVertices;
- ctx->Driver.FlushVertices = vbo_exec_FlushVertices;
-
- vbo_exec_invalidate_state( ctx, ~0 );
-}
-
-
-void vbo_exec_destroy( struct gl_context *ctx )
-{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-
- if (ctx->aelt_context) {
- _ae_destroy_context( ctx );
- ctx->aelt_context = NULL;
- }
-
- vbo_exec_vtx_destroy( exec );
- vbo_exec_array_destroy( exec );
-}
-
-
-/**
- * Really want to install these callbacks to a central facility to be
- * invoked according to the state flags. That will have to wait for a
- * mesa rework:
- */
-void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
-{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
-
- if (new_state & (_NEW_PROGRAM|_NEW_EVAL))
- exec->eval.recalculate_maps = 1;
-
- _ae_invalidate_state(ctx, new_state);
-}
+/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith Whitwell <keith@tungstengraphics.com> + */ + + +#include "main/api_arrayelt.h" +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/vtxfmt.h" +#include "vbo_context.h" + + + +void vbo_exec_init( struct gl_context *ctx ) +{ + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + + exec->ctx = ctx; + + /* Initialize the arrayelt helper + */ + if (!ctx->aelt_context && + !_ae_create_context( ctx )) + return; + + vbo_exec_vtx_init( exec ); + vbo_exec_array_init( exec ); + + /* Hook our functions into exec and compile dispatch tables. + */ + _mesa_install_exec_vtxfmt( ctx, &exec->vtxfmt ); + + ctx->Driver.NeedFlush = 0; + ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; + ctx->Driver.BeginVertices = vbo_exec_BeginVertices; + ctx->Driver.FlushVertices = vbo_exec_FlushVertices; + + vbo_exec_invalidate_state( ctx, ~0 ); +} + + +void vbo_exec_destroy( struct gl_context *ctx ) +{ + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + + if (ctx->aelt_context) { + _ae_destroy_context( ctx ); + ctx->aelt_context = NULL; + } + + vbo_exec_vtx_destroy( exec ); + vbo_exec_array_destroy( exec ); +} + + +/** + * Really want to install these callbacks to a central facility to be + * invoked according to the state flags. That will have to wait for a + * mesa rework: + */ +void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state ) +{ + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; + + if (new_state & (_NEW_PROGRAM|_NEW_EVAL)) + exec->eval.recalculate_maps = 1; + + _ae_invalidate_state(ctx, new_state); +} + + +/** + * Figure out the number of transform feedback primitives that will be output + * by the given _mesa_prim command, assuming that no geometry shading is done + * and primitive restart is not used. + * + * This is intended for use by driver back-ends in implementing the + * PRIMITIVES_GENERATED and TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries. + */ +size_t +count_tessellated_primitives(const struct _mesa_prim *prim) +{ + size_t num_primitives; + switch (prim->mode) { + case GL_POINTS: + num_primitives = prim->count; + break; + case GL_LINE_STRIP: + num_primitives = prim->count >= 2 ? prim->count - 1 : 0; + break; + case GL_LINE_LOOP: + num_primitives = prim->count >= 2 ? prim->count : 0; + break; + case GL_LINES: + num_primitives = prim->count / 2; + break; + case GL_TRIANGLE_STRIP: + case GL_TRIANGLE_FAN: + case GL_POLYGON: + num_primitives = prim->count >= 3 ? prim->count - 2 : 0; + break; + case GL_TRIANGLES: + num_primitives = prim->count / 3; + break; + case GL_QUAD_STRIP: + num_primitives = prim->count >= 4 ? ((prim->count / 2) - 1) * 2 : 0; + break; + case GL_QUADS: + num_primitives = (prim->count / 4) * 2; + break; + default: + assert(!"Unexpected primitive type in count_tessellated_primitives"); + num_primitives = 0; + break; + } + return num_primitives * prim->num_instances; +} diff --git a/mesalib/src/mesa/x86/gen_matypes.c b/mesalib/src/mesa/x86/gen_matypes.c index a7f9a9242..97f71f92c 100644 --- a/mesalib/src/mesa/x86/gen_matypes.c +++ b/mesalib/src/mesa/x86/gen_matypes.c @@ -1,238 +1,243 @@ -/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Gareth Hughes
- */
-
-/*
- * This generates an asm version of mtypes.h (called matypes.h), so that
- * Mesa's x86 assembly code can access the internal structures easily.
- * This will be particularly useful when developing new x86 asm code for
- * Mesa, including lighting, clipping, texture image conversion etc.
- */
-
-#include "main/glheader.h"
-#include "main/mtypes.h"
-#include "tnl/t_context.h"
-
-
-#undef offsetof
-#define offsetof( type, member ) ((size_t) &((type *)0)->member)
-
-
-#define OFFSET_HEADER( x ) \
-do { \
- printf( "\n" ); \
- printf( "\n" ); \
- printf( "/* =====================================================" \
- "========\n" ); \
- printf( " * Offsets for %s\n", x ); \
- printf( " */\n" ); \
- printf( "\n" ); \
-} while (0)
-
-#define DEFINE_HEADER( x ) \
-do { \
- printf( "\n" ); \
- printf( "/*\n" ); \
- printf( " * Flags for %s\n", x ); \
- printf( " */\n" ); \
- printf( "\n" ); \
-} while (0)
-
-#define OFFSET( s, t, m ) \
- printf( "#define %s\t%lu\n", s, (unsigned long) offsetof( t, m ) );
-
-#define SIZEOF( s, t ) \
- printf( "#define %s\t%lu\n", s, (unsigned long) sizeof(t) );
-
-#define DEFINE( s, d ) \
- printf( "#define %s\t0x%x\n", s, d );
-
-
-
-int main( int argc, char **argv )
-{
- printf( "/*\n" );
- printf( " * This file is automatically generated from the Mesa internal type\n" );
- printf( " * definitions. Do not edit directly.\n" );
- printf( " */\n" );
- printf( "\n" );
- printf( "#ifndef __ASM_TYPES_H__\n" );
- printf( "#define __ASM_TYPES_H__\n" );
- printf( "\n" );
-
-
- /* struct gl_context offsets:
- */
- OFFSET_HEADER( "struct gl_context" );
-
- OFFSET( "CTX_DRIVER_CTX ", struct gl_context, DriverCtx );
- printf( "\n" );
- OFFSET( "CTX_LIGHT_ENABLED ", struct gl_context, Light.Enabled );
- OFFSET( "CTX_LIGHT_SHADE_MODEL ", struct gl_context, Light.ShadeModel );
- OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", struct gl_context, Light.ColorMaterialFace );
- OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", struct gl_context, Light.ColorMaterialMode );
- OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", struct gl_context, Light.ColorMaterialBitmask );
- OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", struct gl_context, Light.ColorMaterialEnabled );
- OFFSET( "CTX_LIGHT_ENABLED_LIST ", struct gl_context, Light.EnabledList );
- OFFSET( "CTX_LIGHT_NEED_VERTS ", struct gl_context, Light._NeedVertices );
- OFFSET( "CTX_LIGHT_FLAGS ", struct gl_context, Light._Flags );
- OFFSET( "CTX_LIGHT_BASE_COLOR ", struct gl_context, Light._BaseColor );
-
-
- /* struct vertex_buffer offsets:
- */
- OFFSET_HEADER( "struct vertex_buffer" );
-
- OFFSET( "VB_SIZE ", struct vertex_buffer, Size );
- OFFSET( "VB_COUNT ", struct vertex_buffer, Count );
- printf( "\n" );
- OFFSET( "VB_ELTS ", struct vertex_buffer, Elts );
- OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_POS] );
- OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr );
- OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr );
- OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr );
- OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask );
- OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask );
- OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_NORMAL] );
- OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag );
- OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX0] );
- OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] );
- OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] );
- OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] );
- OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] );
- OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR0] );
- OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR1] );
- OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_FOG] );
- OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive );
- printf( "\n" );
-
- DEFINE_HEADER( "struct vertex_buffer" );
-
- /* XXX use new labels here someday after vertex proram is done */
- DEFINE( "VERT_BIT_OBJ ", VERT_BIT_POS );
- DEFINE( "VERT_BIT_NORM ", VERT_BIT_NORMAL );
- DEFINE( "VERT_BIT_RGBA ", VERT_BIT_COLOR0 );
- DEFINE( "VERT_BIT_SPEC_RGB ", VERT_BIT_COLOR1 );
- DEFINE( "VERT_BIT_FOG_COORD ", VERT_BIT_FOG );
- DEFINE( "VERT_BIT_TEX0 ", VERT_BIT_TEX0 );
- DEFINE( "VERT_BIT_TEX1 ", VERT_BIT_TEX1 );
- DEFINE( "VERT_BIT_TEX2 ", VERT_BIT_TEX2 );
- DEFINE( "VERT_BIT_TEX3 ", VERT_BIT_TEX3 );
-
-
- /* GLvector4f offsets:
- */
- OFFSET_HEADER( "GLvector4f" );
-
- OFFSET( "V4F_DATA ", GLvector4f, data );
- OFFSET( "V4F_START ", GLvector4f, start );
- OFFSET( "V4F_COUNT ", GLvector4f, count );
- OFFSET( "V4F_STRIDE ", GLvector4f, stride );
- OFFSET( "V4F_SIZE ", GLvector4f, size );
- OFFSET( "V4F_FLAGS ", GLvector4f, flags );
-
- DEFINE_HEADER( "GLvector4f" );
-
- DEFINE( "VEC_MALLOC ", VEC_MALLOC );
- DEFINE( "VEC_NOT_WRITEABLE ", VEC_NOT_WRITEABLE );
- DEFINE( "VEC_BAD_STRIDE ", VEC_BAD_STRIDE );
- printf( "\n" );
- DEFINE( "VEC_SIZE_1 ", VEC_SIZE_1 );
- DEFINE( "VEC_SIZE_2 ", VEC_SIZE_2 );
- DEFINE( "VEC_SIZE_3 ", VEC_SIZE_3 );
- DEFINE( "VEC_SIZE_4 ", VEC_SIZE_4 );
-
-
- /* GLmatrix offsets:
- */
- OFFSET_HEADER( "GLmatrix" );
-
- OFFSET( "MATRIX_DATA ", GLmatrix, m );
- OFFSET( "MATRIX_INV ", GLmatrix, inv );
- OFFSET( "MATRIX_FLAGS ", GLmatrix, flags );
- OFFSET( "MATRIX_TYPE ", GLmatrix, type );
-
-
- /* struct gl_light offsets:
- */
- OFFSET_HEADER( "struct gl_light" );
-
- OFFSET( "LIGHT_NEXT ", struct gl_light, next );
- OFFSET( "LIGHT_PREV ", struct gl_light, prev );
- printf( "\n" );
- OFFSET( "LIGHT_AMBIENT ", struct gl_light, Ambient );
- OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse );
- OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular );
- OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition );
- OFFSET( "LIGHT_SPOT_DIRECTION ", struct gl_light, SpotDirection );
- OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent );
- OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff );
- OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff );
- OFFSET( "LIGHT_CONST_ATTEN ", struct gl_light, ConstantAttenuation );
- OFFSET( "LIGHT_LINEAR_ATTEN ", struct gl_light, LinearAttenuation );
- OFFSET( "LIGHT_QUADRATIC_ATTEN ", struct gl_light, QuadraticAttenuation );
- OFFSET( "LIGHT_ENABLED ", struct gl_light, Enabled );
- printf( "\n" );
- OFFSET( "LIGHT_FLAGS ", struct gl_light, _Flags );
- printf( "\n" );
- OFFSET( "LIGHT_POSITION ", struct gl_light, _Position );
- OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm );
- OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm );
- OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormSpotDirection );
- OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation );
- printf( "\n" );
- OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable );
- OFFSET( "LIGHT_MAT_AMBIENT ", struct gl_light, _MatAmbient );
- OFFSET( "LIGHT_MAT_DIFFUSE ", struct gl_light, _MatDiffuse );
- OFFSET( "LIGHT_MAT_SPECULAR ", struct gl_light, _MatSpecular );
- printf( "\n" );
- SIZEOF( "SIZEOF_GL_LIGHT ", struct gl_light );
-
- DEFINE_HEADER( "struct gl_light" );
-
- DEFINE( "LIGHT_SPOT ", LIGHT_SPOT );
- DEFINE( "LIGHT_LOCAL_VIEWER ", LIGHT_LOCAL_VIEWER );
- DEFINE( "LIGHT_POSITIONAL ", LIGHT_POSITIONAL );
- printf( "\n" );
- DEFINE( "LIGHT_NEED_VERTICES ", LIGHT_NEED_VERTICES );
-
-
- /* struct gl_lightmodel offsets:
- */
- OFFSET_HEADER( "struct gl_lightmodel" );
-
- OFFSET( "LIGHT_MODEL_AMBIENT ", struct gl_lightmodel, Ambient );
- OFFSET( "LIGHT_MODEL_LOCAL_VIEWER ", struct gl_lightmodel, LocalViewer );
- OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide );
- OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl );
-
-
- printf( "\n" );
- printf( "\n" );
- printf( "#endif /* __ASM_TYPES_H__ */\n" );
-
- return 0;
-}
+/* + * Mesa 3-D graphics library + * Version: 6.5.1 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes + */ + +/* + * This generates an asm version of mtypes.h (called matypes.h), so that + * Mesa's x86 assembly code can access the internal structures easily. + * This will be particularly useful when developing new x86 asm code for + * Mesa, including lighting, clipping, texture image conversion etc. + */ + +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif +#include <inttypes.h> + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "tnl/t_context.h" + + +#undef offsetof +#define offsetof( type, member ) ((size_t) &((type *)0)->member) + + +#define OFFSET_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "\n" ); \ + printf( "/* =====================================================" \ + "========\n" ); \ + printf( " * Offsets for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#define DEFINE_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "/*\n" ); \ + printf( " * Flags for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%lu\n", s, (unsigned long) offsetof( t, m ) ); + +#define SIZEOF( s, t ) \ + printf( "#define %s\t%lu\n", s, (unsigned long) sizeof(t) ); + +#define DEFINE( s, d ) \ + printf( "#define %s\t0x%" PRIx64 "\n", s, (uint64_t) d ); + + + +int main( int argc, char **argv ) +{ + printf( "/*\n" ); + printf( " * This file is automatically generated from the Mesa internal type\n" ); + printf( " * definitions. Do not edit directly.\n" ); + printf( " */\n" ); + printf( "\n" ); + printf( "#ifndef __ASM_TYPES_H__\n" ); + printf( "#define __ASM_TYPES_H__\n" ); + printf( "\n" ); + + + /* struct gl_context offsets: + */ + OFFSET_HEADER( "struct gl_context" ); + + OFFSET( "CTX_DRIVER_CTX ", struct gl_context, DriverCtx ); + printf( "\n" ); + OFFSET( "CTX_LIGHT_ENABLED ", struct gl_context, Light.Enabled ); + OFFSET( "CTX_LIGHT_SHADE_MODEL ", struct gl_context, Light.ShadeModel ); + OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", struct gl_context, Light.ColorMaterialFace ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", struct gl_context, Light.ColorMaterialMode ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", struct gl_context, Light.ColorMaterialBitmask ); + OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", struct gl_context, Light.ColorMaterialEnabled ); + OFFSET( "CTX_LIGHT_ENABLED_LIST ", struct gl_context, Light.EnabledList ); + OFFSET( "CTX_LIGHT_NEED_VERTS ", struct gl_context, Light._NeedVertices ); + OFFSET( "CTX_LIGHT_FLAGS ", struct gl_context, Light._Flags ); + OFFSET( "CTX_LIGHT_BASE_COLOR ", struct gl_context, Light._BaseColor ); + + + /* struct vertex_buffer offsets: + */ + OFFSET_HEADER( "struct vertex_buffer" ); + + OFFSET( "VB_SIZE ", struct vertex_buffer, Size ); + OFFSET( "VB_COUNT ", struct vertex_buffer, Count ); + printf( "\n" ); + OFFSET( "VB_ELTS ", struct vertex_buffer, Elts ); + OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_POS] ); + OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr ); + OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr ); + OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr ); + OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask ); + OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); + OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_NORMAL] ); + OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag ); + OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX0] ); + OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] ); + OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] ); + OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] ); + OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] ); + OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR0] ); + OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR1] ); + OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_FOG] ); + OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive ); + printf( "\n" ); + + DEFINE_HEADER( "struct vertex_buffer" ); + + /* XXX use new labels here someday after vertex proram is done */ + DEFINE( "VERT_BIT_OBJ ", VERT_BIT_POS ); + DEFINE( "VERT_BIT_NORM ", VERT_BIT_NORMAL ); + DEFINE( "VERT_BIT_RGBA ", VERT_BIT_COLOR0 ); + DEFINE( "VERT_BIT_SPEC_RGB ", VERT_BIT_COLOR1 ); + DEFINE( "VERT_BIT_FOG_COORD ", VERT_BIT_FOG ); + DEFINE( "VERT_BIT_TEX0 ", VERT_BIT_TEX0 ); + DEFINE( "VERT_BIT_TEX1 ", VERT_BIT_TEX1 ); + DEFINE( "VERT_BIT_TEX2 ", VERT_BIT_TEX2 ); + DEFINE( "VERT_BIT_TEX3 ", VERT_BIT_TEX3 ); + + + /* GLvector4f offsets: + */ + OFFSET_HEADER( "GLvector4f" ); + + OFFSET( "V4F_DATA ", GLvector4f, data ); + OFFSET( "V4F_START ", GLvector4f, start ); + OFFSET( "V4F_COUNT ", GLvector4f, count ); + OFFSET( "V4F_STRIDE ", GLvector4f, stride ); + OFFSET( "V4F_SIZE ", GLvector4f, size ); + OFFSET( "V4F_FLAGS ", GLvector4f, flags ); + + DEFINE_HEADER( "GLvector4f" ); + + DEFINE( "VEC_MALLOC ", VEC_MALLOC ); + DEFINE( "VEC_NOT_WRITEABLE ", VEC_NOT_WRITEABLE ); + DEFINE( "VEC_BAD_STRIDE ", VEC_BAD_STRIDE ); + printf( "\n" ); + DEFINE( "VEC_SIZE_1 ", VEC_SIZE_1 ); + DEFINE( "VEC_SIZE_2 ", VEC_SIZE_2 ); + DEFINE( "VEC_SIZE_3 ", VEC_SIZE_3 ); + DEFINE( "VEC_SIZE_4 ", VEC_SIZE_4 ); + + + /* GLmatrix offsets: + */ + OFFSET_HEADER( "GLmatrix" ); + + OFFSET( "MATRIX_DATA ", GLmatrix, m ); + OFFSET( "MATRIX_INV ", GLmatrix, inv ); + OFFSET( "MATRIX_FLAGS ", GLmatrix, flags ); + OFFSET( "MATRIX_TYPE ", GLmatrix, type ); + + + /* struct gl_light offsets: + */ + OFFSET_HEADER( "struct gl_light" ); + + OFFSET( "LIGHT_NEXT ", struct gl_light, next ); + OFFSET( "LIGHT_PREV ", struct gl_light, prev ); + printf( "\n" ); + OFFSET( "LIGHT_AMBIENT ", struct gl_light, Ambient ); + OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse ); + OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular ); + OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition ); + OFFSET( "LIGHT_SPOT_DIRECTION ", struct gl_light, SpotDirection ); + OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent ); + OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff ); + OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff ); + OFFSET( "LIGHT_CONST_ATTEN ", struct gl_light, ConstantAttenuation ); + OFFSET( "LIGHT_LINEAR_ATTEN ", struct gl_light, LinearAttenuation ); + OFFSET( "LIGHT_QUADRATIC_ATTEN ", struct gl_light, QuadraticAttenuation ); + OFFSET( "LIGHT_ENABLED ", struct gl_light, Enabled ); + printf( "\n" ); + OFFSET( "LIGHT_FLAGS ", struct gl_light, _Flags ); + printf( "\n" ); + OFFSET( "LIGHT_POSITION ", struct gl_light, _Position ); + OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm ); + OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm ); + OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormSpotDirection ); + OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation ); + printf( "\n" ); + OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable ); + OFFSET( "LIGHT_MAT_AMBIENT ", struct gl_light, _MatAmbient ); + OFFSET( "LIGHT_MAT_DIFFUSE ", struct gl_light, _MatDiffuse ); + OFFSET( "LIGHT_MAT_SPECULAR ", struct gl_light, _MatSpecular ); + printf( "\n" ); + SIZEOF( "SIZEOF_GL_LIGHT ", struct gl_light ); + + DEFINE_HEADER( "struct gl_light" ); + + DEFINE( "LIGHT_SPOT ", LIGHT_SPOT ); + DEFINE( "LIGHT_LOCAL_VIEWER ", LIGHT_LOCAL_VIEWER ); + DEFINE( "LIGHT_POSITIONAL ", LIGHT_POSITIONAL ); + printf( "\n" ); + DEFINE( "LIGHT_NEED_VERTICES ", LIGHT_NEED_VERTICES ); + + + /* struct gl_lightmodel offsets: + */ + OFFSET_HEADER( "struct gl_lightmodel" ); + + OFFSET( "LIGHT_MODEL_AMBIENT ", struct gl_lightmodel, Ambient ); + OFFSET( "LIGHT_MODEL_LOCAL_VIEWER ", struct gl_lightmodel, LocalViewer ); + OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide ); + OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl ); + + + printf( "\n" ); + printf( "\n" ); + printf( "#endif /* __ASM_TYPES_H__ */\n" ); + + return 0; +} |