From ef3f7e61b314236cbb7ed2cf24d34c6f90d9cfca Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 10 Dec 2010 14:24:05 -0800 Subject: tnl: Initialize gl_program_machine memory in run_vp. Fixes piglit valgrind glsl-array-bounds-04 failure (FDO bug 29946). NOTE: This is a candidate for the 7.10 branch. This is a candidate for the 7.9 branch. --- src/mesa/tnl/t_vb_program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 76f8fde3f52..7e7c59ae07b 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -311,7 +311,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) struct vp_stage_data *store = VP_STAGE_DATA(stage); struct vertex_buffer *VB = &tnl->vb; struct gl_vertex_program *program = ctx->VertexProgram._Current; - struct gl_program_machine machine; + struct gl_program_machine machine = { 0 }; GLuint outputs[VERT_RESULT_MAX], numOutputs; GLuint i, j; -- cgit v1.2.3 From a7e2d649710efaf6b542e8a96453baba5c58321f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 10 Dec 2010 11:34:41 -0800 Subject: mesa: Don't assertion fail for _mesa_get_format_name(MESA_FORMAT_NONE) --- src/mesa/main/formats.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index cd9eb81852f..42f70ca232b 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -863,7 +863,6 @@ const char * _mesa_get_format_name(gl_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); - ASSERT(info->BytesPerBlock); return info->StrName; } -- cgit v1.2.3 From 28bab24e1698843e27d27204a1117066e7ffeabb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Dec 2010 17:30:41 -0800 Subject: intel: Add spans code for the ARB_texture_rg support. This starts spantmp2.h down the path of using MESA_FORMAT_* for specifying the format instead of the crazy GL format/type combo. --- src/mesa/drivers/dri/common/spantmp2.h | 122 ++++++++++++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_span.c | 32 +++++++++ 2 files changed, 154 insertions(+) diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index abd79562f98..f436d1398c2 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -48,6 +48,15 @@ #define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() #endif +#ifdef SPANTMP_MESA_FMT +#define SPANTMP_PIXEL_FMT GL_NONE +#define SPANTMP_PIXEL_TYPE GL_NONE +#endif + +#ifndef SPANTMP_MESA_FMT +#define SPANTMP_MESA_FMT MESA_FORMAT_COUNT +#endif + #if (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5) /** @@ -445,6 +454,118 @@ rgba[3] = p; \ } while (0) +#elif (SPANTMP_MESA_FMT == MESA_FORMAT_R8) + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLubyte *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLubyte *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = color[0] + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, r) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLubyte p = GET_VALUE(_x, _y); \ + rgba[0] = p; \ + rgba[1] = 0; \ + rgba[2] = 0; \ + rgba[3] = 0; \ + } while (0) + +#elif (SPANTMP_MESA_FMT == MESA_FORMAT_RG88) + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + PACK_COLOR_8888(color[0], color[1], 0, 0) + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, r) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = p & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = 0; \ + rgba[3] = 0; \ + } while (0) + +#elif (SPANTMP_MESA_FMT == MESA_FORMAT_R16) + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = color[0] + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, r) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = p; \ + rgba[1] = 0; \ + rgba[2] = 0; \ + rgba[3] = 0; \ + } while (0) + +#elif (SPANTMP_MESA_FMT == MESA_FORMAT_RG1616) + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + ((color[1] << 16) | (color[0])) + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, r) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + rgba[0] = p & 0xffff; \ + rgba[1] = (p >> 16) & 0xffff; \ + rgba[2] = 0; \ + rgba[3] = 0; \ + } while (0) + #else #error SPANTMP_PIXEL_FMT must be set to a valid value! #endif @@ -914,3 +1035,4 @@ static void TAG(InitPointers)(struct gl_renderbuffer *rb) #undef GET_PTR #undef SPANTMP_PIXEL_FMT #undef SPANTMP_PIXEL_TYPE +#undef SPANTMP_MESA_FMT diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 104cadf0f9e..1c128bbfdf0 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -113,6 +113,26 @@ intel_set_span_functions(struct intel_context *intel, #define TAG2(x,y) intel_##x##y##_A8 #include "spantmp2.h" +#define SPANTMP_MESA_FMT MESA_FORMAT_R8 +#define TAG(x) intel_##x##_R8 +#define TAG2(x,y) intel_##x##y##_R8 +#include "spantmp2.h" + +#define SPANTMP_MESA_FMT MESA_FORMAT_RG88 +#define TAG(x) intel_##x##_RG88 +#define TAG2(x,y) intel_##x##y##_RG88 +#include "spantmp2.h" + +#define SPANTMP_MESA_FMT MESA_FORMAT_R16 +#define TAG(x) intel_##x##_R16 +#define TAG2(x,y) intel_##x##y##_R16 +#include "spantmp2.h" + +#define SPANTMP_MESA_FMT MESA_FORMAT_RG1616 +#define TAG(x) intel_##x##_RG1616 +#define TAG2(x,y) intel_##x##y##_RG1616 +#include "spantmp2.h" + #define LOCAL_DEPTH_VARS \ struct intel_renderbuffer *irb = intel_renderbuffer(rb); \ const GLint yScale = rb->Name ? 1 : -1; \ @@ -376,6 +396,18 @@ intel_set_span_functions(struct intel_context *intel, case MESA_FORMAT_S8_Z24: intel_InitDepthPointers_z24_s8(rb); break; + case MESA_FORMAT_R8: + intel_InitPointers_R8(rb); + break; + case MESA_FORMAT_RG88: + intel_InitPointers_RG88(rb); + break; + case MESA_FORMAT_R16: + intel_InitPointers_R16(rb); + break; + case MESA_FORMAT_RG1616: + intel_InitPointers_RG1616(rb); + break; default: _mesa_problem(NULL, "Unexpected MesaFormat %d in intelSetSpanFunctions", -- cgit v1.2.3 From e339b669a14f37698b842c0c51c1f5e4001ef12f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Dec 2010 17:08:31 -0800 Subject: intel: Add a couple of helper functions to reduce rb code duplication. --- src/mesa/drivers/dri/intel/intel_fbo.c | 104 +++----------------------- src/mesa/drivers/dri/intel/intel_span.c | 74 +++++++----------- src/mesa/drivers/dri/intel/intel_span.h | 4 + src/mesa/drivers/dri/intel/intel_tex.h | 1 + src/mesa/drivers/dri/intel/intel_tex_format.c | 33 ++++++++ 5 files changed, 78 insertions(+), 138 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 18e796a1186..bd51fc280d0 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -42,6 +42,8 @@ #include "intel_fbo.h" #include "intel_mipmap_tree.h" #include "intel_regions.h" +#include "intel_tex.h" +#include "intel_span.h" #define FILE_DEBUG_FLAG DEBUG_FBO @@ -110,26 +112,21 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer case GL_RED: case GL_R8: rb->Format = MESA_FORMAT_R8; - rb->DataType = GL_UNSIGNED_BYTE; break; case GL_R16: rb->Format = MESA_FORMAT_R16; - rb->DataType = GL_UNSIGNED_SHORT; break; case GL_RG: case GL_RG8: rb->Format = MESA_FORMAT_RG88; - rb->DataType = GL_UNSIGNED_BYTE; break; case GL_RG16: rb->Format = MESA_FORMAT_RG1616; - rb->DataType = GL_UNSIGNED_SHORT; break; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: rb->Format = MESA_FORMAT_RGB565; - rb->DataType = GL_UNSIGNED_BYTE; break; case GL_RGB: case GL_RGB8: @@ -137,7 +134,6 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer case GL_RGB12: case GL_RGB16: rb->Format = MESA_FORMAT_XRGB8888; - rb->DataType = GL_UNSIGNED_BYTE; break; case GL_RGBA: case GL_RGBA2: @@ -148,16 +144,13 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer case GL_RGBA12: case GL_RGBA16: rb->Format = MESA_FORMAT_ARGB8888; - rb->DataType = GL_UNSIGNED_BYTE; break; case GL_ALPHA: case GL_ALPHA8: rb->Format = MESA_FORMAT_A8; - rb->DataType = GL_UNSIGNED_BYTE; break; case GL_DEPTH_COMPONENT16: rb->Format = MESA_FORMAT_Z16; - rb->DataType = GL_UNSIGNED_SHORT; break; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: @@ -171,7 +164,6 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer case GL_DEPTH24_STENCIL8_EXT: /* alloc a depth+stencil buffer */ rb->Format = MESA_FORMAT_S8_Z24; - rb->DataType = GL_UNSIGNED_INT_24_8_EXT; break; default: _mesa_problem(ctx, @@ -180,6 +172,7 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer } rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); + rb->DataType = intel_mesa_format_to_rb_datatype(rb->Format); cpp = _mesa_get_format_bytes(rb->Format); intel_flush(ctx); @@ -338,39 +331,30 @@ intel_create_renderbuffer(gl_format format) switch (format) { case MESA_FORMAT_RGB565: irb->Base._BaseFormat = GL_RGB; - irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_XRGB8888: irb->Base._BaseFormat = GL_RGB; - irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_ARGB8888: irb->Base._BaseFormat = GL_RGBA; - irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_Z16: irb->Base._BaseFormat = GL_DEPTH_COMPONENT; - irb->Base.DataType = GL_UNSIGNED_SHORT; break; case MESA_FORMAT_X8_Z24: irb->Base._BaseFormat = GL_DEPTH_COMPONENT; - irb->Base.DataType = GL_UNSIGNED_INT; break; case MESA_FORMAT_S8_Z24: irb->Base._BaseFormat = GL_DEPTH_STENCIL; - irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; break; case MESA_FORMAT_A8: irb->Base._BaseFormat = GL_ALPHA; - irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_R8: irb->Base._BaseFormat = GL_RED; - irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_RG88: irb->Base._BaseFormat = GL_RG; - irb->Base.DataType = GL_UNSIGNED_BYTE; break; default: _mesa_problem(NULL, @@ -381,6 +365,7 @@ intel_create_renderbuffer(gl_format format) irb->Base.Format = format; irb->Base.InternalFormat = irb->Base._BaseFormat; + irb->Base.DataType = intel_mesa_format_to_rb_datatype(format); /* intel-specific methods */ irb->Base.Delete = intel_delete_renderbuffer; @@ -457,70 +442,16 @@ static GLboolean intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb, struct gl_texture_image *texImage) { - if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to RGBA8 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_XRGB8888) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to XGBA8 texture OK\n"); - } -#ifndef I915 - else if (texImage->TexFormat == MESA_FORMAT_SARGB8) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to SARGB8 texture OK\n"); - } -#endif - else if (texImage->TexFormat == MESA_FORMAT_RGB565) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to RGB5 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to ARGB1555 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to ARGB4444 texture OK\n"); - } -#ifndef I915 - else if (texImage->TexFormat == MESA_FORMAT_A8) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to A8 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_R8) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to R8 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_RG88) { - irb->Base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to RG88 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_R16) { - irb->Base.DataType = GL_UNSIGNED_SHORT; - DBG("Render to R8 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_RG1616) { - irb->Base.DataType = GL_UNSIGNED_SHORT; - DBG("Render to RG88 texture OK\n"); - } -#endif - else if (texImage->TexFormat == MESA_FORMAT_Z16) { - irb->Base.DataType = GL_UNSIGNED_SHORT; - DBG("Render to DEPTH16 texture OK\n"); - } - else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { - irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - DBG("Render to DEPTH_STENCIL texture OK\n"); - } - else { + if (!intel_span_supports_format(texImage->TexFormat)) { DBG("Render to texture BAD FORMAT %s\n", _mesa_get_format_name(texImage->TexFormat)); return GL_FALSE; + } else { + DBG("Render to texture %s\n", _mesa_get_format_name(texImage->TexFormat)); } irb->Base.Format = texImage->TexFormat; - + irb->Base.DataType = intel_mesa_format_to_rb_datatype(texImage->TexFormat); irb->Base.InternalFormat = texImage->InternalFormat; irb->Base._BaseFormat = _mesa_base_fbo_format(ctx, irb->Base.InternalFormat); irb->Base.Width = texImage->Width; @@ -711,22 +642,9 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) continue; } - switch (irb->Base.Format) { - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_XRGB8888: - case MESA_FORMAT_RGB565: - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB4444: -#ifndef I915 - case MESA_FORMAT_SARGB8: - case MESA_FORMAT_A8: - case MESA_FORMAT_R8: - case MESA_FORMAT_R16: - case MESA_FORMAT_RG88: - case MESA_FORMAT_RG1616: -#endif - break; - default: + if (!intel_span_supports_format(irb->Base.Format)) { + DBG("Unsupported texture/renderbuffer format attached: %s\n", + _mesa_get_format_name(irb->Base.Format)); fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; } } diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 1c128bbfdf0..1f41518535c 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -25,6 +25,7 @@ * **************************************************************************/ +#include #include "main/glheader.h" #include "main/macros.h" #include "main/mtypes.h" @@ -359,6 +360,32 @@ intel_unmap_vertex_shader_textures(struct gl_context *ctx) } } +typedef void (*span_init_func)(struct gl_renderbuffer *rb); + +static span_init_func intel_span_init_funcs[MESA_FORMAT_COUNT] = +{ + [MESA_FORMAT_A8] = intel_InitPointers_A8, + [MESA_FORMAT_RGB565] = intel_InitPointers_RGB565, + [MESA_FORMAT_ARGB4444] = intel_InitPointers_ARGB4444, + [MESA_FORMAT_ARGB1555] = intel_InitPointers_ARGB1555, + [MESA_FORMAT_XRGB8888] = intel_InitPointers_xRGB8888, + [MESA_FORMAT_ARGB8888] = intel_InitPointers_ARGB8888, + [MESA_FORMAT_SARGB8] = intel_InitPointers_ARGB8888, + [MESA_FORMAT_Z16] = intel_InitDepthPointers_z16, + [MESA_FORMAT_X8_Z24] = intel_InitDepthPointers_z24_s8, + [MESA_FORMAT_S8_Z24] = intel_InitDepthPointers_z24_s8, + [MESA_FORMAT_R8] = intel_InitPointers_R8, + [MESA_FORMAT_RG88] = intel_InitPointers_RG88, + [MESA_FORMAT_R16] = intel_InitPointers_R16, + [MESA_FORMAT_RG1616] = intel_InitPointers_RG1616, +}; + +bool +intel_span_supports_format(gl_format format) +{ + return intel_span_init_funcs[format] != NULL; +} + /** * Plug in appropriate span read/write functions for the given renderbuffer. * These are used for the software fallbacks. @@ -369,49 +396,6 @@ intel_set_span_functions(struct intel_context *intel, { struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb; - switch (irb->Base.Format) { - case MESA_FORMAT_A8: - intel_InitPointers_A8(rb); - break; - case MESA_FORMAT_RGB565: - intel_InitPointers_RGB565(rb); - break; - case MESA_FORMAT_ARGB4444: - intel_InitPointers_ARGB4444(rb); - break; - case MESA_FORMAT_ARGB1555: - intel_InitPointers_ARGB1555(rb); - break; - case MESA_FORMAT_XRGB8888: - intel_InitPointers_xRGB8888(rb); - break; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_SARGB8: - intel_InitPointers_ARGB8888(rb); - break; - case MESA_FORMAT_Z16: - intel_InitDepthPointers_z16(rb); - break; - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_S8_Z24: - intel_InitDepthPointers_z24_s8(rb); - break; - case MESA_FORMAT_R8: - intel_InitPointers_R8(rb); - break; - case MESA_FORMAT_RG88: - intel_InitPointers_RG88(rb); - break; - case MESA_FORMAT_R16: - intel_InitPointers_R16(rb); - break; - case MESA_FORMAT_RG1616: - intel_InitPointers_RG1616(rb); - break; - default: - _mesa_problem(NULL, - "Unexpected MesaFormat %d in intelSetSpanFunctions", - irb->Base.Format); - break; - } + assert(intel_span_init_funcs[irb->Base.Format]); + intel_span_init_funcs[irb->Base.Format](rb); } diff --git a/src/mesa/drivers/dri/intel/intel_span.h b/src/mesa/drivers/dri/intel/intel_span.h index aa8d08e843a..5a4c4e8e52a 100644 --- a/src/mesa/drivers/dri/intel/intel_span.h +++ b/src/mesa/drivers/dri/intel/intel_span.h @@ -28,6 +28,9 @@ #ifndef _INTEL_SPAN_H #define _INTEL_SPAN_H +#include "main/formats.h" +#include + extern void intelInitSpanFuncs(struct gl_context * ctx); extern void intelSpanRenderFinish(struct gl_context * ctx); @@ -38,5 +41,6 @@ void intel_renderbuffer_unmap(struct intel_context *intel, struct gl_renderbuffer *rb); void intel_map_vertex_shader_textures(struct gl_context *ctx); void intel_unmap_vertex_shader_textures(struct gl_context *ctx); +bool intel_span_supports_format(gl_format format); #endif diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 7906554e453..b638628c711 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -42,6 +42,7 @@ void intelInitTextureCopyImageFuncs(struct dd_function_table *functions); gl_format intelChooseTextureFormat(struct gl_context *ctx, GLint internalFormat, GLenum format, GLenum type); +GLenum intel_mesa_format_to_rb_datatype(gl_format format); void intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *pDraw); diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index f8316ae2f8d..c9763c9ae16 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -3,6 +3,39 @@ #include "main/enums.h" #include "main/formats.h" +/** + * Returns the renderbuffer DataType for a MESA_FORMAT. + */ +GLenum +intel_mesa_format_to_rb_datatype(gl_format format) +{ + switch (format) { + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_SARGB8: + case MESA_FORMAT_R8: + case MESA_FORMAT_RG88: + case MESA_FORMAT_A8: + case MESA_FORMAT_AL88: + case MESA_FORMAT_RGB565: + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB4444: + return GL_UNSIGNED_BYTE; + case MESA_FORMAT_R16: + case MESA_FORMAT_RG1616: + case MESA_FORMAT_Z16: + return GL_UNSIGNED_SHORT; + case MESA_FORMAT_X8_Z24: + return GL_UNSIGNED_INT; + case MESA_FORMAT_S8_Z24: + return GL_UNSIGNED_INT_24_8_EXT; + default: + _mesa_problem(NULL, "unexpected MESA_FORMAT for renderbuffer"); + return GL_UNSIGNED_BYTE; + } +} + + /** * Choose hardware texture format given the user's glTexImage parameters. * -- cgit v1.2.3 From be72efb4f29180fdaf0935f8739f230fe5ea6317 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Dec 2010 17:15:26 -0800 Subject: intel: Just use ChooseTextureFormat for renderbuffer format choice. One less place to forget to put your new MESA_FORMAT support in. --- src/mesa/drivers/dri/intel/intel_fbo.c | 61 +++++----------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index bd51fc280d0..f6fe7b17536 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -109,66 +109,23 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer ASSERT(rb->Name != 0); switch (internalFormat) { - case GL_RED: - case GL_R8: - rb->Format = MESA_FORMAT_R8; - break; - case GL_R16: - rb->Format = MESA_FORMAT_R16; - break; - case GL_RG: - case GL_RG8: - rb->Format = MESA_FORMAT_RG88; - break; - case GL_RG16: - rb->Format = MESA_FORMAT_RG1616; - break; - case GL_R3_G3_B2: - case GL_RGB4: - case GL_RGB5: - rb->Format = MESA_FORMAT_RGB565; - break; - case GL_RGB: - case GL_RGB8: - case GL_RGB10: - case GL_RGB12: - case GL_RGB16: - rb->Format = MESA_FORMAT_XRGB8888; - break; - case GL_RGBA: - case GL_RGBA2: - case GL_RGBA4: - case GL_RGB5_A1: - case GL_RGBA8: - case GL_RGB10_A2: - case GL_RGBA12: - case GL_RGBA16: - rb->Format = MESA_FORMAT_ARGB8888; - break; - case GL_ALPHA: - case GL_ALPHA8: - rb->Format = MESA_FORMAT_A8; - break; - case GL_DEPTH_COMPONENT16: - rb->Format = MESA_FORMAT_Z16; + default: + /* Use the same format-choice logic as for textures. + * Renderbuffers aren't any different from textures for us, + * except they're less useful because you can't texture with + * them. + */ + rb->Format = intelChooseTextureFormat(ctx, internalFormat, + GL_NONE, GL_NONE); break; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: - case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT24: - case GL_DEPTH_COMPONENT32: - case GL_DEPTH_STENCIL_EXT: - case GL_DEPTH24_STENCIL8_EXT: - /* alloc a depth+stencil buffer */ + /* These aren't actual texture formats, so force them here. */ rb->Format = MESA_FORMAT_S8_Z24; break; - default: - _mesa_problem(ctx, - "Unexpected format in intel_alloc_renderbuffer_storage"); - return GL_FALSE; } rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); -- cgit v1.2.3 From 783e7caadf945f176cb297b8791769e2855fc9ef Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 10 Dec 2010 13:09:55 -0800 Subject: i965: Put common info on converting MESA_FORMAT to BRW_FORMAT in a table. There are exceptions to the table for depth texturing or rendering to not-quite-supported formats thanks to the non-orthogonal component selection for surface formats, but it's still a lot simpler. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 168 ++++++----------------- 1 file changed, 42 insertions(+), 126 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index ad744044c70..1cd736a1119 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -68,71 +68,43 @@ static GLuint translate_tex_target( GLenum target ) } } +static uint32_t brw_format_for_mesa_format[MESA_FORMAT_COUNT] = +{ + [MESA_FORMAT_L8] = BRW_SURFACEFORMAT_L8_UNORM, + [MESA_FORMAT_I8] = BRW_SURFACEFORMAT_I8_UNORM, + [MESA_FORMAT_A8] = BRW_SURFACEFORMAT_A8_UNORM, + [MESA_FORMAT_AL88] = BRW_SURFACEFORMAT_L8A8_UNORM, + [MESA_FORMAT_AL1616] = BRW_SURFACEFORMAT_L16A16_UNORM, + [MESA_FORMAT_R8] = BRW_SURFACEFORMAT_R8_UNORM, + [MESA_FORMAT_R16] = BRW_SURFACEFORMAT_R16_UNORM, + [MESA_FORMAT_RG88] = BRW_SURFACEFORMAT_R8G8_UNORM, + [MESA_FORMAT_RG1616] = BRW_SURFACEFORMAT_R16G16_UNORM, + [MESA_FORMAT_ARGB8888] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM, + [MESA_FORMAT_XRGB8888] = BRW_SURFACEFORMAT_B8G8R8X8_UNORM, + [MESA_FORMAT_RGB565] = BRW_SURFACEFORMAT_B5G6R5_UNORM, + [MESA_FORMAT_ARGB1555] = BRW_SURFACEFORMAT_B5G5R5A1_UNORM, + [MESA_FORMAT_ARGB4444] = BRW_SURFACEFORMAT_B4G4R4A4_UNORM, + [MESA_FORMAT_YCBCR_REV] = BRW_SURFACEFORMAT_YCRCB_NORMAL, + [MESA_FORMAT_YCBCR] = BRW_SURFACEFORMAT_YCRCB_SWAPUVY, + [MESA_FORMAT_RGB_FXT1] = BRW_SURFACEFORMAT_FXT1, + [MESA_FORMAT_RGBA_FXT1] = BRW_SURFACEFORMAT_FXT1, + [MESA_FORMAT_RGB_DXT1] = BRW_SURFACEFORMAT_DXT1_RGB, + [MESA_FORMAT_RGBA_DXT1] = BRW_SURFACEFORMAT_BC1_UNORM, + [MESA_FORMAT_RGBA_DXT3] = BRW_SURFACEFORMAT_BC2_UNORM, + [MESA_FORMAT_RGBA_DXT5] = BRW_SURFACEFORMAT_BC3_UNORM, + [MESA_FORMAT_SRGB_DXT1] = BRW_SURFACEFORMAT_BC1_UNORM_SRGB, + [MESA_FORMAT_SARGB8] = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB, + [MESA_FORMAT_SLA8] = BRW_SURFACEFORMAT_L8A8_UNORM_SRGB, + [MESA_FORMAT_SL8] = BRW_SURFACEFORMAT_L8_UNORM_SRGB, + [MESA_FORMAT_DUDV8] = BRW_SURFACEFORMAT_R8G8_SNORM, + [MESA_FORMAT_SIGNED_RGBA8888_REV] = BRW_SURFACEFORMAT_R8G8B8A8_SNORM, +}; static GLuint translate_tex_format( gl_format mesa_format, GLenum internal_format, GLenum depth_mode ) { switch( mesa_format ) { - case MESA_FORMAT_L8: - return BRW_SURFACEFORMAT_L8_UNORM; - - case MESA_FORMAT_I8: - return BRW_SURFACEFORMAT_I8_UNORM; - - case MESA_FORMAT_A8: - return BRW_SURFACEFORMAT_A8_UNORM; - - case MESA_FORMAT_AL88: - return BRW_SURFACEFORMAT_L8A8_UNORM; - - case MESA_FORMAT_AL1616: - return BRW_SURFACEFORMAT_L16A16_UNORM; - - case MESA_FORMAT_R8: - return BRW_SURFACEFORMAT_R8_UNORM; - - case MESA_FORMAT_R16: - return BRW_SURFACEFORMAT_R16_UNORM; - - case MESA_FORMAT_RG88: - return BRW_SURFACEFORMAT_R8G8_UNORM; - - case MESA_FORMAT_RG1616: - return BRW_SURFACEFORMAT_R16G16_UNORM; - - case MESA_FORMAT_RGB888: - assert(0); /* not supported for sampling */ - return BRW_SURFACEFORMAT_R8G8B8_UNORM; - - case MESA_FORMAT_ARGB8888: - return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - - case MESA_FORMAT_XRGB8888: - return BRW_SURFACEFORMAT_B8G8R8X8_UNORM; - - case MESA_FORMAT_RGBA8888_REV: - _mesa_problem(NULL, "unexpected format in i965:translate_tex_format()"); - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; - - case MESA_FORMAT_RGB565: - return BRW_SURFACEFORMAT_B5G6R5_UNORM; - - case MESA_FORMAT_ARGB1555: - return BRW_SURFACEFORMAT_B5G5R5A1_UNORM; - - case MESA_FORMAT_ARGB4444: - return BRW_SURFACEFORMAT_B4G4R4A4_UNORM; - - case MESA_FORMAT_YCBCR_REV: - return BRW_SURFACEFORMAT_YCRCB_NORMAL; - - case MESA_FORMAT_YCBCR: - return BRW_SURFACEFORMAT_YCRCB_SWAPUVY; - - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - return BRW_SURFACEFORMAT_FXT1; case MESA_FORMAT_Z16: if (depth_mode == GL_INTENSITY) @@ -144,30 +116,6 @@ static GLuint translate_tex_format( gl_format mesa_format, else return BRW_SURFACEFORMAT_L16_UNORM; - case MESA_FORMAT_RGB_DXT1: - return BRW_SURFACEFORMAT_DXT1_RGB; - - case MESA_FORMAT_RGBA_DXT1: - return BRW_SURFACEFORMAT_BC1_UNORM; - - case MESA_FORMAT_RGBA_DXT3: - return BRW_SURFACEFORMAT_BC2_UNORM; - - case MESA_FORMAT_RGBA_DXT5: - return BRW_SURFACEFORMAT_BC3_UNORM; - - case MESA_FORMAT_SARGB8: - return BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB; - - case MESA_FORMAT_SLA8: - return BRW_SURFACEFORMAT_L8A8_UNORM_SRGB; - - case MESA_FORMAT_SL8: - return BRW_SURFACEFORMAT_L8_UNORM_SRGB; - - case MESA_FORMAT_SRGB_DXT1: - return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; - case MESA_FORMAT_S8_Z24: /* XXX: these different surface formats don't seem to * make any difference for shadow sampler/compares. @@ -181,15 +129,9 @@ static GLuint translate_tex_format( gl_format mesa_format, else return BRW_SURFACEFORMAT_L24X8_UNORM; - case MESA_FORMAT_DUDV8: - return BRW_SURFACEFORMAT_R8G8_SNORM; - - case MESA_FORMAT_SIGNED_RGBA8888_REV: - return BRW_SURFACEFORMAT_R8G8B8A8_SNORM; - default: - assert(0); - return 0; + assert(brw_format_for_mesa_format[mesa_format] != 0); + return brw_format_for_mesa_format[mesa_format]; } } @@ -448,45 +390,19 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.surface_type = BRW_SURFACE_2D; switch (irb->Base.Format) { - /* XRGB and ARGB are treated the same here because the chips in this - * family cannot render to XRGB targets. This means that we have to - * mask writes to alpha (ala glColorMask) and reconfigure the alpha - * blending hardware to use GL_ONE (or GL_ZERO) for cases where - * GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is used. - */ - case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: + /* XRGB is handled as ARGB because the chips in this family + * cannot render to XRGB targets. This means that we have to + * mask writes to alpha (ala glColorMask) and reconfigure the + * alpha blending hardware to use GL_ONE (or GL_ZERO) for + * cases where GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is + * used. + */ key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; - case MESA_FORMAT_SARGB8: - key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB; - break; - case MESA_FORMAT_RGB565: - key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; - break; - case MESA_FORMAT_ARGB1555: - key.surface_format = BRW_SURFACEFORMAT_B5G5R5A1_UNORM; - break; - case MESA_FORMAT_ARGB4444: - key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM; - break; - case MESA_FORMAT_A8: - key.surface_format = BRW_SURFACEFORMAT_A8_UNORM; - break; - case MESA_FORMAT_R8: - key.surface_format = BRW_SURFACEFORMAT_R8_UNORM; - break; - case MESA_FORMAT_R16: - key.surface_format = BRW_SURFACEFORMAT_R16_UNORM; - break; - case MESA_FORMAT_RG88: - key.surface_format = BRW_SURFACEFORMAT_R8G8_UNORM; - break; - case MESA_FORMAT_RG1616: - key.surface_format = BRW_SURFACEFORMAT_R16G16_UNORM; - break; default: - _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format); + key.surface_format = brw_format_for_mesa_format[irb->Base.Format]; + assert(key.surface_format != 0); } key.tiling = region->tiling; key.width = rb->Width; -- cgit v1.2.3 From ec53010c4d02e11171d3c782a41b70cad76788e8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 10 Dec 2010 15:47:11 -0800 Subject: glsl: Minor clean-up in validate_assignment This code has been changed around a lot, and there were some temporary variables left around from previous versions. --- src/glsl/ast_to_hir.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 1f4972cfca2..75ba3a9bafa 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -598,17 +598,15 @@ ir_rvalue * validate_assignment(struct _mesa_glsl_parse_state *state, const glsl_type *lhs_type, ir_rvalue *rhs) { - const glsl_type *rhs_type = rhs->type; - /* If there is already some error in the RHS, just return it. Anything * else will lead to an avalanche of error message back to the user. */ - if (rhs_type->is_error()) + if (rhs->type->is_error()) return rhs; /* If the types are identical, the assignment can trivially proceed. */ - if (rhs_type == lhs_type) + if (rhs->type == lhs_type) return rhs; /* If the array element types are the same and the size of the LHS is zero, @@ -625,8 +623,7 @@ validate_assignment(struct _mesa_glsl_parse_state *state, /* Check for implicit conversion in GLSL 1.20 */ if (apply_implicit_conversion(lhs_type, rhs, state)) { - rhs_type = rhs->type; - if (rhs_type == lhs_type) + if (rhs->type == lhs_type) return rhs; } -- cgit v1.2.3 From d7f27e2e76eac9bc2ee0fa36f52542fdcb9563dd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 10 Dec 2010 15:48:15 -0800 Subject: glsl: Inherrit type of declared variable from initializer after processing assignment do_assignment may apply implicit conversions to coerce the base type of initializer to the base type of the variable being declared. Fixes piglit test glsl-implicit-conversion-02 (bugzilla #32287). This probably also fixes bugzilla #32273. NOTE: This is a candidate for the 7.9 branch and the 7.10 branch. --- src/glsl/ast_to_hir.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 75ba3a9bafa..741cd19e9d3 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2239,6 +2239,17 @@ ast_declarator_list::hir(exec_list *instructions, if (this->type->qualifier.flags.q.constant) var->read_only = false; + /* Never emit code to initialize a uniform. + */ + const glsl_type *initializer_type; + if (!this->type->qualifier.flags.q.uniform) { + result = do_assignment(&initializer_instructions, state, + lhs, rhs, + this->get_location()); + initializer_type = result->type; + } else + initializer_type = rhs->type; + /* If the declared variable is an unsized array, it must inherrit * its full type from the initializer. A declaration such as * @@ -2253,16 +2264,14 @@ ast_declarator_list::hir(exec_list *instructions, * * If the declared variable is not an array, the types must * already match exactly. As a result, the type assignment - * here can be done unconditionally. + * here can be done unconditionally. For non-uniforms the call + * to do_assignment can change the type of the initializer (via + * the implicit conversion rules). For uniforms the initializer + * must be a constant expression, and the type of that expression + * was validated above. */ - var->type = rhs->type; + var->type = initializer_type; - /* Never emit code to initialize a uniform. - */ - if (!this->type->qualifier.flags.q.uniform) - result = do_assignment(&initializer_instructions, state, - lhs, rhs, - this->get_location()); var->read_only = temp; } } -- cgit v1.2.3 From 9e1fbd3d6e2a8accd0ebdc5937dd6eb7a8ef9b10 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 11 Dec 2010 07:32:24 +0100 Subject: r300/compiler: fix LIT in VS This fixes broken rendering of trees in ETQW. The trees still disappear for an unknown reason when they are close. Broken since: 2ff9d4474bdf5f05852ad4963d0b597d20743678 r300/compiler: make lowering passes possibly use up to two less temps NOTE: This is a candidate for the 7.10 branch. --- src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 58977a40c7c..c8063171b81 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -689,11 +689,12 @@ static void transform_r300_vertex_fix_LIT(struct radeon_compiler* c, &constant_swizzle); /* MOV dst, src */ + dst.WriteMask = RC_MASK_XYZW; emit1(c, inst->Prev, RC_OPCODE_MOV, 0, dst, inst->U.I.SrcReg[0]); - /* MAX dst.z, src, 0.00...001 */ + /* MAX dst.y, src, 0.00...001 */ emit2(c, inst->Prev, RC_OPCODE_MAX, 0, dstregtmpmask(dst.Index, RC_MASK_Y), srcreg(RC_FILE_TEMPORARY, dst.Index), -- cgit v1.2.3 From d0990db6bd7d6e9e1cd780dc6b50ce00408a3cbc Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 11 Dec 2010 13:22:19 +0100 Subject: r300/compiler: fix swizzle lowering with a presubtract source operand If a source operand has a non-native swizzle (e.g. the KIL instruction cannot have a swizzle other than .xyzw), the lowering pass uses one or more MOV instructions to move the operand to an intermediate temporary with native swizzles. This commit fixes that the presubtract information was lost during the lowering. NOTE: This is a candidate for both the 7.9 and 7.10 branches. --- src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c index a0f7bd81741..133a9f72ec7 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c @@ -56,6 +56,7 @@ static void rewrite_source(struct radeon_compiler * c, mov->U.I.DstReg.Index = tempreg; mov->U.I.DstReg.WriteMask = split.Phase[phase]; mov->U.I.SrcReg[0] = inst->U.I.SrcReg[src]; + mov->U.I.PreSub = inst->U.I.PreSub; phase_refmask = 0; for(unsigned int chan = 0; chan < 4; ++chan) { -- cgit v1.2.3 From c398f1544ea113279e5f038f4a643005743cab62 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 11 Dec 2010 08:38:39 +0100 Subject: tgsi: fix rbug compile error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../mesa/src/gallium/auxiliary/tgsi/tgsi_parse.h:139: error: dereferencing pointer ‘tokens.25’ does break strict-aliasing rules Signed-off-by: Marek Olšák --- src/gallium/auxiliary/tgsi/tgsi_parse.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index d4df5851764..2aafa2a6e83 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -136,7 +136,8 @@ tgsi_parse_token( static INLINE unsigned tgsi_num_tokens(const struct tgsi_token *tokens) { - struct tgsi_header header = *(const struct tgsi_header *) tokens; + struct tgsi_header header; + memcpy(&header, tokens, sizeof(header)); return header.HeaderSize + header.BodySize; } -- cgit v1.2.3 From 2af8a1983180fc0168c1e0e53bcc69ee3d684ea4 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 11 Dec 2010 14:45:27 +0100 Subject: r300g: fix rendering with a vertex attrib having a zero stride The hardware apparently does support a zero stride, so let's use it. This fixes missing objects in ETQW, but might also fix a ton of other similar-looking bugs. NOTE: This is a candidate for both the 7.9 and 7.10 branches. --- src/gallium/drivers/r300/r300_state.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 75292532405..0ad8a1f4204 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1496,14 +1496,14 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, any_user_buffer = TRUE; } + /* The stride of zero means we will be fetching only the first + * vertex, so don't care about max_index. */ + if (!vbo->stride) + continue; + if (vbo->max_index == ~0) { - /* if no VBO stride then only one vertex value so max index is 1 */ - /* should think about converting to VS constants like svga does */ - if (!vbo->stride) - vbo->max_index = 1; - else - vbo->max_index = - (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; + vbo->max_index = + (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; } max_index = MIN2(vbo->max_index, max_index); -- cgit v1.2.3 From 7d8c06746059c2b3cd7ac08fd0909e38c880ec9c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 11 Dec 2010 13:30:13 -0800 Subject: mesa: Clean up header file inclusion in ir_to_mesa.h. --- src/mesa/program/ir_to_mesa.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h index 7197615f949..7410e149735 100644 --- a/src/mesa/program/ir_to_mesa.h +++ b/src/mesa/program/ir_to_mesa.h @@ -25,8 +25,11 @@ extern "C" { #endif -#include "main/config.h" -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_shader; +struct gl_shader_program; void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *sh); void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); -- cgit v1.2.3 From bf8242684a893c2b3abb4a515c31d24a0a6b7dc4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 11 Dec 2010 14:37:18 -0800 Subject: mesa: Clean up header file inclusion in nvfragparse.h. --- src/mesa/program/nvfragparse.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/nvfragparse.h b/src/mesa/program/nvfragparse.h index 3e85dd2c30b..088e7527d5b 100644 --- a/src/mesa/program/nvfragparse.h +++ b/src/mesa/program/nvfragparse.h @@ -30,7 +30,10 @@ #ifndef NVFRAGPARSE_H #define NVFRAGPARSE_H -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_fragment_program; extern void _mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target, -- cgit v1.2.3 From 1c01bedb02617d8c0ff208b39d11e50fd1051430 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 12 Dec 2010 17:56:49 +0800 Subject: mapi: Fix a warning in !THREADS build. It should be u_thread_self, not _glthread_GetID. --- src/mapi/mapi/u_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mapi/mapi/u_thread.c b/src/mapi/mapi/u_thread.c index e9eae55364b..138db47b5cd 100644 --- a/src/mapi/mapi/u_thread.c +++ b/src/mapi/mapi/u_thread.c @@ -222,7 +222,7 @@ u_tsd_set(struct u_tsd *tsd, void *ptr) */ unsigned long -_glthread_GetID(void) +u_thread_self(void) { return 0; } -- cgit v1.2.3 From d6b1478ff0499059661df145efe469e7b28ff7bf Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 12 Dec 2010 18:13:27 +0800 Subject: egl: Do not unload drivers. When the driver is the last reference to libEGL.so, unloading it will cause libEGL.so to be unmapped and give problems. Disable the unloading for now. Still have to figure out the right timing to unload drivers. --- src/egl/main/egldriver.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index ff0011c4b15..e5d8a39a4c8 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -186,11 +186,22 @@ _eglLoadModule(_EGLModule *mod) static void _eglUnloadModule(_EGLModule *mod) { +#if defined(_EGL_OS_UNIX) /* destroy the driver */ if (mod->Driver && mod->Driver->Unload) mod->Driver->Unload(mod->Driver); + + /* + * XXX At this point (atexit), the module might be the last reference to + * libEGL. Closing the module might unmap libEGL and give problems. + */ +#if 0 if (mod->Handle) close_library(mod->Handle); +#endif +#elif defined(_EGL_OS_WINDOWS) + /* XXX Windows unloads DLLs before atexit */ +#endif mod->Driver = NULL; mod->Handle = NULL; @@ -670,12 +681,7 @@ _eglUnloadDrivers(void) { /* this is called at atexit time */ if (_eglModules) { -#if defined(_EGL_OS_UNIX) _eglDestroyArray(_eglModules, _eglFreeModule); -#elif defined(_EGL_OS_WINDOWS) - /* XXX Windows unloads DLLs before atexit */ - _eglDestroyArray(_eglModules, NULL); -#endif _eglModules = NULL; } } -- cgit v1.2.3 From d19b5cbd317620f3977e68fffb7a74793436b7e2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 10 Dec 2010 15:40:48 +1000 Subject: r300g: fixup rs690 tiling stride alignment calculations. The RS690 memory controller prefers things to be on a different boundary than the discrete GPUs, we had an attempt to fix this, but it still failed, this consolidates the stride calculation into one place and removes the really special case check. This fixes gnome-shell and 16 piglit tests on my rs690 system. NOTE: This is a candidate for both the 7.9 and 7.10 branches. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_texture.c | 2 +- src/gallium/drivers/r300/r300_texture_desc.c | 46 ++++++++++------------------ src/gallium/drivers/r300/r300_texture_desc.h | 2 +- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 70fc5d96d83..6d86bc282ff 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -899,7 +899,7 @@ struct pipe_surface* r300_create_surface(struct pipe_context * ctx, tex->desc.b.b.nr_samples, tex->desc.microtile, tex->desc.macrotile[level], - DIM_HEIGHT); + DIM_HEIGHT, 0); surface->cbzb_height = align((surface->base.height + 1) / 2, tile_height); diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c index aa82c47151a..7b1739142d4 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.c +++ b/src/gallium/drivers/r300/r300_texture_desc.c @@ -34,7 +34,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, unsigned num_samples, enum r300_buffer_tiling microtile, enum r300_buffer_tiling macrotile, - enum r300_dim dim) + enum r300_dim dim, boolean is_rs690) { static const unsigned table[2][5][3][2] = { @@ -57,6 +57,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, {{ 16, 8}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */ } }; + static const unsigned aa_block[2] = {4, 8}; unsigned tile = 0; unsigned pixsize = util_format_get_blocksize(format); @@ -74,6 +75,14 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, } else { /* Standard alignment. */ tile = table[macrotile][util_logbase2(pixsize)][microtile][dim]; + if (macrotile == 0 && is_rs690 && dim == DIM_WIDTH) { + int align; + int h_tile; + h_tile = table[macrotile][util_logbase2(pixsize)][microtile][DIM_HEIGHT]; + align = 64 / (pixsize * h_tile); + if (tile < align) + tile = align; + } } assert(tile); @@ -89,7 +98,7 @@ static boolean r300_texture_macro_switch(struct r300_texture_desc *desc, unsigned tile, texdim; tile = r300_get_pixel_alignment(desc->b.b.format, desc->b.b.nr_samples, - desc->microtile, R300_BUFFER_TILED, dim); + desc->microtile, R300_BUFFER_TILED, dim, 0); if (dim == DIM_WIDTH) { texdim = u_minify(desc->width0, level); } else { @@ -113,6 +122,9 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, unsigned level) { unsigned tile_width, width, stride; + boolean is_rs690 = (screen->caps.family == CHIP_FAMILY_RS600 || + screen->caps.family == CHIP_FAMILY_RS690 || + screen->caps.family == CHIP_FAMILY_RS740); if (desc->stride_in_bytes_override) return desc->stride_in_bytes_override; @@ -131,38 +143,14 @@ static unsigned r300_texture_get_stride(struct r300_screen *screen, desc->b.b.nr_samples, desc->microtile, desc->macrotile[level], - DIM_WIDTH); + DIM_WIDTH, is_rs690); width = align(width, tile_width); stride = util_format_get_stride(desc->b.b.format, width); - - /* Some IGPs need a minimum stride of 64 bytes, hmm... */ - if (!desc->macrotile[level] && - (screen->caps.family == CHIP_FAMILY_RS600 || - screen->caps.family == CHIP_FAMILY_RS690 || - screen->caps.family == CHIP_FAMILY_RS740)) { - unsigned min_stride; - - if (desc->microtile) { - unsigned tile_height = - r300_get_pixel_alignment(desc->b.b.format, - desc->b.b.nr_samples, - desc->microtile, - desc->macrotile[level], - DIM_HEIGHT); - - min_stride = 64 / tile_height; - } else { - min_stride = 64; - } - - return stride < min_stride ? min_stride : stride; - } - /* The alignment to 32 bytes is sort of implied by the layout... */ return stride; } else { - return align(util_format_get_stride(desc->b.b.format, width), 32); + return align(util_format_get_stride(desc->b.b.format, width), is_rs690 ? 64 : 32); } } @@ -179,7 +167,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture_desc *desc, desc->b.b.nr_samples, desc->microtile, desc->macrotile[level], - DIM_HEIGHT); + DIM_HEIGHT, 0); height = align(height, tile_height); /* This is needed for the kernel checker, unfortunately. */ diff --git a/src/gallium/drivers/r300/r300_texture_desc.h b/src/gallium/drivers/r300/r300_texture_desc.h index 44d88794a12..121d215b4cb 100644 --- a/src/gallium/drivers/r300/r300_texture_desc.h +++ b/src/gallium/drivers/r300/r300_texture_desc.h @@ -41,7 +41,7 @@ unsigned r300_get_pixel_alignment(enum pipe_format format, unsigned num_samples, enum r300_buffer_tiling microtile, enum r300_buffer_tiling macrotile, - enum r300_dim dim); + enum r300_dim dim, boolean is_rs690); boolean r300_texture_desc_init(struct r300_screen *rscreen, struct r300_texture_desc *desc, -- cgit v1.2.3 From 4523285e518702ac9be839851765d8d0d2461eca Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sun, 12 Dec 2010 22:44:53 -0500 Subject: r600g: fix rendering with a vertex attrib having a zero stride The hardware supports zero stride just fine. This is a port of 2af8a1983180fc0168c1e0e53bcc69ee3d684ea4 from r300g. NOTE: This is a candidate for both the 7.9 and 7.10 branches. Signed-off-by: Alex Deucher --- src/gallium/drivers/r600/r600_state_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index c647e77b373..1333808c66f 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -187,11 +187,13 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, rctx->any_user_vbs = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); + /* The stride of zero means we will be fetching only the first + * vertex, so don't care about max_index. */ + if (!vbo->stride) + continue; + if (vbo->max_index == ~0) { - if (!vbo->stride) - vbo->max_index = 1; - else - vbo->max_index = (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; + vbo->max_index = (vbo->buffer->width0 - vbo->buffer_offset) / vbo->stride; } max_index = MIN2(vbo->max_index, max_index); } -- cgit v1.2.3 From 6577f753b278878eeb965964b381812c7b950083 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 08:11:56 -0700 Subject: tnl: a better way to initialize the gl_program_machine memory This improves commit ef3f7e61b314236cbb7ed2cf24d34c6f90d9cfca NOTE: This is a candidate for the 7.9 and 7.10 branches. --- src/mesa/tnl/t_vb_program.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 7e7c59ae07b..94372bbafbc 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -67,6 +67,8 @@ struct vp_stage_data { GLvector4f ndcCoords; /**< normalized device coords */ GLubyte *clipmask; /**< clip flags */ GLubyte ormask, andmask; /**< for clipping */ + + struct gl_program_machine machine; }; @@ -311,7 +313,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) struct vp_stage_data *store = VP_STAGE_DATA(stage); struct vertex_buffer *VB = &tnl->vb; struct gl_vertex_program *program = ctx->VertexProgram._Current; - struct gl_program_machine machine = { 0 }; + struct gl_program_machine *machine = &store->machine; GLuint outputs[VERT_RESULT_MAX], numOutputs; GLuint i, j; @@ -339,7 +341,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) for (i = 0; i < VB->Count; i++) { GLuint attr; - init_machine(ctx, &machine); + init_machine(ctx, machine); #if 0 printf("Input %d: %f, %f, %f, %f\n", i, @@ -372,23 +374,23 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) check_float(data[2]); check_float(data[3]); #endif - COPY_CLEAN_4V(machine.VertAttribs[attr], size, data); + COPY_CLEAN_4V(machine->VertAttribs[attr], size, data); } } /* execute the program */ - _mesa_execute_program(ctx, &program->Base, &machine); + _mesa_execute_program(ctx, &program->Base, machine); /* copy the output registers into the VB->attribs arrays */ for (j = 0; j < numOutputs; j++) { const GLuint attr = outputs[j]; #ifdef NAN_CHECK - check_float(machine.Outputs[attr][0]); - check_float(machine.Outputs[attr][1]); - check_float(machine.Outputs[attr][2]); - check_float(machine.Outputs[attr][3]); + check_float(machine->Outputs[attr][0]); + check_float(machine->Outputs[attr][1]); + check_float(machine->Outputs[attr][2]); + check_float(machine->Outputs[attr][3]); #endif - COPY_4V(store->results[attr].data[i], machine.Outputs[attr]); + COPY_4V(store->results[attr].data[i], machine->Outputs[attr]); } /* FOGC is a special case. Fragment shader expects (f,0,0,1) */ @@ -398,14 +400,14 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) store->results[VERT_RESULT_FOGC].data[i][3] = 1.0; } #ifdef NAN_CHECK - ASSERT(machine.Outputs[0][3] != 0.0F); + ASSERT(machine->Outputs[0][3] != 0.0F); #endif #if 0 printf("HPOS: %f %f %f %f\n", - machine.Outputs[0][0], - machine.Outputs[0][1], - machine.Outputs[0][2], - machine.Outputs[0][3]); + machine->Outputs[0][0], + machine->Outputs[0][1], + machine->Outputs[0][2], + machine->Outputs[0][3]); #endif } @@ -501,7 +503,7 @@ init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage) const GLuint size = VB->Size; GLuint i; - stage->privatePtr = MALLOC(sizeof(*store)); + stage->privatePtr = CALLOC(sizeof(*store)); store = VP_STAGE_DATA(stage); if (!store) return GL_FALSE; -- cgit v1.2.3 From b363dd43d6f7f63bfe5261a46f8bdb2024f85db1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 11:47:26 -0700 Subject: gallivm: store callbacks in a linked list rather than fixed size array Should fix http://bugs.freedesktop.org/show_bug.cgi?id=32308 --- src/gallium/auxiliary/gallivm/lp_bld_init.c | 54 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index efe8d38b8f0..7504cb5cf2f 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -30,6 +30,7 @@ #include "util/u_cpu_detect.h" #include "util/u_debug.h" #include "util/u_memory.h" +#include "util/u_simple_list.h" #include "lp_bld_debug.h" #include "lp_bld_init.h" @@ -291,12 +292,12 @@ struct callback { garbage_collect_callback_func func; void *cb_data; + struct callback *prev, *next; }; -#define MAX_CALLBACKS 32 -static struct callback Callbacks[MAX_CALLBACKS]; -static unsigned NumCallbacks = 0; +/** list of all garbage collector callbacks */ +static struct callback callback_list = {NULL, NULL, NULL, NULL}; /** @@ -307,20 +308,24 @@ void gallivm_register_garbage_collector_callback(garbage_collect_callback_func func, void *cb_data) { - unsigned i; + struct callback *cb; - for (i = 0; i < NumCallbacks; i++) { - if (Callbacks[i].func == func && Callbacks[i].cb_data == cb_data) { - /* already in list: no-op */ + if (!callback_list.prev) { + make_empty_list(&callback_list); + } + + /* see if already in list */ + foreach(cb, &callback_list) { + if (cb->func == func && cb->cb_data == cb_data) return; - } } - assert(NumCallbacks < MAX_CALLBACKS); - if (NumCallbacks < MAX_CALLBACKS) { - Callbacks[NumCallbacks].func = func; - Callbacks[NumCallbacks].cb_data = cb_data; - NumCallbacks++; + /* add to list */ + cb = CALLOC_STRUCT(callback); + if (cb) { + cb->func = func; + cb->cb_data = cb_data; + insert_at_head(&callback_list, cb); } } @@ -332,15 +337,13 @@ void gallivm_remove_garbage_collector_callback(garbage_collect_callback_func func, void *cb_data) { - unsigned i; - - for (i = 0; i < NumCallbacks; i++) { - if (Callbacks[i].func == func && Callbacks[i].cb_data == cb_data) { - /* found, now remove it */ - NumCallbacks--; - for ( ; i < NumCallbacks; i++) { - Callbacks[i] = Callbacks[i + 1]; - } + struct callback *cb; + + /* search list */ + foreach(cb, &callback_list) { + if (cb->func == func && cb->cb_data == cb_data) { + /* found, remove it */ + remove_from_list(cb); return; } } @@ -354,10 +357,9 @@ gallivm_remove_garbage_collector_callback(garbage_collect_callback_func func, static void call_garbage_collector_callbacks(void) { - unsigned i; - - for (i = 0; i < NumCallbacks; i++) { - Callbacks[i].func(Callbacks[i].cb_data); + struct callback *cb; + foreach(cb, &callback_list) { + cb->func(cb->cb_data); } } -- cgit v1.2.3 From df9f89154471ec162227ebce1681c5010f64e6e6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 Dec 2010 11:02:15 -0800 Subject: intel: Include stdbool so we can stop using GLboolean when we want to. This requires shuffling the driconf XML macros around, since they use true and false tokens expecting them to not get expanded to anything. --- src/mesa/drivers/dri/intel/intel_context.h | 2 +- src/mesa/drivers/dri/intel/intel_screen.c | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 96493c0f2bb..53a11ba9a7e 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -29,7 +29,7 @@ #define INTELCONTEXT_INC - +#include #include "main/mtypes.h" #include "main/mm.h" #include "dri_metaops.h" diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 3f13589a214..d683e675328 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -35,19 +35,6 @@ #include "utils.h" #include "xmlpool.h" -#include "intel_batchbuffer.h" -#include "intel_buffers.h" -#include "intel_bufmgr.h" -#include "intel_chipset.h" -#include "intel_fbo.h" -#include "intel_screen.h" -#include "intel_tex.h" -#include "intel_regions.h" - -#include "i915_drm.h" - -#define DRI_CONF_TEXTURE_TILING(def) \ - PUBLIC const char __driConfigOptions[] = DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE @@ -92,6 +79,17 @@ DRI_CONF_END; const GLuint __driNConfigOptions = 11; +#include "intel_batchbuffer.h" +#include "intel_buffers.h" +#include "intel_bufmgr.h" +#include "intel_chipset.h" +#include "intel_fbo.h" +#include "intel_screen.h" +#include "intel_tex.h" +#include "intel_regions.h" + +#include "i915_drm.h" + #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; #endif /*USE_NEW_INTERFACE */ -- cgit v1.2.3 From 7cec7bf56c1b8aa03800e01fa06f29a02edae755 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 Dec 2010 11:44:26 -0800 Subject: i965: Fix ARL to work on gen6. RNDD isn't one of the instructions that can do conversion from execution type to destination type. Fixes glsl-vs-arrays-3. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 09887dae95d..326bb1e562f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -658,6 +658,22 @@ static void emit_min( struct brw_compile *p, } } +static void emit_arl(struct brw_compile *p, + struct brw_reg dst, + struct brw_reg src) +{ + struct intel_context *intel = &p->brw->intel; + + if (intel->gen >= 6) { + struct brw_reg dst_f = retype(dst, BRW_REGISTER_TYPE_F); + + brw_RNDD(p, dst_f, src); + brw_MOV(p, dst, dst_f); + } else { + brw_RNDD(p, dst, src); + } +} + static void emit_math1_gen4(struct brw_vs_compile *c, GLuint function, struct brw_reg dst, @@ -1963,7 +1979,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) emit_math1(c, BRW_MATH_FUNCTION_EXP, dst, args[0], BRW_MATH_PRECISION_FULL); break; case OPCODE_ARL: - brw_RNDD(p, dst, args[0]); + emit_arl(p, dst, args[0]); break; case OPCODE_FLR: brw_RNDD(p, dst, args[0]); -- cgit v1.2.3 From 5fbd8da8dfb89c61f0ed143ad3f21a2b8752a476 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 Dec 2010 12:15:21 -0800 Subject: i956: Fix the old FP path fragment position setup on gen6. Fixes fp-arb-fragment-coord-conventions-none --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index a0e86034e1e..a8be10638c7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -219,43 +219,45 @@ void emit_wpos_xy(struct brw_wm_compile *c, const struct brw_reg *arg0) { struct brw_compile *p = &c->func; + struct intel_context *intel = &p->brw->intel; + struct brw_reg delta_x = retype(arg0[0], BRW_REGISTER_TYPE_W); + struct brw_reg delta_y = retype(arg0[1], BRW_REGISTER_TYPE_W); if (mask & WRITEMASK_X) { + if (intel->gen >= 6) { + struct brw_reg delta_x_f = retype(delta_x, BRW_REGISTER_TYPE_F); + brw_MOV(p, delta_x_f, delta_x); + delta_x = delta_x_f; + } + if (c->fp->program.PixelCenterInteger) { /* X' = X */ - brw_MOV(p, - dst[0], - retype(arg0[0], BRW_REGISTER_TYPE_W)); + brw_MOV(p, dst[0], delta_x); } else { /* X' = X + 0.5 */ - brw_ADD(p, - dst[0], - retype(arg0[0], BRW_REGISTER_TYPE_W), - brw_imm_f(0.5)); + brw_ADD(p, dst[0], delta_x, brw_imm_f(0.5)); } } if (mask & WRITEMASK_Y) { + if (intel->gen >= 6) { + struct brw_reg delta_y_f = retype(delta_y, BRW_REGISTER_TYPE_F); + brw_MOV(p, delta_y_f, delta_y); + delta_y = delta_y_f; + } + if (c->fp->program.OriginUpperLeft) { if (c->fp->program.PixelCenterInteger) { /* Y' = Y */ - brw_MOV(p, - dst[1], - retype(arg0[1], BRW_REGISTER_TYPE_W)); + brw_MOV(p, dst[1], delta_y); } else { - /* Y' = Y + 0.5 */ - brw_ADD(p, - dst[1], - retype(arg0[1], BRW_REGISTER_TYPE_W), - brw_imm_f(0.5)); + brw_ADD(p, dst[1], delta_y, brw_imm_f(0.5)); } } else { float center_offset = c->fp->program.PixelCenterInteger ? 0.0 : 0.5; /* Y' = (height - 1) - Y + center */ - brw_ADD(p, - dst[1], - negate(retype(arg0[1], BRW_REGISTER_TYPE_W)), + brw_ADD(p, dst[1], negate(delta_y), brw_imm_f(c->key.drawable_height - 1 + center_offset)); } } -- cgit v1.2.3 From 036c817f77f71e7c4b17571ae100a9bc93d8fe5b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 Dec 2010 13:37:54 -0800 Subject: i965: Fix gl_FragCoord.z setup on gen6. Fixes glsl-bug-22603. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c3cbe0df618..4eead32cbbd 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -474,8 +474,13 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) wpos.reg_offset++; /* gl_FragCoord.z */ - emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, - interp_reg(FRAG_ATTRIB_WPOS, 2))); + if (intel->gen >= 6) { + emit(fs_inst(BRW_OPCODE_MOV, wpos, + fs_reg(brw_vec8_grf(c->source_depth_reg, 0)))); + } else { + emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y, + interp_reg(FRAG_ATTRIB_WPOS, 2))); + } wpos.reg_offset++; /* gl_FragCoord.w: Already set up in emit_interpolation */ -- cgit v1.2.3 From cb2b547a4771ddf56975ede566dbf3a8f5389689 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 13 Dec 2010 15:16:39 -0800 Subject: linker: Allow built-in arrays to have different sizes between shader stages Fixes pitlit test glsl-link-varying-TexCoord (bugzilla #31650). --- src/glsl/linker.cpp | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index e62fe6d7e9f..d8c42ac4624 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -487,14 +487,35 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog, /* Check that the types match between stages. */ if (input->type != output->type) { - linker_error_printf(prog, - "%s shader output `%s' declared as " - "type `%s', but %s shader input declared " - "as type `%s'\n", - producer_stage, output->name, - output->type->name, - consumer_stage, input->type->name); - return false; + /* There is a bit of a special case for gl_TexCoord. This + * built-in is unsized by default. Appliations that variable + * access it must redeclare it with a size. There is some + * language in the GLSL spec that implies the fragment shader + * and vertex shader do not have to agree on this size. Other + * driver behave this way, and one or two applications seem to + * rely on it. + * + * Neither declaration needs to be modified here because the array + * sizes are fixed later when update_array_sizes is called. + * + * From page 48 (page 54 of the PDF) of the GLSL 1.10 spec: + * + * "Unlike user-defined varying variables, the built-in + * varying variables don't have a strict one-to-one + * correspondence between the vertex language and the + * fragment language." + */ + if (!output->type->is_array() + || (strncmp("gl_", output->name, 3) != 0)) { + linker_error_printf(prog, + "%s shader output `%s' declared as " + "type `%s', but %s shader input declared " + "as type `%s'\n", + producer_stage, output->name, + output->type->name, + consumer_stage, input->type->name); + return false; + } } /* Check that all of the qualifiers match between stages. -- cgit v1.2.3 From 2d577ee730c30caacf711babde6542766aa0b655 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 13 Dec 2010 15:42:46 -0800 Subject: ir_to_mesa: Don't generate swizzles for record derefs of non-scalar/vectors This is the same as what the array dereference handler does. Fixes piglit test glsl-link-struct-array (bugzilla #31648). NOTE: This is a candidate for the 7.9 and 7.10 branches. --- src/mesa/program/ir_to_mesa.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b274a961b28..490c4cab7ab 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1569,7 +1569,13 @@ ir_to_mesa_visitor::visit(ir_dereference_record *ir) break; offset += type_size(struct_type->fields.structure[i].type); } - this->result.swizzle = swizzle_for_size(ir->type->vector_elements); + + /* If the type is smaller than a vec4, replicate the last channel out. */ + if (ir->type->is_scalar() || ir->type->is_vector()) + this->result.swizzle = swizzle_for_size(ir->type->vector_elements); + else + this->result.swizzle = SWIZZLE_NOOP; + this->result.index += offset; } -- cgit v1.2.3 From bb7c2691d25b6aaea2663f85a5b6723edbf56938 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:01:30 -0700 Subject: mesa, st/mesa: disable GL_ARB_geometry_shader4 The new GLSL compiler doesn't support geom shaders yet so disable the GL_ARB_geometry_shader4 extension. Undo this when geom shaders work again. NOTE: This is a candidate for the 7.10 branch. --- src/mesa/main/extensions.c | 3 ++- src/mesa/state_tracker/st_extensions.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index b71afdd61f3..05e04504c78 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -249,7 +249,8 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) #if FEATURE_ARB_framebuffer_object ctx->Extensions.ARB_framebuffer_object = GL_TRUE; #endif -#if FEATURE_ARB_geometry_shader4 +#if FEATURE_ARB_geometry_shader4 && 0 + /* XXX re-enable when GLSL compiler again supports geometry shaders */ ctx->Extensions.ARB_geometry_shader4 = GL_TRUE; #endif ctx->Extensions.ARB_half_float_pixel = GL_TRUE; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 930b60ade2d..51a45a7d511 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -442,7 +442,9 @@ void st_init_extensions(struct st_context *st) #endif if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { +#if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */ ctx->Extensions.ARB_geometry_shader4 = GL_TRUE; +#endif } if (screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) { -- cgit v1.2.3 From 3d203b610045980853d26370ee21fb2ef4aed17e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:20:12 -0700 Subject: Squashed commit of the following (st-mesa-per-context-shaders branch): commit 4f106f44a32eaddb6cf3fea6ba5ee9787bff609a Author: Brian Paul Date: Mon Dec 13 14:06:08 2010 -0700 st/mesa: reorganize vertex program translation code Now it looks like the fragment and geometry program code. Also remove the serial number fields from programs. It was used to determine when new translations were needed. Now the variant key is used for that. And the st_program_string_notify() callback removes all variants when the program's code is changed. commit e12d6791c5e4bff60bb2e6c04414b1b4d1325f3e Author: Brian Paul Date: Mon Dec 13 13:38:12 2010 -0700 st/mesa: implement geometry shader varients Only needed in order to support per-context gallium shaders. commit c5751c673644808ab069259a852f24c4c0e92b9d Author: Brian Paul Date: Sun Dec 12 15:28:57 2010 -0700 st/mesa: restore glDraw/CopyPixels using new fragment program variants Clean up the logic for fragment programs for glDraw/CopyPixels. We now generate fragment program variants for glDraw/CopyPixels as needed which do texture sampling, pixel scale/bias, pixelmap lookups, etc. commit 7b0bb99bab6547f503a0176b5c0aef1482b02c97 Author: Brian Paul Date: Fri Dec 10 17:03:23 2010 -0700 st/mesa: checkpoint: implement fragment program variants The fragment programs variants are per-context, as the vertex programs. NOTE: glDrawPixels is totally broken at this point. commit 2cc926183f957f8abac18d71276dd5bbd1f27be2 Author: Brian Paul Date: Fri Dec 10 14:59:32 2010 -0700 st/mesa: make vertex shader variants per-context Gallium shaders are per-context but OpenGL shaders aren't. So we need to make a different variant for each context. During context tear-down we need to walk over all shaders/programs and free all variants for the context being destroyed. --- src/mesa/state_tracker/st_atom_shader.c | 143 ++---- src/mesa/state_tracker/st_cb_bitmap.c | 88 ++-- src/mesa/state_tracker/st_cb_bitmap.h | 8 + src/mesa/state_tracker/st_cb_drawpixels.c | 199 +++++--- src/mesa/state_tracker/st_cb_drawpixels.h | 10 + src/mesa/state_tracker/st_cb_program.c | 46 +- src/mesa/state_tracker/st_context.c | 2 + src/mesa/state_tracker/st_context.h | 4 +- src/mesa/state_tracker/st_program.c | 751 ++++++++++++++++++++++-------- src/mesa/state_tracker/st_program.h | 119 ++++- 10 files changed, 894 insertions(+), 476 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 05442ef91b5..f416293a7e4 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -50,99 +50,6 @@ #include "st_program.h" - -/** - * Translate fragment program if needed. - */ -static void -translate_fp(struct st_context *st, - struct st_fragment_program *stfp) -{ - if (!stfp->tgsi.tokens) { - assert(stfp->Base.Base.NumInstructions > 0); - - st_translate_fragment_program(st, stfp); - } -} - -/* - * Translate geometry program if needed. - */ -static void -translate_gp(struct st_context *st, - struct st_geometry_program *stgp) -{ - if (!stgp->tgsi.tokens) { - assert(stgp->Base.Base.NumInstructions > 1); - - st_translate_geometry_program(st, stgp); - } -} - -/** - * Find a translated vertex program that corresponds to stvp and - * has outputs matched to stfp's inputs. - * This performs vertex and fragment translation (to TGSI) when needed. - */ -static struct st_vp_varient * -find_translated_vp(struct st_context *st, - struct st_vertex_program *stvp ) -{ - struct st_vp_varient *vpv; - struct st_vp_varient_key key; - - /* Nothing in our key yet. This will change: - */ - memset(&key, 0, sizeof key); - - /* When this is true, we will add an extra input to the vertex - * shader translation (for edgeflags), an extra output with - * edgeflag semantics, and extend the vertex shader to pass through - * the input to the output. We'll need to use similar logic to set - * up the extra vertex_element input for edgeflags. - * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA - */ - key.passthrough_edgeflags = (st->vertdata_edgeflags && ( - st->ctx->Polygon.FrontMode != GL_FILL || - st->ctx->Polygon.BackMode != GL_FILL)); - - - /* Do we need to throw away old translations after a change in the - * GL program string? - */ - if (stvp->serialNo != stvp->lastSerialNo) { - /* These may have changed if the program string changed. - */ - st_prepare_vertex_program( st, stvp ); - - /* We are now up-to-date: - */ - stvp->lastSerialNo = stvp->serialNo; - } - - /* See if we've got a translated vertex program whose outputs match - * the fragment program's inputs. - */ - for (vpv = stvp->varients; vpv; vpv = vpv->next) { - if (memcmp(&vpv->key, &key, sizeof key) == 0) { - break; - } - } - - /* No? Perform new translation here. */ - if (!vpv) { - vpv = st_translate_vertex_program(st, stvp, &key); - if (!vpv) - return NULL; - - vpv->next = stvp->varients; - stvp->varients = vpv; - } - - return vpv; -} - - /** * Return pointer to a pass-through fragment shader. * This shader is used when a texture is missing/incomplete. @@ -167,12 +74,16 @@ static void update_fp( struct st_context *st ) { struct st_fragment_program *stfp; + struct st_fp_varient_key key; assert(st->ctx->FragmentProgram._Current); stfp = st_fragment_program(st->ctx->FragmentProgram._Current); assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB); - translate_fp(st, stfp); + memset(&key, 0, sizeof(key)); + key.st = st; + + st->fp_varient = st_get_fp_varient(st, stfp, &key); st_reference_fragprog(st, &st->fp, stfp); @@ -182,7 +93,8 @@ update_fp( struct st_context *st ) cso_set_fragment_shader_handle(st->cso_context, fs); } else { - cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader); + cso_set_fragment_shader_handle(st->cso_context, + st->fp_varient->driver_shader); } } @@ -206,6 +118,7 @@ static void update_vp( struct st_context *st ) { struct st_vertex_program *stvp; + struct st_vp_varient_key key; /* find active shader and params -- Should be covered by * ST_NEW_VERTEX_PROGRAM @@ -214,7 +127,21 @@ update_vp( struct st_context *st ) stvp = st_vertex_program(st->ctx->VertexProgram._Current); assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); - st->vp_varient = find_translated_vp(st, stvp); + memset(&key, 0, sizeof key); + key.st = st; /* variants are per-context */ + + /* When this is true, we will add an extra input to the vertex + * shader translation (for edgeflags), an extra output with + * edgeflag semantics, and extend the vertex shader to pass through + * the input to the output. We'll need to use similar logic to set + * up the extra vertex_element input for edgeflags. + * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA + */ + key.passthrough_edgeflags = (st->vertdata_edgeflags && ( + st->ctx->Polygon.FrontMode != GL_FILL || + st->ctx->Polygon.BackMode != GL_FILL)); + + st->vp_varient = st_get_vp_varient(st, stvp, &key); st_reference_vertprog(st, &st->vp, stvp); @@ -231,14 +158,16 @@ const struct st_tracked_state st_update_vp = { _NEW_POLYGON, /* mesa */ ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA /* st */ }, - update_vp /* update */ + update_vp /* update */ }; + + static void update_gp( struct st_context *st ) { - struct st_geometry_program *stgp; + struct st_gp_varient_key key; if (!st->ctx->GeometryProgram._Current) { cso_set_geometry_shader_handle(st->cso_context, NULL); @@ -248,18 +177,22 @@ update_gp( struct st_context *st ) stgp = st_geometry_program(st->ctx->GeometryProgram._Current); assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM); - translate_gp(st, stgp); + memset(&key, 0, sizeof(key)); + key.st = st; + + st->gp_varient = st_get_gp_varient(st, stgp, &key); st_reference_geomprog(st, &st->gp, stgp); - cso_set_geometry_shader_handle(st->cso_context, stgp->driver_shader); + cso_set_geometry_shader_handle(st->cso_context, + st->gp_varient->driver_shader); } const struct st_tracked_state st_update_gp = { - "st_update_gp", /* name */ - { /* dirty */ - 0, /* mesa */ - ST_NEW_GEOMETRY_PROGRAM /* st */ + "st_update_gp", /* name */ + { /* dirty */ + 0, /* mesa */ + ST_NEW_GEOMETRY_PROGRAM /* st */ }, - update_gp /* update */ + update_gp /* update */ }; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index f08697fe23b..320b73f03de 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -185,48 +185,47 @@ find_free_bit(uint bitfield) /** * Combine basic bitmap fragment program with the user-defined program. + * \param st current context + * \param fpIn the incoming fragment program + * \param fpOut the new fragment program which does fragment culling + * \param bitmap_sampler sampler number for the bitmap texture */ -static struct st_fragment_program * -combined_bitmap_fragment_program(struct gl_context *ctx) +void +st_make_bitmap_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut, + GLuint *bitmap_sampler) { - struct st_context *st = st_context(ctx); - struct st_fragment_program *stfp = st->fp; - - if (!stfp->bitmap_program) { - /* - * Generate new program which is the user-defined program prefixed - * with the bitmap sampler/kill instructions. - */ - struct st_fragment_program *bitmap_prog; - uint sampler; + struct st_fragment_program *bitmap_prog; + struct gl_program *newProg; + uint sampler; - sampler = find_free_bit(st->fp->Base.Base.SamplersUsed); - bitmap_prog = make_bitmap_fragment_program(ctx, sampler); - - stfp->bitmap_program = (struct st_fragment_program *) - _mesa_combine_programs(ctx, - &bitmap_prog->Base.Base, &stfp->Base.Base); - stfp->bitmap_program->bitmap_sampler = sampler; + /* + * Generate new program which is the user-defined program prefixed + * with the bitmap sampler/kill instructions. + */ + sampler = find_free_bit(fpIn->Base.SamplersUsed); + bitmap_prog = make_bitmap_fragment_program(st->ctx, sampler); - /* done with this after combining */ - st_reference_fragprog(st, &bitmap_prog, NULL); + newProg = _mesa_combine_programs(st->ctx, + &bitmap_prog->Base.Base, + &fpIn->Base); + /* done with this after combining */ + st_reference_fragprog(st, &bitmap_prog, NULL); #if 0 - { - struct gl_program *p = &stfp->bitmap_program->Base.Base; - printf("Combined bitmap program:\n"); - _mesa_print_program(p); - printf("InputsRead: 0x%x\n", p->InputsRead); - printf("OutputsWritten: 0x%x\n", p->OutputsWritten); - _mesa_print_parameter_list(p->Parameters); - } -#endif - - /* translate to TGSI tokens */ - st_translate_fragment_program(st, stfp->bitmap_program); + { + printf("Combined bitmap program:\n"); + _mesa_print_program(newProg); + printf("InputsRead: 0x%x\n", newProg->InputsRead); + printf("OutputsWritten: 0x%x\n", newProg->OutputsWritten); + _mesa_print_parameter_list(newProg->Parameters); } +#endif - return stfp->bitmap_program; + /* return results */ + *fpOut = (struct gl_fragment_program *) newProg; + *bitmap_sampler = sampler; } @@ -411,11 +410,16 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; - struct st_fragment_program *stfp; + struct st_fp_varient *fpv; + struct st_fp_varient_key key; GLuint maxSize; GLuint offset; - stfp = combined_bitmap_fragment_program(ctx); + memset(&key, 0, sizeof(key)); + key.st = st; + key.bitmap = GL_TRUE; + + fpv = st_get_fp_varient(st, st->fp, &key); /* As an optimization, Mesa's fragment programs will sometimes get the * primary color from a statevar/constant rather than a varying variable. @@ -428,7 +432,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, GLfloat colorSave[4]; COPY_4V(colorSave, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], color); - st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT); + st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT); COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave); } @@ -454,7 +458,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_set_rasterizer(cso, &st->bitmap.rasterizer); /* fragment shader state: TEX lookup program */ - cso_set_fragment_shader_handle(cso, stfp->driver_shader); + cso_set_fragment_shader_handle(cso, fpv->driver_shader); /* vertex shader state: position + texcoord pass-through */ cso_set_vertex_shader_handle(cso, st->bitmap.vs); @@ -462,21 +466,21 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* user samplers, plus our bitmap sampler */ { struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; - uint num = MAX2(stfp->bitmap_sampler + 1, st->state.num_samplers); + uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_samplers); uint i; for (i = 0; i < st->state.num_samplers; i++) { samplers[i] = &st->state.samplers[i]; } - samplers[stfp->bitmap_sampler] = &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT]; + samplers[fpv->bitmap_sampler] = &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT]; cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers); } /* user textures, plus the bitmap texture */ { struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; - uint num = MAX2(stfp->bitmap_sampler + 1, st->state.num_textures); + uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_textures); memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views)); - sampler_views[stfp->bitmap_sampler] = sv; + sampler_views[fpv->bitmap_sampler] = sv; cso_set_fragment_sampler_views(cso, num, sampler_views); } diff --git a/src/mesa/state_tracker/st_cb_bitmap.h b/src/mesa/state_tracker/st_cb_bitmap.h index d04b2b67795..2bd63b9b741 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.h +++ b/src/mesa/state_tracker/st_cb_bitmap.h @@ -34,6 +34,8 @@ struct dd_function_table; struct st_context; +struct gl_fragment_program; +struct st_fragment_program; #if FEATURE_drawpix @@ -46,6 +48,12 @@ st_init_bitmap(struct st_context *st); extern void st_destroy_bitmap(struct st_context *st); +extern void +st_make_bitmap_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut, + GLuint *bitmap_sampler); + extern void st_flush_bitmap_cache(struct st_context *st); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c9786024575..323e7e357ec 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -94,88 +94,61 @@ is_passthrough_program(const struct gl_fragment_program *prog) /** * Make fragment shader for glDraw/CopyPixels. This shader is made * by combining the pixel transfer shader with the user-defined shader. - * \return pointer to Gallium driver fragment shader + * \param fpIn the current/incoming fragment program + * \param fpOut returns the combined fragment program */ -static void * -combined_drawpix_fragment_program(struct gl_context *ctx) +void +st_make_drawpix_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut) { - struct st_context *st = st_context(ctx); - struct st_fragment_program *stfp; + struct gl_program *newProg; - if (st->pixel_xfer.program->serialNo == st->pixel_xfer.xfer_prog_sn - && st->fp->serialNo == st->pixel_xfer.user_prog_sn) { - /* the pixel tranfer program has not changed and the user-defined - * program has not changed, so re-use the combined program. - */ - stfp = st->pixel_xfer.combined_prog; + if (is_passthrough_program(fpIn)) { + newProg = (struct gl_program *) _mesa_clone_fragment_program(st->ctx, + &st->pixel_xfer.program->Base); } else { - /* Concatenate the pixel transfer program with the current user- - * defined program. - */ - if (is_passthrough_program(&st->fp->Base)) { - stfp = (struct st_fragment_program *) - _mesa_clone_fragment_program(ctx, &st->pixel_xfer.program->Base); - } - else { #if 0 - printf("Base program:\n"); - _mesa_print_program(&st->fp->Base.Base); - printf("DrawPix program:\n"); - _mesa_print_program(&st->pixel_xfer.program->Base.Base); + /* debug */ + printf("Base program:\n"); + _mesa_print_program(&fpIn->Base); + printf("DrawPix program:\n"); + _mesa_print_program(&st->pixel_xfer.program->Base.Base); #endif - stfp = (struct st_fragment_program *) - _mesa_combine_programs(ctx, - &st->pixel_xfer.program->Base.Base, - &st->fp->Base.Base); - } + newProg = _mesa_combine_programs(st->ctx, + &st->pixel_xfer.program->Base.Base, + &fpIn->Base); + } #if 0 - { - struct gl_program *p = &stfp->Base.Base; - printf("Combined DrawPixels program:\n"); - _mesa_print_program(p); - printf("InputsRead: 0x%x\n", p->InputsRead); - printf("OutputsWritten: 0x%x\n", p->OutputsWritten); - _mesa_print_parameter_list(p->Parameters); - } + /* debug */ + printf("Combined DrawPixels program:\n"); + _mesa_print_program(newProg); + printf("InputsRead: 0x%x\n", newProg->InputsRead); + printf("OutputsWritten: 0x%x\n", newProg->OutputsWritten); + _mesa_print_parameter_list(newProg->Parameters); #endif - /* translate to TGSI tokens */ - st_translate_fragment_program(st, stfp); - - /* save new program, update serial numbers */ - st->pixel_xfer.xfer_prog_sn = st->pixel_xfer.program->serialNo; - st->pixel_xfer.user_prog_sn = st->fp->serialNo; - st->pixel_xfer.combined_prog_sn = stfp->serialNo; - /* can't reference new program directly, already have a reference on it */ - st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL); - st->pixel_xfer.combined_prog = stfp; - } - - /* Ideally we'd have updated the pipe constants during the normal - * st/atom mechanism. But we can't since this is specific to glDrawPixels. - */ - st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT); - - return stfp->driver_shader; + *fpOut = (struct gl_fragment_program *) newProg; } /** - * Create fragment shader that does a TEX() instruction to get a Z and/or + * Create fragment program that does a TEX() instruction to get a Z and/or * stencil value value, then writes to FRAG_RESULT_DEPTH/FRAG_RESULT_STENCIL. * Used for glDrawPixels(GL_DEPTH_COMPONENT / GL_STENCIL_INDEX). * Pass fragment color through as-is. - * \return pointer to the Gallium driver fragment shader + * \return pointer to the gl_fragment program */ -static void * -make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth, - GLboolean write_stencil) +struct gl_fragment_program * +st_make_drawpix_z_stencil_program(struct st_context *st, + GLboolean write_depth, + GLboolean write_stencil) { struct gl_context *ctx = st->ctx; struct gl_program *p; - struct st_fragment_program *stp; + struct gl_fragment_program *fp; GLuint ic = 0; const GLuint shaderIndex = write_depth * 2 + write_stencil; @@ -183,7 +156,7 @@ make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth, if (st->drawpix.shaders[shaderIndex]) { /* already have the proper shader */ - return st->drawpix.shaders[shaderIndex]->driver_shader; + return st->drawpix.shaders[shaderIndex]; } /* @@ -245,18 +218,15 @@ make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth, if (write_stencil) p->SamplersUsed |= 1 << 1; - stp = st_fragment_program((struct gl_fragment_program *) p); + fp = (struct gl_fragment_program *) p; /* save the new shader */ - st->drawpix.shaders[shaderIndex] = stp; + st->drawpix.shaders[shaderIndex] = fp; - st_translate_fragment_program(st, stp); - - return stp->driver_shader; + return fp; } - /** * Create a simple vertex shader that just passes through the * vertex position and texcoord (and optionally, color). @@ -872,6 +842,61 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, } +/** + * Get fragment program variant for a glDrawPixels or glCopyPixels + * command for RGBA data. + */ +static struct st_fp_varient * +get_color_fp_varient(struct st_context *st) +{ + struct gl_context *ctx = st->ctx; + struct st_fp_varient_key key; + struct st_fp_varient *fpv; + + memset(&key, 0, sizeof(key)); + + key.st = st; + key.drawpixels = 1; + key.scaleAndBias = (ctx->Pixel.RedBias != 0.0 || + ctx->Pixel.RedScale != 1.0 || + ctx->Pixel.GreenBias != 0.0 || + ctx->Pixel.GreenScale != 1.0 || + ctx->Pixel.BlueBias != 0.0 || + ctx->Pixel.BlueScale != 1.0 || + ctx->Pixel.AlphaBias != 0.0 || + ctx->Pixel.AlphaScale != 1.0); + key.pixelMaps = ctx->Pixel.MapColorFlag; + + fpv = st_get_fp_varient(st, st->fp, &key); + + return fpv; +} + + +/** + * Get fragment program variant for a glDrawPixels or glCopyPixels + * command for depth/stencil data. + */ +static struct st_fp_varient * +get_depth_stencil_fp_varient(struct st_context *st, GLboolean write_depth, + GLboolean write_stencil) +{ + struct st_fp_varient_key key; + struct st_fp_varient *fpv; + + memset(&key, 0, sizeof(key)); + + key.st = st; + key.drawpixels = 1; + key.drawpixels_z = write_depth; + key.drawpixels_stencil = write_stencil; + + fpv = st_get_fp_varient(st, st->fp, &key); + + return fpv; +} + + /** * Called via ctx->Driver.DrawPixels() */ @@ -889,6 +914,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, struct pipe_sampler_view *sv[2]; int num_sampler_view = 1; enum pipe_format stencil_format = PIPE_FORMAT_NONE; + struct st_fp_varient *fpv; if (format == GL_DEPTH_STENCIL) write_stencil = write_depth = GL_TRUE; @@ -921,14 +947,25 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, st_validate_state(st); + /* + * Get vertex/fragment shaders + */ if (write_depth || write_stencil) { - driver_fp = make_fragment_shader_z_stencil(st, write_depth, write_stencil); + fpv = get_depth_stencil_fp_varient(st, write_depth, write_stencil); + + driver_fp = fpv->driver_shader; + driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); + color = ctx->Current.RasterColor; } else { - driver_fp = combined_drawpix_fragment_program(ctx); + fpv = get_color_fp_varient(st); + + driver_fp = fpv->driver_shader; + driver_vp = make_passthrough_vertex_shader(st, GL_FALSE); + color = NULL; if (st->pixel_xfer.pixelmap_enabled) { sv[1] = st->pixel_xfer.pixelmap_sampler_view; @@ -936,6 +973,9 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, } } + /* update fragment program constants */ + st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT); + /* draw with textured quad */ { struct pipe_resource *pt @@ -1116,6 +1156,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLint readX, readY, readW, readH; GLuint sample_count; struct gl_pixelstore_attrib pack = ctx->DefaultPacking; + struct st_fp_varient *fpv; st_validate_state(st); @@ -1125,11 +1166,18 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, return; } + /* + * Get vertex/fragment shaders + */ if (type == GL_COLOR) { rbRead = st_get_color_read_renderbuffer(ctx); color = NULL; - driver_fp = combined_drawpix_fragment_program(ctx); + + fpv = get_color_fp_varient(st); + driver_fp = fpv->driver_shader; + driver_vp = make_passthrough_vertex_shader(st, GL_FALSE); + if (st->pixel_xfer.pixelmap_enabled) { sv[1] = st->pixel_xfer.pixelmap_sampler_view; num_sampler_view++; @@ -1139,10 +1187,17 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, assert(type == GL_DEPTH); rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer); color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - driver_fp = make_fragment_shader_z_stencil(st, GL_TRUE, GL_FALSE); + + fpv = get_depth_stencil_fp_varient(st, GL_TRUE, GL_FALSE); + driver_fp = fpv->driver_shader; + driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); } + /* update fragment program constants */ + st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT); + + if (rbRead->Base.Wrapped) rbRead = st_renderbuffer(rbRead->Base.Wrapped); @@ -1294,7 +1349,7 @@ st_destroy_drawpix(struct st_context *st) for (i = 0; i < Elements(st->drawpix.shaders); i++) { if (st->drawpix.shaders[i]) - st_reference_fragprog(st, &st->drawpix.shaders[i], NULL); + _mesa_reference_fragprog(st->ctx, &st->drawpix.shaders[i], NULL); } st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h b/src/mesa/state_tracker/st_cb_drawpixels.h index 575f169e08e..8f73e626240 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.h +++ b/src/mesa/state_tracker/st_cb_drawpixels.h @@ -42,6 +42,16 @@ extern void st_init_drawpixels_functions(struct dd_function_table *functions); extern void st_destroy_drawpix(struct st_context *st); +extern void +st_make_drawpix_fragment_program(struct st_context *st, + struct gl_fragment_program *fpIn, + struct gl_fragment_program **fpOut); + +extern struct gl_fragment_program * +st_make_drawpix_z_stencil_program(struct st_context *st, + GLboolean write_depth, + GLboolean write_stencil); + #else static INLINE void diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 4d83fcc6ccb..3e1b709d25b 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -46,8 +46,6 @@ #include "st_cb_program.h" -static GLuint SerialNo = 1; - /** * Called via ctx->Driver.BindProgram() to bind an ARB vertex or @@ -100,8 +98,6 @@ static struct gl_program *st_new_program( struct gl_context *ctx, case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program); - prog->serialNo = SerialNo++; - return _mesa_init_vertex_program( ctx, &prog->Base, target, @@ -112,8 +108,6 @@ static struct gl_program *st_new_program( struct gl_context *ctx, case GL_FRAGMENT_PROGRAM_NV: { struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program); - prog->serialNo = SerialNo++; - return _mesa_init_fragment_program( ctx, &prog->Base, target, @@ -123,8 +117,6 @@ static struct gl_program *st_new_program( struct gl_context *ctx, case MESA_GEOMETRY_PROGRAM: { struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program); - prog->serialNo = SerialNo++; - return _mesa_init_geometry_program( ctx, &prog->Base, target, @@ -152,12 +144,10 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) break; case MESA_GEOMETRY_PROGRAM: { - struct st_geometry_program *stgp = (struct st_geometry_program *) prog; + struct st_geometry_program *stgp = + (struct st_geometry_program *) prog; - if (stgp->driver_shader) { - cso_delete_geometry_shader(st->cso_context, stgp->driver_shader); - stgp->driver_shader = NULL; - } + st_gp_release_varients(st, stgp); if (stgp->tgsi.tokens) { st_free_tokens((void *) stgp->tgsi.tokens); @@ -167,23 +157,15 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) break; case GL_FRAGMENT_PROGRAM_ARB: { - struct st_fragment_program *stfp = (struct st_fragment_program *) prog; + struct st_fragment_program *stfp = + (struct st_fragment_program *) prog; - if (stfp->driver_shader) { - cso_delete_fragment_shader(st->cso_context, stfp->driver_shader); - stfp->driver_shader = NULL; - } + st_fp_release_varients(st, stfp); if (stfp->tgsi.tokens) { st_free_tokens(stfp->tgsi.tokens); stfp->tgsi.tokens = NULL; } - - if (stfp->bitmap_program) { - struct gl_program *prg = &stfp->bitmap_program->Base.Base; - _mesa_reference_program(ctx, &prg, NULL); - stfp->bitmap_program = NULL; - } } break; default: @@ -212,12 +194,7 @@ static GLboolean st_program_string_notify( struct gl_context *ctx, if (target == GL_FRAGMENT_PROGRAM_ARB) { struct st_fragment_program *stfp = (struct st_fragment_program *) prog; - stfp->serialNo++; - - if (stfp->driver_shader) { - cso_delete_fragment_shader(st->cso_context, stfp->driver_shader); - stfp->driver_shader = NULL; - } + st_fp_release_varients(st, stfp); if (stfp->tgsi.tokens) { st_free_tokens(stfp->tgsi.tokens); @@ -230,12 +207,7 @@ static GLboolean st_program_string_notify( struct gl_context *ctx, else if (target == MESA_GEOMETRY_PROGRAM) { struct st_geometry_program *stgp = (struct st_geometry_program *) prog; - stgp->serialNo++; - - if (stgp->driver_shader) { - cso_delete_geometry_shader(st->cso_context, stgp->driver_shader); - stgp->driver_shader = NULL; - } + st_gp_release_varients(st, stgp); if (stgp->tgsi.tokens) { st_free_tokens((void *) stgp->tgsi.tokens); @@ -248,8 +220,6 @@ static GLboolean st_program_string_notify( struct gl_context *ctx, else if (target == GL_VERTEX_PROGRAM_ARB) { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; - stvp->serialNo++; - st_vp_release_varients( st, stvp ); if (st->vp == stvp) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6ec9c699a26..21bb91f47a8 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -252,6 +252,8 @@ void st_destroy_context( struct st_context *st ) _vbo_DestroyContext(st->ctx); + st_destroy_program_variants(st); + _mesa_free_context_data(ctx); st_destroy_context_priv(st); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index d342c0cff1e..26565225e3b 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -131,6 +131,8 @@ struct st_context struct st_geometry_program *gp; /**< Currently bound geometry program */ struct st_vp_varient *vp_varient; + struct st_fp_varient *fp_varient; + struct st_gp_varient *gp_varient; struct gl_texture_object *default_texture; @@ -160,7 +162,7 @@ struct st_context /** for glDraw/CopyPixels */ struct { - struct st_fragment_program *shaders[4]; + struct gl_fragment_program *shaders[4]; void *vert_shaders[2]; /**< ureg shaders */ } drawpix; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index aae2913c202..202f7cb711e 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -32,7 +32,9 @@ #include "main/imports.h" +#include "main/hash.h" #include "main/mtypes.h" +#include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/programopt.h" @@ -44,6 +46,8 @@ #include "tgsi/tgsi_ureg.h" #include "st_debug.h" +#include "st_cb_bitmap.h" +#include "st_cb_drawpixels.h" #include "st_context.h" #include "st_program.h" #include "st_mesa_to_tgsi.h" @@ -51,6 +55,29 @@ +/** + * Delete a vertex program varient. Note the caller must unlink + * the varient from the linked list. + */ +static void +delete_vp_varient(struct st_context *st, struct st_vp_varient *vpv) +{ + if (vpv->driver_shader) + cso_delete_vertex_shader(st->cso_context, vpv->driver_shader); + +#if FEATURE_feedback || FEATURE_rastpos + if (vpv->draw_shader) + draw_delete_vertex_shader( st->draw, vpv->draw_shader ); +#endif + + if (vpv->tgsi.tokens) + st_free_tokens(vpv->tgsi.tokens); + + FREE( vpv ); +} + + + /** * Clean out any old compilations: */ @@ -62,24 +89,76 @@ st_vp_release_varients( struct st_context *st, for (vpv = stvp->varients; vpv; ) { struct st_vp_varient *next = vpv->next; + delete_vp_varient(st, vpv); + vpv = next; + } - if (vpv->driver_shader) - cso_delete_vertex_shader(st->cso_context, vpv->driver_shader); - -#if FEATURE_feedback || FEATURE_rastpos - if (vpv->draw_shader) - draw_delete_vertex_shader( st->draw, vpv->draw_shader ); -#endif + stvp->varients = NULL; +} + + + +/** + * Delete a fragment program varient. Note the caller must unlink + * the varient from the linked list. + */ +static void +delete_fp_varient(struct st_context *st, struct st_fp_varient *fpv) +{ + if (fpv->driver_shader) + cso_delete_fragment_shader(st->cso_context, fpv->driver_shader); - if (vpv->tgsi.tokens) - st_free_tokens(vpv->tgsi.tokens); + FREE(fpv); +} + + +/** + * Free all varients of a fragment program. + */ +void +st_fp_release_varients(struct st_context *st, struct st_fragment_program *stfp) +{ + struct st_fp_varient *fpv; + + for (fpv = stfp->varients; fpv; ) { + struct st_fp_varient *next = fpv->next; + delete_fp_varient(st, fpv); + fpv = next; + } + + stfp->varients = NULL; +} + + +/** + * Delete a geometry program varient. Note the caller must unlink + * the varient from the linked list. + */ +static void +delete_gp_varient(struct st_context *st, struct st_gp_varient *gpv) +{ + if (gpv->driver_shader) + cso_delete_geometry_shader(st->cso_context, gpv->driver_shader); - FREE( vpv ); + FREE(gpv); +} - vpv = next; + +/** + * Free all varients of a geometry program. + */ +void +st_gp_release_varients(struct st_context *st, struct st_geometry_program *stgp) +{ + struct st_gp_varient *gpv; + + for (gpv = stgp->varients; gpv; ) { + struct st_gp_varient *next = gpv->next; + delete_gp_varient(st, gpv); + gpv = next; } - stvp->varients = NULL; + stgp->varients = NULL; } @@ -92,7 +171,7 @@ st_vp_release_varients( struct st_context *st, * \param tokensOut destination for TGSI tokens * \return pointer to cached pipe_shader object. */ -void +static void st_prepare_vertex_program(struct st_context *st, struct st_vertex_program *stvp) { @@ -196,7 +275,10 @@ st_prepare_vertex_program(struct st_context *st, } -struct st_vp_varient * +/** + * Translate a vertex program to create a new varient. + */ +static struct st_vp_varient * st_translate_vertex_program(struct st_context *st, struct st_vertex_program *stvp, const struct st_vp_varient_key *key) @@ -207,6 +289,8 @@ st_translate_vertex_program(struct st_context *st, enum pipe_error error; unsigned num_outputs; + st_prepare_vertex_program( st, stvp ); + _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT); _mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_VARYING); @@ -277,201 +361,310 @@ fail: } +/** + * Find/create a vertex program varient. + */ +struct st_vp_varient * +st_get_vp_varient(struct st_context *st, + struct st_vertex_program *stvp, + const struct st_vp_varient_key *key) +{ + struct st_vp_varient *vpv; + + /* Search for existing varient */ + for (vpv = stvp->varients; vpv; vpv = vpv->next) { + if (memcmp(&vpv->key, key, sizeof(*key)) == 0) { + break; + } + } + + if (!vpv) { + /* create now */ + vpv = st_translate_vertex_program(st, stvp, key); + if (vpv) { + /* insert into list */ + vpv->next = stvp->varients; + stvp->varients = vpv; + } + } + + return vpv; +} + /** - * Translate a Mesa fragment shader into a TGSI shader. - * \return pointer to cached pipe_shader object. + * Translate a Mesa fragment shader into a TGSI shader using extra info in + * the key. + * \return new fragment program variant */ -void +static struct st_fp_varient * st_translate_fragment_program(struct st_context *st, - struct st_fragment_program *stfp ) + struct st_fragment_program *stfp, + const struct st_fp_varient_key *key) { struct pipe_context *pipe = st->pipe; - GLuint outputMapping[FRAG_RESULT_MAX]; - GLuint inputMapping[FRAG_ATTRIB_MAX]; - GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ - GLuint attr; - enum pipe_error error; - const GLbitfield inputsRead = stfp->Base.Base.InputsRead; - struct ureg_program *ureg; + struct st_fp_varient *varient = CALLOC_STRUCT(st_fp_varient); - ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; - ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; - uint fs_num_inputs = 0; + if (!varient) + return NULL; - ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; - ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; - uint fs_num_outputs = 0; + assert(!(key->bitmap && key->drawpixels)); - _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT); + if (key->bitmap) { + /* glBitmap drawing */ + struct gl_fragment_program *fp; - /* - * Convert Mesa program inputs to TGSI input register semantics. - */ - for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) { - if (inputsRead & (1 << attr)) { - const GLuint slot = fs_num_inputs++; + st_make_bitmap_fragment_program(st, &stfp->Base, + &fp, &varient->bitmap_sampler); - inputMapping[attr] = slot; + varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); + stfp = (struct st_fragment_program *) fp; + } + else if (key->drawpixels) { + /* glDrawPixels drawing */ + struct gl_fragment_program *fp; - switch (attr) { - case FRAG_ATTRIB_WPOS: - input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; - input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_LINEAR; - break; - case FRAG_ATTRIB_COL0: - input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_LINEAR; - break; - case FRAG_ATTRIB_COL1: - input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - input_semantic_index[slot] = 1; - interpMode[slot] = TGSI_INTERPOLATE_LINEAR; - break; - case FRAG_ATTRIB_FOGC: - input_semantic_name[slot] = TGSI_SEMANTIC_FOG; - input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - break; - case FRAG_ATTRIB_FACE: - input_semantic_name[slot] = TGSI_SEMANTIC_FACE; - input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; - break; - /* In most cases, there is nothing special about these - * inputs, so adopt a convention to use the generic - * semantic name and the mesa FRAG_ATTRIB_ number as the - * index. - * - * All that is required is that the vertex shader labels - * its own outputs similarly, and that the vertex shader - * generates at least every output required by the - * fragment shader plus fixed-function hardware (such as - * BFC). - * - * There is no requirement that semantic indexes start at - * zero or be restricted to a particular range -- nobody - * should be building tables based on semantic index. - */ - case FRAG_ATTRIB_PNTC: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - case FRAG_ATTRIB_VAR0: - default: - /* Actually, let's try and zero-base this just for - * readability of the generated TGSI. - */ - assert(attr >= FRAG_ATTRIB_TEX0); - input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); - input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - if (attr == FRAG_ATTRIB_PNTC) - interpMode[slot] = TGSI_INTERPOLATE_LINEAR; - else - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - break; - } + if (key->drawpixels_z || key->drawpixels_stencil) { + fp = st_make_drawpix_z_stencil_program(st, key->drawpixels_z, + key->drawpixels_stencil); } else { - inputMapping[attr] = -1; + /* RGBA */ + st_make_drawpix_fragment_program(st, &stfp->Base, &fp); + varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); } + stfp = (struct st_fragment_program *) fp; } - /* - * Semantics and mapping for outputs - */ - { - uint numColors = 0; - GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten; - - /* if z is written, emit that first */ - if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { - fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION; - fs_output_semantic_index[fs_num_outputs] = 0; - outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs; - fs_num_outputs++; - outputsWritten &= ~(1 << FRAG_RESULT_DEPTH); - } + if (!stfp->tgsi.tokens) { + /* need to translate Mesa instructions to TGSI now */ + GLuint outputMapping[FRAG_RESULT_MAX]; + GLuint inputMapping[FRAG_ATTRIB_MAX]; + GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ + GLuint attr; + enum pipe_error error; + const GLbitfield inputsRead = stfp->Base.Base.InputsRead; + struct ureg_program *ureg; - if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) { - fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL; - fs_output_semantic_index[fs_num_outputs] = 0; - outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs; - fs_num_outputs++; - outputsWritten &= ~(1 << FRAG_RESULT_STENCIL); - } + ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; + ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; + uint fs_num_inputs = 0; + + ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; + ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; + uint fs_num_outputs = 0; + + + _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT); + + /* + * Convert Mesa program inputs to TGSI input register semantics. + */ + for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) { + if (inputsRead & (1 << attr)) { + const GLuint slot = fs_num_inputs++; + + inputMapping[attr] = slot; - /* handle remaning outputs (color) */ - for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { - if (outputsWritten & BITFIELD64_BIT(attr)) { switch (attr) { - case FRAG_RESULT_DEPTH: - case FRAG_RESULT_STENCIL: - /* handled above */ - assert(0); + case FRAG_ATTRIB_WPOS: + input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; + input_semantic_index[slot] = 0; + interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + break; + case FRAG_ATTRIB_COL0: + input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + input_semantic_index[slot] = 0; + interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + break; + case FRAG_ATTRIB_COL1: + input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + input_semantic_index[slot] = 1; + interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + break; + case FRAG_ATTRIB_FOGC: + input_semantic_name[slot] = TGSI_SEMANTIC_FOG; + input_semantic_index[slot] = 0; + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; + case FRAG_ATTRIB_FACE: + input_semantic_name[slot] = TGSI_SEMANTIC_FACE; + input_semantic_index[slot] = 0; + interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; + break; + /* In most cases, there is nothing special about these + * inputs, so adopt a convention to use the generic + * semantic name and the mesa FRAG_ATTRIB_ number as the + * index. + * + * All that is required is that the vertex shader labels + * its own outputs similarly, and that the vertex shader + * generates at least every output required by the + * fragment shader plus fixed-function hardware (such as + * BFC). + * + * There is no requirement that semantic indexes start at + * zero or be restricted to a particular range -- nobody + * should be building tables based on semantic index. + */ + case FRAG_ATTRIB_PNTC: + case FRAG_ATTRIB_TEX0: + case FRAG_ATTRIB_TEX1: + case FRAG_ATTRIB_TEX2: + case FRAG_ATTRIB_TEX3: + case FRAG_ATTRIB_TEX4: + case FRAG_ATTRIB_TEX5: + case FRAG_ATTRIB_TEX6: + case FRAG_ATTRIB_TEX7: + case FRAG_ATTRIB_VAR0: default: - assert(attr == FRAG_RESULT_COLOR || - (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX)); - fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; - fs_output_semantic_index[fs_num_outputs] = numColors; - outputMapping[attr] = fs_num_outputs; - numColors++; + /* Actually, let's try and zero-base this just for + * readability of the generated TGSI. + */ + assert(attr >= FRAG_ATTRIB_TEX0); + input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); + input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + if (attr == FRAG_ATTRIB_PNTC) + interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + else + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; } + } + else { + inputMapping[attr] = -1; + } + } + + /* + * Semantics and mapping for outputs + */ + { + uint numColors = 0; + GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten; + + /* if z is written, emit that first */ + if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { + fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION; + fs_output_semantic_index[fs_num_outputs] = 0; + outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs; + fs_num_outputs++; + outputsWritten &= ~(1 << FRAG_RESULT_DEPTH); + } + if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) { + fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL; + fs_output_semantic_index[fs_num_outputs] = 0; + outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs; fs_num_outputs++; + outputsWritten &= ~(1 << FRAG_RESULT_STENCIL); + } + + /* handle remaning outputs (color) */ + for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { + if (outputsWritten & BITFIELD64_BIT(attr)) { + switch (attr) { + case FRAG_RESULT_DEPTH: + case FRAG_RESULT_STENCIL: + /* handled above */ + assert(0); + break; + default: + assert(attr == FRAG_RESULT_COLOR || + (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX)); + fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; + fs_output_semantic_index[fs_num_outputs] = numColors; + outputMapping[attr] = fs_num_outputs; + numColors++; + break; + } + + fs_num_outputs++; + } } } - } - ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT ); - if (ureg == NULL) - return; + ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT ); + if (ureg == NULL) + return NULL; - if (ST_DEBUG & DEBUG_MESA) { - _mesa_print_program(&stfp->Base.Base); - _mesa_print_program_parameters(st->ctx, &stfp->Base.Base); - debug_printf("\n"); - } + if (ST_DEBUG & DEBUG_MESA) { + _mesa_print_program(&stfp->Base.Base); + _mesa_print_program_parameters(st->ctx, &stfp->Base.Base); + debug_printf("\n"); + } - error = - st_translate_mesa_program(st->ctx, - TGSI_PROCESSOR_FRAGMENT, - ureg, - &stfp->Base.Base, - /* inputs */ - fs_num_inputs, - inputMapping, - input_semantic_name, - input_semantic_index, - interpMode, - /* outputs */ - fs_num_outputs, - outputMapping, - fs_output_semantic_name, - fs_output_semantic_index, FALSE ); + error = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_FRAGMENT, + ureg, + &stfp->Base.Base, + /* inputs */ + fs_num_inputs, + inputMapping, + input_semantic_name, + input_semantic_index, + interpMode, + /* outputs */ + fs_num_outputs, + outputMapping, + fs_output_semantic_name, + fs_output_semantic_index, FALSE ); + + stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); + ureg_destroy( ureg ); + } - stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); - ureg_destroy( ureg ); - stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi); + /* fill in varient */ + varient->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi); + varient->key = *key; if (ST_DEBUG & DEBUG_TGSI) { tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); debug_printf("\n"); } + + return varient; } -void + +/** + * Translate fragment program if needed. + */ +struct st_fp_varient * +st_get_fp_varient(struct st_context *st, + struct st_fragment_program *stfp, + const struct st_fp_varient_key *key) +{ + struct st_fp_varient *fpv; + + /* Search for existing varient */ + for (fpv = stfp->varients; fpv; fpv = fpv->next) { + if (memcmp(&fpv->key, key, sizeof(*key)) == 0) { + break; + } + } + + if (!fpv) { + /* create new */ + fpv = st_translate_fragment_program(st, stfp, key); + if (fpv) { + /* insert into list */ + fpv->next = stfp->varients; + stfp->varients = fpv; + } + } + + return fpv; +} + + +/** + * Translate a geometry program to create a new varient. + */ +static struct st_gp_varient * st_translate_geometry_program(struct st_context *st, - struct st_geometry_program *stgp) + struct st_geometry_program *stgp, + const struct st_gp_varient_key *key) { GLuint inputMapping[GEOM_ATTRIB_MAX]; GLuint outputMapping[GEOM_RESULT_MAX]; @@ -494,12 +687,19 @@ st_translate_geometry_program(struct st_context *st, GLuint maxSlot = 0; struct ureg_program *ureg; + struct st_gp_varient *gpv; + + gpv = CALLOC_STRUCT(st_gp_varient); + if (!gpv) + return NULL; + _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_OUTPUT); _mesa_remove_output_reads(&stgp->Base.Base, PROGRAM_VARYING); ureg = ureg_create( TGSI_PROCESSOR_GEOMETRY ); if (ureg == NULL) { - return; + FREE(gpv); + return NULL; } /* which vertex output goes to the first geometry input */ @@ -529,7 +729,7 @@ st_translate_geometry_program(struct st_context *st, } else ++gs_builtin_inputs; -#if 1 +#if 0 debug_printf("input map at %d = %d\n", slot + gs_array_offset, stgp->input_map[slot + gs_array_offset]); #endif @@ -671,37 +871,35 @@ st_translate_geometry_program(struct st_context *st, st_free_tokens(stgp->tgsi.tokens); stgp->tgsi.tokens = NULL; } - if (stgp->driver_shader) { - cso_delete_geometry_shader(st->cso_context, stgp->driver_shader); - stgp->driver_shader = NULL; - } ureg_property_gs_input_prim(ureg, stgp->Base.InputType); ureg_property_gs_output_prim(ureg, stgp->Base.OutputType); ureg_property_gs_max_vertices(ureg, stgp->Base.VerticesOut); - error = st_translate_mesa_program(st->ctx, - TGSI_PROCESSOR_GEOMETRY, - ureg, - &stgp->Base.Base, - /* inputs */ - gs_num_inputs, - inputMapping, - stgp->input_semantic_name, - stgp->input_semantic_index, - NULL, - /* outputs */ - gs_num_outputs, - outputMapping, - gs_output_semantic_name, - gs_output_semantic_index, - FALSE); - + error = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_GEOMETRY, + ureg, + &stgp->Base.Base, + /* inputs */ + gs_num_inputs, + inputMapping, + stgp->input_semantic_name, + stgp->input_semantic_index, + NULL, + /* outputs */ + gs_num_outputs, + outputMapping, + gs_output_semantic_name, + gs_output_semantic_index, + FALSE); stgp->num_inputs = gs_num_inputs; stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); ureg_destroy( ureg ); - stgp->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi); + + /* fill in new varient */ + gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi); + gpv->key = *key; if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(&stgp->Base.Base); @@ -712,8 +910,44 @@ st_translate_geometry_program(struct st_context *st, tgsi_dump(stgp->tgsi.tokens, 0); debug_printf("\n"); } + + return gpv; +} + + +/** + * Get/create geometry program variant. + */ +struct st_gp_varient * +st_get_gp_varient(struct st_context *st, + struct st_geometry_program *stgp, + const struct st_gp_varient_key *key) +{ + struct st_gp_varient *gpv; + + /* Search for existing varient */ + for (gpv = stgp->varients; gpv; gpv = gpv->next) { + if (memcmp(&gpv->key, key, sizeof(*key)) == 0) { + break; + } + } + + if (!gpv) { + /* create new */ + gpv = st_translate_geometry_program(st, stgp, key); + if (gpv) { + /* insert into list */ + gpv->next = stgp->varients; + stgp->varients = gpv; + } + } + + return gpv; } + + + /** * Debug- print current shader text */ @@ -759,3 +993,134 @@ st_print_shaders(struct gl_context *ctx) } } } + + +/** + * Vert/Geom/Frag programs have per-context variants. Free all the + * variants attached to the given program which match the given context. + */ +static void +destroy_program_variants(struct st_context *st, struct gl_program *program) +{ + if (!program) + return; + + switch (program->Target) { + case GL_VERTEX_PROGRAM_ARB: + { + struct st_vertex_program *stvp = (struct st_vertex_program *) program; + struct st_vp_varient *vpv, **prev = &stvp->varients; + + for (vpv = stvp->varients; vpv; ) { + struct st_vp_varient *next = vpv->next; + if (vpv->key.st == st) { + /* unlink from list */ + *prev = next; + /* destroy this variant */ + delete_vp_varient(st, vpv); + } + else { + prev = &vpv; + } + vpv = next; + } + } + break; + case GL_FRAGMENT_PROGRAM_ARB: + { + struct st_fragment_program *stfp = + (struct st_fragment_program *) program; + struct st_fp_varient *fpv, **prev = &stfp->varients; + + for (fpv = stfp->varients; fpv; ) { + struct st_fp_varient *next = fpv->next; + if (fpv->key.st == st) { + /* unlink from list */ + *prev = next; + /* destroy this variant */ + delete_fp_varient(st, fpv); + } + else { + prev = &fpv; + } + fpv = next; + } + } + break; + default: + _mesa_problem(NULL, "Unexpected program target in " + "destroy_program_variants_cb()"); + } +} + + +/** + * Callback for _mesa_HashWalk. Free all the shader's program variants + * which match the given context. + */ +static void +destroy_shader_program_variants_cb(GLuint key, void *data, void *userData) +{ + struct st_context *st = (struct st_context *) userData; + struct gl_shader *shader = (struct gl_shader *) data; + + switch (shader->Type) { + case GL_SHADER_PROGRAM_MESA: + { + struct gl_shader_program *shProg = (struct gl_shader_program *) data; + GLuint i; + + for (i = 0; i < shProg->NumShaders; i++) { + destroy_program_variants(st, shProg->Shaders[i]->Program); + } + + destroy_program_variants(st, (struct gl_program *) + shProg->VertexProgram); + destroy_program_variants(st, (struct gl_program *) + shProg->FragmentProgram); + destroy_program_variants(st, (struct gl_program *) + shProg->GeometryProgram); + } + break; + case GL_VERTEX_SHADER: + case GL_FRAGMENT_SHADER: + case GL_GEOMETRY_SHADER: + { + destroy_program_variants(st, shader->Program); + } + break; + default: + assert(0); + } +} + + +/** + * Callback for _mesa_HashWalk. Free all the program variants which match + * the given context. + */ +static void +destroy_program_variants_cb(GLuint key, void *data, void *userData) +{ + struct st_context *st = (struct st_context *) userData; + struct gl_program *program = (struct gl_program *) data; + destroy_program_variants(st, program); +} + + +/** + * Walk over all shaders and programs to delete any variants which + * belong to the given context. + * This is called during context tear-down. + */ +void +st_destroy_program_variants(struct st_context *st) +{ + /* ARB vert/frag program */ + _mesa_HashWalk(st->ctx->Shared->Programs, + destroy_program_variants_cb, st); + + /* GLSL vert/frag/geom shaders */ + _mesa_HashWalk(st->ctx->Shared->ShaderObjects, + destroy_shader_program_variants_cb, st); +} diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 72dbc715fe1..519ee8c0d17 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -40,26 +40,60 @@ #include "st_context.h" +/** Fragment program variant key */ +struct st_fp_varient_key +{ + struct st_context *st; /**< variants are per-context */ + + /** for glBitmap */ + GLuint bitmap:1; /**< glBitmap varient? */ + + /** for glDrawPixels */ + GLuint drawpixels:1; /**< glDrawPixels varient */ + GLuint scaleAndBias:1; /**< glDrawPixels w/ scale and/or bias? */ + GLuint pixelMaps:1; /**< glDrawPixels w/ pixel lookup map? */ + GLuint drawpixels_z:1; /**< glDrawPixels(GL_DEPTH) */ + GLuint drawpixels_stencil:1; /**< glDrawPixels(GL_STENCIL) */ +}; + + +/** + * Variant of a fragment program. + */ +struct st_fp_varient +{ + /** Parameters which generated this version of fragment program */ + struct st_fp_varient_key key; + + /** Driver's compiled shader */ + void *driver_shader; + + /** For glBitmap variants */ + struct gl_program_parameter_list *parameters; + uint bitmap_sampler; + + /** next in linked list */ + struct st_fp_varient *next; +}; + + /** * Derived from Mesa gl_fragment_program: */ struct st_fragment_program { struct gl_fragment_program Base; - GLuint serialNo; struct pipe_shader_state tgsi; - void *driver_shader; - /** Program prefixed with glBitmap prologue */ - struct st_fragment_program *bitmap_program; - uint bitmap_sampler; + struct st_fp_varient *varients; }; struct st_vp_varient_key { + struct st_context *st; /**< variants are per-context */ boolean passthrough_edgeflags; }; @@ -101,7 +135,6 @@ struct st_vp_varient struct st_vertex_program { struct gl_vertex_program Base; /**< The Mesa vertex program */ - GLuint serialNo, lastSerialNo; /** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */ GLuint input_to_index[VERT_ATTRIB_MAX]; @@ -120,13 +153,35 @@ struct st_vertex_program struct st_vp_varient *varients; }; + + +struct st_gp_varient_key +{ + struct st_context *st; /**< variants are per-context */ + /* no other fields yet */ +}; + + +/** + * Geometry program variant. + */ +struct st_gp_varient +{ + /* Parameters which generated this translated version of a vertex */ + struct st_gp_varient_key key; + + void *driver_shader; + + struct st_gp_varient *next; +}; + + /** * Derived from Mesa gl_geometry_program: */ struct st_geometry_program { struct gl_geometry_program Base; /**< The Mesa geometry program */ - GLuint serialNo; /** map GP input back to VP output */ GLuint input_map[PIPE_MAX_SHADER_INPUTS]; @@ -145,9 +200,12 @@ struct st_geometry_program ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; struct pipe_shader_state tgsi; - void *driver_shader; + + struct st_gp_varient *varients; }; + + static INLINE struct st_fragment_program * st_fragment_program( struct gl_fragment_program *fp ) { @@ -198,32 +256,43 @@ st_reference_fragprog(struct st_context *st, } -extern void -st_translate_fragment_program(struct st_context *st, - struct st_fragment_program *fp); +extern struct st_vp_varient * +st_get_vp_varient(struct st_context *st, + struct st_vertex_program *stvp, + const struct st_vp_varient_key *key); -extern void -st_translate_geometry_program(struct st_context *st, - struct st_geometry_program *stgp); -/* Called after program string change, discard all previous - * compilation results. - */ -extern void -st_prepare_vertex_program(struct st_context *st, - struct st_vertex_program *stvp); +extern struct st_fp_varient * +st_get_fp_varient(struct st_context *st, + struct st_fragment_program *stfp, + const struct st_fp_varient_key *key); -extern struct st_vp_varient * -st_translate_vertex_program(struct st_context *st, - struct st_vertex_program *stvp, - const struct st_vp_varient_key *key); -void +extern struct st_gp_varient * +st_get_gp_varient(struct st_context *st, + struct st_geometry_program *stgp, + const struct st_gp_varient_key *key); + + + +extern void st_vp_release_varients( struct st_context *st, struct st_vertex_program *stvp ); +extern void +st_fp_release_varients( struct st_context *st, + struct st_fragment_program *stfp ); + +extern void +st_gp_release_varients(struct st_context *st, + struct st_geometry_program *stgp); + + extern void st_print_shaders(struct gl_context *ctx); +extern void +st_destroy_program_variants(struct st_context *st); + #endif -- cgit v1.2.3 From 9b4433fe58cc1a64c44388590385a777e3050bb3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:16:18 -0700 Subject: st/mesa: add comments, fix formatting in st_cb_program.c --- src/mesa/state_tracker/st_cb_program.c | 60 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 3e1b709d25b..3e217abbb2e 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -51,9 +51,8 @@ * Called via ctx->Driver.BindProgram() to bind an ARB vertex or * fragment program. */ -static void st_bind_program( struct gl_context *ctx, - GLenum target, - struct gl_program *prog ) +static void +st_bind_program(struct gl_context *ctx, GLenum target, struct gl_program *prog) { struct st_context *st = st_context(ctx); @@ -75,7 +74,8 @@ static void st_bind_program( struct gl_context *ctx, * Called via ctx->Driver.UseProgram() to bind a linked GLSL program * (vertex shader + fragment shader). */ -static void st_use_program( struct gl_context *ctx, struct gl_shader_program *shProg) +static void +st_use_program(struct gl_context *ctx, struct gl_shader_program *shProg) { struct st_context *st = st_context(ctx); @@ -85,42 +85,28 @@ static void st_use_program( struct gl_context *ctx, struct gl_shader_program *sh } - /** * Called via ctx->Driver.NewProgram() to allocate a new vertex or * fragment program. */ -static struct gl_program *st_new_program( struct gl_context *ctx, - GLenum target, - GLuint id ) +static struct gl_program * +st_new_program(struct gl_context *ctx, GLenum target, GLuint id) { switch (target) { case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program); - - return _mesa_init_vertex_program( ctx, - &prog->Base, - target, - id ); + return _mesa_init_vertex_program(ctx, &prog->Base, target, id); } case GL_FRAGMENT_PROGRAM_ARB: case GL_FRAGMENT_PROGRAM_NV: { struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program); - - return _mesa_init_fragment_program( ctx, - &prog->Base, - target, - id ); + return _mesa_init_fragment_program(ctx, &prog->Base, target, id); } case MESA_GEOMETRY_PROGRAM: { struct st_geometry_program *prog = ST_CALLOC_STRUCT(st_geometry_program); - - return _mesa_init_geometry_program( ctx, - &prog->Base, - target, - id ); + return _mesa_init_geometry_program(ctx, &prog->Base, target, id); } default: @@ -130,6 +116,9 @@ static struct gl_program *st_new_program( struct gl_context *ctx, } +/** + * Called via ctx->Driver.DeleteProgram() + */ void st_delete_program(struct gl_context *ctx, struct gl_program *prog) { @@ -177,15 +166,25 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) } -static GLboolean st_is_program_native( struct gl_context *ctx, - GLenum target, - struct gl_program *prog ) +/** + * Called via ctx->Driver.IsProgramNative() + */ +static GLboolean +st_is_program_native(struct gl_context *ctx, + GLenum target, + struct gl_program *prog) { return GL_TRUE; } -static GLboolean st_program_string_notify( struct gl_context *ctx, +/** + * Called via ctx->Driver.ProgramStringNotify() + * Called when the program's text/code is changed. We have to free + * all shader varients and corresponding gallium shaders when this happens. + */ +static GLboolean +st_program_string_notify( struct gl_context *ctx, GLenum target, struct gl_program *prog ) { @@ -231,8 +230,11 @@ static GLboolean st_program_string_notify( struct gl_context *ctx, } - -void st_init_program_functions(struct dd_function_table *functions) +/** + * Plug in the program and shader-related device driver functions. + */ +void +st_init_program_functions(struct dd_function_table *functions) { functions->BindProgram = st_bind_program; functions->UseProgram = st_use_program; -- cgit v1.2.3 From 8d8e9491df01898a8dde725baa000c0259a991a3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:16:57 -0700 Subject: st/mesa: make st_delete_program() static --- src/mesa/state_tracker/st_cb_program.c | 2 +- src/mesa/state_tracker/st_cb_program.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 3e217abbb2e..e55c50f2090 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -119,7 +119,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id) /** * Called via ctx->Driver.DeleteProgram() */ -void +static void st_delete_program(struct gl_context *ctx, struct gl_program *prog) { struct st_context *st = st_context(ctx); diff --git a/src/mesa/state_tracker/st_cb_program.h b/src/mesa/state_tracker/st_cb_program.h index 004afb6d812..d9149d61fbb 100644 --- a/src/mesa/state_tracker/st_cb_program.h +++ b/src/mesa/state_tracker/st_cb_program.h @@ -36,8 +36,5 @@ struct dd_function_table; extern void st_init_program_functions(struct dd_function_table *functions); -extern void -st_delete_program(struct gl_context *ctx, struct gl_program *prog); - #endif -- cgit v1.2.3 From 83d50c3ee1309ee12bc4516d6c836a3c03fa9026 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:18:47 -0700 Subject: st/mesa: minor re-indenting --- src/mesa/state_tracker/st_program.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 202f7cb711e..f28890e7b32 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -315,23 +315,22 @@ st_translate_vertex_program(struct st_context *st, debug_printf("\n"); } - error = - st_translate_mesa_program(st->ctx, - TGSI_PROCESSOR_VERTEX, - ureg, - &stvp->Base.Base, - /* inputs */ - vpv->num_inputs, - stvp->input_to_index, - NULL, /* input semantic name */ - NULL, /* input semantic index */ - NULL, - /* outputs */ - num_outputs, - stvp->result_to_output, - stvp->output_semantic_name, - stvp->output_semantic_index, - key->passthrough_edgeflags ); + error = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_VERTEX, + ureg, + &stvp->Base.Base, + /* inputs */ + vpv->num_inputs, + stvp->input_to_index, + NULL, /* input semantic name */ + NULL, /* input semantic index */ + NULL, + /* outputs */ + num_outputs, + stvp->result_to_output, + stvp->output_semantic_name, + stvp->output_semantic_index, + key->passthrough_edgeflags ); if (error) goto fail; -- cgit v1.2.3 From 6c669d0c0766c27c58dd3ea7c3bd18b47a922aea Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:25:10 -0700 Subject: st/mesa: rename variable --- src/mesa/state_tracker/st_program.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 519ee8c0d17..10ac1bace59 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -220,9 +220,9 @@ st_vertex_program( struct gl_vertex_program *vp ) } static INLINE struct st_geometry_program * -st_geometry_program( struct gl_geometry_program *vp ) +st_geometry_program( struct gl_geometry_program *gp ) { - return (struct st_geometry_program *)vp; + return (struct st_geometry_program *)gp; } static INLINE void -- cgit v1.2.3 From 43125694109b01b9d99ed73ca340fcf19b831cd5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:25:29 -0700 Subject: st/mesa: use st_fragment_program() instead of cast --- src/mesa/state_tracker/st_program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index f28890e7b32..0e67fcca17b 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -417,7 +417,7 @@ st_translate_fragment_program(struct st_context *st, &fp, &varient->bitmap_sampler); varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); - stfp = (struct st_fragment_program *) fp; + stfp = st_fragment_program(fp); } else if (key->drawpixels) { /* glDrawPixels drawing */ @@ -432,7 +432,7 @@ st_translate_fragment_program(struct st_context *st, st_make_drawpix_fragment_program(st, &stfp->Base, &fp); varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); } - stfp = (struct st_fragment_program *) fp; + stfp = st_fragment_program(fp); } if (!stfp->tgsi.tokens) { -- cgit v1.2.3 From b830b62a47dec70640062c488cbebd2c8ac487f9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:28:02 -0700 Subject: st/mesa: program struct comments --- src/mesa/state_tracker/st_program.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 10ac1bace59..7bb4f0709a6 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -91,6 +91,7 @@ struct st_fragment_program +/** Vertex program variant key */ struct st_vp_varient_key { struct st_context *st; /**< variants are per-context */ @@ -124,7 +125,7 @@ struct st_vp_varient /** Next in linked list */ struct st_vp_varient *next; - /** similar to that in st_vertex_program, but with information about edgeflags too */ + /** similar to that in st_vertex_program, but with edgeflags info too */ GLuint num_inputs; }; @@ -155,6 +156,7 @@ struct st_vertex_program +/** Geometry program varient key */ struct st_gp_varient_key { struct st_context *st; /**< variants are per-context */ -- cgit v1.2.3 From c21807d2f7329a363f2c68cd8ef4dfc46575d52f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:29:56 -0700 Subject: st/mesa: add geom program code in destroy_program_variants() --- src/mesa/state_tracker/st_program.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 0e67fcca17b..65a56319964 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1046,6 +1046,27 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) } } break; + case MESA_GEOMETRY_PROGRAM: + { + struct st_geometry_program *stgp = + (struct st_geometry_program *) program; + struct st_gp_varient *gpv, **prev = &stgp->varients; + + for (gpv = stgp->varients; gpv; ) { + struct st_gp_varient *next = gpv->next; + if (gpv->key.st == st) { + /* unlink from list */ + *prev = next; + /* destroy this variant */ + delete_gp_varient(st, gpv); + } + else { + prev = &gpv; + } + gpv = next; + } + } + break; default: _mesa_problem(NULL, "Unexpected program target in " "destroy_program_variants_cb()"); -- cgit v1.2.3 From 43b7b9d02aa3a3670fd30619ef2b2366abf955dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 17:34:07 -0700 Subject: st/mesa: 80-columns wrapping, whitespace fixes in st_cb_bitmap.c --- src/mesa/state_tracker/st_cb_bitmap.c | 46 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 320b73f03de..d1d7e8f3710 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -348,7 +348,8 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized, if (!st->bitmap.vbuf) { st->bitmap.vbuf = pipe_buffer_create(pipe->screen, PIPE_BIND_VERTEX_BUFFER, - max_slots * sizeof(st->bitmap.vertices)); + max_slots * + sizeof(st->bitmap.vertices)); } /* Positions are in clip coords since we need to do clipping in case @@ -388,10 +389,11 @@ setup_bitmap_vertex_data(struct st_context *st, bool normalized, /* put vertex data into vbuf */ pipe_buffer_write_nooverlap(st->pipe, - st->bitmap.vbuf, - st->bitmap.vbuf_slot * sizeof st->bitmap.vertices, - sizeof st->bitmap.vertices, - st->bitmap.vertices); + st->bitmap.vbuf, + st->bitmap.vbuf_slot + * sizeof(st->bitmap.vertices), + sizeof st->bitmap.vertices, + st->bitmap.vertices); return st->bitmap.vbuf_slot++ * sizeof st->bitmap.vertices; } @@ -441,7 +443,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* XXX if the bitmap is larger than the max texture size, break * it up into chunks. */ - maxSize = 1 << (pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1); + maxSize = 1 << (pipe->screen->get_param(pipe->screen, + PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1); assert(width <= (GLsizei)maxSize); assert(height <= (GLsizei)maxSize); @@ -471,7 +474,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, for (i = 0; i < st->state.num_samplers; i++) { samplers[i] = &st->state.samplers[i]; } - samplers[fpv->bitmap_sampler] = &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT]; + samplers[fpv->bitmap_sampler] = + &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT]; cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers); } @@ -508,7 +512,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, z = z * 2.0 - 1.0; /* draw textured quad */ - offset = setup_bitmap_vertex_data(st, sv->texture->target != PIPE_TEXTURE_RECT, x, y, width, height, z, color); + offset = setup_bitmap_vertex_data(st, + sv->texture->target != PIPE_TEXTURE_RECT, + x, y, width, height, z, color); util_draw_vertex_buffer(pipe, st->bitmap.vbuf, offset, PIPE_PRIM_TRIANGLE_FAN, @@ -577,6 +583,9 @@ print_cache(const struct bitmap_cache *cache) } +/** + * Create gallium pipe_transfer object for the bitmap cache. + */ static void create_cache_trans(struct st_context *st) { @@ -655,7 +664,9 @@ st_flush_bitmap_cache(struct st_context *st) } } -/* Flush bitmap cache and release vertex buffer. + +/** + * Flush bitmap cache and release vertex buffer. */ void st_flush_bitmap( struct st_context *st ) @@ -741,7 +752,8 @@ accum_bitmap(struct st_context *st, * Called via ctx->Driver.Bitmap() */ static void -st_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, +st_Bitmap(struct gl_context *ctx, GLint x, GLint y, + GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ) { struct st_context *st = st_context(ctx); @@ -768,7 +780,8 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei heigh pt = make_bitmap_texture(ctx, width, height, unpack, bitmap); if (pt) { - struct pipe_sampler_view *sv = st_create_texture_sampler_view(st->pipe, pt); + struct pipe_sampler_view *sv = + st_create_texture_sampler_view(st->pipe, pt); assert(pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT); @@ -818,15 +831,18 @@ st_init_bitmap(struct st_context *st) st->bitmap.rasterizer.gl_rasterization_rules = 1; /* find a usable texture format */ - if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D, 0, + if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, + PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) { st->bitmap.tex_format = PIPE_FORMAT_I8_UNORM; } - else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, PIPE_TEXTURE_2D, 0, + else if (screen->is_format_supported(screen, PIPE_FORMAT_A8_UNORM, + PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) { st->bitmap.tex_format = PIPE_FORMAT_A8_UNORM; } - else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, PIPE_TEXTURE_2D, 0, + else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, + PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, 0)) { st->bitmap.tex_format = PIPE_FORMAT_L8_UNORM; } @@ -849,8 +865,6 @@ st_destroy_bitmap(struct st_context *st) struct pipe_context *pipe = st->pipe; struct bitmap_cache *cache = st->bitmap.cache; - - if (st->bitmap.vs) { cso_delete_vertex_shader(st->cso_context, st->bitmap.vs); st->bitmap.vs = NULL; -- cgit v1.2.3 From d88aa6fe3e9e08af332a900c69bf2bf5c4420e90 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 Dec 2010 15:18:13 -0800 Subject: i965: Improve the hacks for ARB_fp scalar^scalar POW on gen6. This is still awful, but my ability to care about reworking the old backend so we can just get a temporary value into a POW is awfully low since the new backend does this all sensibly. Fixes: fp1-LIT test 1 fp1-LIT test 3 (case x < 0) fp1-POW test (exponentiation) fp-lit-mask --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 53 +++++++++++---------------------- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index a8be10638c7..be86e0e1287 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -973,34 +973,23 @@ void emit_math2(struct brw_wm_compile *c, struct brw_reg temp_dst = dst[dst_chan]; if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0) { - if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { - /* Both scalar arguments. Do scalar calc. */ - src0.hstride = BRW_HORIZONTAL_STRIDE_1; - src1.hstride = BRW_HORIZONTAL_STRIDE_1; - temp_dst.hstride = BRW_HORIZONTAL_STRIDE_1; - temp_dst.width = BRW_WIDTH_1; - - if (arg0[0].subnr != 0) { - brw_MOV(p, temp_dst, src0); - src0 = temp_dst; - - /* Ouch. We've used the temp as a dst, and we still - * need a temp to store arg1 in, because src and dst - * offsets have to be equal. Leaving this up to - * glsl2-965 to handle correctly. - */ - assert(arg1[0].subnr == 0); - } else if (arg1[0].subnr != 0) { - brw_MOV(p, temp_dst, src1); - src1 = temp_dst; - } - } else { - brw_MOV(p, temp_dst, src0); - src0 = temp_dst; - } - } else if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { - brw_MOV(p, temp_dst, src1); - src1 = temp_dst; + brw_MOV(p, temp_dst, src0); + src0 = temp_dst; + } + + if (arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { + /* This is a heinous hack to get a temporary register for use + * in case both arg0 and arg1 are constants. Why you're + * doing exponentiation on constant values in the shader, we + * don't know. + * + * max_wm_grf is almost surely less than the maximum GRF, and + * gen6 doesn't care about the number of GRFs used in a + * shader like pre-gen6 did. + */ + struct brw_reg temp = brw_vec8_grf(c->max_wm_grf, 0); + brw_MOV(p, temp, src1); + src1 = temp; } brw_set_saturate(p, (mask & SATURATE) ? 1 : 0); @@ -1018,14 +1007,6 @@ void emit_math2(struct brw_wm_compile *c, sechalf(src0), sechalf(src1)); } - - /* Splat a scalar result into all the channels. */ - if (arg0[0].hstride == BRW_HORIZONTAL_STRIDE_0 && - arg1[0].hstride == BRW_HORIZONTAL_STRIDE_0) { - temp_dst.hstride = BRW_HORIZONTAL_STRIDE_0; - temp_dst.vstride = BRW_VERTICAL_STRIDE_0; - brw_MOV(p, dst[dst_chan], temp_dst); - } } else { GLuint saturate = ((mask & SATURATE) ? BRW_MATH_SATURATE_SATURATE : -- cgit v1.2.3 From c27285610c9f9b50d06bf0f2725da195937cb48d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 13 Dec 2010 11:32:19 -0800 Subject: i965: Add support for using the BLT ring on gen6. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 5 ++- src/mesa/drivers/dri/i915/i915_vtbl.c | 5 ++- src/mesa/drivers/dri/i965/brw_draw.c | 5 ++- src/mesa/drivers/dri/i965/brw_state.h | 3 +- src/mesa/drivers/dri/i965/brw_state_batch.c | 4 +- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 55 ++++++++++++++++---------- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 21 +++++++--- src/mesa/drivers/dri/intel/intel_blit.c | 30 ++++---------- 8 files changed, 72 insertions(+), 56 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index f7fdb78d059..1621c9544ac 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -364,7 +364,7 @@ i830_emit_invarient_state(struct intel_context *intel) #define emit( intel, state, size ) \ - intel_batchbuffer_data(intel->batch, state, size ) + intel_batchbuffer_data(intel->batch, state, size, false) static GLuint get_dirty(struct i830_hw_state *state) @@ -429,7 +429,8 @@ i830_emit_state(struct intel_context *intel) * batchbuffer fills up. */ intel_batchbuffer_require_space(intel->batch, - get_state_size(state) + INTEL_PRIM_EMIT_SIZE); + get_state_size(state) + INTEL_PRIM_EMIT_SIZE, + false); count = 0; again: aper_count = 0; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 59dfe085632..8d9020f5ef3 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -217,7 +217,7 @@ i915_emit_invarient_state(struct intel_context *intel) #define emit(intel, state, size ) \ - intel_batchbuffer_data(intel->batch, state, size) + intel_batchbuffer_data(intel->batch, state, size, false) static GLuint get_dirty(struct i915_hw_state *state) @@ -300,7 +300,8 @@ i915_emit_state(struct intel_context *intel) * batchbuffer fills up. */ intel_batchbuffer_require_space(intel->batch, - get_state_size(state) + INTEL_PRIM_EMIT_SIZE); + get_state_size(state) + INTEL_PRIM_EMIT_SIZE, + false); count = 0; again: aper_count = 0; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index a1f403ca4e6..7eb16b71f4a 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -159,7 +159,7 @@ static void brw_emit_prim(struct brw_context *brw, } if (prim_packet.verts_per_instance) { intel_batchbuffer_data( brw->intel.batch, &prim_packet, - sizeof(prim_packet)); + sizeof(prim_packet), false); } if (intel->always_flush_cache) { intel_batchbuffer_emit_mi_flush(intel->batch); @@ -351,7 +351,8 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx, * an upper bound of how much we might emit in a single * brw_try_draw_prims(). */ - intel_batchbuffer_require_space(intel->batch, intel->batch->size / 4); + intel_batchbuffer_require_space(intel->batch, intel->batch->size / 4, + false); hw_prim = brw_set_prim(brw, &prim[i]); diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 3beed16945b..4bb93e73369 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -164,7 +164,8 @@ void brw_destroy_caches( struct brw_context *brw ); /*********************************************************************** * brw_state_batch.c */ -#define BRW_BATCH_STRUCT(brw, s) intel_batchbuffer_data( brw->intel.batch, (s), sizeof(*(s))) +#define BRW_BATCH_STRUCT(brw, s) intel_batchbuffer_data(brw->intel.batch, (s), \ + sizeof(*(s)), false) #define BRW_CACHED_BATCH_STRUCT(brw, s) brw_cached_batch_struct( brw, (s), sizeof(*(s)) ) GLboolean brw_cached_batch_struct( struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/brw_state_batch.c b/src/mesa/drivers/dri/i965/brw_state_batch.c index be3989eb7db..a21af13caa3 100644 --- a/src/mesa/drivers/dri/i965/brw_state_batch.c +++ b/src/mesa/drivers/dri/i965/brw_state_batch.c @@ -48,7 +48,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw, struct header *newheader = (struct header *)data; if (brw->emit_state_always) { - intel_batchbuffer_data(brw->intel.batch, data, sz); + intel_batchbuffer_data(brw->intel.batch, data, sz, false); return GL_TRUE; } @@ -75,7 +75,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw, emit: memcpy(item->header, newheader, sz); - intel_batchbuffer_data(brw->intel.batch, data, sz); + intel_batchbuffer_data(brw->intel.batch, data, sz, false); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 21fc9ece886..20574ab5462 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -93,8 +93,16 @@ do_flush_locked(struct intel_batchbuffer *batch, GLuint used) batch->ptr = NULL; if (!intel->intelScreen->no_hw) { - drm_intel_bo_exec(batch->buf, used, NULL, 0, - (x_off & 0xffff) | (y_off << 16)); + int ring; + + if (intel->gen < 6 || !intel->batch->is_blit) { + ring = I915_EXEC_RENDER; + } else { + ring = I915_EXEC_BLT; + } + + drm_intel_bo_mrb_exec(batch->buf, used, NULL, 0, + (x_off & 0xffff) | (y_off << 16), ring); } if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) { @@ -242,10 +250,10 @@ intel_batchbuffer_emit_reloc_fenced(struct intel_batchbuffer *batch, void intel_batchbuffer_data(struct intel_batchbuffer *batch, - const void *data, GLuint bytes) + const void *data, GLuint bytes, bool is_blit) { assert((bytes & 3) == 0); - intel_batchbuffer_require_space(batch, bytes); + intel_batchbuffer_require_space(batch, bytes, is_blit); __memcpy(batch->ptr, data, bytes); batch->ptr += bytes; } @@ -262,22 +270,29 @@ intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch) struct intel_context *intel = batch->intel; if (intel->gen >= 6) { - BEGIN_BATCH(8); - - /* XXX workaround: issue any post sync != 0 before write cache flush = 1 */ - OUT_BATCH(_3DSTATE_PIPE_CONTROL); - OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE); - OUT_BATCH(0); /* write address */ - OUT_BATCH(0); /* write data */ - - OUT_BATCH(_3DSTATE_PIPE_CONTROL); - OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH | - PIPE_CONTROL_WRITE_FLUSH | - PIPE_CONTROL_DEPTH_CACHE_FLUSH | - PIPE_CONTROL_NO_WRITE); - OUT_BATCH(0); /* write address */ - OUT_BATCH(0); /* write data */ - ADVANCE_BATCH(); + if (intel->batch->is_blit) { + BEGIN_BATCH_BLT(1); + OUT_BATCH(MI_FLUSH); + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(8); + /* XXX workaround: issue any post sync != 0 before write + * cache flush = 1 + */ + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_WRITE_IMMEDIATE); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + + OUT_BATCH(_3DSTATE_PIPE_CONTROL); + OUT_BATCH(PIPE_CONTROL_INSTRUCTION_FLUSH | + PIPE_CONTROL_WRITE_FLUSH | + PIPE_CONTROL_DEPTH_CACHE_FLUSH | + PIPE_CONTROL_NO_WRITE); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + ADVANCE_BATCH(); + } } else if (intel->gen >= 4) { BEGIN_BATCH(4); OUT_BATCH(_3DSTATE_PIPE_CONTROL | diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 428c027c2f1..635708587a6 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -31,6 +31,7 @@ struct intel_batchbuffer } emit; #endif + bool is_blit; GLuint dirty_state; GLuint reserved_space; }; @@ -55,7 +56,7 @@ void intel_batchbuffer_reset(struct intel_batchbuffer *batch); * intel_buffer_dword() calls. */ void intel_batchbuffer_data(struct intel_batchbuffer *batch, - const void *data, GLuint bytes); + const void *data, GLuint bytes, bool is_blit); void intel_batchbuffer_release_space(struct intel_batchbuffer *batch, GLuint bytes); @@ -114,8 +115,16 @@ intel_batchbuffer_emit_float(struct intel_batchbuffer *batch, float f) static INLINE void intel_batchbuffer_require_space(struct intel_batchbuffer *batch, - GLuint sz) + GLuint sz, int is_blit) { + + if (batch->intel->gen >= 6 && batch->is_blit != is_blit && + batch->ptr != batch->map) { + intel_batchbuffer_flush(batch); + } + + batch->is_blit = is_blit; + #ifdef DEBUG assert(sz < batch->size - 8); #endif @@ -124,9 +133,10 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch, } static INLINE void -intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n) +intel_batchbuffer_begin(struct intel_batchbuffer *batch, int n, bool is_blit) { - intel_batchbuffer_require_space(batch, n * 4); + intel_batchbuffer_require_space(batch, n * 4, is_blit); + #ifdef DEBUG assert(batch->map); assert(batch->emit.start_ptr == NULL); @@ -154,7 +164,8 @@ intel_batchbuffer_advance(struct intel_batchbuffer *batch) */ #define BATCH_LOCALS -#define BEGIN_BATCH(n) intel_batchbuffer_begin(intel->batch, n) +#define BEGIN_BATCH(n) intel_batchbuffer_begin(intel->batch, n, false) +#define BEGIN_BATCH_BLT(n) intel_batchbuffer_begin(intel->batch, n, true) #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d) #define OUT_BATCH_F(f) intel_batchbuffer_emit_float(intel->batch,f) #define OUT_RELOC(buf, read_domains, write_domain, delta) do { \ diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index c2917e9b07e..ede88de82f1 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -107,10 +107,6 @@ intelEmitCopyBlit(struct intel_context *intel, drm_intel_bo *aper_array[3]; BATCH_LOCALS; - /* Blits are in a different ringbuffer so we don't use them. */ - if (intel->gen >= 6) - return GL_FALSE; - if (dst_tiling != I915_TILING_NONE) { if (dst_offset & 4095) return GL_FALSE; @@ -140,7 +136,7 @@ intelEmitCopyBlit(struct intel_context *intel, if (pass >= 2) return GL_FALSE; - intel_batchbuffer_require_space(intel->batch, 8 * 4); + intel_batchbuffer_require_space(intel->batch, 8 * 4, true); DBG("%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", __FUNCTION__, src_buffer, src_pitch, src_offset, src_x, src_y, @@ -181,7 +177,7 @@ intelEmitCopyBlit(struct intel_context *intel, assert(dst_x < dst_x2); assert(dst_y < dst_y2); - BEGIN_BATCH(8); + BEGIN_BATCH_BLT(8); OUT_BATCH(CMD); OUT_BATCH(BR13 | (uint16_t)dst_pitch); OUT_BATCH((dst_y << 16) | dst_x); @@ -219,9 +215,6 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask) GLint cx, cy, cw, ch; BATCH_LOCALS; - /* Blits are in a different ringbuffer so we don't use them. */ - assert(intel->gen < 6); - /* * Compute values for clearing the buffers. */ @@ -356,7 +349,7 @@ intelClearWithBlit(struct gl_context *ctx, GLbitfield mask) intel_batchbuffer_flush(intel->batch); } - BEGIN_BATCH(6); + BEGIN_BATCH_BLT(6); OUT_BATCH(CMD); OUT_BATCH(BR13); OUT_BATCH((y1 << 16) | x1); @@ -393,10 +386,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, int dwords = ALIGN(src_size, 8) / 4; uint32_t opcode, br13, blit_cmd; - /* Blits are in a different ringbuffer so we don't use them. */ - if (intel->gen >= 6) - return GL_FALSE; - if (dst_tiling != I915_TILING_NONE) { if (dst_offset & 4095) return GL_FALSE; @@ -420,7 +409,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, intel_batchbuffer_require_space( intel->batch, (8 * 4) + (3 * 4) + - dwords * 4 ); + dwords * 4, true); opcode = XY_SETUP_BLT_CMD; if (cpp == 4) @@ -439,7 +428,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, if (dst_tiling != I915_TILING_NONE) blit_cmd |= XY_DST_TILED; - BEGIN_BATCH(8 + 3); + BEGIN_BATCH_BLT(8 + 3); OUT_BATCH(opcode); OUT_BATCH(br13); OUT_BATCH((0 << 16) | 0); /* clip x1, y1 */ @@ -456,9 +445,9 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, OUT_BATCH(((y + h) << 16) | (x + w)); ADVANCE_BATCH(); - intel_batchbuffer_data( intel->batch, - src_bits, - dwords * 4 ); + intel_batchbuffer_data(intel->batch, + src_bits, + dwords * 4, true); intel_batchbuffer_emit_mi_flush(intel->batch); @@ -480,9 +469,6 @@ intel_emit_linear_blit(struct intel_context *intel, GLuint pitch, height; GLboolean ok; - /* Blits are in a different ringbuffer so we don't use them. */ - assert(intel->gen < 6); - /* The pitch given to the GPU must be DWORD aligned, and * we want width to match pitch. Max width is (1 << 15 - 1), * rounding that down to the nearest DWORD is 1 << 15 - 4 -- cgit v1.2.3 From 71af07bf40e095e4c4e075d3f52a1f89f22d6639 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 14 Dec 2010 00:22:27 -0800 Subject: mesa: Clean up header file inclusion in nvvertparse.h. --- src/mesa/program/nvvertparse.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/nvvertparse.h b/src/mesa/program/nvvertparse.h index e98e867320f..7318e149416 100644 --- a/src/mesa/program/nvvertparse.h +++ b/src/mesa/program/nvvertparse.h @@ -29,7 +29,10 @@ #ifndef NVVERTPARSE_H #define NVVERTPARSE_H -#include "main/mtypes.h" +#include "main/glheader.h" + +struct gl_context; +struct gl_vertex_program; extern void _mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target, -- cgit v1.2.3 From 2c582dd25f0625eae9ebd2c0c2c151f048a9790b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 14 Dec 2010 00:30:24 -0800 Subject: mesa: Clean up header file inclusion in prog_cache.h. --- src/mesa/program/prog_cache.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/prog_cache.h b/src/mesa/program/prog_cache.h index 4907ae3030e..01673348279 100644 --- a/src/mesa/program/prog_cache.h +++ b/src/mesa/program/prog_cache.h @@ -30,8 +30,9 @@ #define PROG_CACHE_H -#include "main/mtypes.h" +#include "main/glheader.h" +struct gl_context; /** Opaque type */ struct gl_program_cache; -- cgit v1.2.3 From 4d1b2df6c0fd837828fdebc0bd20d9eccf1ffedf Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 14 Dec 2010 00:39:57 -0800 Subject: mesa: Clean up header file inclusion in prog_optimize.h. --- src/mesa/program/prog_optimize.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/prog_optimize.h b/src/mesa/program/prog_optimize.h index 00f1080449b..463f5fc51c4 100644 --- a/src/mesa/program/prog_optimize.h +++ b/src/mesa/program/prog_optimize.h @@ -27,9 +27,10 @@ #include "main/config.h" -#include "main/mtypes.h" +#include "main/glheader.h" +struct gl_context; struct gl_program; struct prog_instruction; -- cgit v1.2.3 From 54773415f407678eb9728ac347cc8302e2d76c74 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 14 Dec 2010 13:50:46 -0500 Subject: r600g: fix segfault when translating vertex buffer Note the support for non float vertex draw likely regressed need to find what we want to do there. candidates for 7.10 branches Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 5 ----- src/gallium/drivers/r600/r600_state.c | 9 --------- src/gallium/drivers/r600/r600_state_common.c | 5 +++++ src/gallium/drivers/r600/r600_translate.c | 12 +++++------- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index a9d4a862c32..07496ebf51e 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1295,11 +1295,6 @@ void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx) if (rctx->vertex_elements == NULL || !rctx->nvertex_buffer) return; - /* delete previous translated vertex elements */ - if (rctx->tran.new_velems) { - r600_end_vertex_translate(rctx); - } - if (rctx->vertex_elements->incompatible_layout) { /* translate rebind new vertex elements so * return once translated diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 67ea21712f7..cd5f0792d5e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -135,11 +135,6 @@ void r600_vertex_buffer_update(struct r600_pipe_context *rctx) if (rctx->vertex_elements == NULL || !rctx->nvertex_buffer) return; - /* delete previous translated vertex elements */ - if (rctx->tran.new_velems) { - r600_end_vertex_translate(rctx); - } - if (rctx->vertex_elements->incompatible_layout) { /* translate rebind new vertex elements so * return once translated @@ -280,7 +275,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_drawl draw; - boolean translate = FALSE; memset(&draw, 0, sizeof(struct r600_drawl)); draw.ctx = ctx; @@ -312,9 +306,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) } r600_draw_common(&draw); - if (translate) - r600_end_vertex_translate(rctx); - pipe_resource_reference(&draw.index_buffer, NULL); } diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 1333808c66f..99b372caace 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -119,6 +119,11 @@ void r600_bind_vertex_elements(struct pipe_context *ctx, void *state) struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_vertex_element *v = (struct r600_vertex_element*)state; + /* delete previous translated vertex elements */ + if (rctx->tran.new_velems) { + r600_end_vertex_translate(rctx); + } + rctx->vertex_elements = v; if (v) { rctx->states[v->rstate.id] = &v->rstate; diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c index 1c227d32151..ba12eee2b56 100644 --- a/src/gallium/drivers/r600/r600_translate.c +++ b/src/gallium/drivers/r600/r600_translate.c @@ -42,6 +42,7 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx) struct pipe_resource *out_buffer; unsigned i, num_verts; struct pipe_vertex_element new_velems[PIPE_MAX_ATTRIBS]; + void *tmp; /* Initialize the translate key, i.e. the recipe how vertices should be * translated. */ @@ -159,8 +160,9 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx) } } - rctx->tran.new_velems = pipe->create_vertex_elements_state(pipe, ve->count, new_velems); - pipe->bind_vertex_elements_state(pipe, rctx->tran.new_velems); + tmp = pipe->create_vertex_elements_state(pipe, ve->count, new_velems); + pipe->bind_vertex_elements_state(pipe, tmp); + rctx->tran.new_velems = tmp; pipe_resource_reference(&out_buffer, NULL); } @@ -173,15 +175,11 @@ void r600_end_vertex_translate(struct r600_pipe_context *rctx) return; } /* Restore vertex elements. */ - if (rctx->vertex_elements == rctx->tran.new_velems) { - pipe->bind_vertex_elements_state(pipe, NULL); - } pipe->delete_vertex_elements_state(pipe, rctx->tran.new_velems); rctx->tran.new_velems = NULL; /* Delete the now-unused VBO. */ - pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, - NULL); + pipe_resource_reference(&rctx->vertex_buffer[rctx->tran.vb_slot].buffer, NULL); } void r600_translate_index_buffer(struct r600_pipe_context *r600, -- cgit v1.2.3 From 68c41a25b4adf77886cc915d47af5e01723142f8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Dec 2010 08:36:39 -0700 Subject: st/mesa: rename the varient release functions --- src/mesa/state_tracker/st_cb_program.c | 12 ++++++------ src/mesa/state_tracker/st_program.c | 6 +++--- src/mesa/state_tracker/st_program.h | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index e55c50f2090..860d5a46de8 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -128,7 +128,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; - st_vp_release_varients( st, stvp ); + st_release_vp_varients( st, stvp ); } break; case MESA_GEOMETRY_PROGRAM: @@ -136,7 +136,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) struct st_geometry_program *stgp = (struct st_geometry_program *) prog; - st_gp_release_varients(st, stgp); + st_release_gp_varients(st, stgp); if (stgp->tgsi.tokens) { st_free_tokens((void *) stgp->tgsi.tokens); @@ -149,7 +149,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) struct st_fragment_program *stfp = (struct st_fragment_program *) prog; - st_fp_release_varients(st, stfp); + st_release_fp_varients(st, stfp); if (stfp->tgsi.tokens) { st_free_tokens(stfp->tgsi.tokens); @@ -193,7 +193,7 @@ st_program_string_notify( struct gl_context *ctx, if (target == GL_FRAGMENT_PROGRAM_ARB) { struct st_fragment_program *stfp = (struct st_fragment_program *) prog; - st_fp_release_varients(st, stfp); + st_release_fp_varients(st, stfp); if (stfp->tgsi.tokens) { st_free_tokens(stfp->tgsi.tokens); @@ -206,7 +206,7 @@ st_program_string_notify( struct gl_context *ctx, else if (target == MESA_GEOMETRY_PROGRAM) { struct st_geometry_program *stgp = (struct st_geometry_program *) prog; - st_gp_release_varients(st, stgp); + st_release_gp_varients(st, stgp); if (stgp->tgsi.tokens) { st_free_tokens((void *) stgp->tgsi.tokens); @@ -219,7 +219,7 @@ st_program_string_notify( struct gl_context *ctx, else if (target == GL_VERTEX_PROGRAM_ARB) { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; - st_vp_release_varients( st, stvp ); + st_release_vp_varients( st, stvp ); if (st->vp == stvp) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 65a56319964..54f1551ebc4 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -82,7 +82,7 @@ delete_vp_varient(struct st_context *st, struct st_vp_varient *vpv) * Clean out any old compilations: */ void -st_vp_release_varients( struct st_context *st, +st_release_vp_varients( struct st_context *st, struct st_vertex_program *stvp ) { struct st_vp_varient *vpv; @@ -116,7 +116,7 @@ delete_fp_varient(struct st_context *st, struct st_fp_varient *fpv) * Free all varients of a fragment program. */ void -st_fp_release_varients(struct st_context *st, struct st_fragment_program *stfp) +st_release_fp_varients(struct st_context *st, struct st_fragment_program *stfp) { struct st_fp_varient *fpv; @@ -148,7 +148,7 @@ delete_gp_varient(struct st_context *st, struct st_gp_varient *gpv) * Free all varients of a geometry program. */ void -st_gp_release_varients(struct st_context *st, struct st_geometry_program *stgp) +st_release_gp_varients(struct st_context *st, struct st_geometry_program *stgp) { struct st_gp_varient *gpv; diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 7bb4f0709a6..0cf81caa267 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -278,15 +278,15 @@ st_get_gp_varient(struct st_context *st, extern void -st_vp_release_varients( struct st_context *st, +st_release_vp_varients( struct st_context *st, struct st_vertex_program *stvp ); extern void -st_fp_release_varients( struct st_context *st, +st_release_fp_varients( struct st_context *st, struct st_fragment_program *stfp ); extern void -st_gp_release_varients(struct st_context *st, +st_release_gp_varients(struct st_context *st, struct st_geometry_program *stgp); -- cgit v1.2.3 From dfbc20593ec89ef5ddcb0dba3b05ea95e296861e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Dec 2010 10:38:15 -0700 Subject: gallivm: do texture swizzle after shadow compare We need to swizzle after the shadow comparison so that the GL_DEPTH_MODE functionality is handled properly. This fixes all the piglit glsl-fs-shadow2d*.shader_test cases, except for glsl-fs-shadow2dproj-bias.shader_test which fails because of a bug in the GLSL compiler (fd.o 32395). --- src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c | 2 -- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c index 991f6fa5ef7..e61cf9541ea 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_aos.c @@ -1098,6 +1098,4 @@ lp_build_sample_aos(struct lp_build_sample_context *bld, texel_out[2] = unswizzled[2]; texel_out[3] = unswizzled[3]; } - - apply_sampler_swizzle(bld, texel_out); } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index cf46e2be832..e685f4b73f0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -187,8 +187,6 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld, border_chan_vec, texel_out[chan]); } } - - apply_sampler_swizzle(bld, texel_out); } @@ -1268,4 +1266,6 @@ lp_build_sample_soa(struct gallivm_state *gallivm, } lp_build_sample_compare(&bld, r, texel_out); + + apply_sampler_swizzle(&bld, texel_out); } -- cgit v1.2.3 From bb10e081c8ddc452bca44ba583f239219a5b9372 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 13 Dec 2010 08:41:08 -0700 Subject: glsl: new glsl_strtod() wrapper to fix decimal point interpretation We always want to use '.' as the decimal point. See http://bugs.freedesktop.org/show_bug.cgi?id=24531 NOTE: this is a candidate for the 7.10 branch. --- src/glsl/Makefile | 1 + src/glsl/SConscript | 1 + src/glsl/glsl_lexer.cpp | 443 +++++++++++++++++++++++----------------------- src/glsl/glsl_lexer.lpp | 11 +- src/glsl/s_expression.cpp | 2 +- src/glsl/s_expression.h | 1 + src/glsl/strtod.c | 56 ++++++ src/glsl/strtod.h | 43 +++++ 8 files changed, 329 insertions(+), 229 deletions(-) create mode 100644 src/glsl/strtod.c create mode 100644 src/glsl/strtod.h diff --git a/src/glsl/Makefile b/src/glsl/Makefile index 2674c6ec485..86a577e0aeb 100644 --- a/src/glsl/Makefile +++ b/src/glsl/Makefile @@ -16,6 +16,7 @@ GLCPP_SOURCES = \ glcpp/glcpp.c C_SOURCES = \ + strtod.c \ $(LIBGLCPP_SOURCES) CXX_SOURCES = \ diff --git a/src/glsl/SConscript b/src/glsl/SConscript index b5b1728beef..f179721d527 100644 --- a/src/glsl/SConscript +++ b/src/glsl/SConscript @@ -76,6 +76,7 @@ sources = [ 'opt_swizzle_swizzle.cpp', 'opt_tree_grafting.cpp', 's_expression.cpp', + 'strtod.c', ] glsl = env.ConvenienceLibrary( diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp index e3d0a3cfc9d..39c119001fd 100644 --- a/src/glsl/glsl_lexer.cpp +++ b/src/glsl/glsl_lexer.cpp @@ -1001,6 +1001,7 @@ static yyconst flex_int16_t yy_chk[1255] = * DEALINGS IN THE SOFTWARE. */ #include +#include "strtod.h" #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" @@ -1054,7 +1055,7 @@ static yyconst flex_int16_t yy_chk[1255] = */ #define ES yyextra->es_shader -#line 1058 "glsl_lexer.cpp" +#line 1059 "glsl_lexer.cpp" #define INITIAL 0 #define PP 1 @@ -1141,10 +1142,6 @@ int _mesa_glsl_get_lineno (yyscan_t yyscanner ); void _mesa_glsl_set_lineno (int line_number ,yyscan_t yyscanner ); -int _mesa_glsl_get_column (yyscan_t yyscanner ); - -void _mesa_glsl_set_column (int column_no ,yyscan_t yyscanner ); - YYSTYPE * _mesa_glsl_get_lval (yyscan_t yyscanner ); void _mesa_glsl_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); @@ -1292,10 +1289,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 94 "glsl_lexer.lpp" +#line 95 "glsl_lexer.lpp" -#line 1299 "glsl_lexer.cpp" +#line 1296 "glsl_lexer.cpp" yylval = yylval_param; @@ -1381,7 +1378,7 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 96 "glsl_lexer.lpp" +#line 97 "glsl_lexer.lpp" ; YY_BREAK /* Preprocessor tokens. */ @@ -1390,17 +1387,17 @@ case 2: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 99 "glsl_lexer.lpp" +#line 100 "glsl_lexer.lpp" ; YY_BREAK case 3: YY_RULE_SETUP -#line 100 "glsl_lexer.lpp" +#line 101 "glsl_lexer.lpp" { BEGIN PP; return VERSION; } YY_BREAK case 4: YY_RULE_SETUP -#line 101 "glsl_lexer.lpp" +#line 102 "glsl_lexer.lpp" { BEGIN PP; return EXTENSION; } YY_BREAK case 5: @@ -1408,7 +1405,7 @@ case 5: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 102 "glsl_lexer.lpp" +#line 103 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1430,7 +1427,7 @@ case 6: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 117 "glsl_lexer.lpp" +#line 118 "glsl_lexer.lpp" { /* Eat characters until the first digit is * encountered @@ -1448,7 +1445,7 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 131 "glsl_lexer.lpp" +#line 132 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_DEBUG_ON; @@ -1456,7 +1453,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 135 "glsl_lexer.lpp" +#line 136 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_DEBUG_OFF; @@ -1464,7 +1461,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 139 "glsl_lexer.lpp" +#line 140 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_OPTIMIZE_ON; @@ -1472,7 +1469,7 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 143 "glsl_lexer.lpp" +#line 144 "glsl_lexer.lpp" { BEGIN PP; return PRAGMA_OPTIMIZE_OFF; @@ -1480,38 +1477,38 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 147 "glsl_lexer.lpp" +#line 148 "glsl_lexer.lpp" { BEGIN PRAGMA; } YY_BREAK case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 149 "glsl_lexer.lpp" +#line 150 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; } YY_BREAK case 13: YY_RULE_SETUP -#line 150 "glsl_lexer.lpp" +#line 151 "glsl_lexer.lpp" { } YY_BREAK case 14: YY_RULE_SETUP -#line 152 "glsl_lexer.lpp" +#line 153 "glsl_lexer.lpp" { } YY_BREAK case 15: YY_RULE_SETUP -#line 153 "glsl_lexer.lpp" +#line 154 "glsl_lexer.lpp" { } YY_BREAK case 16: YY_RULE_SETUP -#line 154 "glsl_lexer.lpp" +#line 155 "glsl_lexer.lpp" return COLON; YY_BREAK case 17: YY_RULE_SETUP -#line 155 "glsl_lexer.lpp" +#line 156 "glsl_lexer.lpp" { yylval->identifier = strdup(yytext); return IDENTIFIER; @@ -1519,7 +1516,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 159 "glsl_lexer.lpp" +#line 160 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return INTCONSTANT; @@ -1528,388 +1525,388 @@ YY_RULE_SETUP case 19: /* rule 19 can match eol */ YY_RULE_SETUP -#line 163 "glsl_lexer.lpp" +#line 164 "glsl_lexer.lpp" { BEGIN 0; yylineno++; yycolumn = 0; return EOL; } YY_BREAK case 20: /* rule 20 can match eol */ YY_RULE_SETUP -#line 165 "glsl_lexer.lpp" +#line 166 "glsl_lexer.lpp" { yylineno++; yycolumn = 0; } YY_BREAK case 21: YY_RULE_SETUP -#line 167 "glsl_lexer.lpp" +#line 168 "glsl_lexer.lpp" return ATTRIBUTE; YY_BREAK case 22: YY_RULE_SETUP -#line 168 "glsl_lexer.lpp" +#line 169 "glsl_lexer.lpp" return CONST_TOK; YY_BREAK case 23: YY_RULE_SETUP -#line 169 "glsl_lexer.lpp" +#line 170 "glsl_lexer.lpp" return BOOL_TOK; YY_BREAK case 24: YY_RULE_SETUP -#line 170 "glsl_lexer.lpp" +#line 171 "glsl_lexer.lpp" return FLOAT_TOK; YY_BREAK case 25: YY_RULE_SETUP -#line 171 "glsl_lexer.lpp" +#line 172 "glsl_lexer.lpp" return INT_TOK; YY_BREAK case 26: YY_RULE_SETUP -#line 172 "glsl_lexer.lpp" +#line 173 "glsl_lexer.lpp" KEYWORD(130, 130, UINT_TOK); YY_BREAK case 27: YY_RULE_SETUP -#line 174 "glsl_lexer.lpp" +#line 175 "glsl_lexer.lpp" return BREAK; YY_BREAK case 28: YY_RULE_SETUP -#line 175 "glsl_lexer.lpp" +#line 176 "glsl_lexer.lpp" return CONTINUE; YY_BREAK case 29: YY_RULE_SETUP -#line 176 "glsl_lexer.lpp" +#line 177 "glsl_lexer.lpp" return DO; YY_BREAK case 30: YY_RULE_SETUP -#line 177 "glsl_lexer.lpp" +#line 178 "glsl_lexer.lpp" return WHILE; YY_BREAK case 31: YY_RULE_SETUP -#line 178 "glsl_lexer.lpp" +#line 179 "glsl_lexer.lpp" return ELSE; YY_BREAK case 32: YY_RULE_SETUP -#line 179 "glsl_lexer.lpp" +#line 180 "glsl_lexer.lpp" return FOR; YY_BREAK case 33: YY_RULE_SETUP -#line 180 "glsl_lexer.lpp" +#line 181 "glsl_lexer.lpp" return IF; YY_BREAK case 34: YY_RULE_SETUP -#line 181 "glsl_lexer.lpp" +#line 182 "glsl_lexer.lpp" return DISCARD; YY_BREAK case 35: YY_RULE_SETUP -#line 182 "glsl_lexer.lpp" +#line 183 "glsl_lexer.lpp" return RETURN; YY_BREAK case 36: YY_RULE_SETUP -#line 184 "glsl_lexer.lpp" +#line 185 "glsl_lexer.lpp" return BVEC2; YY_BREAK case 37: YY_RULE_SETUP -#line 185 "glsl_lexer.lpp" +#line 186 "glsl_lexer.lpp" return BVEC3; YY_BREAK case 38: YY_RULE_SETUP -#line 186 "glsl_lexer.lpp" +#line 187 "glsl_lexer.lpp" return BVEC4; YY_BREAK case 39: YY_RULE_SETUP -#line 187 "glsl_lexer.lpp" +#line 188 "glsl_lexer.lpp" return IVEC2; YY_BREAK case 40: YY_RULE_SETUP -#line 188 "glsl_lexer.lpp" +#line 189 "glsl_lexer.lpp" return IVEC3; YY_BREAK case 41: YY_RULE_SETUP -#line 189 "glsl_lexer.lpp" +#line 190 "glsl_lexer.lpp" return IVEC4; YY_BREAK case 42: YY_RULE_SETUP -#line 190 "glsl_lexer.lpp" +#line 191 "glsl_lexer.lpp" KEYWORD(130, 130, UVEC2); YY_BREAK case 43: YY_RULE_SETUP -#line 191 "glsl_lexer.lpp" +#line 192 "glsl_lexer.lpp" KEYWORD(130, 130, UVEC3); YY_BREAK case 44: YY_RULE_SETUP -#line 192 "glsl_lexer.lpp" +#line 193 "glsl_lexer.lpp" KEYWORD(130, 130, UVEC4); YY_BREAK case 45: YY_RULE_SETUP -#line 193 "glsl_lexer.lpp" +#line 194 "glsl_lexer.lpp" return VEC2; YY_BREAK case 46: YY_RULE_SETUP -#line 194 "glsl_lexer.lpp" +#line 195 "glsl_lexer.lpp" return VEC3; YY_BREAK case 47: YY_RULE_SETUP -#line 195 "glsl_lexer.lpp" +#line 196 "glsl_lexer.lpp" return VEC4; YY_BREAK case 48: YY_RULE_SETUP -#line 196 "glsl_lexer.lpp" +#line 197 "glsl_lexer.lpp" return MAT2X2; YY_BREAK case 49: YY_RULE_SETUP -#line 197 "glsl_lexer.lpp" +#line 198 "glsl_lexer.lpp" return MAT3X3; YY_BREAK case 50: YY_RULE_SETUP -#line 198 "glsl_lexer.lpp" +#line 199 "glsl_lexer.lpp" return MAT4X4; YY_BREAK case 51: YY_RULE_SETUP -#line 199 "glsl_lexer.lpp" +#line 200 "glsl_lexer.lpp" KEYWORD(120, 120, MAT2X2); YY_BREAK case 52: YY_RULE_SETUP -#line 200 "glsl_lexer.lpp" +#line 201 "glsl_lexer.lpp" KEYWORD(120, 120, MAT2X3); YY_BREAK case 53: YY_RULE_SETUP -#line 201 "glsl_lexer.lpp" +#line 202 "glsl_lexer.lpp" KEYWORD(120, 120, MAT2X4); YY_BREAK case 54: YY_RULE_SETUP -#line 202 "glsl_lexer.lpp" +#line 203 "glsl_lexer.lpp" KEYWORD(120, 120, MAT3X2); YY_BREAK case 55: YY_RULE_SETUP -#line 203 "glsl_lexer.lpp" +#line 204 "glsl_lexer.lpp" KEYWORD(120, 120, MAT3X3); YY_BREAK case 56: YY_RULE_SETUP -#line 204 "glsl_lexer.lpp" +#line 205 "glsl_lexer.lpp" KEYWORD(120, 120, MAT3X4); YY_BREAK case 57: YY_RULE_SETUP -#line 205 "glsl_lexer.lpp" +#line 206 "glsl_lexer.lpp" KEYWORD(120, 120, MAT4X2); YY_BREAK case 58: YY_RULE_SETUP -#line 206 "glsl_lexer.lpp" +#line 207 "glsl_lexer.lpp" KEYWORD(120, 120, MAT4X3); YY_BREAK case 59: YY_RULE_SETUP -#line 207 "glsl_lexer.lpp" +#line 208 "glsl_lexer.lpp" KEYWORD(120, 120, MAT4X4); YY_BREAK case 60: YY_RULE_SETUP -#line 209 "glsl_lexer.lpp" +#line 210 "glsl_lexer.lpp" return IN_TOK; YY_BREAK case 61: YY_RULE_SETUP -#line 210 "glsl_lexer.lpp" +#line 211 "glsl_lexer.lpp" return OUT_TOK; YY_BREAK case 62: YY_RULE_SETUP -#line 211 "glsl_lexer.lpp" +#line 212 "glsl_lexer.lpp" return INOUT_TOK; YY_BREAK case 63: YY_RULE_SETUP -#line 212 "glsl_lexer.lpp" +#line 213 "glsl_lexer.lpp" return UNIFORM; YY_BREAK case 64: YY_RULE_SETUP -#line 213 "glsl_lexer.lpp" +#line 214 "glsl_lexer.lpp" return VARYING; YY_BREAK case 65: YY_RULE_SETUP -#line 214 "glsl_lexer.lpp" +#line 215 "glsl_lexer.lpp" KEYWORD(120, 120, CENTROID); YY_BREAK case 66: YY_RULE_SETUP -#line 215 "glsl_lexer.lpp" +#line 216 "glsl_lexer.lpp" KEYWORD(120 || ES, 120 || ES, INVARIANT); YY_BREAK case 67: YY_RULE_SETUP -#line 216 "glsl_lexer.lpp" +#line 217 "glsl_lexer.lpp" KEYWORD(130 || ES, 130, FLAT); YY_BREAK case 68: YY_RULE_SETUP -#line 217 "glsl_lexer.lpp" +#line 218 "glsl_lexer.lpp" KEYWORD(130, 130, SMOOTH); YY_BREAK case 69: YY_RULE_SETUP -#line 218 "glsl_lexer.lpp" +#line 219 "glsl_lexer.lpp" KEYWORD(130, 130, NOPERSPECTIVE); YY_BREAK case 70: YY_RULE_SETUP -#line 220 "glsl_lexer.lpp" +#line 221 "glsl_lexer.lpp" return SAMPLER1D; YY_BREAK case 71: YY_RULE_SETUP -#line 221 "glsl_lexer.lpp" +#line 222 "glsl_lexer.lpp" return SAMPLER2D; YY_BREAK case 72: YY_RULE_SETUP -#line 222 "glsl_lexer.lpp" +#line 223 "glsl_lexer.lpp" return SAMPLER3D; YY_BREAK case 73: YY_RULE_SETUP -#line 223 "glsl_lexer.lpp" +#line 224 "glsl_lexer.lpp" return SAMPLERCUBE; YY_BREAK case 74: YY_RULE_SETUP -#line 224 "glsl_lexer.lpp" +#line 225 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER1DARRAY); YY_BREAK case 75: YY_RULE_SETUP -#line 225 "glsl_lexer.lpp" +#line 226 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER2DARRAY); YY_BREAK case 76: YY_RULE_SETUP -#line 226 "glsl_lexer.lpp" +#line 227 "glsl_lexer.lpp" return SAMPLER1DSHADOW; YY_BREAK case 77: YY_RULE_SETUP -#line 227 "glsl_lexer.lpp" +#line 228 "glsl_lexer.lpp" return SAMPLER2DSHADOW; YY_BREAK case 78: YY_RULE_SETUP -#line 228 "glsl_lexer.lpp" +#line 229 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLERCUBESHADOW); YY_BREAK case 79: YY_RULE_SETUP -#line 229 "glsl_lexer.lpp" +#line 230 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER1DARRAYSHADOW); YY_BREAK case 80: YY_RULE_SETUP -#line 230 "glsl_lexer.lpp" +#line 231 "glsl_lexer.lpp" KEYWORD(130, 130, SAMPLER2DARRAYSHADOW); YY_BREAK case 81: YY_RULE_SETUP -#line 231 "glsl_lexer.lpp" +#line 232 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER1D); YY_BREAK case 82: YY_RULE_SETUP -#line 232 "glsl_lexer.lpp" +#line 233 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER2D); YY_BREAK case 83: YY_RULE_SETUP -#line 233 "glsl_lexer.lpp" +#line 234 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER3D); YY_BREAK case 84: YY_RULE_SETUP -#line 234 "glsl_lexer.lpp" +#line 235 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLERCUBE); YY_BREAK case 85: YY_RULE_SETUP -#line 235 "glsl_lexer.lpp" +#line 236 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER1DARRAY); YY_BREAK case 86: YY_RULE_SETUP -#line 236 "glsl_lexer.lpp" +#line 237 "glsl_lexer.lpp" KEYWORD(130, 130, ISAMPLER2DARRAY); YY_BREAK case 87: YY_RULE_SETUP -#line 237 "glsl_lexer.lpp" +#line 238 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER1D); YY_BREAK case 88: YY_RULE_SETUP -#line 238 "glsl_lexer.lpp" +#line 239 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER2D); YY_BREAK case 89: YY_RULE_SETUP -#line 239 "glsl_lexer.lpp" +#line 240 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER3D); YY_BREAK case 90: YY_RULE_SETUP -#line 240 "glsl_lexer.lpp" +#line 241 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLERCUBE); YY_BREAK case 91: YY_RULE_SETUP -#line 241 "glsl_lexer.lpp" +#line 242 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER1DARRAY); YY_BREAK case 92: YY_RULE_SETUP -#line 242 "glsl_lexer.lpp" +#line 243 "glsl_lexer.lpp" KEYWORD(130, 130, USAMPLER2DARRAY); YY_BREAK case 93: YY_RULE_SETUP -#line 245 "glsl_lexer.lpp" +#line 246 "glsl_lexer.lpp" return STRUCT; YY_BREAK case 94: YY_RULE_SETUP -#line 246 "glsl_lexer.lpp" +#line 247 "glsl_lexer.lpp" return VOID_TOK; YY_BREAK case 95: YY_RULE_SETUP -#line 248 "glsl_lexer.lpp" +#line 249 "glsl_lexer.lpp" { if ((yyextra->language_version >= 140) || yyextra->ARB_explicit_attrib_location_enable @@ -1923,112 +1920,112 @@ YY_RULE_SETUP YY_BREAK case 96: YY_RULE_SETUP -#line 259 "glsl_lexer.lpp" +#line 260 "glsl_lexer.lpp" return INC_OP; YY_BREAK case 97: YY_RULE_SETUP -#line 260 "glsl_lexer.lpp" +#line 261 "glsl_lexer.lpp" return DEC_OP; YY_BREAK case 98: YY_RULE_SETUP -#line 261 "glsl_lexer.lpp" +#line 262 "glsl_lexer.lpp" return LE_OP; YY_BREAK case 99: YY_RULE_SETUP -#line 262 "glsl_lexer.lpp" +#line 263 "glsl_lexer.lpp" return GE_OP; YY_BREAK case 100: YY_RULE_SETUP -#line 263 "glsl_lexer.lpp" +#line 264 "glsl_lexer.lpp" return EQ_OP; YY_BREAK case 101: YY_RULE_SETUP -#line 264 "glsl_lexer.lpp" +#line 265 "glsl_lexer.lpp" return NE_OP; YY_BREAK case 102: YY_RULE_SETUP -#line 265 "glsl_lexer.lpp" +#line 266 "glsl_lexer.lpp" return AND_OP; YY_BREAK case 103: YY_RULE_SETUP -#line 266 "glsl_lexer.lpp" +#line 267 "glsl_lexer.lpp" return OR_OP; YY_BREAK case 104: YY_RULE_SETUP -#line 267 "glsl_lexer.lpp" +#line 268 "glsl_lexer.lpp" return XOR_OP; YY_BREAK case 105: YY_RULE_SETUP -#line 268 "glsl_lexer.lpp" +#line 269 "glsl_lexer.lpp" return LEFT_OP; YY_BREAK case 106: YY_RULE_SETUP -#line 269 "glsl_lexer.lpp" +#line 270 "glsl_lexer.lpp" return RIGHT_OP; YY_BREAK case 107: YY_RULE_SETUP -#line 271 "glsl_lexer.lpp" +#line 272 "glsl_lexer.lpp" return MUL_ASSIGN; YY_BREAK case 108: YY_RULE_SETUP -#line 272 "glsl_lexer.lpp" +#line 273 "glsl_lexer.lpp" return DIV_ASSIGN; YY_BREAK case 109: YY_RULE_SETUP -#line 273 "glsl_lexer.lpp" +#line 274 "glsl_lexer.lpp" return ADD_ASSIGN; YY_BREAK case 110: YY_RULE_SETUP -#line 274 "glsl_lexer.lpp" +#line 275 "glsl_lexer.lpp" return MOD_ASSIGN; YY_BREAK case 111: YY_RULE_SETUP -#line 275 "glsl_lexer.lpp" +#line 276 "glsl_lexer.lpp" return LEFT_ASSIGN; YY_BREAK case 112: YY_RULE_SETUP -#line 276 "glsl_lexer.lpp" +#line 277 "glsl_lexer.lpp" return RIGHT_ASSIGN; YY_BREAK case 113: YY_RULE_SETUP -#line 277 "glsl_lexer.lpp" +#line 278 "glsl_lexer.lpp" return AND_ASSIGN; YY_BREAK case 114: YY_RULE_SETUP -#line 278 "glsl_lexer.lpp" +#line 279 "glsl_lexer.lpp" return XOR_ASSIGN; YY_BREAK case 115: YY_RULE_SETUP -#line 279 "glsl_lexer.lpp" +#line 280 "glsl_lexer.lpp" return OR_ASSIGN; YY_BREAK case 116: YY_RULE_SETUP -#line 280 "glsl_lexer.lpp" +#line 281 "glsl_lexer.lpp" return SUB_ASSIGN; YY_BREAK case 117: YY_RULE_SETUP -#line 282 "glsl_lexer.lpp" +#line 283 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 10); return IS_UINT ? UINTCONSTANT : INTCONSTANT; @@ -2036,7 +2033,7 @@ YY_RULE_SETUP YY_BREAK case 118: YY_RULE_SETUP -#line 286 "glsl_lexer.lpp" +#line 287 "glsl_lexer.lpp" { yylval->n = strtol(yytext + 2, NULL, 16); return IS_UINT ? UINTCONSTANT : INTCONSTANT; @@ -2044,7 +2041,7 @@ YY_RULE_SETUP YY_BREAK case 119: YY_RULE_SETUP -#line 290 "glsl_lexer.lpp" +#line 291 "glsl_lexer.lpp" { yylval->n = strtol(yytext, NULL, 8); return IS_UINT ? UINTCONSTANT : INTCONSTANT; @@ -2052,47 +2049,47 @@ YY_RULE_SETUP YY_BREAK case 120: YY_RULE_SETUP -#line 295 "glsl_lexer.lpp" +#line 296 "glsl_lexer.lpp" { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK case 121: YY_RULE_SETUP -#line 299 "glsl_lexer.lpp" +#line 300 "glsl_lexer.lpp" { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK case 122: YY_RULE_SETUP -#line 303 "glsl_lexer.lpp" +#line 304 "glsl_lexer.lpp" { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK case 123: YY_RULE_SETUP -#line 307 "glsl_lexer.lpp" +#line 308 "glsl_lexer.lpp" { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK case 124: YY_RULE_SETUP -#line 311 "glsl_lexer.lpp" +#line 312 "glsl_lexer.lpp" { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } YY_BREAK case 125: YY_RULE_SETUP -#line 316 "glsl_lexer.lpp" +#line 317 "glsl_lexer.lpp" { yylval->n = 1; return BOOLCONSTANT; @@ -2100,7 +2097,7 @@ YY_RULE_SETUP YY_BREAK case 126: YY_RULE_SETUP -#line 320 "glsl_lexer.lpp" +#line 321 "glsl_lexer.lpp" { yylval->n = 0; return BOOLCONSTANT; @@ -2109,409 +2106,409 @@ YY_RULE_SETUP /* Reserved words in GLSL 1.10. */ case 127: YY_RULE_SETUP -#line 327 "glsl_lexer.lpp" +#line 328 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, ASM); YY_BREAK case 128: YY_RULE_SETUP -#line 328 "glsl_lexer.lpp" +#line 329 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, CLASS); YY_BREAK case 129: YY_RULE_SETUP -#line 329 "glsl_lexer.lpp" +#line 330 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, UNION); YY_BREAK case 130: YY_RULE_SETUP -#line 330 "glsl_lexer.lpp" +#line 331 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, ENUM); YY_BREAK case 131: YY_RULE_SETUP -#line 331 "glsl_lexer.lpp" +#line 332 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, TYPEDEF); YY_BREAK case 132: YY_RULE_SETUP -#line 332 "glsl_lexer.lpp" +#line 333 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, TEMPLATE); YY_BREAK case 133: YY_RULE_SETUP -#line 333 "glsl_lexer.lpp" +#line 334 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, THIS); YY_BREAK case 134: YY_RULE_SETUP -#line 334 "glsl_lexer.lpp" +#line 335 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, PACKED_TOK); YY_BREAK case 135: YY_RULE_SETUP -#line 335 "glsl_lexer.lpp" +#line 336 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, GOTO); YY_BREAK case 136: YY_RULE_SETUP -#line 336 "glsl_lexer.lpp" +#line 337 "glsl_lexer.lpp" KEYWORD(110 || ES, 130, SWITCH); YY_BREAK case 137: YY_RULE_SETUP -#line 337 "glsl_lexer.lpp" +#line 338 "glsl_lexer.lpp" KEYWORD(110 || ES, 130, DEFAULT); YY_BREAK case 138: YY_RULE_SETUP -#line 338 "glsl_lexer.lpp" +#line 339 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, INLINE_TOK); YY_BREAK case 139: YY_RULE_SETUP -#line 339 "glsl_lexer.lpp" +#line 340 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, NOINLINE); YY_BREAK case 140: YY_RULE_SETUP -#line 340 "glsl_lexer.lpp" +#line 341 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, VOLATILE); YY_BREAK case 141: YY_RULE_SETUP -#line 341 "glsl_lexer.lpp" +#line 342 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, PUBLIC_TOK); YY_BREAK case 142: YY_RULE_SETUP -#line 342 "glsl_lexer.lpp" +#line 343 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, STATIC); YY_BREAK case 143: YY_RULE_SETUP -#line 343 "glsl_lexer.lpp" +#line 344 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, EXTERN); YY_BREAK case 144: YY_RULE_SETUP -#line 344 "glsl_lexer.lpp" +#line 345 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, EXTERNAL); YY_BREAK case 145: YY_RULE_SETUP -#line 345 "glsl_lexer.lpp" +#line 346 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, INTERFACE); YY_BREAK case 146: YY_RULE_SETUP -#line 346 "glsl_lexer.lpp" +#line 347 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, LONG_TOK); YY_BREAK case 147: YY_RULE_SETUP -#line 347 "glsl_lexer.lpp" +#line 348 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, SHORT_TOK); YY_BREAK case 148: YY_RULE_SETUP -#line 348 "glsl_lexer.lpp" +#line 349 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DOUBLE_TOK); YY_BREAK case 149: YY_RULE_SETUP -#line 349 "glsl_lexer.lpp" +#line 350 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HALF); YY_BREAK case 150: YY_RULE_SETUP -#line 350 "glsl_lexer.lpp" +#line 351 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FIXED_TOK); YY_BREAK case 151: YY_RULE_SETUP -#line 351 "glsl_lexer.lpp" +#line 352 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, UNSIGNED); YY_BREAK case 152: YY_RULE_SETUP -#line 352 "glsl_lexer.lpp" +#line 353 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, INPUT_TOK); YY_BREAK case 153: YY_RULE_SETUP -#line 353 "glsl_lexer.lpp" +#line 354 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, OUTPUT); YY_BREAK case 154: YY_RULE_SETUP -#line 354 "glsl_lexer.lpp" +#line 355 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HVEC2); YY_BREAK case 155: YY_RULE_SETUP -#line 355 "glsl_lexer.lpp" +#line 356 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HVEC3); YY_BREAK case 156: YY_RULE_SETUP -#line 356 "glsl_lexer.lpp" +#line 357 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, HVEC4); YY_BREAK case 157: YY_RULE_SETUP -#line 357 "glsl_lexer.lpp" +#line 358 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DVEC2); YY_BREAK case 158: YY_RULE_SETUP -#line 358 "glsl_lexer.lpp" +#line 359 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DVEC3); YY_BREAK case 159: YY_RULE_SETUP -#line 359 "glsl_lexer.lpp" +#line 360 "glsl_lexer.lpp" KEYWORD(110 || ES, 400, DVEC4); YY_BREAK case 160: YY_RULE_SETUP -#line 360 "glsl_lexer.lpp" +#line 361 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FVEC2); YY_BREAK case 161: YY_RULE_SETUP -#line 361 "glsl_lexer.lpp" +#line 362 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FVEC3); YY_BREAK case 162: YY_RULE_SETUP -#line 362 "glsl_lexer.lpp" +#line 363 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, FVEC4); YY_BREAK case 163: YY_RULE_SETUP -#line 363 "glsl_lexer.lpp" +#line 364 "glsl_lexer.lpp" return SAMPLER2DRECT; YY_BREAK case 164: YY_RULE_SETUP -#line 364 "glsl_lexer.lpp" +#line 365 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, SAMPLER3DRECT); YY_BREAK case 165: YY_RULE_SETUP -#line 365 "glsl_lexer.lpp" +#line 366 "glsl_lexer.lpp" return SAMPLER2DRECTSHADOW; YY_BREAK case 166: YY_RULE_SETUP -#line 366 "glsl_lexer.lpp" +#line 367 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, SIZEOF); YY_BREAK case 167: YY_RULE_SETUP -#line 367 "glsl_lexer.lpp" +#line 368 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, CAST); YY_BREAK case 168: YY_RULE_SETUP -#line 368 "glsl_lexer.lpp" +#line 369 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, NAMESPACE); YY_BREAK case 169: YY_RULE_SETUP -#line 369 "glsl_lexer.lpp" +#line 370 "glsl_lexer.lpp" KEYWORD(110 || ES, 999, USING); YY_BREAK /* Additional reserved words in GLSL 1.20. */ case 170: YY_RULE_SETUP -#line 372 "glsl_lexer.lpp" +#line 373 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, LOWP); YY_BREAK case 171: YY_RULE_SETUP -#line 373 "glsl_lexer.lpp" +#line 374 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, MEDIUMP); YY_BREAK case 172: YY_RULE_SETUP -#line 374 "glsl_lexer.lpp" +#line 375 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, HIGHP); YY_BREAK case 173: YY_RULE_SETUP -#line 375 "glsl_lexer.lpp" +#line 376 "glsl_lexer.lpp" KEYWORD(120, 130 || ES, PRECISION); YY_BREAK /* Additional reserved words in GLSL 1.30. */ case 174: YY_RULE_SETUP -#line 378 "glsl_lexer.lpp" +#line 379 "glsl_lexer.lpp" KEYWORD(130, 130, CASE); YY_BREAK case 175: YY_RULE_SETUP -#line 379 "glsl_lexer.lpp" +#line 380 "glsl_lexer.lpp" KEYWORD(130, 999, COMMON); YY_BREAK case 176: YY_RULE_SETUP -#line 380 "glsl_lexer.lpp" +#line 381 "glsl_lexer.lpp" KEYWORD(130, 999, PARTITION); YY_BREAK case 177: YY_RULE_SETUP -#line 381 "glsl_lexer.lpp" +#line 382 "glsl_lexer.lpp" KEYWORD(130, 999, ACTIVE); YY_BREAK case 178: YY_RULE_SETUP -#line 382 "glsl_lexer.lpp" +#line 383 "glsl_lexer.lpp" KEYWORD(130 || ES, 999, SUPERP); YY_BREAK case 179: YY_RULE_SETUP -#line 383 "glsl_lexer.lpp" +#line 384 "glsl_lexer.lpp" KEYWORD(130, 140, SAMPLERBUFFER); YY_BREAK case 180: YY_RULE_SETUP -#line 384 "glsl_lexer.lpp" +#line 385 "glsl_lexer.lpp" KEYWORD(130, 999, FILTER); YY_BREAK case 181: YY_RULE_SETUP -#line 385 "glsl_lexer.lpp" +#line 386 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1D); YY_BREAK case 182: YY_RULE_SETUP -#line 386 "glsl_lexer.lpp" +#line 387 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2D); YY_BREAK case 183: YY_RULE_SETUP -#line 387 "glsl_lexer.lpp" +#line 388 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE3D); YY_BREAK case 184: YY_RULE_SETUP -#line 388 "glsl_lexer.lpp" +#line 389 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGECUBE); YY_BREAK case 185: YY_RULE_SETUP -#line 389 "glsl_lexer.lpp" +#line 390 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE1D); YY_BREAK case 186: YY_RULE_SETUP -#line 390 "glsl_lexer.lpp" +#line 391 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE2D); YY_BREAK case 187: YY_RULE_SETUP -#line 391 "glsl_lexer.lpp" +#line 392 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE3D); YY_BREAK case 188: YY_RULE_SETUP -#line 392 "glsl_lexer.lpp" +#line 393 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGECUBE); YY_BREAK case 189: YY_RULE_SETUP -#line 393 "glsl_lexer.lpp" +#line 394 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE1D); YY_BREAK case 190: YY_RULE_SETUP -#line 394 "glsl_lexer.lpp" +#line 395 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE2D); YY_BREAK case 191: YY_RULE_SETUP -#line 395 "glsl_lexer.lpp" +#line 396 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE3D); YY_BREAK case 192: YY_RULE_SETUP -#line 396 "glsl_lexer.lpp" +#line 397 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGECUBE); YY_BREAK case 193: YY_RULE_SETUP -#line 397 "glsl_lexer.lpp" +#line 398 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1DARRAY); YY_BREAK case 194: YY_RULE_SETUP -#line 398 "glsl_lexer.lpp" +#line 399 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2DARRAY); YY_BREAK case 195: YY_RULE_SETUP -#line 399 "glsl_lexer.lpp" +#line 400 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE1DARRAY); YY_BREAK case 196: YY_RULE_SETUP -#line 400 "glsl_lexer.lpp" +#line 401 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGE2DARRAY); YY_BREAK case 197: YY_RULE_SETUP -#line 401 "glsl_lexer.lpp" +#line 402 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE1DARRAY); YY_BREAK case 198: YY_RULE_SETUP -#line 402 "glsl_lexer.lpp" +#line 403 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGE2DARRAY); YY_BREAK case 199: YY_RULE_SETUP -#line 403 "glsl_lexer.lpp" +#line 404 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1DSHADOW); YY_BREAK case 200: YY_RULE_SETUP -#line 404 "glsl_lexer.lpp" +#line 405 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2DSHADOW); YY_BREAK case 201: YY_RULE_SETUP -#line 405 "glsl_lexer.lpp" +#line 406 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE1DARRAYSHADOW); YY_BREAK case 202: YY_RULE_SETUP -#line 406 "glsl_lexer.lpp" +#line 407 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGE2DARRAYSHADOW); YY_BREAK case 203: YY_RULE_SETUP -#line 407 "glsl_lexer.lpp" +#line 408 "glsl_lexer.lpp" KEYWORD(130, 999, IMAGEBUFFER); YY_BREAK case 204: YY_RULE_SETUP -#line 408 "glsl_lexer.lpp" +#line 409 "glsl_lexer.lpp" KEYWORD(130, 999, IIMAGEBUFFER); YY_BREAK case 205: YY_RULE_SETUP -#line 409 "glsl_lexer.lpp" +#line 410 "glsl_lexer.lpp" KEYWORD(130, 999, UIMAGEBUFFER); YY_BREAK case 206: YY_RULE_SETUP -#line 410 "glsl_lexer.lpp" +#line 411 "glsl_lexer.lpp" KEYWORD(130, 999, ROW_MAJOR); YY_BREAK case 207: YY_RULE_SETUP -#line 412 "glsl_lexer.lpp" +#line 413 "glsl_lexer.lpp" { struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; @@ -2521,15 +2518,15 @@ YY_RULE_SETUP YY_BREAK case 208: YY_RULE_SETUP -#line 419 "glsl_lexer.lpp" +#line 420 "glsl_lexer.lpp" { return yytext[0]; } YY_BREAK case 209: YY_RULE_SETUP -#line 421 "glsl_lexer.lpp" +#line 422 "glsl_lexer.lpp" ECHO; YY_BREAK -#line 2533 "glsl_lexer.cpp" +#line 2530 "glsl_lexer.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PP): case YY_STATE_EOF(PRAGMA): @@ -3672,7 +3669,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 421 "glsl_lexer.lpp" +#line 422 "glsl_lexer.lpp" diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp index 7a3f1a67e66..15742ac3636 100644 --- a/src/glsl/glsl_lexer.lpp +++ b/src/glsl/glsl_lexer.lpp @@ -22,6 +22,7 @@ * DEALINGS IN THE SOFTWARE. */ #include +#include "strtod.h" #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" @@ -293,23 +294,23 @@ layout { } [0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } \.[0-9]+([eE][+-]?[0-9]+)?[fF]? { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } [0-9]+\.([eE][+-]?[0-9]+)?[fF]? { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } [0-9]+[eE][+-]?[0-9]+[fF]? { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } [0-9]+[fF] { - yylval->real = strtod(yytext, NULL); + yylval->real = glsl_strtod(yytext, NULL); return FLOATCONSTANT; } diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp index 4c8829fea9a..e420cd6e7ec 100644 --- a/src/glsl/s_expression.cpp +++ b/src/glsl/s_expression.cpp @@ -62,7 +62,7 @@ read_atom(void *ctx, const char *& src) // Check if the atom is a number. char *float_end = NULL; - double f = strtod(src, &float_end); + double f = glsl_strtod(src, &float_end); if (float_end != src) { char *int_end = NULL; int i = strtol(src, &int_end, 10); diff --git a/src/glsl/s_expression.h b/src/glsl/s_expression.h index aa22475a1bf..29d800e394a 100644 --- a/src/glsl/s_expression.h +++ b/src/glsl/s_expression.h @@ -26,6 +26,7 @@ #ifndef S_EXPRESSION_H #define S_EXPRESSION_H +#include "strtod.h" #include "list.h" #define SX_AS_(t,x) ((x) && ((s_expression*) x)->is_##t()) ? ((s_##t*) (x)) \ diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c new file mode 100644 index 00000000000..ff34591488c --- /dev/null +++ b/src/glsl/strtod.c @@ -0,0 +1,56 @@ +/* + * Copyright 2010 VMware, Inc. + * 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, sub license, 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 (including the + * next paragraph) 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. + */ + + +#include + +#ifdef _GNU_SOURCE +#include +#ifdef __APPLE__ +#include +#endif +#endif + +#include "strtod.h" + + + +/** + * Wrapper around strtod which uses the "C" locale so the decimal + * point is always '.' + */ +double +glsl_strtod(const char *s, char **end) +{ +#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); + } + return strtod_l(s, end, loc); +#else + return strtod(s, end); +#endif +} diff --git a/src/glsl/strtod.h b/src/glsl/strtod.h new file mode 100644 index 00000000000..0cf6409d425 --- /dev/null +++ b/src/glsl/strtod.h @@ -0,0 +1,43 @@ +/* + * Copyright 2010 VMware, Inc. + * 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, sub license, 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 (including the + * next paragraph) 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 NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. + */ + + +#ifndef STRTOD_H +#define STRTOD_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern double +glsl_strtod(const char *s, char **end); + + +#ifdef __cplusplus +} +#endif + + +#endif -- cgit v1.2.3 From 2a77c3cc0b5ea126e9e15d9a928f3dc944e3668f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Dec 2010 12:45:36 -0700 Subject: tgsi: document texture opcodes --- src/gallium/docs/source/tgsi.rst | 64 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index d99ed7c6d6b..7eb6bd05d7b 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -577,17 +577,45 @@ This instruction replicates its result. .. opcode:: TEX - Texture Lookup - TBD +.. math:: + + coord = src0 + + bias = 0.0 + + dst = texture_sample(unit, coord, bias) .. opcode:: TXD - Texture Lookup with Derivatives - TBD +.. math:: + + coord = src0 + + ddx = src1 + + ddy = src2 + + bias = 0.0 + + dst = texture_sample_deriv(unit, coord, bias, ddx, ddy) .. opcode:: TXP - Projective Texture Lookup - TBD +.. math:: + + coord.x = src0.x / src.w + + coord.y = src0.y / src.w + + coord.z = src0.z / src.w + + coord.w = src0.w + + bias = 0.0 + + dst = texture_sample(unit, coord, bias) .. opcode:: UP2H - Unpack Two 16-Bit Floats @@ -729,7 +757,19 @@ This instruction replicates its result. .. opcode:: TXB - Texture Lookup With Bias - TBD +.. math:: + + coord.x = src.x + + coord.y = src.y + + coord.z = src.z + + coord.w = 1.0 + + bias = src.z + + dst = texture_sample(unit, coord, bias) .. opcode:: NRM - 3-component Vector Normalise @@ -767,9 +807,21 @@ This instruction replicates its result. dst = src0.x \times src1.x + src0.y \times src1.y -.. opcode:: TXL - Texture Lookup With LOD +.. opcode:: TXL - Texture Lookup With explicit LOD - TBD +.. math:: + + coord.x = src0.x + + coord.y = src0.y + + coord.z = src0.z + + coord.w = 1.0 + + lod = src0.w + + dst = texture_sample(unit, coord, lod) .. opcode:: BRK - Break -- cgit v1.2.3 From be2aa81f5f8f44be8c9c8854098d29635352c4f8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Dec 2010 12:46:01 -0700 Subject: mesa: more program debug code --- src/mesa/program/prog_execute.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index 1d97a077f52..dd15e9a1ccd 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -1670,6 +1670,18 @@ _mesa_execute_program(struct gl_context * ctx, fetch_texel(ctx, machine, inst, texcoord, lodBias, color); + if (DEBUG_PROG) { + printf("TXB (%g, %g, %g, %g) = texture[%d][%g %g %g %g]" + " bias %g\n", + color[0], color[1], color[2], color[3], + inst->TexSrcUnit, + texcoord[0], + texcoord[1], + texcoord[2], + texcoord[3], + lodBias); + } + store_vector4(inst, machine, color); } break; -- cgit v1.2.3 From c62bb90d6a864468fe1a717aebb9c1a9c43bf3c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Dec 2010 13:01:00 -0700 Subject: softpipe: do texture swizzle during texture sampling Instead of when we read texture tiles. Now swizzling happens after the shadow depth compare step. This fixes the piglit glsl-fs-shadow2d* tests (except for proj+bias because of a GLSL bug). --- src/gallium/drivers/softpipe/sp_state_sampler.c | 8 ++ src/gallium/drivers/softpipe/sp_tex_sample.c | 94 +++++++++++++++++++++++- src/gallium/drivers/softpipe/sp_tex_sample.h | 7 +- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 20 ++--- 4 files changed, 114 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index b59fbc33ed6..8972d62cc7e 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -289,6 +289,7 @@ softpipe_set_geometry_sampler_views(struct pipe_context *pipe, static struct sp_sampler_varient * get_sampler_varient( unsigned unit, struct sp_sampler *sampler, + struct pipe_sampler_view *view, struct pipe_resource *resource, unsigned processor ) { @@ -303,6 +304,10 @@ get_sampler_varient( unsigned unit, key.bits.is_pot = sp_texture->pot; key.bits.processor = processor; key.bits.unit = unit; + key.bits.swizzle_r = view->swizzle_r; + key.bits.swizzle_g = view->swizzle_g; + key.bits.swizzle_b = view->swizzle_b; + key.bits.swizzle_a = view->swizzle_a; key.bits.pad = 0; if (sampler->current && @@ -347,6 +352,7 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) softpipe->tgsi.vert_samplers_list[i] = get_sampler_varient( i, sp_sampler(softpipe->vertex_samplers[i]), + softpipe->vertex_sampler_views[i], texture, TGSI_PROCESSOR_VERTEX ); @@ -369,6 +375,7 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) get_sampler_varient( i, sp_sampler(softpipe->geometry_samplers[i]), + softpipe->geometry_sampler_views[i], texture, TGSI_PROCESSOR_GEOMETRY ); @@ -391,6 +398,7 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) softpipe->tgsi.frag_samplers_list[i] = get_sampler_varient( i, sp_sampler(softpipe->sampler[i]), + softpipe->sampler_views[i], texture, TGSI_PROCESSOR_FRAGMENT ); diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 2eac4c7a82b..acd94f32605 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1731,6 +1731,86 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, } +static void +sample_swizzle(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + const float c0[QUAD_SIZE], + enum tgsi_sampler_control control, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + float rgba_temp[NUM_CHANNELS][QUAD_SIZE]; + const unsigned swizzle_r = samp->key.bits.swizzle_r; + const unsigned swizzle_g = samp->key.bits.swizzle_g; + const unsigned swizzle_b = samp->key.bits.swizzle_b; + const unsigned swizzle_a = samp->key.bits.swizzle_a; + unsigned j; + + samp->sample_target(tgsi_sampler, s, t, p, c0, control, rgba_temp); + + switch (swizzle_r) { + case PIPE_SWIZZLE_ZERO: + for (j = 0; j < 4; j++) + rgba[0][j] = 0.0f; + break; + case PIPE_SWIZZLE_ONE: + for (j = 0; j < 4; j++) + rgba[0][j] = 1.0f; + break; + default: + assert(swizzle_r < 4); + for (j = 0; j < 4; j++) + rgba[0][j] = rgba_temp[swizzle_r][j]; + } + + switch (swizzle_g) { + case PIPE_SWIZZLE_ZERO: + for (j = 0; j < 4; j++) + rgba[1][j] = 0.0f; + break; + case PIPE_SWIZZLE_ONE: + for (j = 0; j < 4; j++) + rgba[1][j] = 1.0f; + break; + default: + assert(swizzle_g < 4); + for (j = 0; j < 4; j++) + rgba[1][j] = rgba_temp[swizzle_g][j]; + } + + switch (swizzle_b) { + case PIPE_SWIZZLE_ZERO: + for (j = 0; j < 4; j++) + rgba[2][j] = 0.0f; + break; + case PIPE_SWIZZLE_ONE: + for (j = 0; j < 4; j++) + rgba[2][j] = 1.0f; + break; + default: + assert(swizzle_b < 4); + for (j = 0; j < 4; j++) + rgba[2][j] = rgba_temp[swizzle_b][j]; + } + + switch (swizzle_a) { + case PIPE_SWIZZLE_ZERO: + for (j = 0; j < 4; j++) + rgba[3][j] = 0.0f; + break; + case PIPE_SWIZZLE_ONE: + for (j = 0; j < 4; j++) + rgba[3][j] = 1.0f; + break; + default: + assert(swizzle_a < 4); + for (j = 0; j < 4; j++) + rgba[3][j] = rgba_temp[swizzle_a][j]; + } +} + static wrap_nearest_func get_nearest_unorm_wrap(unsigned mode) @@ -2015,7 +2095,7 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler, } if (key.bits.target == PIPE_TEXTURE_CUBE) { - samp->base.get_samples = sample_cube; + samp->sample_target = sample_cube; } else { samp->faces[0] = 0; @@ -2026,7 +2106,17 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler, /* Skip cube face determination by promoting the compare * function pointer: */ - samp->base.get_samples = samp->compare; + samp->sample_target = samp->compare; + } + + if (key.bits.swizzle_r != PIPE_SWIZZLE_RED || + key.bits.swizzle_g != PIPE_SWIZZLE_GREEN || + key.bits.swizzle_b != PIPE_SWIZZLE_BLUE || + key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA) { + samp->base.get_samples = sample_swizzle; + } + else { + samp->base.get_samples = samp->sample_target; } return samp; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 6114acf7371..0f471a98270 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -64,7 +64,11 @@ union sp_sampler_key { unsigned is_pot:1; unsigned processor:2; unsigned unit:4; - unsigned pad:22; + unsigned swizzle_r:3; + unsigned swizzle_g:3; + unsigned swizzle_b:3; + unsigned swizzle_a:3; + unsigned pad:10; } bits; unsigned value; }; @@ -113,6 +117,7 @@ struct sp_sampler_varient filter_func mip_filter; filter_func compare; + filter_func sample_target; /* Linked list: */ diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index 1393164150e..e5708a1c88a 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -279,18 +279,14 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, } /* get tile from the transfer (view into texture) */ - pipe_get_tile_swizzle(tc->pipe, - tc->tex_trans, - addr.bits.x * TILE_SIZE, - addr.bits.y * TILE_SIZE, - TILE_SIZE, - TILE_SIZE, - tc->swizzle_r, - tc->swizzle_g, - tc->swizzle_b, - tc->swizzle_a, - tc->format, - (float *) tile->data.color); + pipe_get_tile_rgba(tc->pipe, + tc->tex_trans, + addr.bits.x * TILE_SIZE, + addr.bits.y * TILE_SIZE, + TILE_SIZE, + TILE_SIZE, + (float *) tile->data.color); + tile->addr = addr; } -- cgit v1.2.3 From a8ca30bc58b73203a83799149ca9d21bcdce74b5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 14 Dec 2010 14:15:20 -0700 Subject: st/mesa: fix incorrect prev pointer in destroy_program_variants() --- src/mesa/state_tracker/st_program.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 54f1551ebc4..bbd3cdbfacb 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1008,18 +1008,18 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *stvp = (struct st_vertex_program *) program; - struct st_vp_varient *vpv, **prev = &stvp->varients; + struct st_vp_varient *vpv, **prevPtr = &stvp->varients; for (vpv = stvp->varients; vpv; ) { struct st_vp_varient *next = vpv->next; if (vpv->key.st == st) { /* unlink from list */ - *prev = next; + *prevPtr = next; /* destroy this variant */ delete_vp_varient(st, vpv); } else { - prev = &vpv; + prevPtr = &vpv->next; } vpv = next; } @@ -1029,18 +1029,18 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) { struct st_fragment_program *stfp = (struct st_fragment_program *) program; - struct st_fp_varient *fpv, **prev = &stfp->varients; + struct st_fp_varient *fpv, **prevPtr = &stfp->varients; for (fpv = stfp->varients; fpv; ) { struct st_fp_varient *next = fpv->next; if (fpv->key.st == st) { /* unlink from list */ - *prev = next; + *prevPtr = next; /* destroy this variant */ delete_fp_varient(st, fpv); } else { - prev = &fpv; + prevPtr = &fpv->next; } fpv = next; } @@ -1050,18 +1050,18 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) { struct st_geometry_program *stgp = (struct st_geometry_program *) program; - struct st_gp_varient *gpv, **prev = &stgp->varients; + struct st_gp_varient *gpv, **prevPtr = &stgp->varients; for (gpv = stgp->varients; gpv; ) { struct st_gp_varient *next = gpv->next; if (gpv->key.st == st) { /* unlink from list */ - *prev = next; + *prevPtr = next; /* destroy this variant */ delete_gp_varient(st, gpv); } else { - prev = &gpv; + prevPtr = &gpv->next; } gpv = next; } -- cgit v1.2.3 From 3861a1001c5ad0dd0de3b0befabf3ed69da9dc5e Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 15 Dec 2010 12:07:09 -0500 Subject: r600g: need to reference upload buffer as the might still live accross flush Can't get away from referencing upload buffer as after flush a vertex buffer using the upload buffer might still be active. Likely need to simplify the pipe_refence a bit so we don't waste so much cpu time in it. candidates for 7.10 branch Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_buffer.c | 2 +- src/gallium/drivers/r600/r600_upload.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 7d29f760a5d..a17c54d6eeb 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -103,7 +103,7 @@ static void r600_buffer_destroy(struct pipe_screen *screen, { struct r600_resource_buffer *rbuffer = r600_buffer(buf); - if (!rbuffer->uploaded && rbuffer->r.bo) { + if (rbuffer->r.bo) { r600_bo_reference((struct radeon*)screen->winsys, &rbuffer->r.bo, NULL); } rbuffer->r.bo = NULL; diff --git a/src/gallium/drivers/r600/r600_upload.c b/src/gallium/drivers/r600/r600_upload.c index ac72854ab16..44102ff55b6 100644 --- a/src/gallium/drivers/r600/r600_upload.c +++ b/src/gallium/drivers/r600/r600_upload.c @@ -69,6 +69,7 @@ void r600_upload_flush(struct r600_upload *upload) upload->default_size = MAX2(upload->total_alloc_size, upload->default_size); upload->total_alloc_size = 0; upload->size = 0; + upload->offset = 0; upload->ptr = NULL; upload->buffer = NULL; } @@ -105,7 +106,8 @@ int r600_upload_buffer(struct r600_upload *upload, unsigned offset, memcpy(upload->ptr + upload->offset, (uint8_t *) in_ptr + offset, size); *out_offset = upload->offset; *out_size = upload->size; - *out_buffer = upload->buffer; + *out_buffer = NULL; + r600_bo_reference(upload->rctx->radeon, out_buffer, upload->buffer); upload->offset += alloc_size; return 0; -- cgit v1.2.3 From 66f55de31e15f97ad1d16c573756738218c02109 Mon Sep 17 00:00:00 2001 From: Fredrik Höglund Date: Wed, 15 Dec 2010 20:00:42 +0100 Subject: r600g: fix pow(0, 0) evaluating to NaN We have to use the non-IEEE compliant version of MUL here, since log2(0) is -inf, and 0 * -inf is NaN in IEEE arithmetic. candidates for 7.10 branch --- src/gallium/drivers/r600/r600_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d6455023a3a..9c7b7f0a578 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1451,7 +1451,7 @@ static int tgsi_pow(struct r600_shader_ctx *ctx) return r; /* b * LOG2(a) */ memset(&alu, 0, sizeof(struct r600_bc_alu)); - alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE); + alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL); r = tgsi_src(ctx, &inst->Src[1], &alu.src[0]); if (r) return r; -- cgit v1.2.3 From dbb679e51d7e91e98d1d48d0c93be69bfabbba23 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 15 Dec 2010 15:27:16 -0500 Subject: gallium: properly check for src->dst blit compatibilities Spotted by Christoph Bumiller & Jose Fonseca Signed-off-by: Jerome Glisse --- src/gallium/auxiliary/util/u_blitter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 4c986e3565c..545021d2642 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -738,8 +738,8 @@ void util_blitter_copy_region(struct blitter_context *blitter, assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + height, dstx, dstx + width, dsty, dsty + height)); } else { - assert(util_is_format_compatible(util_format_description(dst->format), - util_format_description(src->format))); + assert(util_is_format_compatible(util_format_description(src->format), + util_format_description(dst->format))); } assert(src->target < PIPE_MAX_TEXTURE_TYPES); /* XXX should handle 3d regions */ -- cgit v1.2.3 From 57dcd800cad857ce03fd0714924f9aaa5373eec7 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 16 Dec 2010 11:12:52 +1000 Subject: nvfx: fix fragprog word swapping on big-endian machines Signed-off-by: Ben Skeggs --- src/gallium/drivers/nvfx/nvfx_fragprog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c index 13e8beed479..1740d72a8ae 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragprog.c +++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c @@ -1189,12 +1189,12 @@ out_err: static inline void nvfx_fp_memcpy(void* dst, const void* src, size_t len) { -#ifndef WORDS_BIGENDIAN +#ifndef PIPE_ARCH_BIG_ENDIAN memcpy(dst, src, len); #else size_t i; for(i = 0; i < len; i += 4) { - uint32_t v = (uint32_t*)((char*)src + i); + uint32_t v = *(uint32_t*)((char*)src + i); *(uint32_t*)((char*)dst + i) = (v >> 16) | (v << 16); } #endif -- cgit v1.2.3 From 2bd11ea11921bcd180b354342a8786c5b7ddd6b3 Mon Sep 17 00:00:00 2001 From: Shuang He Date: Wed, 15 Dec 2010 11:16:49 +0800 Subject: i915: Fix INTEL_DEBUG=wm segmentation fault The program should be disassembled after it's uploaded --- src/mesa/drivers/dri/i915/i915_fragprog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 7a9fb7f088b..1c6e9845172 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1162,11 +1162,6 @@ translate_program(struct i915_fragment_program *p) fixup_depth_write(p); i915_fini_program(p); - if (INTEL_DEBUG & DEBUG_WM) { - printf("i915:\n"); - i915_disassemble_program(i915->state.Program, i915->state.ProgramSize); - } - p->translated = 1; } @@ -1427,6 +1422,11 @@ i915ValidateFragmentProgram(struct i915_context *i915) if (!p->on_hardware) i915_upload_program(i915, p); + + if (INTEL_DEBUG & DEBUG_WM) { + printf("i915:\n"); + i915_disassemble_program(i915->state.Program, i915->state.ProgramSize); + } } void -- cgit v1.2.3 From c52adfc2e1d130effea940e75690897eb5d3ceaa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 15 Dec 2010 15:15:02 -0800 Subject: i965: Set the alternative floating point mode on gen6 VS and WM. This matches how we did the math instructions pre-gen6, though it applies to non-math as well. Fixes vp1-LIT test 2 (degenerate case: 0 ^ 0 -> 1) --- src/mesa/drivers/dri/i965/brw_defines.h | 4 ++++ src/mesa/drivers/dri/i965/gen6_vs_state.c | 1 + src/mesa/drivers/dri/i965/gen6_wm_state.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 7f3e4986808..b48a30d6be9 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -906,6 +906,8 @@ # define GEN6_VS_VECTOR_MASK_ENABLE (1 << 30) # define GEN6_VS_SAMPLER_COUNT_SHIFT 27 # define GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 +# define GEN6_VS_FLOATING_POINT_MODE_IEEE_754 (0 << 16) +# define GEN6_VS_FLOATING_POINT_MODE_ALT (1 << 16) /* DW4 */ # define GEN6_VS_DISPATCH_START_GRF_SHIFT 20 # define GEN6_VS_URB_READ_LENGTH_SHIFT 11 @@ -1048,6 +1050,8 @@ # define GEN6_WM_VECTOR_MASK_ENABLE (1 << 30) # define GEN6_WM_SAMPLER_COUNT_SHIFT 27 # define GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 +# define GEN6_WM_FLOATING_POINT_MODE_IEEE_754 (0 << 16) +# define GEN6_WM_FLOATING_POINT_MODE_ALT (1 << 16) /* DW3: scratch space */ /* DW4 */ # define GEN6_WM_STATISTICS_ENABLE (1 << 31) diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index 4ef9e2e6072..ed132bdbd93 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -130,6 +130,7 @@ upload_vs_state(struct brw_context *brw) OUT_BATCH(CMD_3D_VS_STATE << 16 | (6 - 2)); OUT_RELOC(brw->vs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0); OUT_BATCH((0 << GEN6_VS_SAMPLER_COUNT_SHIFT) | + GEN6_VS_FLOATING_POINT_MODE_ALT | (brw->vs.nr_surfaces << GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT)); OUT_BATCH(0); /* scratch space base offset */ OUT_BATCH((1 << GEN6_VS_DISPATCH_START_GRF_SHIFT) | diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index d80df4e254b..2ae0c093ebe 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -133,6 +133,9 @@ upload_wm_state(struct brw_context *brw) dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0; dw5 |= GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5; + /* OpenGL non-ieee floating point mode */ + dw2 |= GEN6_WM_FLOATING_POINT_MODE_ALT; + /* BRW_NEW_NR_WM_SURFACES */ dw2 |= brw->wm.nr_surfaces << GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT; -- cgit v1.2.3 From aa5ba96d294698809186cc4b59034abbd3076812 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 08:43:21 -0700 Subject: st/mesa: s/varient/variant --- src/mesa/state_tracker/st_atom_shader.c | 18 ++-- src/mesa/state_tracker/st_cb_bitmap.c | 6 +- src/mesa/state_tracker/st_cb_drawpixels.c | 32 +++--- src/mesa/state_tracker/st_cb_program.c | 14 +-- src/mesa/state_tracker/st_context.h | 6 +- src/mesa/state_tracker/st_debug.c | 4 +- src/mesa/state_tracker/st_draw.c | 12 +-- src/mesa/state_tracker/st_draw_feedback.c | 8 +- src/mesa/state_tracker/st_program.c | 174 +++++++++++++++--------------- src/mesa/state_tracker/st_program.h | 62 +++++------ 10 files changed, 168 insertions(+), 168 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index f416293a7e4..c311d043931 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -74,7 +74,7 @@ static void update_fp( struct st_context *st ) { struct st_fragment_program *stfp; - struct st_fp_varient_key key; + struct st_fp_variant_key key; assert(st->ctx->FragmentProgram._Current); stfp = st_fragment_program(st->ctx->FragmentProgram._Current); @@ -83,7 +83,7 @@ update_fp( struct st_context *st ) memset(&key, 0, sizeof(key)); key.st = st; - st->fp_varient = st_get_fp_varient(st, stfp, &key); + st->fp_variant = st_get_fp_variant(st, stfp, &key); st_reference_fragprog(st, &st->fp, stfp); @@ -94,7 +94,7 @@ update_fp( struct st_context *st ) } else { cso_set_fragment_shader_handle(st->cso_context, - st->fp_varient->driver_shader); + st->fp_variant->driver_shader); } } @@ -118,7 +118,7 @@ static void update_vp( struct st_context *st ) { struct st_vertex_program *stvp; - struct st_vp_varient_key key; + struct st_vp_variant_key key; /* find active shader and params -- Should be covered by * ST_NEW_VERTEX_PROGRAM @@ -141,12 +141,12 @@ update_vp( struct st_context *st ) st->ctx->Polygon.FrontMode != GL_FILL || st->ctx->Polygon.BackMode != GL_FILL)); - st->vp_varient = st_get_vp_varient(st, stvp, &key); + st->vp_variant = st_get_vp_variant(st, stvp, &key); st_reference_vertprog(st, &st->vp, stvp); cso_set_vertex_shader_handle(st->cso_context, - st->vp_varient->driver_shader); + st->vp_variant->driver_shader); st->vertex_result_to_slot = stvp->result_to_output; } @@ -167,7 +167,7 @@ static void update_gp( struct st_context *st ) { struct st_geometry_program *stgp; - struct st_gp_varient_key key; + struct st_gp_variant_key key; if (!st->ctx->GeometryProgram._Current) { cso_set_geometry_shader_handle(st->cso_context, NULL); @@ -180,12 +180,12 @@ update_gp( struct st_context *st ) memset(&key, 0, sizeof(key)); key.st = st; - st->gp_varient = st_get_gp_varient(st, stgp, &key); + st->gp_variant = st_get_gp_variant(st, stgp, &key); st_reference_geomprog(st, &st->gp, stgp); cso_set_geometry_shader_handle(st->cso_context, - st->gp_varient->driver_shader); + st->gp_variant->driver_shader); } const struct st_tracked_state st_update_gp = { diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index d1d7e8f3710..516346c8c7a 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -412,8 +412,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; - struct st_fp_varient *fpv; - struct st_fp_varient_key key; + struct st_fp_variant *fpv; + struct st_fp_variant_key key; GLuint maxSize; GLuint offset; @@ -421,7 +421,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, key.st = st; key.bitmap = GL_TRUE; - fpv = st_get_fp_varient(st, st->fp, &key); + fpv = st_get_fp_variant(st, st->fp, &key); /* As an optimization, Mesa's fragment programs will sometimes get the * primary color from a statevar/constant rather than a varying variable. diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 323e7e357ec..1fc47688e4a 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -846,12 +846,12 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, * Get fragment program variant for a glDrawPixels or glCopyPixels * command for RGBA data. */ -static struct st_fp_varient * -get_color_fp_varient(struct st_context *st) +static struct st_fp_variant * +get_color_fp_variant(struct st_context *st) { struct gl_context *ctx = st->ctx; - struct st_fp_varient_key key; - struct st_fp_varient *fpv; + struct st_fp_variant_key key; + struct st_fp_variant *fpv; memset(&key, 0, sizeof(key)); @@ -867,7 +867,7 @@ get_color_fp_varient(struct st_context *st) ctx->Pixel.AlphaScale != 1.0); key.pixelMaps = ctx->Pixel.MapColorFlag; - fpv = st_get_fp_varient(st, st->fp, &key); + fpv = st_get_fp_variant(st, st->fp, &key); return fpv; } @@ -877,12 +877,12 @@ get_color_fp_varient(struct st_context *st) * Get fragment program variant for a glDrawPixels or glCopyPixels * command for depth/stencil data. */ -static struct st_fp_varient * -get_depth_stencil_fp_varient(struct st_context *st, GLboolean write_depth, +static struct st_fp_variant * +get_depth_stencil_fp_variant(struct st_context *st, GLboolean write_depth, GLboolean write_stencil) { - struct st_fp_varient_key key; - struct st_fp_varient *fpv; + struct st_fp_variant_key key; + struct st_fp_variant *fpv; memset(&key, 0, sizeof(key)); @@ -891,7 +891,7 @@ get_depth_stencil_fp_varient(struct st_context *st, GLboolean write_depth, key.drawpixels_z = write_depth; key.drawpixels_stencil = write_stencil; - fpv = st_get_fp_varient(st, st->fp, &key); + fpv = st_get_fp_variant(st, st->fp, &key); return fpv; } @@ -914,7 +914,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, struct pipe_sampler_view *sv[2]; int num_sampler_view = 1; enum pipe_format stencil_format = PIPE_FORMAT_NONE; - struct st_fp_varient *fpv; + struct st_fp_variant *fpv; if (format == GL_DEPTH_STENCIL) write_stencil = write_depth = GL_TRUE; @@ -951,7 +951,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, * Get vertex/fragment shaders */ if (write_depth || write_stencil) { - fpv = get_depth_stencil_fp_varient(st, write_depth, write_stencil); + fpv = get_depth_stencil_fp_variant(st, write_depth, write_stencil); driver_fp = fpv->driver_shader; @@ -960,7 +960,7 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, color = ctx->Current.RasterColor; } else { - fpv = get_color_fp_varient(st); + fpv = get_color_fp_variant(st); driver_fp = fpv->driver_shader; @@ -1156,7 +1156,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, GLint readX, readY, readW, readH; GLuint sample_count; struct gl_pixelstore_attrib pack = ctx->DefaultPacking; - struct st_fp_varient *fpv; + struct st_fp_variant *fpv; st_validate_state(st); @@ -1173,7 +1173,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, rbRead = st_get_color_read_renderbuffer(ctx); color = NULL; - fpv = get_color_fp_varient(st); + fpv = get_color_fp_variant(st); driver_fp = fpv->driver_shader; driver_vp = make_passthrough_vertex_shader(st, GL_FALSE); @@ -1188,7 +1188,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer); color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - fpv = get_depth_stencil_fp_varient(st, GL_TRUE, GL_FALSE); + fpv = get_depth_stencil_fp_variant(st, GL_TRUE, GL_FALSE); driver_fp = fpv->driver_shader; driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 860d5a46de8..32694975d17 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -128,7 +128,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; - st_release_vp_varients( st, stvp ); + st_release_vp_variants( st, stvp ); } break; case MESA_GEOMETRY_PROGRAM: @@ -136,7 +136,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) struct st_geometry_program *stgp = (struct st_geometry_program *) prog; - st_release_gp_varients(st, stgp); + st_release_gp_variants(st, stgp); if (stgp->tgsi.tokens) { st_free_tokens((void *) stgp->tgsi.tokens); @@ -149,7 +149,7 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog) struct st_fragment_program *stfp = (struct st_fragment_program *) prog; - st_release_fp_varients(st, stfp); + st_release_fp_variants(st, stfp); if (stfp->tgsi.tokens) { st_free_tokens(stfp->tgsi.tokens); @@ -181,7 +181,7 @@ st_is_program_native(struct gl_context *ctx, /** * Called via ctx->Driver.ProgramStringNotify() * Called when the program's text/code is changed. We have to free - * all shader varients and corresponding gallium shaders when this happens. + * all shader variants and corresponding gallium shaders when this happens. */ static GLboolean st_program_string_notify( struct gl_context *ctx, @@ -193,7 +193,7 @@ st_program_string_notify( struct gl_context *ctx, if (target == GL_FRAGMENT_PROGRAM_ARB) { struct st_fragment_program *stfp = (struct st_fragment_program *) prog; - st_release_fp_varients(st, stfp); + st_release_fp_variants(st, stfp); if (stfp->tgsi.tokens) { st_free_tokens(stfp->tgsi.tokens); @@ -206,7 +206,7 @@ st_program_string_notify( struct gl_context *ctx, else if (target == MESA_GEOMETRY_PROGRAM) { struct st_geometry_program *stgp = (struct st_geometry_program *) prog; - st_release_gp_varients(st, stgp); + st_release_gp_variants(st, stgp); if (stgp->tgsi.tokens) { st_free_tokens((void *) stgp->tgsi.tokens); @@ -219,7 +219,7 @@ st_program_string_notify( struct gl_context *ctx, else if (target == GL_VERTEX_PROGRAM_ARB) { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; - st_release_vp_varients( st, stvp ); + st_release_vp_variants( st, stvp ); if (st->vp == stvp) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 26565225e3b..68b52286d94 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -130,9 +130,9 @@ struct st_context struct st_fragment_program *fp; /**< Currently bound fragment program */ struct st_geometry_program *gp; /**< Currently bound geometry program */ - struct st_vp_varient *vp_varient; - struct st_fp_varient *fp_varient; - struct st_gp_varient *gp_varient; + struct st_vp_variant *vp_variant; + struct st_fp_variant *fp_variant; + struct st_gp_variant *gp_variant; struct gl_texture_object *default_texture; diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c index df32491d044..e1e373d07d4 100644 --- a/src/mesa/state_tracker/st_debug.c +++ b/src/mesa/state_tracker/st_debug.c @@ -89,8 +89,8 @@ st_print_current(void) } #endif - if (st->vp->varients) - tgsi_dump( st->vp->varients[0].tgsi.tokens, 0 ); + if (st->vp->variants) + tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 ); if (st->vp->Base.Base.Parameters) _mesa_print_parameter_list(st->vp->Base.Base.Parameters); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 61a0e1b0877..f4bf1802390 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -241,7 +241,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, */ static GLboolean is_interleaved_arrays(const struct st_vertex_program *vp, - const struct st_vp_varient *vpv, + const struct st_vp_variant *vpv, const struct gl_client_array **arrays, GLboolean *userSpace) { @@ -297,7 +297,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, */ static void get_arrays_bounds(const struct st_vertex_program *vp, - const struct st_vp_varient *vpv, + const struct st_vp_variant *vpv, const struct gl_client_array **arrays, GLuint max_index, const GLubyte **low, const GLubyte **high) @@ -343,7 +343,7 @@ get_arrays_bounds(const struct st_vertex_program *vp, static void setup_interleaved_attribs(struct gl_context *ctx, const struct st_vertex_program *vp, - const struct st_vp_varient *vpv, + const struct st_vp_variant *vpv, const struct gl_client_array **arrays, GLuint max_index, GLboolean userSpace, @@ -409,7 +409,7 @@ setup_interleaved_attribs(struct gl_context *ctx, static void setup_non_interleaved_attribs(struct gl_context *ctx, const struct st_vertex_program *vp, - const struct st_vp_varient *vpv, + const struct st_vp_variant *vpv, const struct gl_client_array **arrays, GLuint max_index, GLboolean *userSpace, @@ -617,7 +617,7 @@ st_draw_vbo(struct gl_context *ctx, struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; const struct st_vertex_program *vp; - const struct st_vp_varient *vpv; + const struct st_vp_variant *vpv; struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS]; GLuint attr; struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; @@ -650,7 +650,7 @@ st_draw_vbo(struct gl_context *ctx, /* must get these after state validation! */ vp = st->vp; - vpv = st->vp_varient; + vpv = st->vp_variant; #if 0 if (MESA_VERBOSE & VERBOSE_GLSL) { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 7f392fc4916..0a6cebb84cc 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -123,10 +123,10 @@ st_feedback_draw_vbo(struct gl_context *ctx, /* must get these after state validation! */ vp = st->vp; - vs = &st->vp_varient->tgsi; + vs = &st->vp_variant->tgsi; - if (!st->vp_varient->draw_shader) { - st->vp_varient->draw_shader = draw_create_vertex_shader(draw, vs); + if (!st->vp_variant->draw_shader) { + st->vp_variant->draw_shader = draw_create_vertex_shader(draw, vs); } /* @@ -139,7 +139,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, draw_set_viewport_state(draw, &st->state.viewport); draw_set_clip_state(draw, &st->state.clip); draw_set_rasterizer_state(draw, &st->state.rasterizer, NULL); - draw_bind_vertex_shader(draw, st->vp_varient->draw_shader); + draw_bind_vertex_shader(draw, st->vp_variant->draw_shader); set_feedback_vertex_format(ctx); /* loop over TGSI shader inputs to determine vertex buffer diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index bbd3cdbfacb..cfdc96b9dbe 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -56,11 +56,11 @@ /** - * Delete a vertex program varient. Note the caller must unlink - * the varient from the linked list. + * Delete a vertex program variant. Note the caller must unlink + * the variant from the linked list. */ static void -delete_vp_varient(struct st_context *st, struct st_vp_varient *vpv) +delete_vp_variant(struct st_context *st, struct st_vp_variant *vpv) { if (vpv->driver_shader) cso_delete_vertex_shader(st->cso_context, vpv->driver_shader); @@ -82,28 +82,28 @@ delete_vp_varient(struct st_context *st, struct st_vp_varient *vpv) * Clean out any old compilations: */ void -st_release_vp_varients( struct st_context *st, +st_release_vp_variants( struct st_context *st, struct st_vertex_program *stvp ) { - struct st_vp_varient *vpv; + struct st_vp_variant *vpv; - for (vpv = stvp->varients; vpv; ) { - struct st_vp_varient *next = vpv->next; - delete_vp_varient(st, vpv); + for (vpv = stvp->variants; vpv; ) { + struct st_vp_variant *next = vpv->next; + delete_vp_variant(st, vpv); vpv = next; } - stvp->varients = NULL; + stvp->variants = NULL; } /** - * Delete a fragment program varient. Note the caller must unlink - * the varient from the linked list. + * Delete a fragment program variant. Note the caller must unlink + * the variant from the linked list. */ static void -delete_fp_varient(struct st_context *st, struct st_fp_varient *fpv) +delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv) { if (fpv->driver_shader) cso_delete_fragment_shader(st->cso_context, fpv->driver_shader); @@ -113,29 +113,29 @@ delete_fp_varient(struct st_context *st, struct st_fp_varient *fpv) /** - * Free all varients of a fragment program. + * Free all variants of a fragment program. */ void -st_release_fp_varients(struct st_context *st, struct st_fragment_program *stfp) +st_release_fp_variants(struct st_context *st, struct st_fragment_program *stfp) { - struct st_fp_varient *fpv; + struct st_fp_variant *fpv; - for (fpv = stfp->varients; fpv; ) { - struct st_fp_varient *next = fpv->next; - delete_fp_varient(st, fpv); + for (fpv = stfp->variants; fpv; ) { + struct st_fp_variant *next = fpv->next; + delete_fp_variant(st, fpv); fpv = next; } - stfp->varients = NULL; + stfp->variants = NULL; } /** - * Delete a geometry program varient. Note the caller must unlink - * the varient from the linked list. + * Delete a geometry program variant. Note the caller must unlink + * the variant from the linked list. */ static void -delete_gp_varient(struct st_context *st, struct st_gp_varient *gpv) +delete_gp_variant(struct st_context *st, struct st_gp_variant *gpv) { if (gpv->driver_shader) cso_delete_geometry_shader(st->cso_context, gpv->driver_shader); @@ -145,20 +145,20 @@ delete_gp_varient(struct st_context *st, struct st_gp_varient *gpv) /** - * Free all varients of a geometry program. + * Free all variants of a geometry program. */ void -st_release_gp_varients(struct st_context *st, struct st_geometry_program *stgp) +st_release_gp_variants(struct st_context *st, struct st_geometry_program *stgp) { - struct st_gp_varient *gpv; + struct st_gp_variant *gpv; - for (gpv = stgp->varients; gpv; ) { - struct st_gp_varient *next = gpv->next; - delete_gp_varient(st, gpv); + for (gpv = stgp->variants; gpv; ) { + struct st_gp_variant *next = gpv->next; + delete_gp_variant(st, gpv); gpv = next; } - stgp->varients = NULL; + stgp->variants = NULL; } @@ -276,14 +276,14 @@ st_prepare_vertex_program(struct st_context *st, /** - * Translate a vertex program to create a new varient. + * Translate a vertex program to create a new variant. */ -static struct st_vp_varient * +static struct st_vp_variant * st_translate_vertex_program(struct st_context *st, struct st_vertex_program *stvp, - const struct st_vp_varient_key *key) + const struct st_vp_variant_key *key) { - struct st_vp_varient *vpv = CALLOC_STRUCT(st_vp_varient); + struct st_vp_variant *vpv = CALLOC_STRUCT(st_vp_variant); struct pipe_context *pipe = st->pipe; struct ureg_program *ureg; enum pipe_error error; @@ -361,17 +361,17 @@ fail: /** - * Find/create a vertex program varient. + * Find/create a vertex program variant. */ -struct st_vp_varient * -st_get_vp_varient(struct st_context *st, +struct st_vp_variant * +st_get_vp_variant(struct st_context *st, struct st_vertex_program *stvp, - const struct st_vp_varient_key *key) + const struct st_vp_variant_key *key) { - struct st_vp_varient *vpv; + struct st_vp_variant *vpv; - /* Search for existing varient */ - for (vpv = stvp->varients; vpv; vpv = vpv->next) { + /* Search for existing variant */ + for (vpv = stvp->variants; vpv; vpv = vpv->next) { if (memcmp(&vpv->key, key, sizeof(*key)) == 0) { break; } @@ -382,8 +382,8 @@ st_get_vp_varient(struct st_context *st, vpv = st_translate_vertex_program(st, stvp, key); if (vpv) { /* insert into list */ - vpv->next = stvp->varients; - stvp->varients = vpv; + vpv->next = stvp->variants; + stvp->variants = vpv; } } @@ -396,15 +396,15 @@ st_get_vp_varient(struct st_context *st, * the key. * \return new fragment program variant */ -static struct st_fp_varient * +static struct st_fp_variant * st_translate_fragment_program(struct st_context *st, struct st_fragment_program *stfp, - const struct st_fp_varient_key *key) + const struct st_fp_variant_key *key) { struct pipe_context *pipe = st->pipe; - struct st_fp_varient *varient = CALLOC_STRUCT(st_fp_varient); + struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant); - if (!varient) + if (!variant) return NULL; assert(!(key->bitmap && key->drawpixels)); @@ -414,9 +414,9 @@ st_translate_fragment_program(struct st_context *st, struct gl_fragment_program *fp; st_make_bitmap_fragment_program(st, &stfp->Base, - &fp, &varient->bitmap_sampler); + &fp, &variant->bitmap_sampler); - varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); + variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); stfp = st_fragment_program(fp); } else if (key->drawpixels) { @@ -430,7 +430,7 @@ st_translate_fragment_program(struct st_context *st, else { /* RGBA */ st_make_drawpix_fragment_program(st, &stfp->Base, &fp); - varient->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); + variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters); } stfp = st_fragment_program(fp); } @@ -613,31 +613,31 @@ st_translate_fragment_program(struct st_context *st, ureg_destroy( ureg ); } - /* fill in varient */ - varient->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi); - varient->key = *key; + /* fill in variant */ + variant->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi); + variant->key = *key; if (ST_DEBUG & DEBUG_TGSI) { tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); debug_printf("\n"); } - return varient; + return variant; } /** * Translate fragment program if needed. */ -struct st_fp_varient * -st_get_fp_varient(struct st_context *st, +struct st_fp_variant * +st_get_fp_variant(struct st_context *st, struct st_fragment_program *stfp, - const struct st_fp_varient_key *key) + const struct st_fp_variant_key *key) { - struct st_fp_varient *fpv; + struct st_fp_variant *fpv; - /* Search for existing varient */ - for (fpv = stfp->varients; fpv; fpv = fpv->next) { + /* Search for existing variant */ + for (fpv = stfp->variants; fpv; fpv = fpv->next) { if (memcmp(&fpv->key, key, sizeof(*key)) == 0) { break; } @@ -648,8 +648,8 @@ st_get_fp_varient(struct st_context *st, fpv = st_translate_fragment_program(st, stfp, key); if (fpv) { /* insert into list */ - fpv->next = stfp->varients; - stfp->varients = fpv; + fpv->next = stfp->variants; + stfp->variants = fpv; } } @@ -658,12 +658,12 @@ st_get_fp_varient(struct st_context *st, /** - * Translate a geometry program to create a new varient. + * Translate a geometry program to create a new variant. */ -static struct st_gp_varient * +static struct st_gp_variant * st_translate_geometry_program(struct st_context *st, struct st_geometry_program *stgp, - const struct st_gp_varient_key *key) + const struct st_gp_variant_key *key) { GLuint inputMapping[GEOM_ATTRIB_MAX]; GLuint outputMapping[GEOM_RESULT_MAX]; @@ -686,9 +686,9 @@ st_translate_geometry_program(struct st_context *st, GLuint maxSlot = 0; struct ureg_program *ureg; - struct st_gp_varient *gpv; + struct st_gp_variant *gpv; - gpv = CALLOC_STRUCT(st_gp_varient); + gpv = CALLOC_STRUCT(st_gp_variant); if (!gpv) return NULL; @@ -896,7 +896,7 @@ st_translate_geometry_program(struct st_context *st, stgp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); ureg_destroy( ureg ); - /* fill in new varient */ + /* fill in new variant */ gpv->driver_shader = pipe->create_gs_state(pipe, &stgp->tgsi); gpv->key = *key; @@ -917,15 +917,15 @@ st_translate_geometry_program(struct st_context *st, /** * Get/create geometry program variant. */ -struct st_gp_varient * -st_get_gp_varient(struct st_context *st, +struct st_gp_variant * +st_get_gp_variant(struct st_context *st, struct st_geometry_program *stgp, - const struct st_gp_varient_key *key) + const struct st_gp_variant_key *key) { - struct st_gp_varient *gpv; + struct st_gp_variant *gpv; - /* Search for existing varient */ - for (gpv = stgp->varients; gpv; gpv = gpv->next) { + /* Search for existing variant */ + for (gpv = stgp->variants; gpv; gpv = gpv->next) { if (memcmp(&gpv->key, key, sizeof(*key)) == 0) { break; } @@ -936,8 +936,8 @@ st_get_gp_varient(struct st_context *st, gpv = st_translate_geometry_program(st, stgp, key); if (gpv) { /* insert into list */ - gpv->next = stgp->varients; - stgp->varients = gpv; + gpv->next = stgp->variants; + stgp->variants = gpv; } } @@ -1008,15 +1008,15 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *stvp = (struct st_vertex_program *) program; - struct st_vp_varient *vpv, **prevPtr = &stvp->varients; + struct st_vp_variant *vpv, **prevPtr = &stvp->variants; - for (vpv = stvp->varients; vpv; ) { - struct st_vp_varient *next = vpv->next; + for (vpv = stvp->variants; vpv; ) { + struct st_vp_variant *next = vpv->next; if (vpv->key.st == st) { /* unlink from list */ *prevPtr = next; /* destroy this variant */ - delete_vp_varient(st, vpv); + delete_vp_variant(st, vpv); } else { prevPtr = &vpv->next; @@ -1029,15 +1029,15 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) { struct st_fragment_program *stfp = (struct st_fragment_program *) program; - struct st_fp_varient *fpv, **prevPtr = &stfp->varients; + struct st_fp_variant *fpv, **prevPtr = &stfp->variants; - for (fpv = stfp->varients; fpv; ) { - struct st_fp_varient *next = fpv->next; + for (fpv = stfp->variants; fpv; ) { + struct st_fp_variant *next = fpv->next; if (fpv->key.st == st) { /* unlink from list */ *prevPtr = next; /* destroy this variant */ - delete_fp_varient(st, fpv); + delete_fp_variant(st, fpv); } else { prevPtr = &fpv->next; @@ -1050,15 +1050,15 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) { struct st_geometry_program *stgp = (struct st_geometry_program *) program; - struct st_gp_varient *gpv, **prevPtr = &stgp->varients; + struct st_gp_variant *gpv, **prevPtr = &stgp->variants; - for (gpv = stgp->varients; gpv; ) { - struct st_gp_varient *next = gpv->next; + for (gpv = stgp->variants; gpv; ) { + struct st_gp_variant *next = gpv->next; if (gpv->key.st == st) { /* unlink from list */ *prevPtr = next; /* destroy this variant */ - delete_gp_varient(st, gpv); + delete_gp_variant(st, gpv); } else { prevPtr = &gpv->next; diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 0cf81caa267..c4244df939e 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -41,15 +41,15 @@ /** Fragment program variant key */ -struct st_fp_varient_key +struct st_fp_variant_key { struct st_context *st; /**< variants are per-context */ /** for glBitmap */ - GLuint bitmap:1; /**< glBitmap varient? */ + GLuint bitmap:1; /**< glBitmap variant? */ /** for glDrawPixels */ - GLuint drawpixels:1; /**< glDrawPixels varient */ + GLuint drawpixels:1; /**< glDrawPixels variant */ GLuint scaleAndBias:1; /**< glDrawPixels w/ scale and/or bias? */ GLuint pixelMaps:1; /**< glDrawPixels w/ pixel lookup map? */ GLuint drawpixels_z:1; /**< glDrawPixels(GL_DEPTH) */ @@ -60,10 +60,10 @@ struct st_fp_varient_key /** * Variant of a fragment program. */ -struct st_fp_varient +struct st_fp_variant { /** Parameters which generated this version of fragment program */ - struct st_fp_varient_key key; + struct st_fp_variant_key key; /** Driver's compiled shader */ void *driver_shader; @@ -73,7 +73,7 @@ struct st_fp_varient uint bitmap_sampler; /** next in linked list */ - struct st_fp_varient *next; + struct st_fp_variant *next; }; @@ -86,13 +86,13 @@ struct st_fragment_program struct pipe_shader_state tgsi; - struct st_fp_varient *varients; + struct st_fp_variant *variants; }; /** Vertex program variant key */ -struct st_vp_varient_key +struct st_vp_variant_key { struct st_context *st; /**< variants are per-context */ boolean passthrough_edgeflags; @@ -103,12 +103,12 @@ struct st_vp_varient_key * This represents a vertex program, especially translated to match * the inputs of a particular fragment shader. */ -struct st_vp_varient +struct st_vp_variant { /* Parameters which generated this translated version of a vertex * shader: */ - struct st_vp_varient_key key; + struct st_vp_variant_key key; /** * TGSI tokens (to later generate a 'draw' module shader for @@ -123,7 +123,7 @@ struct st_vp_varient struct draw_vertex_shader *draw_shader; /** Next in linked list */ - struct st_vp_varient *next; + struct st_vp_variant *next; /** similar to that in st_vertex_program, but with edgeflags info too */ GLuint num_inputs; @@ -149,15 +149,15 @@ struct st_vertex_program ubyte output_semantic_index[VERT_RESULT_MAX]; GLuint num_outputs; - /** List of translated varients of this vertex program. + /** List of translated variants of this vertex program. */ - struct st_vp_varient *varients; + struct st_vp_variant *variants; }; -/** Geometry program varient key */ -struct st_gp_varient_key +/** Geometry program variant key */ +struct st_gp_variant_key { struct st_context *st; /**< variants are per-context */ /* no other fields yet */ @@ -167,14 +167,14 @@ struct st_gp_varient_key /** * Geometry program variant. */ -struct st_gp_varient +struct st_gp_variant { /* Parameters which generated this translated version of a vertex */ - struct st_gp_varient_key key; + struct st_gp_variant_key key; void *driver_shader; - struct st_gp_varient *next; + struct st_gp_variant *next; }; @@ -203,7 +203,7 @@ struct st_geometry_program struct pipe_shader_state tgsi; - struct st_gp_varient *varients; + struct st_gp_variant *variants; }; @@ -258,35 +258,35 @@ st_reference_fragprog(struct st_context *st, } -extern struct st_vp_varient * -st_get_vp_varient(struct st_context *st, +extern struct st_vp_variant * +st_get_vp_variant(struct st_context *st, struct st_vertex_program *stvp, - const struct st_vp_varient_key *key); + const struct st_vp_variant_key *key); -extern struct st_fp_varient * -st_get_fp_varient(struct st_context *st, +extern struct st_fp_variant * +st_get_fp_variant(struct st_context *st, struct st_fragment_program *stfp, - const struct st_fp_varient_key *key); + const struct st_fp_variant_key *key); -extern struct st_gp_varient * -st_get_gp_varient(struct st_context *st, +extern struct st_gp_variant * +st_get_gp_variant(struct st_context *st, struct st_geometry_program *stgp, - const struct st_gp_varient_key *key); + const struct st_gp_variant_key *key); extern void -st_release_vp_varients( struct st_context *st, +st_release_vp_variants( struct st_context *st, struct st_vertex_program *stvp ); extern void -st_release_fp_varients( struct st_context *st, +st_release_fp_variants( struct st_context *st, struct st_fragment_program *stfp ); extern void -st_release_gp_varients(struct st_context *st, +st_release_gp_variants(struct st_context *st, struct st_geometry_program *stgp); -- cgit v1.2.3 From f3955f6fcdd1a3106a6538642131ccea5ef1cef0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 08:44:12 -0700 Subject: softpipe: s/varient/variant --- src/gallium/drivers/softpipe/sp_context.h | 8 +-- src/gallium/drivers/softpipe/sp_state_derived.c | 2 +- src/gallium/drivers/softpipe/sp_state_sampler.c | 46 +++++++-------- src/gallium/drivers/softpipe/sp_tex_sample.c | 74 ++++++++++++------------- src/gallium/drivers/softpipe/sp_tex_sample.h | 24 ++++---- 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 9361a3df09e..903574b7e19 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -154,9 +154,9 @@ struct softpipe_context { /** TGSI exec things */ struct { - struct sp_sampler_varient *geom_samplers_list[PIPE_MAX_GEOMETRY_SAMPLERS]; - struct sp_sampler_varient *vert_samplers_list[PIPE_MAX_VERTEX_SAMPLERS]; - struct sp_sampler_varient *frag_samplers_list[PIPE_MAX_SAMPLERS]; + struct sp_sampler_variant *geom_samplers_list[PIPE_MAX_GEOMETRY_SAMPLERS]; + struct sp_sampler_variant *vert_samplers_list[PIPE_MAX_VERTEX_SAMPLERS]; + struct sp_sampler_variant *frag_samplers_list[PIPE_MAX_SAMPLERS]; } tgsi; struct tgsi_exec_machine *fs_machine; @@ -192,7 +192,7 @@ softpipe_context( struct pipe_context *pipe ) } void -softpipe_reset_sampler_varients(struct softpipe_context *softpipe); +softpipe_reset_sampler_variants(struct softpipe_context *softpipe); struct pipe_context * softpipe_create_context( struct pipe_screen *, void *priv ); diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 3ba4d934fd2..bf4c12701af 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -197,7 +197,7 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) { unsigned i; - softpipe_reset_sampler_varients( softpipe ); + softpipe_reset_sampler_variants( softpipe ); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { struct softpipe_tex_tile_cache *tc = softpipe->tex_cache[i]; diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 8972d62cc7e..cfa211b60a0 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -43,8 +43,8 @@ struct sp_sampler { struct pipe_sampler_state base; - struct sp_sampler_varient *varients; - struct sp_sampler_varient *current; + struct sp_sampler_variant *variants; + struct sp_sampler_variant *current; }; static struct sp_sampler *sp_sampler( struct pipe_sampler_state *sampler ) @@ -60,7 +60,7 @@ softpipe_create_sampler_state(struct pipe_context *pipe, struct sp_sampler *sp_sampler = CALLOC_STRUCT(sp_sampler); sp_sampler->base = *sampler; - sp_sampler->varients = NULL; + sp_sampler->variants = NULL; return (void *)sp_sampler; } @@ -277,24 +277,24 @@ softpipe_set_geometry_sampler_views(struct pipe_context *pipe, /** - * Find/create an sp_sampler_varient object for sampling the given texture, + * Find/create an sp_sampler_variant object for sampling the given texture, * sampler and tex unit. * * Note that the tex unit is significant. We can't re-use a sampler - * varient for multiple texture units because the sampler varient contains + * variant for multiple texture units because the sampler variant contains * the texture object pointer. If the texture object pointer were stored - * somewhere outside the sampler varient, we could re-use samplers for + * somewhere outside the sampler variant, we could re-use samplers for * multiple texture units. */ -static struct sp_sampler_varient * -get_sampler_varient( unsigned unit, +static struct sp_sampler_variant * +get_sampler_variant( unsigned unit, struct sp_sampler *sampler, struct pipe_sampler_view *view, struct pipe_resource *resource, unsigned processor ) { struct softpipe_resource *sp_texture = softpipe_resource(resource); - struct sp_sampler_varient *v = NULL; + struct sp_sampler_variant *v = NULL; union sp_sampler_key key; /* if this fails, widen the key.unit field and update this assertion */ @@ -316,14 +316,14 @@ get_sampler_varient( unsigned unit, } if (v == NULL) { - for (v = sampler->varients; v; v = v->next) + for (v = sampler->variants; v; v = v->next) if (v->key.value == key.value) break; if (v == NULL) { - v = sp_create_sampler_varient( &sampler->base, key ); - v->next = sampler->varients; - sampler->varients = v; + v = sp_create_sampler_variant( &sampler->base, key ); + v->next = sampler->variants; + sampler->variants = v; } } @@ -333,7 +333,7 @@ get_sampler_varient( unsigned unit, void -softpipe_reset_sampler_varients(struct softpipe_context *softpipe) +softpipe_reset_sampler_variants(struct softpipe_context *softpipe) { int i; @@ -350,13 +350,13 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) } softpipe->tgsi.vert_samplers_list[i] = - get_sampler_varient( i, + get_sampler_variant( i, sp_sampler(softpipe->vertex_samplers[i]), softpipe->vertex_sampler_views[i], texture, TGSI_PROCESSOR_VERTEX ); - sp_sampler_varient_bind_texture( softpipe->tgsi.vert_samplers_list[i], + sp_sampler_variant_bind_texture( softpipe->tgsi.vert_samplers_list[i], softpipe->vertex_tex_cache[i], texture ); } @@ -372,14 +372,14 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) } softpipe->tgsi.geom_samplers_list[i] = - get_sampler_varient( + get_sampler_variant( i, sp_sampler(softpipe->geometry_samplers[i]), softpipe->geometry_sampler_views[i], texture, TGSI_PROCESSOR_GEOMETRY ); - sp_sampler_varient_bind_texture( + sp_sampler_variant_bind_texture( softpipe->tgsi.geom_samplers_list[i], softpipe->geometry_tex_cache[i], texture ); @@ -396,13 +396,13 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) } softpipe->tgsi.frag_samplers_list[i] = - get_sampler_varient( i, + get_sampler_variant( i, sp_sampler(softpipe->sampler[i]), softpipe->sampler_views[i], texture, TGSI_PROCESSOR_FRAGMENT ); - sp_sampler_varient_bind_texture( softpipe->tgsi.frag_samplers_list[i], + sp_sampler_variant_bind_texture( softpipe->tgsi.frag_samplers_list[i], softpipe->tex_cache[i], texture ); } @@ -414,11 +414,11 @@ softpipe_delete_sampler_state(struct pipe_context *pipe, void *sampler) { struct sp_sampler *sp_sampler = (struct sp_sampler *)sampler; - struct sp_sampler_varient *v, *tmp; + struct sp_sampler_variant *v, *tmp; - for (v = sp_sampler->varients; v; v = tmp) { + for (v = sp_sampler->variants; v; v = tmp) { tmp = v->next; - sp_sampler_varient_destroy(v); + sp_sampler_variant_destroy(v); } FREE( sampler ); diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index acd94f32605..70fa74b7e4b 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -545,7 +545,7 @@ wrap_linear_unorm_clamp_to_edge(const float s[4], unsigned size, * derivatives w.r.t X and Y, then compute lambda (level of detail). */ static float -compute_lambda_1d(const struct sp_sampler_varient *samp, +compute_lambda_1d(const struct sp_sampler_variant *samp, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE]) @@ -560,7 +560,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp, static float -compute_lambda_2d(const struct sp_sampler_varient *samp, +compute_lambda_2d(const struct sp_sampler_variant *samp, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE]) @@ -579,7 +579,7 @@ compute_lambda_2d(const struct sp_sampler_varient *samp, static float -compute_lambda_3d(const struct sp_sampler_varient *samp, +compute_lambda_3d(const struct sp_sampler_variant *samp, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE]) @@ -608,7 +608,7 @@ compute_lambda_3d(const struct sp_sampler_varient *samp, * Since there aren't derivatives to use, just return 0. */ static float -compute_lambda_vert(const struct sp_sampler_varient *samp, +compute_lambda_vert(const struct sp_sampler_variant *samp, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE]) @@ -634,7 +634,7 @@ compute_lambda_vert(const struct sp_sampler_varient *samp, static INLINE const float * -get_texel_2d_no_border(const struct sp_sampler_varient *samp, +get_texel_2d_no_border(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x, int y) { const struct softpipe_tex_cached_tile *tile; @@ -651,7 +651,7 @@ get_texel_2d_no_border(const struct sp_sampler_varient *samp, static INLINE const float * -get_texel_2d(const struct sp_sampler_varient *samp, +get_texel_2d(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x, int y) { const struct pipe_resource *texture = samp->texture; @@ -671,7 +671,7 @@ get_texel_2d(const struct sp_sampler_varient *samp, /* Gather a quad of adjacent texels within a tile: */ static INLINE void -get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_varient *samp, +get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_variant *samp, union tex_tile_address addr, unsigned x, unsigned y, const float *out[4]) @@ -695,7 +695,7 @@ get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_varient *samp, /* Gather a quad of potentially non-adjacent texels: */ static INLINE void -get_texel_quad_2d_no_border(const struct sp_sampler_varient *samp, +get_texel_quad_2d_no_border(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x0, int y0, int x1, int y1, @@ -710,7 +710,7 @@ get_texel_quad_2d_no_border(const struct sp_sampler_varient *samp, /* Can involve a lot of unnecessary checks for border color: */ static INLINE void -get_texel_quad_2d(const struct sp_sampler_varient *samp, +get_texel_quad_2d(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x0, int y0, int x1, int y1, @@ -724,10 +724,10 @@ get_texel_quad_2d(const struct sp_sampler_varient *samp, -/* 3d varients: +/* 3d variants: */ static INLINE const float * -get_texel_3d_no_border(const struct sp_sampler_varient *samp, +get_texel_3d_no_border(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x, int y, int z) { const struct softpipe_tex_cached_tile *tile; @@ -745,7 +745,7 @@ get_texel_3d_no_border(const struct sp_sampler_varient *samp, static INLINE const float * -get_texel_3d(const struct sp_sampler_varient *samp, +get_texel_3d(const struct sp_sampler_variant *samp, union tex_tile_address addr, int x, int y, int z) { const struct pipe_resource *texture = samp->texture; @@ -800,7 +800,7 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); unsigned j; unsigned level = samp->level; unsigned xpot = pot_level_size(samp->xpot, level); @@ -863,7 +863,7 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); unsigned j; unsigned level = samp->level; unsigned xpot = pot_level_size(samp->xpot, level); @@ -907,7 +907,7 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); unsigned j; unsigned level = samp->level; unsigned xpot = pot_level_size(samp->xpot, level); @@ -960,7 +960,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; unsigned level0, j; int width; @@ -1000,7 +1000,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; unsigned level0, j; int width, height; @@ -1052,7 +1052,7 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; const unsigned *faces = samp->faces; /* zero when not cube-mapping */ unsigned level0, j; @@ -1096,7 +1096,7 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; unsigned level0, j; int width, height, depth; @@ -1138,7 +1138,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; unsigned level0, j; int width; @@ -1178,7 +1178,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; unsigned level0, j; int width, height; @@ -1225,7 +1225,7 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; const unsigned *faces = samp->faces; /* zero when not cube-mapping */ unsigned level0, j; @@ -1274,7 +1274,7 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; unsigned level0, j; int width, height, depth; @@ -1350,7 +1350,7 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; int level0; float lambda; @@ -1417,7 +1417,7 @@ mip_filter_nearest(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; float lambda; float lod[QUAD_SIZE]; @@ -1460,7 +1460,7 @@ mip_filter_none(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); float lambda; float lod[QUAD_SIZE]; @@ -1501,7 +1501,7 @@ mip_filter_linear_2d_linear_repeat_POT( enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_resource *texture = samp->texture; int level0; float lambda; @@ -1569,7 +1569,7 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); const struct pipe_sampler_state *sampler = samp->sampler; int j, k0, k1, k2, k3; float val; @@ -1656,7 +1656,7 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); unsigned j; float ssss[4], tttt[4]; @@ -1740,7 +1740,7 @@ sample_swizzle(struct tgsi_sampler *tgsi_sampler, enum tgsi_sampler_control control, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + struct sp_sampler_variant *samp = sp_sampler_variant(tgsi_sampler); float rgba_temp[NUM_CHANNELS][QUAD_SIZE]; const unsigned swizzle_r = samp->key.bits.swizzle_r; const unsigned swizzle_g = samp->key.bits.swizzle_g; @@ -1989,10 +1989,10 @@ get_img_filter(const union sp_sampler_key key, /** - * Bind the given texture object and texture cache to the sampler varient. + * Bind the given texture object and texture cache to the sampler variant. */ void -sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp, +sp_sampler_variant_bind_texture( struct sp_sampler_variant *samp, struct softpipe_tex_tile_cache *tex_cache, const struct pipe_resource *texture ) { @@ -2007,20 +2007,20 @@ sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp, void -sp_sampler_varient_destroy( struct sp_sampler_varient *samp ) +sp_sampler_variant_destroy( struct sp_sampler_variant *samp ) { FREE(samp); } /** - * Create a sampler varient for a given set of non-orthogonal state. + * Create a sampler variant for a given set of non-orthogonal state. */ -struct sp_sampler_varient * -sp_create_sampler_varient( const struct pipe_sampler_state *sampler, +struct sp_sampler_variant * +sp_create_sampler_variant( const struct pipe_sampler_state *sampler, const union sp_sampler_key key ) { - struct sp_sampler_varient *samp = CALLOC_STRUCT(sp_sampler_varient); + struct sp_sampler_variant *samp = CALLOC_STRUCT(sp_sampler_variant); if (!samp) return NULL; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 0f471a98270..ed99006ab02 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -32,7 +32,7 @@ #include "tgsi/tgsi_exec.h" -struct sp_sampler_varient; +struct sp_sampler_variant; typedef void (*wrap_nearest_func)(const float s[4], unsigned size, @@ -44,7 +44,7 @@ typedef void (*wrap_linear_func)(const float s[4], int icoord1[4], float w[4]); -typedef float (*compute_lambda_func)(const struct sp_sampler_varient *sampler, +typedef float (*compute_lambda_func)(const struct sp_sampler_variant *sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE]); @@ -76,7 +76,7 @@ union sp_sampler_key { /** * Subclass of tgsi_sampler */ -struct sp_sampler_varient +struct sp_sampler_variant { struct tgsi_sampler base; /**< base class */ @@ -121,29 +121,29 @@ struct sp_sampler_varient /* Linked list: */ - struct sp_sampler_varient *next; + struct sp_sampler_variant *next; }; struct sp_sampler; -/* Create a sampler varient for a given set of non-orthogonal state. Currently the +/* Create a sampler variant for a given set of non-orthogonal state. Currently the */ -struct sp_sampler_varient * -sp_create_sampler_varient( const struct pipe_sampler_state *sampler, +struct sp_sampler_variant * +sp_create_sampler_variant( const struct pipe_sampler_state *sampler, const union sp_sampler_key key ); -void sp_sampler_varient_bind_texture( struct sp_sampler_varient *varient, +void sp_sampler_variant_bind_texture( struct sp_sampler_variant *variant, struct softpipe_tex_tile_cache *tex_cache, const struct pipe_resource *tex ); -void sp_sampler_varient_destroy( struct sp_sampler_varient * ); +void sp_sampler_variant_destroy( struct sp_sampler_variant * ); -static INLINE struct sp_sampler_varient * -sp_sampler_varient(const struct tgsi_sampler *sampler) +static INLINE struct sp_sampler_variant * +sp_sampler_variant(const struct tgsi_sampler *sampler) { - return (struct sp_sampler_varient *) sampler; + return (struct sp_sampler_variant *) sampler; } extern void -- cgit v1.2.3 From a185d439bdab24750d9c22e42a723f6baa23b730 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 08:46:35 -0700 Subject: i915g: s/varient/variant/ --- src/gallium/drivers/i915/i915_context.h | 2 +- src/gallium/drivers/i915/i915_debug.c | 2 +- src/gallium/drivers/i915/i915_state_emit.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 7103a1b8c16..d15e1723d83 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -272,7 +272,7 @@ struct i915_context { #define I915_HW_PROGRAM (1<batch->relocs; /* 14 dwords, 0 relocs */ - if (i915->hardware_dirty & I915_HW_INVARIENT) + if (i915->hardware_dirty & I915_HW_INVARIANT) { OUT_BATCH(_3DSTATE_AA_CMD | AA_LINE_ECAAR_WIDTH_ENABLE | -- cgit v1.2.3 From bd75e4b8bea478cf9edd74248be6b575e743ca00 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 08:47:37 -0700 Subject: i965g: s/varient/variant/ --- src/gallium/drivers/i965/brw_misc_state.c | 10 +++++----- src/gallium/drivers/i965/brw_state.h | 2 +- src/gallium/drivers/i965/brw_state_upload.c | 2 +- src/gallium/drivers/i965/brw_wm_fp.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/i965/brw_misc_state.c b/src/gallium/drivers/i965/brw_misc_state.c index 6d89b5d2baf..c635d696617 100644 --- a/src/gallium/drivers/i965/brw_misc_state.c +++ b/src/gallium/drivers/i965/brw_misc_state.c @@ -363,10 +363,10 @@ const struct brw_tracked_state brw_line_stipple = { /*********************************************************************** - * Misc invarient state packets + * Misc invariant state packets */ -static int upload_invarient_state( struct brw_context *brw ) +static int upload_invariant_state( struct brw_context *brw ) { { /* 0x61040000 Pipeline Select */ @@ -439,7 +439,7 @@ static int upload_invarient_state( struct brw_context *brw ) { struct brw_polygon_stipple_offset bpso; - /* This is invarient state in gallium: + /* This is invariant state in gallium: */ memset(&bpso, 0, sizeof(bpso)); bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET; @@ -453,13 +453,13 @@ static int upload_invarient_state( struct brw_context *brw ) return 0; } -const struct brw_tracked_state brw_invarient_state = { +const struct brw_tracked_state brw_invariant_state = { .dirty = { .mesa = 0, .brw = BRW_NEW_CONTEXT, .cache = 0 }, - .emit = upload_invarient_state + .emit = upload_invariant_state }; diff --git a/src/gallium/drivers/i965/brw_state.h b/src/gallium/drivers/i965/brw_state.h index d2bbd0123d1..380d511f9bb 100644 --- a/src/gallium/drivers/i965/brw_state.h +++ b/src/gallium/drivers/i965/brw_state.h @@ -56,7 +56,7 @@ const struct brw_tracked_state brw_clip_prog; const struct brw_tracked_state brw_clip_unit; const struct brw_tracked_state brw_curbe_buffer; const struct brw_tracked_state brw_curbe_offsets; -const struct brw_tracked_state brw_invarient_state; +const struct brw_tracked_state brw_invariant_state; const struct brw_tracked_state brw_gs_prog; const struct brw_tracked_state brw_gs_unit; const struct brw_tracked_state brw_line_stipple; diff --git a/src/gallium/drivers/i965/brw_state_upload.c b/src/gallium/drivers/i965/brw_state_upload.c index f8b91eff816..cdbf270e06a 100644 --- a/src/gallium/drivers/i965/brw_state_upload.c +++ b/src/gallium/drivers/i965/brw_state_upload.c @@ -69,7 +69,7 @@ const struct brw_tracked_state *atoms[] = /* Command packets: */ - &brw_invarient_state, + &brw_invariant_state, &brw_state_base_address, &brw_binding_table_pointers, diff --git a/src/gallium/drivers/i965/brw_wm_fp.c b/src/gallium/drivers/i965/brw_wm_fp.c index f7ee55cc1c8..a65e16edec0 100644 --- a/src/gallium/drivers/i965/brw_wm_fp.c +++ b/src/gallium/drivers/i965/brw_wm_fp.c @@ -812,7 +812,7 @@ static void precalc_tex( struct brw_wm_compile *c, } /* XXX: add GL_EXT_texture_swizzle support to gallium -- by - * generating shader varients in mesa state tracker. + * generating shader variants in mesa state tracker. */ /* Release this temp if we ended up allocating it: -- cgit v1.2.3 From 2bd9b386e6c8f47537c8da50d2f5378b287b3c4f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 08:50:30 -0700 Subject: svga: s/varient/variant/ --- src/gallium/drivers/svga/svga_pipe_rasterizer.c | 2 +- src/gallium/drivers/svga/svga_state_fs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index 660eb0757a6..e97b4e57415 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -68,7 +68,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe, /* need this for draw module. */ rast->templ = *templ; - /* light_twoside - XXX: need fragment shader varient */ + /* light_twoside - XXX: need fragment shader variant */ /* poly_smooth - XXX: no fallback available */ /* poly_stipple_enable - draw module */ /* sprite_coord_enable - ? */ diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c index ad6f2947137..9c04adec8ee 100644 --- a/src/gallium/drivers/svga/svga_state_fs.c +++ b/src/gallium/drivers/svga/svga_state_fs.c @@ -136,7 +136,7 @@ static int make_fs_key( const struct svga_context *svga, /* The blend workaround for simulating logicop xor behaviour * requires that the incoming fragment color be white. This change - * achieves that by creating a varient of the current fragment + * achieves that by creating a variant of the current fragment * shader that overrides all output colors with 1,1,1,1 * * This will work for most shaders, including those containing -- cgit v1.2.3 From b7e150605d402224cdd8fa3d186924bdee3c6c49 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 08:50:42 -0700 Subject: draw: s/varient/variant/ --- .../auxiliary/draw/draw_pt_fetch_shade_emit.c | 6 +- src/gallium/auxiliary/draw/draw_vs.c | 40 ++++++------- src/gallium/auxiliary/draw/draw_vs.h | 70 +++++++++++----------- src/gallium/auxiliary/draw/draw_vs_aos.c | 50 ++++++++-------- src/gallium/auxiliary/draw/draw_vs_aos.h | 10 ++-- src/gallium/auxiliary/draw/draw_vs_exec.c | 2 +- src/gallium/auxiliary/draw/draw_vs_llvm.c | 2 +- src/gallium/auxiliary/draw/draw_vs_ppc.c | 4 +- src/gallium/auxiliary/draw/draw_vs_sse.c | 4 +- src/gallium/auxiliary/draw/draw_vs_varient.c | 32 +++++----- 10 files changed, 110 insertions(+), 110 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index 7c198c6026d..c98fb3d5205 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -58,8 +58,8 @@ struct fetch_shade_emit { const ubyte *src[PIPE_MAX_ATTRIBS]; unsigned prim; - struct draw_vs_varient_key key; - struct draw_vs_varient *active; + struct draw_vs_variant_key key; + struct draw_vs_variant *active; const struct vertex_info *vinfo; @@ -150,7 +150,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle, } - fse->active = draw_vs_lookup_varient( draw->vs.vertex_shader, + fse->active = draw_vs_lookup_variant( draw->vs.vertex_shader, &fse->key ); if (!fse->active) { diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c index fb665b08fff..7caad6f0053 100644 --- a/src/gallium/auxiliary/draw/draw_vs.c +++ b/src/gallium/auxiliary/draw/draw_vs.c @@ -165,10 +165,10 @@ draw_delete_vertex_shader(struct draw_context *draw, { unsigned i; - for (i = 0; i < dvs->nr_varients; i++) - dvs->varient[i]->destroy( dvs->varient[i] ); + for (i = 0; i < dvs->nr_variants; i++) + dvs->variant[i]->destroy( dvs->variant[i] ); - dvs->nr_varients = 0; + dvs->nr_variants = 0; dvs->delete( dvs ); } @@ -225,40 +225,40 @@ draw_vs_destroy( struct draw_context *draw ) } -struct draw_vs_varient * -draw_vs_lookup_varient( struct draw_vertex_shader *vs, - const struct draw_vs_varient_key *key ) +struct draw_vs_variant * +draw_vs_lookup_variant( struct draw_vertex_shader *vs, + const struct draw_vs_variant_key *key ) { - struct draw_vs_varient *varient; + struct draw_vs_variant *variant; unsigned i; - /* Lookup existing varient: + /* Lookup existing variant: */ - for (i = 0; i < vs->nr_varients; i++) - if (draw_vs_varient_key_compare(key, &vs->varient[i]->key) == 0) - return vs->varient[i]; + for (i = 0; i < vs->nr_variants; i++) + if (draw_vs_variant_key_compare(key, &vs->variant[i]->key) == 0) + return vs->variant[i]; /* Else have to create a new one: */ - varient = vs->create_varient( vs, key ); - if (varient == NULL) + variant = vs->create_variant( vs, key ); + if (variant == NULL) return NULL; /* Add it to our list, could be smarter: */ - if (vs->nr_varients < Elements(vs->varient)) { - vs->varient[vs->nr_varients++] = varient; + if (vs->nr_variants < Elements(vs->variant)) { + vs->variant[vs->nr_variants++] = variant; } else { - vs->last_varient++; - vs->last_varient %= Elements(vs->varient); - vs->varient[vs->last_varient]->destroy(vs->varient[vs->last_varient]); - vs->varient[vs->last_varient] = varient; + vs->last_variant++; + vs->last_variant %= Elements(vs->variant); + vs->variant[vs->last_variant]->destroy(vs->variant[vs->last_variant]); + vs->variant[vs->last_variant] = variant; } /* Done */ - return varient; + return variant; } diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h index f9a038788fb..bfb72d50efa 100644 --- a/src/gallium/auxiliary/draw/draw_vs.h +++ b/src/gallium/auxiliary/draw/draw_vs.h @@ -38,7 +38,7 @@ struct draw_context; struct pipe_shader_state; -struct draw_varient_input +struct draw_variant_input { enum pipe_format format; unsigned buffer; @@ -46,19 +46,19 @@ struct draw_varient_input unsigned instance_divisor; }; -struct draw_varient_output +struct draw_variant_output { enum pipe_format format; /* output format */ unsigned vs_output:8; /* which vertex shader output is this? */ unsigned offset:24; /* offset into output vertex */ }; -struct draw_varient_element { - struct draw_varient_input in; - struct draw_varient_output out; +struct draw_variant_element { + struct draw_variant_input in; + struct draw_variant_output out; }; -struct draw_vs_varient_key { +struct draw_vs_variant_key { unsigned output_stride; unsigned nr_elements:8; /* max2(nr_inputs, nr_outputs) */ unsigned nr_inputs:8; @@ -66,34 +66,34 @@ struct draw_vs_varient_key { unsigned viewport:1; unsigned clip:1; unsigned const_vbuffers:5; - struct draw_varient_element element[PIPE_MAX_ATTRIBS]; + struct draw_variant_element element[PIPE_MAX_ATTRIBS]; }; -struct draw_vs_varient; +struct draw_vs_variant; -struct draw_vs_varient { - struct draw_vs_varient_key key; +struct draw_vs_variant { + struct draw_vs_variant_key key; struct draw_vertex_shader *vs; - void (*set_buffer)( struct draw_vs_varient *, + void (*set_buffer)( struct draw_vs_variant *, unsigned i, const void *ptr, unsigned stride, unsigned max_stride ); - void (PIPE_CDECL *run_linear)( struct draw_vs_varient *shader, + void (PIPE_CDECL *run_linear)( struct draw_vs_variant *shader, unsigned start, unsigned count, void *output_buffer ); - void (PIPE_CDECL *run_elts)( struct draw_vs_varient *shader, + void (PIPE_CDECL *run_elts)( struct draw_vs_variant *shader, const unsigned *elts, unsigned count, void *output_buffer ); - void (*destroy)( struct draw_vs_varient * ); + void (*destroy)( struct draw_vs_variant * ); }; @@ -117,11 +117,11 @@ struct draw_vertex_shader { /* */ - struct draw_vs_varient *varient[16]; - unsigned nr_varients; - unsigned last_varient; - struct draw_vs_varient *(*create_varient)( struct draw_vertex_shader *shader, - const struct draw_vs_varient_key *key ); + struct draw_vs_variant *variant[16]; + unsigned nr_variants; + unsigned last_variant; + struct draw_vs_variant *(*create_variant)( struct draw_vertex_shader *shader, + const struct draw_vs_variant_key *key ); void (*prepare)( struct draw_vertex_shader *shader, @@ -144,9 +144,9 @@ struct draw_vertex_shader { }; -struct draw_vs_varient * -draw_vs_lookup_varient( struct draw_vertex_shader *base, - const struct draw_vs_varient_key *key ); +struct draw_vs_variant * +draw_vs_lookup_variant( struct draw_vertex_shader *base, + const struct draw_vs_variant_key *key ); /******************************************************************************** @@ -166,12 +166,12 @@ draw_create_vs_ppc(struct draw_context *draw, const struct pipe_shader_state *templ); -struct draw_vs_varient_key; +struct draw_vs_variant_key; struct draw_vertex_shader; -struct draw_vs_varient * -draw_vs_create_varient_aos_sse( struct draw_vertex_shader *vs, - const struct draw_vs_varient_key *key ); +struct draw_vs_variant * +draw_vs_create_variant_aos_sse( struct draw_vertex_shader *vs, + const struct draw_vs_variant_key *key ); #if HAVE_LLVM struct draw_vertex_shader * @@ -181,7 +181,7 @@ draw_create_vs_llvm(struct draw_context *draw, /******************************************************************************** - * Helpers for vs implementations that don't do their own fetch/emit varients. + * Helpers for vs implementations that don't do their own fetch/emit variants. * Means these can be shared between shaders. */ struct translate; @@ -194,21 +194,21 @@ struct translate *draw_vs_get_fetch( struct draw_context *draw, struct translate *draw_vs_get_emit( struct draw_context *draw, struct translate_key *key ); -struct draw_vs_varient * -draw_vs_create_varient_generic( struct draw_vertex_shader *vs, - const struct draw_vs_varient_key *key ); +struct draw_vs_variant * +draw_vs_create_variant_generic( struct draw_vertex_shader *vs, + const struct draw_vs_variant_key *key ); -static INLINE int draw_vs_varient_keysize( const struct draw_vs_varient_key *key ) +static INLINE int draw_vs_variant_keysize( const struct draw_vs_variant_key *key ) { - return 2 * sizeof(int) + key->nr_elements * sizeof(struct draw_varient_element); + return 2 * sizeof(int) + key->nr_elements * sizeof(struct draw_variant_element); } -static INLINE int draw_vs_varient_key_compare( const struct draw_vs_varient_key *a, - const struct draw_vs_varient_key *b ) +static INLINE int draw_vs_variant_key_compare( const struct draw_vs_variant_key *a, + const struct draw_vs_variant_key *b ) { - int keysize = draw_vs_varient_keysize(a); + int keysize = draw_vs_variant_keysize(a); return memcmp(a, b, keysize); } diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 19f49e34c8b..7b90dba0cd5 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -1918,7 +1918,7 @@ static void find_last_write_outputs( struct aos_compilation *cp ) #define ARG_OUTBUF 4 -static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient, +static boolean build_vertex_program( struct draw_vs_variant_aos_sse *variant, boolean linear ) { struct tgsi_parse_context parse; @@ -1927,14 +1927,14 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient, util_init_math(); - tgsi_parse_init( &parse, varient->base.vs->state.tokens ); + tgsi_parse_init( &parse, variant->base.vs->state.tokens ); memset(&cp, 0, sizeof(cp)); cp.insn_counter = 1; - cp.vaos = varient; + cp.vaos = variant; cp.have_sse2 = 1; - cp.func = &varient->func[ linear ? 0 : 1 ]; + cp.func = &variant->func[ linear ? 0 : 1 ]; cp.tmp_EAX = x86_make_reg(file_REG32, reg_AX); cp.idx_EBX = x86_make_reg(file_REG32, reg_BX); @@ -2090,20 +2090,20 @@ static boolean build_vertex_program( struct draw_vs_varient_aos_sse *varient, /** cast wrapper */ -static INLINE struct draw_vs_varient_aos_sse * -draw_vs_varient_aos_sse(struct draw_vs_varient *varient) +static INLINE struct draw_vs_variant_aos_sse * +draw_vs_variant_aos_sse(struct draw_vs_variant *variant) { - return (struct draw_vs_varient_aos_sse *) varient; + return (struct draw_vs_variant_aos_sse *) variant; } -static void vaos_set_buffer( struct draw_vs_varient *varient, +static void vaos_set_buffer( struct draw_vs_variant *variant, unsigned buf, const void *ptr, unsigned stride, unsigned max_stride) { - struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient); + struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant); if (buf < vaos->nr_vb) { vaos->buffer[buf].base_ptr = (char *)ptr; @@ -2115,12 +2115,12 @@ static void vaos_set_buffer( struct draw_vs_varient *varient, -static void PIPE_CDECL vaos_run_elts( struct draw_vs_varient *varient, +static void PIPE_CDECL vaos_run_elts( struct draw_vs_variant *variant, const unsigned *elts, unsigned count, void *output_buffer ) { - struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient); + struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant); struct aos_machine *machine = vaos->draw->vs.aos_machine; unsigned i; @@ -2139,12 +2139,12 @@ static void PIPE_CDECL vaos_run_elts( struct draw_vs_varient *varient, output_buffer ); } -static void PIPE_CDECL vaos_run_linear( struct draw_vs_varient *varient, +static void PIPE_CDECL vaos_run_linear( struct draw_vs_variant *variant, unsigned start, unsigned count, void *output_buffer ) { - struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient); + struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant); struct aos_machine *machine = vaos->draw->vs.aos_machine; unsigned i; @@ -2171,9 +2171,9 @@ static void PIPE_CDECL vaos_run_linear( struct draw_vs_varient *varient, -static void vaos_destroy( struct draw_vs_varient *varient ) +static void vaos_destroy( struct draw_vs_variant *variant ) { - struct draw_vs_varient_aos_sse *vaos = draw_vs_varient_aos_sse(varient); + struct draw_vs_variant_aos_sse *vaos = draw_vs_variant_aos_sse(variant); FREE( vaos->buffer ); @@ -2185,11 +2185,11 @@ static void vaos_destroy( struct draw_vs_varient *varient ) -static struct draw_vs_varient *varient_aos_sse( struct draw_vertex_shader *vs, - const struct draw_vs_varient_key *key ) +static struct draw_vs_variant *variant_aos_sse( struct draw_vertex_shader *vs, + const struct draw_vs_variant_key *key ) { unsigned i; - struct draw_vs_varient_aos_sse *vaos = CALLOC_STRUCT(draw_vs_varient_aos_sse); + struct draw_vs_variant_aos_sse *vaos = CALLOC_STRUCT(draw_vs_variant_aos_sse); if (!vaos) goto fail; @@ -2249,17 +2249,17 @@ static struct draw_vs_varient *varient_aos_sse( struct draw_vertex_shader *vs, } -struct draw_vs_varient * -draw_vs_create_varient_aos_sse( struct draw_vertex_shader *vs, - const struct draw_vs_varient_key *key ) +struct draw_vs_variant * +draw_vs_create_variant_aos_sse( struct draw_vertex_shader *vs, + const struct draw_vs_variant_key *key ) { - struct draw_vs_varient *varient = varient_aos_sse( vs, key ); + struct draw_vs_variant *variant = variant_aos_sse( vs, key ); - if (varient == NULL) { - varient = draw_vs_create_varient_generic( vs, key ); + if (variant == NULL) { + variant = draw_vs_create_variant_generic( vs, key ); } - return varient; + return variant; } diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.h b/src/gallium/auxiliary/draw/draw_vs_aos.h index 68e8295b5e1..55e63d8b9fa 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.h +++ b/src/gallium/auxiliary/draw/draw_vs_aos.h @@ -98,9 +98,9 @@ struct aos_buffer { -/* This is the temporary storage used by all the aos_sse vs varients. +/* This is the temporary storage used by all the aos_sse vs variants. * Create one per context and reuse by passing a pointer in at - * vs_varient creation?? + * vs_variant creation?? */ struct aos_machine { float input [MAX_INPUTS ][4]; @@ -134,7 +134,7 @@ struct aos_machine { struct aos_compilation { struct x86_function *func; - struct draw_vs_varient_aos_sse *vaos; + struct draw_vs_variant_aos_sse *vaos; unsigned insn_counter; unsigned num_immediates; @@ -234,8 +234,8 @@ typedef void (PIPE_CDECL *vaos_run_linear_func)( struct aos_machine *, void *output_buffer); -struct draw_vs_varient_aos_sse { - struct draw_vs_varient base; +struct draw_vs_variant_aos_sse { + struct draw_vs_variant base; struct draw_context *draw; struct aos_buffer *buffer; diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c index dab3eb1ca8e..667eb507855 100644 --- a/src/gallium/auxiliary/draw/draw_vs_exec.c +++ b/src/gallium/auxiliary/draw/draw_vs_exec.c @@ -203,7 +203,7 @@ draw_create_vs_exec(struct draw_context *draw, vs->base.prepare = vs_exec_prepare; vs->base.run_linear = vs_exec_run_linear; vs->base.delete = vs_exec_delete; - vs->base.create_varient = draw_vs_create_varient_generic; + vs->base.create_variant = draw_vs_create_variant_generic; vs->machine = draw->vs.machine; return &vs->base; diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c index de074be0926..54a5574f73f 100644 --- a/src/gallium/auxiliary/draw/draw_vs_llvm.c +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -107,7 +107,7 @@ draw_create_vs_llvm(struct draw_context *draw, vs->base.prepare = vs_llvm_prepare; vs->base.run_linear = vs_llvm_run_linear; vs->base.delete = vs_llvm_delete; - vs->base.create_varient = draw_vs_create_varient_generic; + vs->base.create_variant = draw_vs_create_variant_generic; make_empty_list(&vs->variants); diff --git a/src/gallium/auxiliary/draw/draw_vs_ppc.c b/src/gallium/auxiliary/draw/draw_vs_ppc.c index 5df84916c51..cf894bbe8af 100644 --- a/src/gallium/auxiliary/draw/draw_vs_ppc.c +++ b/src/gallium/auxiliary/draw/draw_vs_ppc.c @@ -187,10 +187,10 @@ draw_create_vs_ppc(struct draw_context *draw, vs->base.draw = draw; #if 0 if (1) - vs->base.create_varient = draw_vs_varient_aos_ppc; + vs->base.create_variant = draw_vs_variant_aos_ppc; else #endif - vs->base.create_varient = draw_vs_create_varient_generic; + vs->base.create_variant = draw_vs_create_variant_generic; vs->base.prepare = vs_ppc_prepare; vs->base.run_linear = vs_ppc_run_linear; vs->base.delete = vs_ppc_delete; diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c index 0b0c6077c6f..dee7c0da9b6 100644 --- a/src/gallium/auxiliary/draw/draw_vs_sse.c +++ b/src/gallium/auxiliary/draw/draw_vs_sse.c @@ -166,9 +166,9 @@ draw_create_vs_sse(struct draw_context *draw, vs->base.draw = draw; if (1) - vs->base.create_varient = draw_vs_create_varient_aos_sse; + vs->base.create_variant = draw_vs_create_variant_aos_sse; else - vs->base.create_varient = draw_vs_create_varient_generic; + vs->base.create_variant = draw_vs_create_variant_generic; vs->base.prepare = vs_sse_prepare; vs->base.run_linear = vs_sse_run_linear; vs->base.delete = vs_sse_delete; diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_varient.c index eacd1601877..d8f030f61eb 100644 --- a/src/gallium/auxiliary/draw/draw_vs_varient.c +++ b/src/gallium/auxiliary/draw/draw_vs_varient.c @@ -41,8 +41,8 @@ /* A first pass at incorporating vertex fetch/emit functionality into */ -struct draw_vs_varient_generic { - struct draw_vs_varient base; +struct draw_vs_variant_generic { + struct draw_vs_variant base; struct draw_vertex_shader *shader; struct draw_context *draw; @@ -63,13 +63,13 @@ struct draw_vs_varient_generic { -static void vsvg_set_buffer( struct draw_vs_varient *varient, +static void vsvg_set_buffer( struct draw_vs_variant *variant, unsigned buffer, const void *ptr, unsigned stride, unsigned max_index ) { - struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient; + struct draw_vs_variant_generic *vsvg = (struct draw_vs_variant_generic *)variant; vsvg->fetch->set_buffer(vsvg->fetch, buffer, @@ -81,7 +81,7 @@ static void vsvg_set_buffer( struct draw_vs_varient *varient, /* Mainly for debug at this stage: */ -static void do_rhw_viewport( struct draw_vs_varient_generic *vsvg, +static void do_rhw_viewport( struct draw_vs_variant_generic *vsvg, unsigned count, void *output_buffer ) { @@ -104,7 +104,7 @@ static void do_rhw_viewport( struct draw_vs_varient_generic *vsvg, } } -static void do_viewport( struct draw_vs_varient_generic *vsvg, +static void do_viewport( struct draw_vs_variant_generic *vsvg, unsigned count, void *output_buffer ) { @@ -126,12 +126,12 @@ static void do_viewport( struct draw_vs_varient_generic *vsvg, } -static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient, +static void PIPE_CDECL vsvg_run_elts( struct draw_vs_variant *variant, const unsigned *elts, unsigned count, void *output_buffer) { - struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient; + struct draw_vs_variant_generic *vsvg = (struct draw_vs_variant_generic *)variant; unsigned temp_vertex_stride = vsvg->temp_vertex_stride; void *temp_buffer = MALLOC( align(count,4) * temp_vertex_stride ); @@ -193,12 +193,12 @@ static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient, } -static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient, +static void PIPE_CDECL vsvg_run_linear( struct draw_vs_variant *variant, unsigned start, unsigned count, void *output_buffer ) { - struct draw_vs_varient_generic *vsvg = (struct draw_vs_varient_generic *)varient; + struct draw_vs_variant_generic *vsvg = (struct draw_vs_variant_generic *)variant; unsigned temp_vertex_stride = vsvg->temp_vertex_stride; void *temp_buffer = MALLOC( align(count,4) * temp_vertex_stride ); @@ -259,20 +259,20 @@ static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient, -static void vsvg_destroy( struct draw_vs_varient *varient ) +static void vsvg_destroy( struct draw_vs_variant *variant ) { - FREE(varient); + FREE(variant); } -struct draw_vs_varient * -draw_vs_create_varient_generic( struct draw_vertex_shader *vs, - const struct draw_vs_varient_key *key ) +struct draw_vs_variant * +draw_vs_create_variant_generic( struct draw_vertex_shader *vs, + const struct draw_vs_variant_key *key ) { unsigned i; struct translate_key fetch, emit; - struct draw_vs_varient_generic *vsvg = CALLOC_STRUCT( draw_vs_varient_generic ); + struct draw_vs_variant_generic *vsvg = CALLOC_STRUCT( draw_vs_variant_generic ); if (vsvg == NULL) return NULL; -- cgit v1.2.3 From ee16e97ed1d0921c533c77688b278bef393d9922 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 10:13:02 -0700 Subject: gallivm: work around LLVM 2.6 bug when calling C functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create a constant int pointer to the C function, then cast it to the function's type. This avoids using trampoline code which seem to be inadvertantly freed by LLVM in some situations (which leads to segfaults). The root issue and work-around were found by José. NOTE: This is a candidate for the 7.10 branch --- src/gallium/auxiliary/gallivm/lp_bld_const.h | 18 ++++++++ src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 54 ++++++++++++++++++----- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.h b/src/gallium/auxiliary/gallivm/lp_bld_const.h index c749a7a3150..680211fbbd7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_const.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_const.h @@ -125,4 +125,22 @@ lp_build_const_float(struct gallivm_state *gallivm, float x) } +/** Return constant-valued pointer to int */ +static INLINE LLVMValueRef +lp_build_const_int_pointer(struct gallivm_state *gallivm, const void *ptr) +{ + LLVMTypeRef int_type; + LLVMValueRef v; + + /* int type large enough to hold a pointer */ + int_type = LLVMIntTypeInContext(gallivm->context, 8 * sizeof(void *)); + v = LLVMConstInt(int_type, (unsigned long long) ptr, 0); + v = LLVMBuildIntToPtr(gallivm->builder, v, + LLVMPointerType(int_type, 0), + "cast int to ptr"); + return v; +} + + + #endif /* !LP_BLD_CONST_H */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index 75d2e666f09..905cf66137c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -36,6 +36,7 @@ #include "util/u_format.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_pointer.h" #include "util/u_string.h" #include "lp_bld_arit.h" @@ -520,6 +521,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, LLVMValueRef tmp_ptr; LLVMValueRef tmp; LLVMValueRef res; + LLVMValueRef callee; unsigned k; util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_8unorm", @@ -535,6 +537,10 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, function = LLVMGetNamedFunction(module, name); if (!function) { + /* + * Function to call looks like: + * fetch(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) + */ LLVMTypeRef ret_type; LLVMTypeRef arg_types[4]; LLVMTypeRef function_type; @@ -542,19 +548,26 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, ret_type = LLVMVoidTypeInContext(gallivm->context); arg_types[0] = pi8t; arg_types[1] = pi8t; - arg_types[3] = arg_types[2] = LLVMIntTypeInContext(gallivm->context, sizeof(unsigned) * 8); - function_type = LLVMFunctionType(ret_type, arg_types, Elements(arg_types), 0); + arg_types[2] = i32t; + arg_types[3] = i32t; + function_type = LLVMFunctionType(ret_type, arg_types, + Elements(arg_types), 0); function = LLVMAddFunction(module, name, function_type); LLVMSetFunctionCallConv(function, LLVMCCallConv); LLVMSetLinkage(function, LLVMExternalLinkage); assert(LLVMIsDeclaration(function)); - - LLVMAddGlobalMapping(gallivm->engine, function, - func_to_pointer((func_pointer)format_desc->fetch_rgba_8unorm)); } + /* make const pointer for the C fetch_rgba_float function */ + callee = lp_build_const_int_pointer(gallivm, + func_to_pointer((func_pointer) format_desc->fetch_rgba_float)); + + /* cast the callee pointer to the function's type */ + function = LLVMBuildBitCast(builder, callee, + LLVMTypeOf(function), "cast callee"); + tmp_ptr = lp_build_alloca(gallivm, i32t, ""); res = LLVMGetUndef(LLVMVectorType(i32t, num_pixels)); @@ -619,10 +632,13 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, LLVMTypeRef f32t = LLVMFloatTypeInContext(gallivm->context); LLVMTypeRef f32x4t = LLVMVectorType(f32t, 4); LLVMTypeRef pf32t = LLVMPointerType(f32t, 0); + LLVMTypeRef pi8t = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); + LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context); LLVMValueRef function; LLVMValueRef tmp_ptr; LLVMValueRef tmps[LP_MAX_VECTOR_LENGTH/4]; LLVMValueRef res; + LLVMValueRef callee; unsigned k; util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_float", @@ -638,26 +654,42 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, function = LLVMGetNamedFunction(module, name); if (!function) { + /* + * Function to call looks like: + * fetch(float *dst, const uint8_t *src, unsigned i, unsigned j) + */ LLVMTypeRef ret_type; LLVMTypeRef arg_types[4]; LLVMTypeRef function_type; ret_type = LLVMVoidTypeInContext(gallivm->context); arg_types[0] = pf32t; - arg_types[1] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); - arg_types[3] = arg_types[2] = LLVMIntTypeInContext(gallivm->context, sizeof(unsigned) * 8); - function_type = LLVMFunctionType(ret_type, arg_types, Elements(arg_types), 0); + arg_types[1] = pi8t; + arg_types[2] = i32t; + arg_types[3] = i32t; + function_type = LLVMFunctionType(ret_type, arg_types, + Elements(arg_types), 0); function = LLVMAddFunction(module, name, function_type); LLVMSetFunctionCallConv(function, LLVMCCallConv); LLVMSetLinkage(function, LLVMExternalLinkage); assert(LLVMIsDeclaration(function)); - - LLVMAddGlobalMapping(gallivm->engine, function, - func_to_pointer((func_pointer)format_desc->fetch_rgba_float)); } + /* Note: we're using this casting here instead of LLVMAddGlobalMapping() + * to work around a bug in LLVM 2.6. + */ + + /* make const pointer for the C fetch_rgba_float function */ + callee = lp_build_const_int_pointer(gallivm, + func_to_pointer((func_pointer) format_desc->fetch_rgba_float)); + + /* cast the callee pointer to the function's type */ + function = LLVMBuildBitCast(builder, callee, + LLVMTypeOf(function), "cast callee"); + + tmp_ptr = lp_build_alloca(gallivm, f32x4t, ""); /* -- cgit v1.2.3 From 99c7840b0c10dbc731cad93b02b3865855ad086b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 15 Dec 2010 11:37:45 -0800 Subject: intel: Update renderbuffers before looking up CopyTexImage's read buffer. Not fixing a particular bug, just noticed by code inspection. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 87b31bf078c..5540c9849b4 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -101,8 +101,11 @@ do_copy_texsubimage(struct intel_context *intel, GLint x, GLint y, GLsizei width, GLsizei height) { struct gl_context *ctx = &intel->ctx; - const struct intel_region *src = get_teximage_source(intel, internalFormat); + const struct intel_region *src; + /* intel_flush(ctx); */ + intel_prepare_render(intel); + src = get_teximage_source(intel, internalFormat); if (!intelImage->mt || !src || !src->buffer) { if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) fprintf(stderr, "%s fail %p %p (0x%08x)\n", @@ -116,8 +119,6 @@ do_copy_texsubimage(struct intel_context *intel, return GL_FALSE; } - /* intel_flush(ctx); */ - intel_prepare_render(intel); { drm_intel_bo *dst_bo = intel_region_buffer(intel, intelImage->mt->region, -- cgit v1.2.3 From e65c643792d1327a0a491f5d4a707467a6955746 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 15 Dec 2010 11:46:37 -0800 Subject: intel: Drop commented intel_flush from copy_teximage. The blit that follows appears in the command stream so it's serialized with previous rendering. Any queued vertices in the tnl layer were already flushed up in mesa/main/. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 5540c9849b4..381ad14dcbf 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -103,7 +103,6 @@ do_copy_texsubimage(struct intel_context *intel, struct gl_context *ctx = &intel->ctx; const struct intel_region *src; - /* intel_flush(ctx); */ intel_prepare_render(intel); src = get_teximage_source(intel, internalFormat); if (!intelImage->mt || !src || !src->buffer) { -- cgit v1.2.3 From ec03b316b4dc5d56b8510cc5aeb0f71a4fdada18 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 15 Dec 2010 11:54:38 -0800 Subject: intel: Try to sanely check that formats match for CopyTexImage. Before, we were going off of a couple of known (hopeful) matches between internalFormats and the cpp of the read buffer. Instead, we can now just look at the gl_format of the two to see if they match. We should avoid bad blits that might have been possible before, but also allow different internalFormats to work without having to enumerate each one. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 60 ++++++++++------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 381ad14dcbf..c4a3364ceba 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -50,44 +50,20 @@ * Do the best we can using the blitter. A future project is to use * the texture engine and fragment programs for these copies. */ -static const struct intel_region * -get_teximage_source(struct intel_context *intel, GLenum internalFormat) +static struct intel_renderbuffer * +get_teximage_readbuffer(struct intel_context *intel, GLenum internalFormat) { - struct intel_renderbuffer *irb; - DBG("%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(internalFormat)); switch (internalFormat) { case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: - irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH); - if (irb && irb->region && irb->region->cpp == 2) - return irb->region; - return NULL; case GL_DEPTH24_STENCIL8_EXT: case GL_DEPTH_STENCIL_EXT: - irb = intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH); - if (irb && irb->region && irb->region->cpp == 4) - return irb->region; - return NULL; - case 4: - case GL_RGBA: - case GL_RGBA8: - irb = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer); - /* We're required to set alpha to 1.0 in this case, but we can't - * do that with the blitter, so fall back. We could use the 3D - * engine or do two passes with the blitter, but it doesn't seem - * worth it for this case. */ - if (irb->Base._BaseFormat == GL_RGB) - return NULL; - return irb->region; - case 3: - case GL_RGB: - case GL_RGB8: - return intel_readbuf_region(intel); + return intel_get_renderbuffer(intel->ctx.ReadBuffer, BUFFER_DEPTH); default: - return NULL; + return intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer); } } @@ -101,20 +77,24 @@ do_copy_texsubimage(struct intel_context *intel, GLint x, GLint y, GLsizei width, GLsizei height) { struct gl_context *ctx = &intel->ctx; - const struct intel_region *src; + struct intel_renderbuffer *irb; intel_prepare_render(intel); - src = get_teximage_source(intel, internalFormat); - if (!intelImage->mt || !src || !src->buffer) { + + irb = get_teximage_readbuffer(intel, internalFormat); + if (!intelImage->mt || !irb) { if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) fprintf(stderr, "%s fail %p %p (0x%08x)\n", - __FUNCTION__, intelImage->mt, src, internalFormat); + __FUNCTION__, intelImage->mt, irb, internalFormat); return GL_FALSE; } - if (intelImage->mt->cpp != src->cpp) { - fallback_debug("%s fail %d vs %d cpp\n", - __FUNCTION__, intelImage->mt->cpp, src->cpp); + if (intelImage->base.TexFormat != irb->Base.Format) { + if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) + fprintf(stderr, "%s mismatched formats %s, %s\n", + __FUNCTION__, + _mesa_get_format_name(intelImage->base.TexFormat), + _mesa_get_format_name(irb->Base.Format)); return GL_FALSE; } @@ -140,24 +120,24 @@ do_copy_texsubimage(struct intel_context *intel, if (ctx->ReadBuffer->Name == 0) { /* Flip vertical orientation for system framebuffers */ y = ctx->ReadBuffer->Height - (y + height); - src_pitch = -src->pitch; + src_pitch = -irb->region->pitch; } else { /* reading from a FBO, y is already oriented the way we like */ - src_pitch = src->pitch; + src_pitch = irb->region->pitch; } /* blit from src buffer to texture */ if (!intelEmitCopyBlit(intel, intelImage->mt->cpp, src_pitch, - src->buffer, + irb->region->buffer, 0, - src->tiling, + irb->region->tiling, intelImage->mt->region->pitch, dst_bo, 0, intelImage->mt->region->tiling, - src->draw_x + x, src->draw_y + y, + irb->region->draw_x + x, irb->region->draw_y + y, image_x + dstx, image_y + dsty, width, height, GL_COPY)) { -- cgit v1.2.3 From 290a1141bc561cbd8fd2bbbb0a7c24d1b6abe0b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 15 Dec 2010 12:10:03 -0800 Subject: intel: Support glCopyTexImage() from XRGB8888 to ARGB8888. The only mismatch between the two is that we have to clear the destination's alpha to 1.0. Fixes WOW performance on my Ironlake, from a few frames a second to almost playable. --- src/mesa/drivers/dri/intel/intel_blit.c | 80 +++++++++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_blit.h | 2 + src/mesa/drivers/dri/intel/intel_tex_copy.c | 14 ++++- 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index ede88de82f1..a2822b11d96 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -38,6 +38,8 @@ #include "intel_reg.h" #include "intel_regions.h" #include "intel_batchbuffer.h" +#include "intel_tex.h" +#include "intel_mipmap_tree.h" #define FILE_DEBUG_FLAG DEBUG_BLIT @@ -500,3 +502,81 @@ intel_emit_linear_blit(struct intel_context *intel, assert(ok); } } + +/** + * Used to initialize the alpha value of an ARGB8888 teximage after + * loading it from an XRGB8888 source. + * + * This is very common with glCopyTexImage2D(). + */ +void +intel_set_teximage_alpha_to_one(struct gl_context *ctx, + struct intel_texture_image *intel_image) +{ + struct intel_context *intel = intel_context(ctx); + unsigned int image_x, image_y; + uint32_t x1, y1, x2, y2; + uint32_t BR13, CMD; + int pitch, cpp; + drm_intel_bo *aper_array[2]; + struct intel_region *region = intel_image->mt->region; + BATCH_LOCALS; + + assert(intel_image->base.TexFormat == MESA_FORMAT_ARGB8888); + + /* get dest x/y in destination texture */ + intel_miptree_get_image_offset(intel_image->mt, + intel_image->level, + intel_image->face, + 0, + &image_x, &image_y); + + x1 = image_x; + y1 = image_y; + x2 = image_x + intel_image->base.Width; + y2 = image_y + intel_image->base.Height; + + pitch = region->pitch; + cpp = region->cpp; + + DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n", + __FUNCTION__, + intel_image->mt->region->buffer, (pitch * region->cpp), + x1, y1, x2 - x1, y2 - y1); + + BR13 = br13_for_cpp(region->cpp) | 0xf0 << 16; + CMD = XY_COLOR_BLT_CMD; + CMD |= XY_BLT_WRITE_ALPHA; + + assert(region->tiling != I915_TILING_Y); + +#ifndef I915 + if (region->tiling != I915_TILING_NONE) { + CMD |= XY_DST_TILED; + pitch /= 4; + } +#endif + BR13 |= (pitch * region->cpp); + + /* do space check before going any further */ + aper_array[0] = intel->batch->buf; + aper_array[1] = region->buffer; + + if (drm_intel_bufmgr_check_aperture_space(aper_array, + ARRAY_SIZE(aper_array)) != 0) { + intel_batchbuffer_flush(intel->batch); + } + + BEGIN_BATCH_BLT(6); + OUT_BATCH(CMD); + OUT_BATCH(BR13); + OUT_BATCH((y1 << 16) | x1); + OUT_BATCH((y2 << 16) | x2); + OUT_RELOC_FENCED(region->buffer, + I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, + 0); + OUT_BATCH(0xffffffff); /* white, but only alpha gets written */ + ADVANCE_BATCH(); + + intel_batchbuffer_emit_mi_flush(intel->batch); +} diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 01631465735..ff69e4f8f8f 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -69,5 +69,7 @@ void intel_emit_linear_blit(struct intel_context *intel, drm_intel_bo *src_bo, unsigned int src_offset, unsigned int size); +void intel_set_teximage_alpha_to_one(struct gl_context *ctx, + struct intel_texture_image *intel_image); #endif diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index c4a3364ceba..c6bc3d962ab 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -78,18 +78,25 @@ do_copy_texsubimage(struct intel_context *intel, { struct gl_context *ctx = &intel->ctx; struct intel_renderbuffer *irb; + bool copy_supported_with_alpha_override = false; intel_prepare_render(intel); irb = get_teximage_readbuffer(intel, internalFormat); - if (!intelImage->mt || !irb) { + if (!intelImage->mt || !irb || !irb->region) { if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) fprintf(stderr, "%s fail %p %p (0x%08x)\n", __FUNCTION__, intelImage->mt, irb, internalFormat); return GL_FALSE; } - if (intelImage->base.TexFormat != irb->Base.Format) { + if (irb->Base.Format == MESA_FORMAT_XRGB8888 && + intelImage->base.TexFormat == MESA_FORMAT_ARGB8888) { + copy_supported_with_alpha_override = true; + } + + if (intelImage->base.TexFormat != irb->Base.Format && + !copy_supported_with_alpha_override) { if (unlikely(INTEL_DEBUG & DEBUG_FALLBACKS)) fprintf(stderr, "%s mismatched formats %s, %s\n", __FUNCTION__, @@ -145,6 +152,9 @@ do_copy_texsubimage(struct intel_context *intel, } } + if (copy_supported_with_alpha_override) + intel_set_teximage_alpha_to_one(ctx, intelImage); + return GL_TRUE; } -- cgit v1.2.3 From fcc7024afec9b02069334b57c2c6bd20f1138731 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 16 Dec 2010 15:52:55 -0500 Subject: r600c : inline vertex format is not updated in an app, switch to use vfetch constants. For the 7.9 and 7.10 branches as well. --- src/mesa/drivers/dri/r600/r700_assembler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 1fa559cec1a..bee9c3bc6d3 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1134,7 +1134,7 @@ GLboolean EG_assemble_vfetch_instruction(r700_AssemblerBase* pAsm, EG_VTX_WORD1__DST_SEL_W_shift, EG_VTX_WORD1__DST_SEL_W_mask); - SETfield(vfetch_instruction_ptr->m_Word1.val, 0, /* use format here, in r6/r7, format used set in const, need to use same */ + SETfield(vfetch_instruction_ptr->m_Word1.val, 1, EG_VTX_WORD1__UCF_shift, EG_VTX_WORD1__UCF_bit); SETfield(vfetch_instruction_ptr->m_Word1.val, data_format, -- cgit v1.2.3 From 3ecf47af1252ad10f98d5ce488cc1b91fab64c25 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 14:29:15 -0700 Subject: gallivm: fix copy&paste error from previous commit Fixes piglit regression, http://bugs.freedesktop.org/show_bug.cgi?id=32452 NOTE: This is a candidate for the 7.10 branch --- src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index 905cf66137c..8a4261fb05b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -562,7 +562,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, /* make const pointer for the C fetch_rgba_float function */ callee = lp_build_const_int_pointer(gallivm, - func_to_pointer((func_pointer) format_desc->fetch_rgba_float)); + func_to_pointer((func_pointer) format_desc->fetch_rgba_8unorm)); /* cast the callee pointer to the function's type */ function = LLVMBuildBitCast(builder, callee, -- cgit v1.2.3 From 9d9f8aba0aa51f707ac1d451fb8a89bb95676ab1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 17:38:16 -0700 Subject: softpipe: fix depth texture sampling regression We need to keep using the pipe_get_tile_swizzle() even though there's no swizzling because we need to explicitly pass in the surface format. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32459 --- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index e5708a1c88a..6fd324ffe58 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -278,15 +278,23 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, tc->tex_z = addr.bits.z; } - /* get tile from the transfer (view into texture) */ - pipe_get_tile_rgba(tc->pipe, - tc->tex_trans, - addr.bits.x * TILE_SIZE, - addr.bits.y * TILE_SIZE, - TILE_SIZE, - TILE_SIZE, - (float *) tile->data.color); - + /* get tile from the transfer (view into texture) + * Note we're using the swizzle version of this fuction only because + * we need to pass the texture cache's format explicitly. + */ + pipe_get_tile_swizzle(tc->pipe, + tc->tex_trans, + addr.bits.x * TILE_SIZE, + addr.bits.y * TILE_SIZE, + TILE_SIZE, + TILE_SIZE, + PIPE_SWIZZLE_RED, + PIPE_SWIZZLE_GREEN, + PIPE_SWIZZLE_BLUE, + PIPE_SWIZZLE_ALPHA, + tc->format, + (float *) tile->data.color); + tile->addr = addr; } -- cgit v1.2.3 From 42a0967a36ff3331de96289125243e6afeb5d560 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Dec 2010 18:17:20 -0700 Subject: softpipe: remove sp_tex_tile_cache_border_color() With swizzling done at the end of texture sampling, we can greatly simplify swizzling of the border color. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=32460 --- src/gallium/drivers/softpipe/sp_tex_sample.c | 6 ++---- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 23 ----------------------- src/gallium/drivers/softpipe/sp_tex_tile_cache.h | 7 ------- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 70fa74b7e4b..cbc40d4b446 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -659,8 +659,7 @@ get_texel_2d(const struct sp_sampler_variant *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level)) { - return sp_tex_tile_cache_border_color(samp->cache, - samp->sampler->border_color); + return samp->sampler->border_color; } else { return get_texel_2d_no_border( samp, addr, x, y ); @@ -754,8 +753,7 @@ get_texel_3d(const struct sp_sampler_variant *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level) || z < 0 || z >= (int) u_minify(texture->depth0, level)) { - return sp_tex_tile_cache_border_color(samp->cache, - samp->sampler->border_color); + return samp->sampler->border_color; } else { return get_texel_3d_no_border( samp, addr, x, y, z ); diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index 6fd324ffe58..e42015ad498 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -301,26 +301,3 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, tc->last_tile = tile; return tile; } - - - -/** - * Return the swizzled border color. - */ -const float * -sp_tex_tile_cache_border_color(struct softpipe_tex_tile_cache *tc, - const float border_color[4]) -{ - float rgba01[6]; - - COPY_4V(rgba01, border_color); - rgba01[PIPE_SWIZZLE_ZERO] = 0.0f; - rgba01[PIPE_SWIZZLE_ONE] = 1.0f; - - tc->swz_border_color[0] = rgba01[tc->swizzle_r]; - tc->swz_border_color[1] = rgba01[tc->swizzle_g]; - tc->swz_border_color[2] = rgba01[tc->swizzle_b]; - tc->swz_border_color[3] = rgba01[tc->swizzle_a]; - - return tc->swz_border_color; -} diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h index e0b66bf3f7c..2220955b715 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h @@ -95,8 +95,6 @@ struct softpipe_tex_tile_cache unsigned format; struct softpipe_tex_cached_tile *last_tile; /**< most recently retrieved tile */ - - float swz_border_color[4]; /**< swizzled border color */ }; @@ -161,10 +159,5 @@ sp_get_cached_tile_tex(struct softpipe_tex_tile_cache *tc, } -const float * -sp_tex_tile_cache_border_color(struct softpipe_tex_tile_cache *tc, - const float border_color[4]); - - #endif /* SP_TEX_TILE_CACHE_H */ -- cgit v1.2.3 From d0f8eea9a06d8268a21ac58b134964a602f9594e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 16 Dec 2010 17:40:00 -0800 Subject: Remove OES_compressed_paletted_texture from the ES2 extension list. We don't support it. --- src/mesa/main/extensions.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 05e04504c78..f3bf5cb164b 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -858,8 +858,6 @@ make_extension_string_es2(const struct gl_context *ctx, GLubyte *str) { size_t len = 0; - len += append_extension(&str, "GL_OES_compressed_paletted_texture"); - if (ctx->Extensions.ARB_framebuffer_object) { len += append_extension(&str, "GL_OES_depth24"); len += append_extension(&str, "GL_OES_depth32"); -- cgit v1.2.3 From daffaca53e47faeaaefb98ca46fe4870133d9f02 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 17 Dec 2010 08:59:32 +0100 Subject: r300g: finally fix the texture corruption on r3xx-r4xx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though a bound texture stays bound when calling set_fragment_sampler_views, it must be assigned a new cache region depending on the occupancy of other texture units. This fixes: https://bugs.freedesktop.org/show_bug.cgi?id=28800 Thanks to Álmos for finding the bug in the code. NOTE: This is a candidate for both the 7.9 and 7.10 branches. --- src/gallium/drivers/r300/r300_state.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 0ad8a1f4204..f902db54cc1 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1298,29 +1298,27 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, } for (i = 0; i < count; i++) { - if (&state->sampler_views[i]->base != views[i]) { - pipe_sampler_view_reference( - (struct pipe_sampler_view**)&state->sampler_views[i], - views[i]); + pipe_sampler_view_reference( + (struct pipe_sampler_view**)&state->sampler_views[i], + views[i]); - if (!views[i]) { - continue; - } + if (!views[i]) { + continue; + } - /* A new sampler view (= texture)... */ - dirty_tex = TRUE; + /* A new sampler view (= texture)... */ + dirty_tex = TRUE; - /* Set the texrect factor in the fragment shader. + /* Set the texrect factor in the fragment shader. * Needed for RECT and NPOT fallback. */ - texture = r300_texture(views[i]->texture); - if (texture->desc.is_npot) { - r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state); - } + texture = r300_texture(views[i]->texture); + if (texture->desc.is_npot) { + r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state); + } - state->sampler_views[i]->texcache_region = + state->sampler_views[i]->texcache_region = r300_assign_texture_cache_region(view_index, real_num_views); - view_index++; - } + view_index++; } for (i = count; i < tex_units; i++) { -- cgit v1.2.3 From 5c229e5fbd8ffa573ab2c1225f182036792a75af Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 13 Dec 2010 11:19:38 -0800 Subject: glsl: Expose a public glsl_type::void_type const pointer. This is analogous to glsl_type::int_type and all the others. --- src/glsl/builtin_types.h | 3 ++- src/glsl/glsl_types.cpp | 4 ++-- src/glsl/glsl_types.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h index 443ae1606ed..8ccbf6e312f 100644 --- a/src/glsl/builtin_types.h +++ b/src/glsl/builtin_types.h @@ -24,10 +24,11 @@ const glsl_type glsl_type::_error_type = glsl_type(GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0, ""); -const glsl_type glsl_type::void_type = +const glsl_type glsl_type::_void_type = glsl_type(GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0, "void"); const glsl_type *const glsl_type::error_type = & glsl_type::_error_type; +const glsl_type *const glsl_type::void_type = & glsl_type::_void_type; /** \name Core built-in types * diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index 8c33cfa20d0..95b85926482 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -120,7 +120,7 @@ glsl_type::generate_100ES_types(glsl_symbol_table *symtab) add_types_to_symbol_table(symtab, builtin_structure_types, Elements(builtin_structure_types), false); - add_types_to_symbol_table(symtab, &void_type, 1, false); + add_types_to_symbol_table(symtab, void_type, 1, false); } void @@ -279,7 +279,7 @@ const glsl_type * glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns) { if (base_type == GLSL_TYPE_VOID) - return &void_type; + return void_type; if ((rows < 1) || (rows > 4) || (columns < 1) || (columns > 4)) return error_type; diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index d62d493c8e8..57e7b09d98c 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -142,6 +142,7 @@ struct glsl_type { */ /*@{*/ static const glsl_type *const error_type; + static const glsl_type *const void_type; static const glsl_type *const int_type; static const glsl_type *const ivec4_type; static const glsl_type *const uint_type; @@ -424,7 +425,7 @@ private: */ /*@{*/ static const glsl_type _error_type; - static const glsl_type void_type; + static const glsl_type _void_type; static const glsl_type builtin_core_types[]; static const glsl_type builtin_structure_types[]; static const glsl_type builtin_110_deprecated_structure_types[]; -- cgit v1.2.3 From 3f94d96fce244bbe8a9edc15758729ce0e604ae2 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 17 Dec 2010 20:08:35 +0000 Subject: gallivm: Cleanup util_format_xxx_fetch_xxx call generation. No need to register function prototypes in the module now that we call the C function pointer directly -- less LLVM objects lying around. Limited testing with lp_test_format. --- src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 71 ++++++++--------------- 1 file changed, 24 insertions(+), 47 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index 8a4261fb05b..82ab19eda14 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -512,8 +512,6 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, * or incentive to optimize. */ - LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(gallivm->builder))); - char name[256]; LLVMTypeRef i8t = LLVMInt8TypeInContext(gallivm->context); LLVMTypeRef pi8t = LLVMPointerType(i8t, 0); LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context); @@ -521,22 +519,18 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, LLVMValueRef tmp_ptr; LLVMValueRef tmp; LLVMValueRef res; - LLVMValueRef callee; unsigned k; - util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_8unorm", - format_desc->short_name); - if (gallivm_debug & GALLIVM_DEBUG_PERF) { - debug_printf("%s: falling back to %s\n", __FUNCTION__, name); + debug_printf("%s: falling back to util_format_%s_fetch_rgba_8unorm\n", + __FUNCTION__, format_desc->short_name); } /* * Declare and bind format_desc->fetch_rgba_8unorm(). */ - function = LLVMGetNamedFunction(module, name); - if (!function) { + { /* * Function to call looks like: * fetch(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) @@ -552,22 +546,17 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, arg_types[3] = i32t; function_type = LLVMFunctionType(ret_type, arg_types, Elements(arg_types), 0); - function = LLVMAddFunction(module, name, function_type); - LLVMSetFunctionCallConv(function, LLVMCCallConv); - LLVMSetLinkage(function, LLVMExternalLinkage); + /* make const pointer for the C fetch_rgba_8unorm function */ + function = lp_build_const_int_pointer(gallivm, + func_to_pointer((func_pointer) format_desc->fetch_rgba_8unorm)); - assert(LLVMIsDeclaration(function)); + /* cast the callee pointer to the function's type */ + function = LLVMBuildBitCast(builder, function, + LLVMPointerType(function_type, 0), + "cast callee"); } - /* make const pointer for the C fetch_rgba_float function */ - callee = lp_build_const_int_pointer(gallivm, - func_to_pointer((func_pointer) format_desc->fetch_rgba_8unorm)); - - /* cast the callee pointer to the function's type */ - function = LLVMBuildBitCast(builder, callee, - LLVMTypeOf(function), "cast callee"); - tmp_ptr = lp_build_alloca(gallivm, i32t, ""); res = LLVMGetUndef(LLVMVectorType(i32t, num_pixels)); @@ -627,8 +616,6 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, * or incentive to optimize. */ - LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder))); - char name[256]; LLVMTypeRef f32t = LLVMFloatTypeInContext(gallivm->context); LLVMTypeRef f32x4t = LLVMVectorType(f32t, 4); LLVMTypeRef pf32t = LLVMPointerType(f32t, 0); @@ -638,22 +625,18 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, LLVMValueRef tmp_ptr; LLVMValueRef tmps[LP_MAX_VECTOR_LENGTH/4]; LLVMValueRef res; - LLVMValueRef callee; unsigned k; - util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_float", - format_desc->short_name); - if (gallivm_debug & GALLIVM_DEBUG_PERF) { - debug_printf("%s: falling back to %s\n", __FUNCTION__, name); + debug_printf("%s: falling back to util_format_%s_fetch_rgba_float\n", + __FUNCTION__, format_desc->short_name); } /* * Declare and bind format_desc->fetch_rgba_float(). */ - function = LLVMGetNamedFunction(module, name); - if (!function) { + { /* * Function to call looks like: * fetch(float *dst, const uint8_t *src, unsigned i, unsigned j) @@ -669,26 +652,20 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, arg_types[3] = i32t; function_type = LLVMFunctionType(ret_type, arg_types, Elements(arg_types), 0); - function = LLVMAddFunction(module, name, function_type); - - LLVMSetFunctionCallConv(function, LLVMCCallConv); - LLVMSetLinkage(function, LLVMExternalLinkage); - assert(LLVMIsDeclaration(function)); - } - - /* Note: we're using this casting here instead of LLVMAddGlobalMapping() - * to work around a bug in LLVM 2.6. - */ - - /* make const pointer for the C fetch_rgba_float function */ - callee = lp_build_const_int_pointer(gallivm, - func_to_pointer((func_pointer) format_desc->fetch_rgba_float)); + /* Note: we're using this casting here instead of LLVMAddGlobalMapping() + * to work around a bug in LLVM 2.6, and for efficiency/simplicity. + */ - /* cast the callee pointer to the function's type */ - function = LLVMBuildBitCast(builder, callee, - LLVMTypeOf(function), "cast callee"); + /* make const pointer for the C fetch_rgba_float function */ + function = lp_build_const_int_pointer(gallivm, + func_to_pointer((func_pointer) format_desc->fetch_rgba_float)); + /* cast the callee pointer to the function's type */ + function = LLVMBuildBitCast(builder, function, + LLVMPointerType(function_type, 0), + "cast callee"); + } tmp_ptr = lp_build_alloca(gallivm, f32x4t, ""); -- cgit v1.2.3 From d7423a653175352c5e2017f1de647bc7ef5ede43 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 17 Dec 2010 19:25:37 -0800 Subject: glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec). These mistakenly computed 't' instead of t * t * (3.0 - 2.0 * t). Also, properly vectorize the smoothstep(float, float, vec) variants. NOTE: This is a candidate for the 7.9 and 7.10 branches. --- src/glsl/builtins/ir/smoothstep | 121 +++++++++++----------------------------- 1 file changed, 34 insertions(+), 87 deletions(-) diff --git a/src/glsl/builtins/ir/smoothstep b/src/glsl/builtins/ir/smoothstep index 0164219a056..b283f73d8d3 100644 --- a/src/glsl/builtins/ir/smoothstep +++ b/src/glsl/builtins/ir/smoothstep @@ -5,40 +5,26 @@ (declare (in) float edge1) (declare (in) float x)) ((declare () float t) - (assign (constant bool (1)) (x) (var_ref t) (expression float max (expression float min (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) (constant float (1.0))) (constant float (0.0)))) - (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t)))))))) - + (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.0)) (expression float * (constant float (2.0)) (var_ref t)))))))) (signature vec2 (parameters (declare (in) float edge0) (declare (in) float edge1) (declare (in) vec2 x)) ((declare () vec2 t) - (declare () vec2 retval) - - (assign (constant bool (1)) (x) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (assign (constant bool (1)) (xy) (var_ref t) + (expression vec2 max + (expression vec2 min + (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) (constant float (1.0))) (constant float (0.0)))) - (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (y) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - (return (var_ref retval)) - )) + (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t)))))))) (signature vec3 (parameters @@ -46,33 +32,13 @@ (declare (in) float edge1) (declare (in) vec3 x)) ((declare () vec3 t) - (declare () vec3 retval) - - (assign (constant bool (1)) (x) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (y) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (assign (constant bool (1)) (xyz) (var_ref t) + (expression vec3 max + (expression vec3 min + (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) (constant float (1.0))) (constant float (0.0)))) - (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - - (assign (constant bool (1)) (z) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) - (return (var_ref retval)) - )) + (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t)))))))) (signature vec4 @@ -81,73 +47,54 @@ (declare (in) float edge1) (declare (in) vec4 x)) ((declare () vec4 t) - (declare () vec4 retval) - - (assign (constant bool (1)) (x) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t))))))) - - (assign (constant bool (1)) (y) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) + (assign (constant bool (1)) (xyzw) (var_ref t) + (expression vec4 max + (expression vec4 min + (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) (constant float (1.0))) (constant float (0.0)))) - (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t))))))) - - (assign (constant bool (1)) (z) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t))))))) - - (assign (constant bool (1)) (w) (var_ref t) - (expression float max - (expression float min - (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0))) - (constant float (1.0))) - (constant float (0.0)))) - (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t))))))) - (return (var_ref retval)) - )) + (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t)))))))) (signature vec2 (parameters (declare (in) vec2 edge0) (declare (in) vec2 edge1) (declare (in) vec2 x)) - ((return (expression vec2 max + ((declare () vec2 t) + (assign (constant bool (1)) (xy) (var_ref t) + (expression vec2 max (expression vec2 min (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0))) - (constant vec2 (1.0 1.0))) - (constant vec2 (0.0 0.0)))))) + (constant float (1.0))) + (constant float (0.0)))) + (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t)))))))) (signature vec3 (parameters (declare (in) vec3 edge0) (declare (in) vec3 edge1) (declare (in) vec3 x)) - ((return (expression vec3 max + ((declare () vec3 t) + (assign (constant bool (1)) (xyz) (var_ref t) + (expression vec3 max (expression vec3 min (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0))) - (constant vec3 (1.0 1.0 1.0))) - (constant vec3 (0.0 0.0 0.0)))))) + (constant float (1.0))) + (constant float (0.0)))) + (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t)))))))) (signature vec4 (parameters (declare (in) vec4 edge0) (declare (in) vec4 edge1) (declare (in) vec4 x)) - ((return (expression vec4 max + ((declare () vec4 t) + (assign (constant bool (1)) (xyzw) (var_ref t) + (expression vec4 max (expression vec4 min (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0))) - (constant vec4 (1.0 1.0 1.0 1.0))) - (constant vec4 (0.0 0.0 0.0 0.0)))))) + (constant float (1.0))) + (constant float (0.0)))) + (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t)))))))) )) -- cgit v1.2.3 From a954dbeb8c422a6a800b77d5ded76c92eebde1a8 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 17 Dec 2010 19:28:47 -0800 Subject: Refresh autogenerated file builtin_function.cpp. NOTE: The 7.9 and 7.10 branches will need their builtins refreshed too. Rather than cherry-picking this commit, run 'make builtins'. --- src/glsl/builtin_function.cpp | 121 ++++++++++++------------------------------ 1 file changed, 34 insertions(+), 87 deletions(-) diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp index 631aeac12ce..1c6d59d5a21 100644 --- a/src/glsl/builtin_function.cpp +++ b/src/glsl/builtin_function.cpp @@ -3010,40 +3010,26 @@ static const char builtin_smoothstep[] = " (declare (in) float edge1)\n" " (declare (in) float x))\n" " ((declare () float t)\n" - "\n" " (assign (constant bool (1)) (x) (var_ref t)\n" " (expression float max\n" " (expression float min\n" " (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" " (constant float (1.0)))\n" " (constant float (0.0))))\n" - " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (var_ref t))))))))\n" - "\n" + " (return (expression float * (var_ref t) (expression float * (var_ref t) (expression float - (constant float (3.0)) (expression float * (constant float (2.0)) (var_ref t))))))))\n" " (signature vec2\n" " (parameters\n" " (declare (in) float edge0)\n" " (declare (in) float edge1)\n" " (declare (in) vec2 x))\n" " ((declare () vec2 t)\n" - " (declare () vec2 retval)\n" - "\n" - " (assign (constant bool (1)) (x) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (y) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (assign (constant bool (1)) (xy) (var_ref t)\n" + " (expression vec2 max\n" + " (expression vec2 min\n" + " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" " (constant float (1.0)))\n" " (constant float (0.0))))\n" - " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t))))))))\n" "\n" " (signature vec3\n" " (parameters\n" @@ -3051,33 +3037,13 @@ static const char builtin_smoothstep[] = " (declare (in) float edge1)\n" " (declare (in) vec3 x))\n" " ((declare () vec3 t)\n" - " (declare () vec3 retval)\n" - "\n" - " (assign (constant bool (1)) (x) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (y) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (z) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (assign (constant bool (1)) (xyz) (var_ref t)\n" + " (expression vec3 max\n" + " (expression vec3 min\n" + " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" " (constant float (1.0)))\n" " (constant float (0.0))))\n" - " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t))))))))\n" "\n" "\n" " (signature vec4\n" @@ -3086,74 +3052,55 @@ static const char builtin_smoothstep[] = " (declare (in) float edge1)\n" " (declare (in) vec4 x))\n" " ((declare () vec4 t)\n" - " (declare () vec4 retval)\n" - "\n" - " (assign (constant bool (1)) (x) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (y) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (z) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" - " (constant float (1.0)))\n" - " (constant float (0.0))))\n" - " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n" - "\n" - " (assign (constant bool (1)) (w) (var_ref t)\n" - " (expression float max\n" - " (expression float min\n" - " (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" + " (assign (constant bool (1)) (xyzw) (var_ref t)\n" + " (expression vec4 max\n" + " (expression vec4 min\n" + " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n" " (constant float (1.0)))\n" " (constant float (0.0))))\n" - " (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n" - " (return (var_ref retval))\n" - " ))\n" + " (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t))))))))\n" "\n" " (signature vec2\n" " (parameters\n" " (declare (in) vec2 edge0)\n" " (declare (in) vec2 edge1)\n" " (declare (in) vec2 x))\n" - " ((return (expression vec2 max\n" + " ((declare () vec2 t)\n" + " (assign (constant bool (1)) (xy) (var_ref t)\n" + " (expression vec2 max\n" " (expression vec2 min\n" " (expression vec2 / (expression vec2 - (var_ref x) (var_ref edge0)) (expression vec2 - (var_ref edge1) (var_ref edge0)))\n" - " (constant vec2 (1.0 1.0)))\n" - " (constant vec2 (0.0 0.0))))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (return (expression vec2 * (var_ref t) (expression vec2 * (var_ref t) (expression vec2 - (constant float (3.0)) (expression vec2 * (constant float (2.0)) (var_ref t))))))))\n" "\n" " (signature vec3\n" " (parameters\n" " (declare (in) vec3 edge0)\n" " (declare (in) vec3 edge1)\n" " (declare (in) vec3 x))\n" - " ((return (expression vec3 max\n" + " ((declare () vec3 t)\n" + " (assign (constant bool (1)) (xyz) (var_ref t)\n" + " (expression vec3 max\n" " (expression vec3 min\n" " (expression vec3 / (expression vec3 - (var_ref x) (var_ref edge0)) (expression vec3 - (var_ref edge1) (var_ref edge0)))\n" - " (constant vec3 (1.0 1.0 1.0)))\n" - " (constant vec3 (0.0 0.0 0.0))))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (return (expression vec3 * (var_ref t) (expression vec3 * (var_ref t) (expression vec3 - (constant float (3.0)) (expression vec3 * (constant float (2.0)) (var_ref t))))))))\n" "\n" " (signature vec4\n" " (parameters\n" " (declare (in) vec4 edge0)\n" " (declare (in) vec4 edge1)\n" " (declare (in) vec4 x))\n" - " ((return (expression vec4 max\n" + " ((declare () vec4 t)\n" + " (assign (constant bool (1)) (xyzw) (var_ref t)\n" + " (expression vec4 max\n" " (expression vec4 min\n" " (expression vec4 / (expression vec4 - (var_ref x) (var_ref edge0)) (expression vec4 - (var_ref edge1) (var_ref edge0)))\n" - " (constant vec4 (1.0 1.0 1.0 1.0)))\n" - " (constant vec4 (0.0 0.0 0.0 0.0))))))\n" + " (constant float (1.0)))\n" + " (constant float (0.0))))\n" + " (return (expression vec4 * (var_ref t) (expression vec4 * (var_ref t) (expression vec4 - (constant float (3.0)) (expression vec4 * (constant float (2.0)) (var_ref t))))))))\n" "))\n" "\n" "" -- cgit v1.2.3 From c7119e281b21bcfc88e5fdce2a5d8ebdbf6c6b62 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 17 Dec 2010 03:11:53 +0800 Subject: mapi: Add ABI-tag note. TLS requires kernel >= 2.4.20. Per glapi. --- src/mapi/mapi/entry_x86-64_tls.h | 13 +++++++++++++ src/mapi/mapi/entry_x86_tls.h | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h index 2fbe73b5b32..cc3d5a8d7ea 100644 --- a/src/mapi/mapi/entry_x86-64_tls.h +++ b/src/mapi/mapi/entry_x86-64_tls.h @@ -30,6 +30,19 @@ #include "u_execmem.h" #include "u_macros.h" +#ifdef __linux__ +__asm__(".section .note.ABI-tag, \"a\"\n\t" + ".p2align 2\n\t" + ".long 1f - 0f\n\t" /* name length */ + ".long 3f - 2f\n\t" /* data length */ + ".long 1\n\t" /* note length */ + "0: .asciz \"GNU\"\n\t" /* vendor name */ + "1: .p2align 2\n\t" + "2: .long 0\n\t" /* note data: the ABI tag */ + ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ + "3: .p2align 2\n\t"); /* pad out section */ +#endif /* __linux__ */ + __asm__(".text"); __asm__("x86_64_current_tls:\n\t" diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h index d4f7d98cf12..9a1f6e4ec4b 100644 --- a/src/mapi/mapi/entry_x86_tls.h +++ b/src/mapi/mapi/entry_x86_tls.h @@ -30,6 +30,19 @@ #include "u_execmem.h" #include "u_macros.h" +#ifdef __linux__ +__asm__(".section .note.ABI-tag, \"a\"\n\t" + ".p2align 2\n\t" + ".long 1f - 0f\n\t" /* name length */ + ".long 3f - 2f\n\t" /* data length */ + ".long 1\n\t" /* note length */ + "0: .asciz \"GNU\"\n\t" /* vendor name */ + "1: .p2align 2\n\t" + "2: .long 0\n\t" /* note data: the ABI tag */ + ".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ + "3: .p2align 2\n\t"); /* pad out section */ +#endif /* __linux__ */ + __asm__(".text"); __asm__("x86_current_tls:\n\t" -- cgit v1.2.3 From c17d4999f108d86c468cf4b11b08f915c282ce12 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 10 Dec 2010 17:14:04 +0800 Subject: mapi: Clean up u_current interface. Try not to use macros to make u_current.h appear to be glapi.h. Use u_current.h to implement glapi.h instead whenever possible. --- src/mapi/es1api/Makefile | 2 +- src/mapi/glapi/Makefile | 2 +- src/mapi/glapi/SConscript | 1 + src/mapi/glapi/glapi.c | 65 ++++++++++++++++++++++++++++++++++++++++ src/mapi/glapi/sources.mak | 3 +- src/mapi/mapi/entry_x86-64_tls.h | 4 +-- src/mapi/mapi/entry_x86_tls.h | 2 +- src/mapi/mapi/u_current.c | 35 ++++++++++------------ src/mapi/mapi/u_current.h | 46 ++++++++++------------------ 9 files changed, 104 insertions(+), 56 deletions(-) create mode 100644 src/mapi/glapi/glapi.c diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile index 576ac5afdc3..1e2b5e523b0 100644 --- a/src/mapi/es1api/Makefile +++ b/src/mapi/es1api/Makefile @@ -72,7 +72,7 @@ lib$(ESAPI).a: $(ESAPI_OBJECTS) @$(MKLIB) -o $(ESAPI) -static $(ESAPI_OBJECTS) $(GLAPI_OBJECTS): %.o: $(GLAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ $(GLAPI_ASM_OBJECTS): %.o: $(GEN)/%.S $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ diff --git a/src/mapi/glapi/Makefile b/src/mapi/glapi/Makefile index ca9381d4253..acd8429778a 100644 --- a/src/mapi/glapi/Makefile +++ b/src/mapi/glapi/Makefile @@ -28,7 +28,7 @@ lib$(TARGET).a: $(TARGET_OBJECTS) @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS) $(GLAPI_OBJECTS): %.o: %.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ $(GLAPI_ASM_OBJECTS): %.o: %.S $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript index 4ef855fc350..27258f808a5 100644 --- a/src/mapi/glapi/SConscript +++ b/src/mapi/glapi/SConscript @@ -29,6 +29,7 @@ if env['platform'] != 'winddk': 'glapi_getproc.c', 'glapi_nop.c', 'glthread.c', + 'glapi.c', ] mapi_sources = [ diff --git a/src/mapi/glapi/glapi.c b/src/mapi/glapi/glapi.c new file mode 100644 index 00000000000..f7655c558c4 --- /dev/null +++ b/src/mapi/glapi/glapi.c @@ -0,0 +1,65 @@ +/* + * Mesa 3-D graphics library + * Version: 7.9 + * + * Copyright (C) 2010 LunarG Inc. + * + * 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 + * THE AUTHORS OR COPYRIGHT HOLDERS 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: + * Chia-I Wu + */ + +#include "glapi/glapi.h" +#include "mapi/u_current.h" + +/* + * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in + * u_current.c. + */ + +#ifdef GLX_USE_TLS +/* not used, but defined for compatibility */ +const struct _glapi_table *_glapi_Dispatch; +const void *_glapi_Context; +#endif /* GLX_USE_TLS */ + +void +_glapi_destroy_multithread(void) +{ + u_current_destroy(); +} + +void +_glapi_check_multithread(void) +{ + u_current_init(); +} + +void +_glapi_set_context(void *context) +{ + u_current_set_user((const void *) context); +} + +void +_glapi_set_dispatch(struct _glapi_table *dispatch) +{ + u_current_set((const struct mapi_table *) dispatch); +} diff --git a/src/mapi/glapi/sources.mak b/src/mapi/glapi/sources.mak index cdcfa36e51f..0b4d8cf65df 100644 --- a/src/mapi/glapi/sources.mak +++ b/src/mapi/glapi/sources.mak @@ -5,7 +5,8 @@ GLAPI_SOURCES = \ glapi_entrypoint.c \ glapi_getproc.c \ glapi_nop.c \ - glthread.c + glthread.c \ + glapi.c X86_API = \ glapi_x86.S diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h index cc3d5a8d7ea..2c02933802f 100644 --- a/src/mapi/mapi/entry_x86-64_tls.h +++ b/src/mapi/mapi/entry_x86-64_tls.h @@ -46,7 +46,7 @@ __asm__(".section .note.ABI-tag, \"a\"\n\t" __asm__(".text"); __asm__("x86_64_current_tls:\n\t" - "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" + "movq u_current_table@GOTTPOFF(%rip), %rax\n\t" "ret"); #define STUB_ASM_ENTRY(func) \ @@ -56,7 +56,7 @@ __asm__("x86_64_current_tls:\n\t" func ":" #define STUB_ASM_CODE(slot) \ - "movq u_current_table_tls@GOTTPOFF(%rip), %rax\n\t" \ + "movq u_current_table@GOTTPOFF(%rip), %rax\n\t" \ "movq %fs:(%rax), %r11\n\t" \ "jmp *(8 * " slot ")(%r11)" diff --git a/src/mapi/mapi/entry_x86_tls.h b/src/mapi/mapi/entry_x86_tls.h index 9a1f6e4ec4b..3d0b7caffe1 100644 --- a/src/mapi/mapi/entry_x86_tls.h +++ b/src/mapi/mapi/entry_x86_tls.h @@ -50,7 +50,7 @@ __asm__("x86_current_tls:\n\t" "1:\n\t" "popl %eax\n\t" "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" - "movl u_current_table_tls@GOTNTPOFF(%eax), %eax\n\t" + "movl u_current_table@GOTNTPOFF(%eax), %eax\n\t" "ret"); #ifndef GLX_X86_READONLY_TEXT diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c index 77a593b330c..d84520f313d 100644 --- a/src/mapi/mapi/u_current.c +++ b/src/mapi/mapi/u_current.c @@ -99,16 +99,13 @@ extern void (*__glapi_noop_table[])(void); /*@{*/ #if defined(GLX_USE_TLS) -__thread struct mapi_table *u_current_table_tls +__thread struct mapi_table *u_current_table __attribute__((tls_model("initial-exec"))) = (struct mapi_table *) table_noop_array; -__thread void *u_current_user_tls +__thread void *u_current_user __attribute__((tls_model("initial-exec"))); -const struct mapi_table *u_current_table; -const void *u_current_user; - #else struct mapi_table *u_current_table = @@ -179,8 +176,8 @@ u_current_init(void) } else if (knownID != u_thread_self()) { ThreadSafe = 1; - u_current_set_internal(NULL); - u_current_set_user_internal(NULL); + u_current_set(NULL); + u_current_set_user(NULL); } CHECK_MULTITHREAD_UNLOCK(); } @@ -202,17 +199,17 @@ u_current_init(void) * void from the real context pointer type. */ void -u_current_set_user_internal(void *ptr) +u_current_set_user(const void *ptr) { u_current_init(); #if defined(GLX_USE_TLS) - u_current_user_tls = ptr; + u_current_user = (void *) ptr; #elif defined(THREADS) - u_tsd_set(&u_current_user_tsd, ptr); - u_current_user = (ThreadSafe) ? NULL : ptr; + u_tsd_set(&u_current_user_tsd, (void *) ptr); + u_current_user = (ThreadSafe) ? NULL : (void *) ptr; #else - u_current_user = ptr; + u_current_user = (void *) ptr; #endif } @@ -225,7 +222,7 @@ void * u_current_get_user_internal(void) { #if defined(GLX_USE_TLS) - return u_current_user_tls; + return u_current_user; #elif defined(THREADS) return (ThreadSafe) ? u_tsd_get(&u_current_user_tsd) @@ -241,22 +238,22 @@ u_current_get_user_internal(void) * table (__glapi_noop_table). */ void -u_current_set_internal(struct mapi_table *tbl) +u_current_set(const struct mapi_table *tbl) { u_current_init(); stub_init_once(); if (!tbl) - tbl = (struct mapi_table *) table_noop_array; + tbl = (const struct mapi_table *) table_noop_array; #if defined(GLX_USE_TLS) - u_current_table_tls = tbl; + u_current_table = (struct mapi_table *) tbl; #elif defined(THREADS) u_tsd_set(&u_current_table_tsd, (void *) tbl); - u_current_table = (ThreadSafe) ? NULL : tbl; + u_current_table = (ThreadSafe) ? NULL : (void *) tbl; #else - u_current_table = tbl; + u_current_table = (struct mapi_table *) tbl; #endif } @@ -267,7 +264,7 @@ struct mapi_table * u_current_get_internal(void) { #if defined(GLX_USE_TLS) - return u_current_table_tls; + return u_current_table; #elif defined(THREADS) return (struct mapi_table *) ((ThreadSafe) ? u_tsd_get(&u_current_table_tsd) : (void *) u_current_table); diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index 62e54c6c93d..373d48fb939 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -8,16 +8,15 @@ /* ugly renames to match glapi.h */ #define mapi_table _glapi_table -#define u_current_table_tls _glapi_tls_Dispatch -#define u_current_user_tls _glapi_tls_Context +#ifdef GLX_USE_TLS +#define u_current_table _glapi_tls_Dispatch +#define u_current_user _glapi_tls_Context +#else #define u_current_table _glapi_Dispatch #define u_current_user _glapi_Context +#endif -#define u_current_destroy _glapi_destroy_multithread -#define u_current_init _glapi_check_multithread -#define u_current_set_internal _glapi_set_dispatch #define u_current_get_internal _glapi_get_dispatch -#define u_current_set_user_internal _glapi_set_context #define u_current_get_user_internal _glapi_get_context #define u_current_table_tsd _gl_DispatchTSD @@ -30,15 +29,12 @@ struct mapi_table; #ifdef GLX_USE_TLS -extern __thread struct mapi_table *u_current_table_tls +extern __thread struct mapi_table *u_current_table __attribute__((tls_model("initial-exec"))); -extern __thread void *u_current_user_tls +extern __thread void *u_current_user __attribute__((tls_model("initial-exec"))); -extern const struct mapi_table *u_current_table; -extern const void *u_current_user; - #else /* GLX_USE_TLS */ extern struct mapi_table *u_current_table; @@ -46,6 +42,8 @@ extern void *u_current_user; #endif /* GLX_USE_TLS */ +#endif /* MAPI_GLAPI_CURRENT */ + void u_current_init(void); @@ -53,50 +51,36 @@ void u_current_destroy(void); void -u_current_set_internal(struct mapi_table *tbl); +u_current_set(const struct mapi_table *tbl); struct mapi_table * u_current_get_internal(void); void -u_current_set_user_internal(void *ptr); +u_current_set_user(const void *ptr); void * u_current_get_user_internal(void); -static INLINE void -u_current_set(const struct mapi_table *tbl) -{ - u_current_set_internal((struct mapi_table *) tbl); -} - static INLINE const struct mapi_table * u_current_get(void) { #ifdef GLX_USE_TLS - return (const struct mapi_table *) u_current_table_tls; + return u_current_table; #else return (likely(u_current_table) ? - (const struct mapi_table *) u_current_table : u_current_get_internal()); + u_current_table : u_current_get_internal()); #endif } -static INLINE void -u_current_set_user(void *ptr) -{ - u_current_set_internal(ptr); -} - -static INLINE void * +static INLINE const void * u_current_get_user(void) { #ifdef GLX_USE_TLS - return u_current_user_tls; + return u_current_user; #else return likely(u_current_user) ? u_current_user : u_current_get_user_internal(); #endif } -#endif /* MAPI_GLAPI_CURRENT */ - #endif /* _U_CURRENT_H_ */ -- cgit v1.2.3 From 7048095513f8e91db26736eee0343b1a00d18f6f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 11 Dec 2010 03:27:54 +0800 Subject: mapi: Clean up sources.mk. Rename MAPI_GLAPI_SOURCES to MAPI_UTIL_SOURCES. Rename macro MAPI_GLAPI_CURRENT to MAPI_MODE_UTIL. Update the comments to make it clear that mapi may be used in two ways and how. --- src/mapi/es1api/Makefile | 16 ++++++++-------- src/mapi/glapi/Makefile | 16 ++++++++-------- src/mapi/glapi/SConscript | 2 +- src/mapi/mapi/sources.mak | 14 ++++++++------ src/mapi/mapi/u_current.c | 2 +- src/mapi/mapi/u_current.h | 6 +++--- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile index 1e2b5e523b0..3659d6486a8 100644 --- a/src/mapi/es1api/Makefile +++ b/src/mapi/es1api/Makefile @@ -44,10 +44,10 @@ GLAPI_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o) GLAPI_ASM_SOURCES := $(addprefix $(GEN)/, $(GLAPI_ASM_SOURCES)) include $(MAPI)/sources.mak -MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) -MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) +MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) +MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) -ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS) +ESAPI_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS) INCLUDE_DIRS = \ -I$(TOP)/include \ @@ -72,13 +72,13 @@ lib$(ESAPI).a: $(ESAPI_OBJECTS) @$(MKLIB) -o $(ESAPI) -static $(ESAPI_OBJECTS) $(GLAPI_OBJECTS): %.o: $(GLAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ $(GLAPI_ASM_OBJECTS): %.o: $(GEN)/%.S $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ -$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ +$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ $(GLAPI_SOURCES) $(GLAPI_ASM_SOURCES): | glapi-stamp @@ -135,10 +135,10 @@ install: default install-headers install-pc $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLES_LIB_GLOB) \ $(DESTDIR)$(INSTALL_LIB_DIR) -depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) +depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) @echo "running $(MKDEP)" @touch depend @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ - -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \ + -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \ 2>/dev/null | sed -e 's,^$(GLAPI)/,,' -e 's,^$(MAPI)/,,' \ > depend diff --git a/src/mapi/glapi/Makefile b/src/mapi/glapi/Makefile index acd8429778a..a9ab07903c1 100644 --- a/src/mapi/glapi/Makefile +++ b/src/mapi/glapi/Makefile @@ -12,10 +12,10 @@ GLAPI_OBJECTS = $(GLAPI_SOURCES:.c=.o) GLAPI_ASM_OBJECTS = $(GLAPI_ASM_SOURCES:.S=.o) include $(MAPI)/sources.mak -MAPI_GLAPI_OBJECTS := $(MAPI_GLAPI_SOURCES:.c=.o) -MAPI_GLAPI_SOURCES := $(addprefix $(MAPI)/, $(MAPI_GLAPI_SOURCES)) +MAPI_UTIL_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o) +MAPI_UTIL_SOURCES := $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES)) -TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_GLAPI_OBJECTS) +TARGET_OBJECTS = $(GLAPI_OBJECTS) $(GLAPI_ASM_OBJECTS) $(MAPI_UTIL_OBJECTS) INCLUDE_DIRS = \ -I$(TOP)/include \ @@ -28,13 +28,13 @@ lib$(TARGET).a: $(TARGET_OBJECTS) @$(MKLIB) -o $(TARGET) -static $(TARGET_OBJECTS) $(GLAPI_OBJECTS): %.o: %.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ $(GLAPI_ASM_OBJECTS): %.o: %.S $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ -$(MAPI_GLAPI_OBJECTS): %.o: $(MAPI)/%.c - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_GLAPI_CURRENT $< -o $@ +$(MAPI_UTIL_OBJECTS): %.o: $(MAPI)/%.c + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) -DMAPI_MODE_UTIL $< -o $@ install: @@ -43,11 +43,11 @@ clean: -rm -f lib$(TARGET).a -rm -f depend depend.bak -depend: $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) +depend: $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) @ echo "running $(MKDEP)" @ touch depend @$(MKDEP) $(MKDEP_OPTIONS) -f- $(DEFINES) $(INCLUDE_DIRS) \ - -DMAPI_GLAPI_CURRENT $(GLAPI_SOURCES) $(MAPI_GLAPI_SOURCES) \ + -DMAPI_MODE_UTIL $(GLAPI_SOURCES) $(MAPI_UTIL_SOURCES) \ 2>/dev/null | sed -e 's,^$(MAPI)/,,' > depend -include depend diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript index 27258f808a5..4057991ec8d 100644 --- a/src/mapi/glapi/SConscript +++ b/src/mapi/glapi/SConscript @@ -9,7 +9,7 @@ if env['platform'] != 'winddk': env = env.Clone() env.Append(CPPDEFINES = [ - 'MAPI_GLAPI_CURRENT', + 'MAPI_MODE_UTIL', ]) if env['platform'] == 'windows': diff --git a/src/mapi/mapi/sources.mak b/src/mapi/mapi/sources.mak index 5f327f3df62..ed36e1af486 100644 --- a/src/mapi/mapi/sources.mak +++ b/src/mapi/mapi/sources.mak @@ -1,12 +1,14 @@ # src/mapi/mapi/sources.mak # -# When MAPI_GLAPI_CURRENT is defined, MAPI_GLAPI_SOURCES can be built without -# MAPI_SOURCES and it is used by glapi. +# mapi may be used in several ways # -# Otherwise, MAPI_ABI_HEADER must be defined. It should expand to the header -# generated by mapi_abi.py. +# - In default mode, mapi implements the interface defined by mapi.h. To use +# this mode, compile MAPI_SOURCES. +# +# - In util mode, mapi provides utility functions for use with glapi. To use +# this mode, compile MAPI_UTIL_SOURCES with MAPI_MODE_UTIL defined. -MAPI_GLAPI_SOURCES = \ +MAPI_UTIL_SOURCES = \ u_current.c \ u_execmem.c \ u_thread.c @@ -16,4 +18,4 @@ MAPI_SOURCES = \ mapi.c \ stub.c \ table.c \ - $(MAPI_GLAPI_SOURCES) + $(MAPI_UTIL_SOURCES) diff --git a/src/mapi/mapi/u_current.c b/src/mapi/mapi/u_current.c index d84520f313d..7946d2a2741 100644 --- a/src/mapi/mapi/u_current.c +++ b/src/mapi/mapi/u_current.c @@ -51,7 +51,7 @@ #include "u_current.h" #include "u_thread.h" -#ifndef MAPI_GLAPI_CURRENT +#ifndef MAPI_MODE_UTIL #include "table.h" #include "stub.h" diff --git a/src/mapi/mapi/u_current.h b/src/mapi/mapi/u_current.h index 373d48fb939..061fccc9495 100644 --- a/src/mapi/mapi/u_current.h +++ b/src/mapi/mapi/u_current.h @@ -1,7 +1,7 @@ #ifndef _U_CURRENT_H_ #define _U_CURRENT_H_ -#ifdef MAPI_GLAPI_CURRENT +#ifdef MAPI_MODE_UTIL #include "glapi/glapi.h" @@ -21,7 +21,7 @@ #define u_current_table_tsd _gl_DispatchTSD -#else /* MAPI_GLAPI_CURRENT */ +#else /* MAPI_MODE_UTIL */ #include "u_compiler.h" @@ -42,7 +42,7 @@ extern void *u_current_user; #endif /* GLX_USE_TLS */ -#endif /* MAPI_GLAPI_CURRENT */ +#endif /* MAPI_MODE_UTIL */ void u_current_init(void); -- cgit v1.2.3 From ff7aa554a11863de2c4c0b4b6d1ec7b07c819739 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 12 Sep 2010 06:31:30 +1000 Subject: mesa/swrast/st: add ARB_occlusion_query2 support. This gets my vote for most pointless extension of all time, I'm guessing some driver could possibly optimise for this instead of counting it might just get a true/false, but I'm not really sure. need this to eventually advertise 3.3 despite its total uselessness. Signed-off-by: Dave Airlie --- docs/GL3.txt | 2 +- src/mesa/main/extensions.c | 1 + src/mesa/main/queryobj.c | 43 ++++++++++++++++++++++++---------- src/mesa/state_tracker/st_extensions.c | 1 + 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index fb22739b6c7..9106f439a17 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -71,7 +71,7 @@ GL 3.3: GLSL 3.30 not started GL_ARB_blend_func_extended not started GL_ARB_explicit_attrib_location DONE (swrast, i915, i965) -GL_ARB_occlusion_query2 not started +GL_ARB_occlusion_query2 DONE (swrast, gallium) GL_ARB_sampler_objects not started GL_ARB_texture_rgb10_a2ui not started GL_ARB_texture_swizzle DONE (same as EXT version) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index f3bf5cb164b..fd5b4e915cd 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -259,6 +259,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.ARB_multitexture = GL_TRUE; #if FEATURE_queryobj ctx->Extensions.ARB_occlusion_query = GL_TRUE; + ctx->Extensions.ARB_occlusion_query2 = GL_TRUE; #endif ctx->Extensions.ARB_point_sprite = GL_TRUE; #if FEATURE_ARB_shader_objects diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 88743977206..ca829b09bd1 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -143,6 +143,11 @@ get_query_binding_point(struct gl_context *ctx, GLenum target) return &ctx->Query.CurrentOcclusionObject; else return NULL; + case GL_ANY_SAMPLES_PASSED: + if (ctx->Extensions.ARB_occlusion_query2) + return &ctx->Query.CurrentOcclusionObject; + else + return NULL; case GL_TIME_ELAPSED_EXT: if (ctx->Extensions.EXT_timer_query) return &ctx->Query.CurrentTimerObject; @@ -378,12 +383,19 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) if (!q->Ready) ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ - if (q->Result > 0x7fffffff) { - *params = 0x7fffffff; - } - else { - *params = (GLint)q->Result; - } + if (q->Target == GL_ANY_SAMPLES_PASSED) { + if (q->Result) + *params = GL_TRUE; + else + *params = GL_FALSE; + } else { + if (q->Result > 0x7fffffff) { + *params = 0x7fffffff; + } + else { + *params = (GLint)q->Result; + } + } break; case GL_QUERY_RESULT_AVAILABLE_ARB: if (!q->Ready) @@ -418,12 +430,19 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) if (!q->Ready) ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ - if (q->Result > 0xffffffff) { - *params = 0xffffffff; - } - else { - *params = (GLuint)q->Result; - } + if (q->Target == GL_ANY_SAMPLES_PASSED) { + if (q->Result) + *params = GL_TRUE; + else + *params = GL_FALSE; + } else { + if (q->Result > 0xffffffff) { + *params = 0xffffffff; + } + else { + *params = (GLuint)q->Result; + } + } break; case GL_QUERY_RESULT_AVAILABLE_ARB: if (!q->Ready) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 51a45a7d511..62c9ce7273d 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -343,6 +343,7 @@ void st_init_extensions(struct st_context *st) if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) { ctx->Extensions.ARB_occlusion_query = GL_TRUE; + ctx->Extensions.ARB_occlusion_query2 = GL_TRUE; } if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY)) { ctx->Extensions.EXT_timer_query = GL_TRUE; -- cgit v1.2.3 From aa4d3118734566881e49c8bd962da94630450512 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 18 Dec 2010 17:48:21 +1000 Subject: mesa: fix queryobj whitespace. Had done this before pushing but forgot to amend, doh. --- src/mesa/main/queryobj.c | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index ca829b09bd1..66fb5980589 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -383,19 +383,19 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) if (!q->Ready) ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ - if (q->Target == GL_ANY_SAMPLES_PASSED) { - if (q->Result) - *params = GL_TRUE; - else - *params = GL_FALSE; - } else { - if (q->Result > 0x7fffffff) { - *params = 0x7fffffff; - } - else { - *params = (GLint)q->Result; - } - } + if (q->Target == GL_ANY_SAMPLES_PASSED) { + if (q->Result) + *params = GL_TRUE; + else + *params = GL_FALSE; + } else { + if (q->Result > 0x7fffffff) { + *params = 0x7fffffff; + } + else { + *params = (GLint)q->Result; + } + } break; case GL_QUERY_RESULT_AVAILABLE_ARB: if (!q->Ready) @@ -430,19 +430,19 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) if (!q->Ready) ctx->Driver.WaitQuery(ctx, q); /* if result is too large for returned type, clamp to max value */ - if (q->Target == GL_ANY_SAMPLES_PASSED) { - if (q->Result) - *params = GL_TRUE; - else - *params = GL_FALSE; - } else { - if (q->Result > 0xffffffff) { - *params = 0xffffffff; - } - else { - *params = (GLuint)q->Result; - } - } + if (q->Target == GL_ANY_SAMPLES_PASSED) { + if (q->Result) + *params = GL_TRUE; + else + *params = GL_FALSE; + } else { + if (q->Result > 0xffffffff) { + *params = 0xffffffff; + } + else { + *params = (GLuint)q->Result; + } + } break; case GL_QUERY_RESULT_AVAILABLE_ARB: if (!q->Ready) -- cgit v1.2.3 From 488e994ba977dc363a5b0a8b657d93a46ade7da2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Dec 2010 01:16:53 -0800 Subject: mesa: Clean up header file inclusion in prog_statevars.h. --- src/mesa/program/prog_statevars.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h index 009ebde0012..f2407af9c87 100644 --- a/src/mesa/program/prog_statevars.h +++ b/src/mesa/program/prog_statevars.h @@ -25,8 +25,10 @@ #ifndef PROG_STATEVARS_H #define PROG_STATEVARS_H -#include "main/mtypes.h" +#include "main/glheader.h" +struct gl_context; +struct gl_program_parameter_list; /** * Number of STATE_* values we need to address any GL state. -- cgit v1.2.3 From ac09685d2ae4e302b25454b681396d3256a4b6cb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Dec 2010 01:28:18 -0800 Subject: st/mesa: Clean up header file inclusion in st_cb_accum.h. --- src/mesa/state_tracker/st_cb_accum.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_accum.h b/src/mesa/state_tracker/st_cb_accum.h index b8c9c350031..050a21483e4 100644 --- a/src/mesa/state_tracker/st_cb_accum.h +++ b/src/mesa/state_tracker/st_cb_accum.h @@ -30,7 +30,11 @@ #define ST_CB_ACCUM_H -#include "main/mtypes.h" +#include "main/mfeatures.h" + +struct dd_function_table; +struct gl_context; +struct gl_renderbuffer; #if FEATURE_accum -- cgit v1.2.3 From c87f82bc40f90fd3fe7af74ffa4d7784c7d1b6b1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 18 Dec 2010 01:44:52 -0800 Subject: st/mesa: Clean up header file inclusion in st_cb_program.h. --- src/mesa/state_tracker/st_cb_program.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_program.h b/src/mesa/state_tracker/st_cb_program.h index d9149d61fbb..091a4439c48 100644 --- a/src/mesa/state_tracker/st_cb_program.h +++ b/src/mesa/state_tracker/st_cb_program.h @@ -29,8 +29,6 @@ #define ST_CB_PROGRAM_H -#include "main/mtypes.h" - struct dd_function_table; extern void -- cgit v1.2.3 From 237880463d5168cad8df0bae6018b5fd76617777 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 19 Dec 2010 02:54:43 +0100 Subject: r300g: optimize the fallback for misaligned ushort indices --- src/gallium/drivers/r300/r300_render.c | 22 +++++++++++++++++++++- src/gallium/drivers/r300/r300_render_translate.c | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index b4197e03520..1d26eb9f918 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -551,7 +551,27 @@ static void r300_draw_range_elements(struct pipe_context* pipe, &start, count); r300_update_derived_state(r300); - r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &new_offset); + + /* Fallback for misaligned ushort indices. */ + if (indexSize == 2 && start % 2 == 1) { + struct pipe_transfer *transfer; + struct pipe_resource *userbuf; + uint16_t *ptr = pipe_buffer_map(pipe, indexBuffer, + PIPE_TRANSFER_READ, &transfer); + + /* Copy the mapped index buffer directly to the upload buffer. + * The start index will be aligned simply from the fact that + * every sub-buffer in u_upload_mgr is aligned. */ + userbuf = pipe->screen->user_buffer_create(pipe->screen, + ptr + start, count * 2, + PIPE_BIND_INDEX_BUFFER); + indexBuffer = userbuf; + r300_upload_index_buffer(r300, &indexBuffer, indexSize, 0, count, &new_offset); + pipe_resource_reference(&userbuf, NULL); + pipe_buffer_unmap(pipe, indexBuffer, transfer); + } else { + r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &new_offset); + } start = new_offset; diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index 41a43b04de7..90b2f40be5f 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -204,7 +204,7 @@ void r300_translate_index_buffer(struct r300_context *r300, break; case 2: - if (*start % 2 != 0 || index_offset) { + if (index_offset) { util_rebuild_ushort_elts(&r300->context, index_buffer, index_offset, *start, count); *start = 0; r300->validate_buffers = TRUE; -- cgit v1.2.3 From 10eb0c39d52d59956f306ee9daa63e1466e0cd3e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 20 Dec 2010 01:00:26 -0800 Subject: st/mesa: Clean up header file inclusion in st_cb_readpixels.h. --- src/mesa/state_tracker/st_cb_readpixels.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_readpixels.h b/src/mesa/state_tracker/st_cb_readpixels.h index 83c9b659e3d..9622ae6feea 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.h +++ b/src/mesa/state_tracker/st_cb_readpixels.h @@ -29,9 +29,11 @@ #ifndef ST_CB_READPIXELS_H #define ST_CB_READPIXELS_H -#include "main/mtypes.h" +#include "main/glheader.h" struct dd_function_table; +struct gl_context; +struct gl_pixelstore_attrib; extern struct st_renderbuffer * st_get_color_read_renderbuffer(struct gl_context *ctx); -- cgit v1.2.3 From 2dd788663a8d54e8d54fc373d9399548f324c9ea Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 20 Dec 2010 01:15:04 -0800 Subject: st/mesa: Clean up header file inclusion in st_cb_texture.h. --- src/mesa/state_tracker/st_cb_texture.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h index 60987055eb1..f1502bda788 100644 --- a/src/mesa/state_tracker/st_cb_texture.h +++ b/src/mesa/state_tracker/st_cb_texture.h @@ -31,9 +31,10 @@ #include "main/glheader.h" -#include "main/mtypes.h" struct dd_function_table; +struct gl_context; +struct gl_texture_object; struct pipe_context; struct st_context; -- cgit v1.2.3 From c451aade889c3c0733fabab691f2a33643e8a054 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 20 Dec 2010 01:24:26 -0800 Subject: st/mesa: Remove comment cruft from st_context.h. This was unintentionally added by commit 1525fb4afec0adc164948b4060ec1c0359441cd3. --- src/mesa/state_tracker/st_context.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 68b52286d94..1fd80053c1b 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -1,4 +1,3 @@ -//struct dd_function_table; /************************************************************************** * * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. -- cgit v1.2.3 From ec51092a72e2dff1e9b1362d813fe4691cda89b7 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sun, 19 Dec 2010 04:17:43 +0100 Subject: gallium: remove unused 'buf' parameter in pipe_buffer_unmap --- src/gallium/auxiliary/util/u_index_modify.c | 12 ++++++------ src/gallium/auxiliary/util/u_inlines.h | 3 +-- src/gallium/auxiliary/util/u_upload_mgr.c | 4 ++-- src/gallium/drivers/nv50/nv50_shader_state.c | 2 +- src/gallium/drivers/nv50/nv50_vbo.c | 2 +- src/gallium/drivers/r300/r300_render.c | 11 +++++------ src/gallium/drivers/r300/r300_render_translate.c | 5 ++--- src/gallium/drivers/r600/r600_translate.c | 5 ++--- src/gallium/drivers/svga/svga_draw_arrays.c | 4 ++-- src/gallium/drivers/svga/svga_draw_elements.c | 8 ++++---- src/gallium/drivers/svga/svga_state_constants.c | 2 +- src/gallium/drivers/svga/svga_state_vs.c | 4 +--- src/gallium/drivers/svga/svga_swtnl_backend.c | 2 +- src/gallium/drivers/svga/svga_swtnl_draw.c | 9 +++------ src/mesa/state_tracker/st_cb_bufferobjects.c | 6 +++--- src/mesa/state_tracker/st_cb_drawtex.c | 2 +- src/mesa/state_tracker/st_draw_feedback.c | 8 +++----- 17 files changed, 39 insertions(+), 50 deletions(-) diff --git a/src/gallium/auxiliary/util/u_index_modify.c b/src/gallium/auxiliary/util/u_index_modify.c index 65b079ed537..3822f60e71d 100644 --- a/src/gallium/auxiliary/util/u_index_modify.c +++ b/src/gallium/auxiliary/util/u_index_modify.c @@ -52,8 +52,8 @@ void util_shorten_ubyte_elts(struct pipe_context *context, out_map++; } - pipe_buffer_unmap(context, *elts, src_transfer); - pipe_buffer_unmap(context, new_elts, dst_transfer); + pipe_buffer_unmap(context, src_transfer); + pipe_buffer_unmap(context, dst_transfer); *elts = new_elts; } @@ -86,8 +86,8 @@ void util_rebuild_ushort_elts(struct pipe_context *context, out_map++; } - pipe_buffer_unmap(context, *elts, in_transfer); - pipe_buffer_unmap(context, new_elts, out_transfer); + pipe_buffer_unmap(context, in_transfer); + pipe_buffer_unmap(context, out_transfer); *elts = new_elts; } @@ -120,8 +120,8 @@ void util_rebuild_uint_elts(struct pipe_context *context, out_map++; } - pipe_buffer_unmap(context, *elts, in_transfer); - pipe_buffer_unmap(context, new_elts, out_transfer); + pipe_buffer_unmap(context, in_transfer); + pipe_buffer_unmap(context, out_transfer); *elts = new_elts; } diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index e55aafe90f0..9184b6aa4db 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -242,7 +242,6 @@ pipe_buffer_map(struct pipe_context *pipe, static INLINE void pipe_buffer_unmap(struct pipe_context *pipe, - struct pipe_resource *buf, struct pipe_transfer *transfer) { if (transfer) { @@ -341,7 +340,7 @@ pipe_buffer_read(struct pipe_context *pipe, if (map) memcpy(data, map + offset, size); - pipe_buffer_unmap(pipe, buf, src_transfer); + pipe_buffer_unmap(pipe, src_transfer); } static INLINE struct pipe_transfer * diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index af229e61a00..4daa55d6638 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -108,7 +108,7 @@ my_buffer_write(struct pipe_context *pipe, memcpy(map + offset, data, size); pipe_buffer_flush_mapped_range(pipe, transfer, offset, dirty_size); - pipe_buffer_unmap(pipe, buf, transfer); + pipe_buffer_unmap(pipe, transfer); return PIPE_OK; } @@ -243,7 +243,7 @@ enum pipe_error u_upload_buffer( struct u_upload_mgr *upload, done: if (map) - pipe_buffer_unmap( upload->pipe, inbuf, transfer ); + pipe_buffer_unmap( upload->pipe, transfer ); return ret; } diff --git a/src/gallium/drivers/nv50/nv50_shader_state.c b/src/gallium/drivers/nv50/nv50_shader_state.c index 306aa81d985..1c1b66deb3c 100644 --- a/src/gallium/drivers/nv50/nv50_shader_state.c +++ b/src/gallium/drivers/nv50/nv50_shader_state.c @@ -71,7 +71,7 @@ nv50_transfer_constbuf(struct nv50_context *nv50, map += nr; } - pipe_buffer_unmap(pipe, buf, transfer); + pipe_buffer_unmap(pipe, transfer); } static void diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index d41a59d05db..53f319acf46 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -284,7 +284,7 @@ nv50_draw_elements_inline(struct pipe_context *pipe, nzi = TRUE; } - pipe_buffer_unmap(pipe, indexBuffer, transfer); + pipe_buffer_unmap(pipe, transfer); } static void diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 1d26eb9f918..f58d511e11b 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -425,7 +425,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300, if (transfer[vbi]) { vbuf = &r300->vertex_buffer[vbi]; - pipe_buffer_unmap(&r300->context, vbuf->buffer, transfer[vbi]); + pipe_buffer_unmap(&r300->context, transfer[vbi]); transfer[vbi] = NULL; } } @@ -568,7 +568,7 @@ static void r300_draw_range_elements(struct pipe_context* pipe, indexBuffer = userbuf; r300_upload_index_buffer(r300, &indexBuffer, indexSize, 0, count, &new_offset); pipe_resource_reference(&userbuf, NULL); - pipe_buffer_unmap(pipe, indexBuffer, transfer); + pipe_buffer_unmap(pipe, transfer); } else { r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &new_offset); } @@ -770,14 +770,13 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe, for (i = 0; i < r300->vertex_buffer_count; i++) { if (r300->vertex_buffer[i].buffer) { - pipe_buffer_unmap(pipe, r300->vertex_buffer[i].buffer, - vb_transfer[i]); + pipe_buffer_unmap(pipe, vb_transfer[i]); draw_set_mapped_vertex_buffer(r300->draw, i, NULL); } } if (indexed) { - pipe_buffer_unmap(pipe, r300->index_buffer.buffer, ib_transfer); + pipe_buffer_unmap(pipe, ib_transfer); draw_set_mapped_index_buffer(r300->draw, NULL); } } @@ -877,7 +876,7 @@ static void r300_render_unmap_vertices(struct vbuf_render* render, r300render->vbo_max_used = MAX2(r300render->vbo_max_used, r300render->vertex_size * (max + 1)); - pipe_buffer_unmap(context, r300->vbo, r300render->vbo_transfer); + pipe_buffer_unmap(context, r300render->vbo_transfer); r300render->vbo_transfer = NULL; } diff --git a/src/gallium/drivers/r300/r300_render_translate.c b/src/gallium/drivers/r300/r300_render_translate.c index 90b2f40be5f..26e00a2cad9 100644 --- a/src/gallium/drivers/r300/r300_render_translate.c +++ b/src/gallium/drivers/r300/r300_render_translate.c @@ -128,12 +128,11 @@ void r300_begin_vertex_translate(struct r300_context *r300) /* Unmap all buffers. */ for (i = 0; i < r300->vertex_buffer_count; i++) { if (vb_translated[i]) { - pipe_buffer_unmap(pipe, r300->vertex_buffer[i].buffer, - vb_transfer[i]); + pipe_buffer_unmap(pipe, vb_transfer[i]); } } - pipe_buffer_unmap(pipe, out_buffer, out_transfer); + pipe_buffer_unmap(pipe, out_transfer); /* Setup the new vertex buffer in the first free slot. */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { diff --git a/src/gallium/drivers/r600/r600_translate.c b/src/gallium/drivers/r600/r600_translate.c index ba12eee2b56..f80fa7af941 100644 --- a/src/gallium/drivers/r600/r600_translate.c +++ b/src/gallium/drivers/r600/r600_translate.c @@ -125,12 +125,11 @@ void r600_begin_vertex_translate(struct r600_pipe_context *rctx) /* Unmap all buffers. */ for (i = 0; i < rctx->nvertex_buffer; i++) { if (vb_translated[i]) { - pipe_buffer_unmap(pipe, rctx->vertex_buffer[i].buffer, - vb_transfer[i]); + pipe_buffer_unmap(pipe, vb_transfer[i]); } } - pipe_buffer_unmap(pipe, out_buffer, out_transfer); + pipe_buffer_unmap(pipe, out_transfer); /* Setup the new vertex buffer in the first free slot. */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c index da33fae62f1..be0e7abe21b 100644 --- a/src/gallium/drivers/svga/svga_draw_arrays.c +++ b/src/gallium/drivers/svga/svga_draw_arrays.c @@ -65,14 +65,14 @@ static enum pipe_error generate_indices( struct svga_hwtnl *hwtnl, generate( nr, dst_map ); - pipe_buffer_unmap( pipe, dst, transfer ); + pipe_buffer_unmap( pipe, transfer ); *out_buf = dst; return PIPE_OK; fail: if (dst_map) - pipe_buffer_unmap( pipe, dst, transfer ); + pipe_buffer_unmap( pipe, transfer ); if (dst) pipe->screen->resource_destroy( pipe->screen, dst ); diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c index c4579177b77..c7ea014bba5 100644 --- a/src/gallium/drivers/svga/svga_draw_elements.c +++ b/src/gallium/drivers/svga/svga_draw_elements.c @@ -72,18 +72,18 @@ translate_indices( struct svga_hwtnl *hwtnl, nr, dst_map ); - pipe_buffer_unmap( pipe, src, src_transfer ); - pipe_buffer_unmap( pipe, dst, dst_transfer ); + pipe_buffer_unmap( pipe, src_transfer ); + pipe_buffer_unmap( pipe, dst_transfer ); *out_buf = dst; return PIPE_OK; fail: if (src_map) - pipe_buffer_unmap( pipe, src, src_transfer ); + pipe_buffer_unmap( pipe, src_transfer ); if (dst_map) - pipe_buffer_unmap( pipe, dst, dst_transfer ); + pipe_buffer_unmap( pipe, dst_transfer ); if (dst) pipe->screen->resource_destroy( pipe->screen, dst ); diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 97c818cd379..daf1024fd02 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -110,7 +110,7 @@ static int emit_consts( struct svga_context *svga, done: if (data) - pipe_buffer_unmap(&svga->pipe, svga->curr.cb[unit], transfer); + pipe_buffer_unmap(&svga->pipe, transfer); return ret; } diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c index 5133c70593c..6682a1efe66 100644 --- a/src/gallium/drivers/svga/svga_state_vs.c +++ b/src/gallium/drivers/svga/svga_state_vs.c @@ -233,9 +233,7 @@ static int update_zero_stride( struct svga_context *svga, translate->run(translate, 0, 1, 0, svga->curr.zero_stride_constants); - pipe_buffer_unmap(&svga->pipe, - vbuffer->buffer, - transfer); + pipe_buffer_unmap(&svga->pipe, transfer); translate->release(translate); } diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c index ff3da842729..24646b48f62 100644 --- a/src/gallium/drivers/svga/svga_swtnl_backend.c +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c @@ -141,7 +141,7 @@ svga_vbuf_render_unmap_vertices( struct vbuf_render *render, pipe_buffer_flush_mapped_range(&svga->pipe, svga_render->vbuf_transfer, offset, length); - pipe_buffer_unmap(&svga->pipe, svga_render->vbuf, svga_render->vbuf_transfer); + pipe_buffer_unmap(&svga->pipe, svga_render->vbuf_transfer); svga_render->min_index = min_index; svga_render->max_index = max_index; svga_render->vbuf_used = MAX2(svga_render->vbuf_used, used); diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c index 814e8edd70f..d9039845819 100644 --- a/src/gallium/drivers/svga/svga_swtnl_draw.c +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -106,20 +106,17 @@ svga_swtnl_draw_vbo(struct svga_context *svga, * unmap vertex/index buffers */ for (i = 0; i < svga->curr.num_vertex_buffers; i++) { - pipe_buffer_unmap(&svga->pipe, svga->curr.vb[i].buffer, - vb_transfer[i]); + pipe_buffer_unmap(&svga->pipe, vb_transfer[i]); draw_set_mapped_vertex_buffer(draw, i, NULL); } if (ib_transfer) { - pipe_buffer_unmap(&svga->pipe, svga->curr.ib.buffer, ib_transfer); + pipe_buffer_unmap(&svga->pipe, ib_transfer); draw_set_mapped_index_buffer(draw, NULL); } if (svga->curr.cb[PIPE_SHADER_VERTEX]) { - pipe_buffer_unmap(&svga->pipe, - svga->curr.cb[PIPE_SHADER_VERTEX], - cb_transfer); + pipe_buffer_unmap(&svga->pipe, cb_transfer); } return ret; diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 8b60f9040d0..d4d9af4ada3 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -360,7 +360,7 @@ st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_objec struct st_buffer_object *st_obj = st_buffer_object(obj); if (obj->Length) - pipe_buffer_unmap(pipe, st_obj->buffer, st_obj->transfer); + pipe_buffer_unmap(pipe, st_obj->transfer); st_obj->transfer = NULL; obj->Pointer = NULL; @@ -409,8 +409,8 @@ st_copy_buffer_subdata(struct gl_context *ctx, if (srcPtr && dstPtr) memcpy(dstPtr + writeOffset, srcPtr + readOffset, size); - pipe_buffer_unmap(pipe, srcObj->buffer, src_transfer); - pipe_buffer_unmap(pipe, dstObj->buffer, dst_transfer); + pipe_buffer_unmap(pipe, src_transfer); + pipe_buffer_unmap(pipe, dst_transfer); } diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 6cad7d3216e..22a5ed425e5 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -220,7 +220,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, } } - pipe_buffer_unmap(pipe, vbuffer, vbuffer_transfer); + pipe_buffer_unmap(pipe, vbuffer_transfer); #undef SET_ATTRIB } diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 0a6cebb84cc..da67c713710 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -259,16 +259,14 @@ st_feedback_draw_vbo(struct gl_context *ctx, /* unmap constant buffers */ - pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX], - cb_transfer); + pipe_buffer_unmap(pipe, cb_transfer); /* * unmap vertex/index buffers */ for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { if (draw->pt.vertex_buffer[i].buffer) { - pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer, - vb_transfer[i]); + pipe_buffer_unmap(pipe, vb_transfer[i]); pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL); draw_set_mapped_vertex_buffer(draw, i, NULL); } @@ -279,7 +277,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, draw_set_index_buffer(draw, NULL); if (ib_transfer) - pipe_buffer_unmap(pipe, ibuffer.buffer, ib_transfer); + pipe_buffer_unmap(pipe, ib_transfer); pipe_resource_reference(&ibuffer.buffer, NULL); } } -- cgit v1.2.3 From a14f79f801c52ac6d757ec6ab4c90a8cf952912b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 20 Dec 2010 11:40:54 -0800 Subject: st/python: remove unused 'buf' parameter in pipe_buffer_unmap This is a follow-up to commit ec51092a72e2dff1e9b1362d813fe4691cda89b7. Fixes SCons build. --- src/gallium/state_trackers/python/p_context.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 5bdeaa8e4ea..d694651eef7 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -360,7 +360,7 @@ struct st_context { if (!map) goto error2; memcpy(map, vertices, size); - pipe_buffer_unmap(pipe, vbuf, transfer); + pipe_buffer_unmap(pipe, transfer); cso_save_vertex_elements($self->cso); -- cgit v1.2.3 From abe9ffc25c8d65b48ae02cdc8445b212b9f61632 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 20 Dec 2010 15:30:42 -0500 Subject: r600g: properly unset vertex buffer Fix bug http://bugs.freedesktop.org/show_bug.cgi?id=32455 Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 10 +++++----- src/gallium/drivers/r600/r600_state.c | 10 +++++----- src/gallium/drivers/r600/r600_state_common.c | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 07496ebf51e..af19beb6f3c 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1327,16 +1327,16 @@ void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx) vbuffer_index = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[vbuffer_index]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = rctx->vertex_elements->vbuffer_offset[i] + - vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + offset = rctx->vertex_elements->vbuffer_offset[i]; } else { /* bind vertex buffer once */ vertex_buffer = &rctx->vertex_buffer[i]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + offset = 0; } + if (vertex_buffer == NULL) + continue; + offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo); r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index cd5f0792d5e..0d76afd6cd5 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -167,16 +167,16 @@ void r600_vertex_buffer_update(struct r600_pipe_context *rctx) vbuffer_index = rctx->vertex_elements->elements[i].vertex_buffer_index; vertex_buffer = &rctx->vertex_buffer[vbuffer_index]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = rctx->vertex_elements->vbuffer_offset[i] + - vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + offset = rctx->vertex_elements->vbuffer_offset[i]; } else { /* bind vertex buffer once */ vertex_buffer = &rctx->vertex_buffer[i]; rbuffer = (struct r600_resource*)vertex_buffer->buffer; - offset = vertex_buffer->buffer_offset + - r600_bo_offset(rbuffer->bo); + offset = 0; } + if (vertex_buffer == NULL) + continue; + offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo); r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo); diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 99b372caace..f488cf74ff2 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -179,8 +179,16 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, struct pipe_vertex_buffer *vbo; unsigned max_index = (unsigned)-1; - for (int i = 0; i < rctx->nvertex_buffer; i++) { - pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + if (rctx->family >= CHIP_CEDAR) { + for (int i = 0; i < rctx->nvertex_buffer; i++) { + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + evergreen_fs_resource_set(&rctx->ctx, NULL, i); + } + } else { + for (int i = 0; i < rctx->nvertex_buffer; i++) { + pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); + r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); + } } memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); @@ -188,6 +196,8 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, vbo = (struct pipe_vertex_buffer*)&buffers[i]; rctx->vertex_buffer[i].buffer = NULL; + if (buffers[i].buffer == NULL) + continue; if (r600_buffer_is_user_buffer(buffers[i].buffer)) rctx->any_user_vbs = TRUE; pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer); -- cgit v1.2.3 From cd9ed3da684d8cce845730f23b0ce74890e09262 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Mon, 20 Dec 2010 19:24:29 -0700 Subject: Regenerate gl_mangle.h. NOTE: This is a candidate for the 7.10 branch. --- include/GL/gl_mangle.h | 332 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 329 insertions(+), 3 deletions(-) diff --git a/include/GL/gl_mangle.h b/include/GL/gl_mangle.h index 43d2e896b0b..36848033817 100644 --- a/include/GL/gl_mangle.h +++ b/include/GL/gl_mangle.h @@ -31,6 +31,7 @@ #define glAccum MANGLE(Accum) #define glActiveProgramEXT MANGLE(ActiveProgramEXT) +#define glActiveShaderProgram MANGLE(ActiveShaderProgram) #define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT) #define glActiveTextureARB MANGLE(ActiveTextureARB) #define glActiveTexture MANGLE(ActiveTexture) @@ -56,6 +57,7 @@ #define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV) #define glBeginPerfMonitorAMD MANGLE(BeginPerfMonitorAMD) #define glBeginQueryARB MANGLE(BeginQueryARB) +#define glBeginQueryIndexed MANGLE(BeginQueryIndexed) #define glBeginQuery MANGLE(BeginQuery) #define glBeginTransformFeedbackEXT MANGLE(BeginTransformFeedbackEXT) #define glBeginTransformFeedback MANGLE(BeginTransformFeedback) @@ -75,22 +77,27 @@ #define glBindBufferRange MANGLE(BindBufferRange) #define glBindBufferRangeNV MANGLE(BindBufferRangeNV) #define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT) +#define glBindFragDataLocationIndexed MANGLE(BindFragDataLocationIndexed) #define glBindFragDataLocation MANGLE(BindFragDataLocation) #define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI) #define glBindFramebufferEXT MANGLE(BindFramebufferEXT) #define glBindFramebuffer MANGLE(BindFramebuffer) +#define glBindImageTextureEXT MANGLE(BindImageTextureEXT) #define glBindLightParameterEXT MANGLE(BindLightParameterEXT) #define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT) #define glBindMultiTextureEXT MANGLE(BindMultiTextureEXT) #define glBindParameterEXT MANGLE(BindParameterEXT) #define glBindProgramARB MANGLE(BindProgramARB) #define glBindProgramNV MANGLE(BindProgramNV) +#define glBindProgramPipeline MANGLE(BindProgramPipeline) #define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT) #define glBindRenderbuffer MANGLE(BindRenderbuffer) +#define glBindSampler MANGLE(BindSampler) #define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT) #define glBindTextureEXT MANGLE(BindTextureEXT) #define glBindTexture MANGLE(BindTexture) #define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT) +#define glBindTransformFeedback MANGLE(BindTransformFeedback) #define glBindTransformFeedbackNV MANGLE(BindTransformFeedbackNV) #define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE) #define glBindVertexArray MANGLE(BindVertexArray) @@ -112,18 +119,22 @@ #define glBlendColorEXT MANGLE(BlendColorEXT) #define glBlendColor MANGLE(BlendColor) #define glBlendEquationEXT MANGLE(BlendEquationEXT) +#define glBlendEquationiARB MANGLE(BlendEquationiARB) #define glBlendEquationi MANGLE(BlendEquationi) #define glBlendEquationIndexedAMD MANGLE(BlendEquationIndexedAMD) #define glBlendEquation MANGLE(BlendEquation) #define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI) #define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT) +#define glBlendEquationSeparateiARB MANGLE(BlendEquationSeparateiARB) #define glBlendEquationSeparatei MANGLE(BlendEquationSeparatei) #define glBlendEquationSeparateIndexedAMD MANGLE(BlendEquationSeparateIndexedAMD) #define glBlendEquationSeparate MANGLE(BlendEquationSeparate) +#define glBlendFunciARB MANGLE(BlendFunciARB) #define glBlendFunci MANGLE(BlendFunci) #define glBlendFuncIndexedAMD MANGLE(BlendFuncIndexedAMD) #define glBlendFunc MANGLE(BlendFunc) #define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT) +#define glBlendFuncSeparateiARB MANGLE(BlendFuncSeparateiARB) #define glBlendFuncSeparatei MANGLE(BlendFuncSeparatei) #define glBlendFuncSeparateIndexedAMD MANGLE(BlendFuncSeparateIndexedAMD) #define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR) @@ -153,6 +164,7 @@ #define glClearColor MANGLE(ClearColor) #define glClearDebugLogMESA MANGLE(ClearDebugLogMESA) #define glClearDepthdNV MANGLE(ClearDepthdNV) +#define glClearDepthf MANGLE(ClearDepthf) #define glClearDepth MANGLE(ClearDepth) #define glClearIndex MANGLE(ClearIndex) #define glClear MANGLE(Clear) @@ -215,6 +227,10 @@ #define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT) #define glColorMask MANGLE(ColorMask) #define glColorMaterial MANGLE(ColorMaterial) +#define glColorP3ui MANGLE(ColorP3ui) +#define glColorP3uiv MANGLE(ColorP3uiv) +#define glColorP4ui MANGLE(ColorP4ui) +#define glColorP4uiv MANGLE(ColorP4uiv) #define glColorPointerEXT MANGLE(ColorPointerEXT) #define glColorPointerListIBM MANGLE(ColorPointerListIBM) #define glColorPointer MANGLE(ColorPointer) @@ -236,6 +252,7 @@ #define glCombinerParameterivNV MANGLE(CombinerParameterivNV) #define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV) #define glCompileShaderARB MANGLE(CompileShaderARB) +#define glCompileShaderIncludeARB MANGLE(CompileShaderIncludeARB) #define glCompileShader MANGLE(CompileShader) #define glCompressedMultiTexImage1DEXT MANGLE(CompressedMultiTexImage1DEXT) #define glCompressedMultiTexImage2DEXT MANGLE(CompressedMultiTexImage2DEXT) @@ -310,10 +327,18 @@ #define glCreateShader MANGLE(CreateShader) #define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB) #define glCreateShaderProgramEXT MANGLE(CreateShaderProgramEXT) +#define glCreateShaderProgramv MANGLE(CreateShaderProgramv) +#define glCreateSyncFromCLeventARB MANGLE(CreateSyncFromCLeventARB) #define glCullFace MANGLE(CullFace) #define glCullParameterdvEXT MANGLE(CullParameterdvEXT) #define glCullParameterfvEXT MANGLE(CullParameterfvEXT) #define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB) +#define glDebugMessageCallbackAMD MANGLE(DebugMessageCallbackAMD) +#define glDebugMessageCallbackARB MANGLE(DebugMessageCallbackARB) +#define glDebugMessageControlARB MANGLE(DebugMessageControlARB) +#define glDebugMessageEnableAMD MANGLE(DebugMessageEnableAMD) +#define glDebugMessageInsertAMD MANGLE(DebugMessageInsertAMD) +#define glDebugMessageInsertARB MANGLE(DebugMessageInsertARB) #define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX) #define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX) #define glDeformSGIX MANGLE(DeformSGIX) @@ -326,20 +351,25 @@ #define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT) #define glDeleteFramebuffers MANGLE(DeleteFramebuffers) #define glDeleteLists MANGLE(DeleteLists) +#define glDeleteNamedStringARB MANGLE(DeleteNamedStringARB) +#define glDeleteNamesAMD MANGLE(DeleteNamesAMD) #define glDeleteObjectARB MANGLE(DeleteObjectARB) #define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV) #define glDeletePerfMonitorsAMD MANGLE(DeletePerfMonitorsAMD) #define glDeleteProgram MANGLE(DeleteProgram) +#define glDeleteProgramPipelines MANGLE(DeleteProgramPipelines) #define glDeleteProgramsARB MANGLE(DeleteProgramsARB) #define glDeleteProgramsNV MANGLE(DeleteProgramsNV) #define glDeleteQueriesARB MANGLE(DeleteQueriesARB) #define glDeleteQueries MANGLE(DeleteQueries) #define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT) #define glDeleteRenderbuffers MANGLE(DeleteRenderbuffers) +#define glDeleteSamplers MANGLE(DeleteSamplers) #define glDeleteShader MANGLE(DeleteShader) #define glDeleteSync MANGLE(DeleteSync) #define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT) #define glDeleteTextures MANGLE(DeleteTextures) +#define glDeleteTransformFeedbacks MANGLE(DeleteTransformFeedbacks) #define glDeleteTransformFeedbacksNV MANGLE(DeleteTransformFeedbacksNV) #define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE) #define glDeleteVertexArrays MANGLE(DeleteVertexArrays) @@ -348,7 +378,10 @@ #define glDepthBoundsEXT MANGLE(DepthBoundsEXT) #define glDepthFunc MANGLE(DepthFunc) #define glDepthMask MANGLE(DepthMask) +#define glDepthRangeArrayv MANGLE(DepthRangeArrayv) #define glDepthRangedNV MANGLE(DepthRangedNV) +#define glDepthRangef MANGLE(DepthRangef) +#define glDepthRangeIndexed MANGLE(DepthRangeIndexed) #define glDepthRange MANGLE(DepthRange) #define glDetachObjectARB MANGLE(DetachObjectARB) #define glDetachShader MANGLE(DetachShader) @@ -363,6 +396,7 @@ #define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB) #define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray) #define glDrawArraysEXT MANGLE(DrawArraysEXT) +#define glDrawArraysIndirect MANGLE(DrawArraysIndirect) #define glDrawArraysInstancedARB MANGLE(DrawArraysInstancedARB) #define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT) #define glDrawArraysInstanced MANGLE(DrawArraysInstanced) @@ -374,6 +408,7 @@ #define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE) #define glDrawElementArrayATI MANGLE(DrawElementArrayATI) #define glDrawElementsBaseVertex MANGLE(DrawElementsBaseVertex) +#define glDrawElementsIndirect MANGLE(DrawElementsIndirect) #define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB) #define glDrawElementsInstancedBaseVertex MANGLE(DrawElementsInstancedBaseVertex) #define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT) @@ -386,7 +421,9 @@ #define glDrawRangeElementsBaseVertex MANGLE(DrawRangeElementsBaseVertex) #define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT) #define glDrawRangeElements MANGLE(DrawRangeElements) +#define glDrawTransformFeedback MANGLE(DrawTransformFeedback) #define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV) +#define glDrawTransformFeedbackStream MANGLE(DrawTransformFeedbackStream) #define glEdgeFlagFormatNV MANGLE(EdgeFlagFormatNV) #define glEdgeFlag MANGLE(EdgeFlag) #define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT) @@ -414,6 +451,7 @@ #define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV) #define glEndPerfMonitorAMD MANGLE(EndPerfMonitorAMD) #define glEndQueryARB MANGLE(EndQueryARB) +#define glEndQueryIndexed MANGLE(EndQueryIndexed) #define glEndQuery MANGLE(EndQuery) #define glEndTransformFeedbackEXT MANGLE(EndTransformFeedbackEXT) #define glEndTransformFeedback MANGLE(EndTransformFeedback) @@ -447,6 +485,7 @@ #define glFlush MANGLE(Flush) #define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE) #define glFlushMappedBufferRange MANGLE(FlushMappedBufferRange) +#define glFlushMappedNamedBufferRangeEXT MANGLE(FlushMappedNamedBufferRangeEXT) #define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV) #define glFlushRasterSGIX MANGLE(FlushRasterSGIX) #define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE) @@ -498,7 +537,6 @@ #define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT) #define glFramebufferTextureFaceARB MANGLE(FramebufferTextureFaceARB) #define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT) -#define glFramebufferTextureFace MANGLE(FramebufferTextureFace) #define glFramebufferTextureLayerARB MANGLE(FramebufferTextureLayerARB) #define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT) #define glFramebufferTextureLayer MANGLE(FramebufferTextureLayer) @@ -521,23 +559,30 @@ #define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT) #define glGenFramebuffers MANGLE(GenFramebuffers) #define glGenLists MANGLE(GenLists) +#define glGenNamesAMD MANGLE(GenNamesAMD) #define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV) #define glGenPerfMonitorsAMD MANGLE(GenPerfMonitorsAMD) +#define glGenProgramPipelines MANGLE(GenProgramPipelines) #define glGenProgramsARB MANGLE(GenProgramsARB) #define glGenProgramsNV MANGLE(GenProgramsNV) #define glGenQueriesARB MANGLE(GenQueriesARB) #define glGenQueries MANGLE(GenQueries) #define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT) #define glGenRenderbuffers MANGLE(GenRenderbuffers) +#define glGenSamplers MANGLE(GenSamplers) #define glGenSymbolsEXT MANGLE(GenSymbolsEXT) #define glGenTexturesEXT MANGLE(GenTexturesEXT) #define glGenTextures MANGLE(GenTextures) +#define glGenTransformFeedbacks MANGLE(GenTransformFeedbacks) #define glGenTransformFeedbacksNV MANGLE(GenTransformFeedbacksNV) #define glGenVertexArraysAPPLE MANGLE(GenVertexArraysAPPLE) #define glGenVertexArrays MANGLE(GenVertexArrays) #define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT) #define glGetActiveAttribARB MANGLE(GetActiveAttribARB) #define glGetActiveAttrib MANGLE(GetActiveAttrib) +#define glGetActiveSubroutineName MANGLE(GetActiveSubroutineName) +#define glGetActiveSubroutineUniformiv MANGLE(GetActiveSubroutineUniformiv) +#define glGetActiveSubroutineUniformName MANGLE(GetActiveSubroutineUniformName) #define glGetActiveUniformARB MANGLE(GetActiveUniformARB) #define glGetActiveUniformBlockiv MANGLE(GetActiveUniformBlockiv) #define glGetActiveUniformBlockName MANGLE(GetActiveUniformBlockName) @@ -589,16 +634,21 @@ #define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv) #define glGetDebugLogLengthMESA MANGLE(GetDebugLogLengthMESA) #define glGetDebugLogMESA MANGLE(GetDebugLogMESA) +#define glGetDebugMessageLogAMD MANGLE(GetDebugMessageLogAMD) +#define glGetDebugMessageLogARB MANGLE(GetDebugMessageLogARB) #define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS) #define glGetDoubleIndexedvEXT MANGLE(GetDoubleIndexedvEXT) +#define glGetDoublei_v MANGLE(GetDoublei_v) #define glGetDoublev MANGLE(GetDoublev) #define glGetError MANGLE(GetError) #define glGetFenceivNV MANGLE(GetFenceivNV) #define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV) #define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV) #define glGetFloatIndexedvEXT MANGLE(GetFloatIndexedvEXT) +#define glGetFloati_v MANGLE(GetFloati_v) #define glGetFloatv MANGLE(GetFloatv) #define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS) +#define glGetFragDataIndex MANGLE(GetFragDataIndex) #define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT) #define glGetFragDataLocation MANGLE(GetFragDataLocation) #define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX) @@ -608,6 +658,7 @@ #define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT) #define glGetFramebufferAttachmentParameteriv MANGLE(GetFramebufferAttachmentParameteriv) #define glGetFramebufferParameterivEXT MANGLE(GetFramebufferParameterivEXT) +#define glGetGraphicsResetStatusARB MANGLE(GetGraphicsResetStatusARB) #define glGetHandleARB MANGLE(GetHandleARB) #define glGetHistogramEXT MANGLE(GetHistogramEXT) #define glGetHistogram MANGLE(GetHistogram) @@ -678,6 +729,26 @@ #define glGetNamedProgramLocalParameterIuivEXT MANGLE(GetNamedProgramLocalParameterIuivEXT) #define glGetNamedProgramStringEXT MANGLE(GetNamedProgramStringEXT) #define glGetNamedRenderbufferParameterivEXT MANGLE(GetNamedRenderbufferParameterivEXT) +#define glGetNamedStringARB MANGLE(GetNamedStringARB) +#define glGetNamedStringivARB MANGLE(GetNamedStringivARB) +#define glGetnColorTableARB MANGLE(GetnColorTableARB) +#define glGetnCompressedTexImageARB MANGLE(GetnCompressedTexImageARB) +#define glGetnConvolutionFilterARB MANGLE(GetnConvolutionFilterARB) +#define glGetnHistogramARB MANGLE(GetnHistogramARB) +#define glGetnMapdvARB MANGLE(GetnMapdvARB) +#define glGetnMapfvARB MANGLE(GetnMapfvARB) +#define glGetnMapivARB MANGLE(GetnMapivARB) +#define glGetnMinmaxARB MANGLE(GetnMinmaxARB) +#define glGetnPixelMapfvARB MANGLE(GetnPixelMapfvARB) +#define glGetnPixelMapuivARB MANGLE(GetnPixelMapuivARB) +#define glGetnPixelMapusvARB MANGLE(GetnPixelMapusvARB) +#define glGetnPolygonStippleARB MANGLE(GetnPolygonStippleARB) +#define glGetnSeparableFilterARB MANGLE(GetnSeparableFilterARB) +#define glGetnTexImageARB MANGLE(GetnTexImageARB) +#define glGetnUniformdvARB MANGLE(GetnUniformdvARB) +#define glGetnUniformfvARB MANGLE(GetnUniformfvARB) +#define glGetnUniformivARB MANGLE(GetnUniformivARB) +#define glGetnUniformuivARB MANGLE(GetnUniformuivARB) #define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI) #define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI) #define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB) @@ -700,6 +771,7 @@ #define glGetPointervEXT MANGLE(GetPointervEXT) #define glGetPointerv MANGLE(GetPointerv) #define glGetPolygonStipple MANGLE(GetPolygonStipple) +#define glGetProgramBinary MANGLE(GetProgramBinary) #define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB) #define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB) #define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV) @@ -716,28 +788,42 @@ #define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV) #define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV) #define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV) +#define glGetProgramPipelineInfoLog MANGLE(GetProgramPipelineInfoLog) +#define glGetProgramPipelineiv MANGLE(GetProgramPipelineiv) #define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA) +#define glGetProgramStageiv MANGLE(GetProgramStageiv) #define glGetProgramStringARB MANGLE(GetProgramStringARB) #define glGetProgramStringNV MANGLE(GetProgramStringNV) +#define glGetProgramSubroutineParameteruivNV MANGLE(GetProgramSubroutineParameteruivNV) +#define glGetQueryIndexediv MANGLE(GetQueryIndexediv) #define glGetQueryivARB MANGLE(GetQueryivARB) #define glGetQueryiv MANGLE(GetQueryiv) #define glGetQueryObjecti64vEXT MANGLE(GetQueryObjecti64vEXT) +#define glGetQueryObjecti64v MANGLE(GetQueryObjecti64v) #define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB) #define glGetQueryObjectiv MANGLE(GetQueryObjectiv) #define glGetQueryObjectui64vEXT MANGLE(GetQueryObjectui64vEXT) +#define glGetQueryObjectui64v MANGLE(GetQueryObjectui64v) #define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB) #define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv) #define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT) #define glGetRenderbufferParameteriv MANGLE(GetRenderbufferParameteriv) +#define glGetSamplerParameterfv MANGLE(GetSamplerParameterfv) +#define glGetSamplerParameterIiv MANGLE(GetSamplerParameterIiv) +#define glGetSamplerParameterIuiv MANGLE(GetSamplerParameterIuiv) +#define glGetSamplerParameteriv MANGLE(GetSamplerParameteriv) #define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT) #define glGetSeparableFilter MANGLE(GetSeparableFilter) #define glGetShaderInfoLog MANGLE(GetShaderInfoLog) #define glGetShaderiv MANGLE(GetShaderiv) +#define glGetShaderPrecisionFormat MANGLE(GetShaderPrecisionFormat) #define glGetShaderSourceARB MANGLE(GetShaderSourceARB) #define glGetShaderSource MANGLE(GetShaderSource) #define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS) #define glGetStringi MANGLE(GetStringi) #define glGetString MANGLE(GetString) +#define glGetSubroutineIndex MANGLE(GetSubroutineIndex) +#define glGetSubroutineUniformLocation MANGLE(GetSubroutineUniformLocation) #define glGetSynciv MANGLE(GetSynciv) #define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI) #define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI) @@ -770,14 +856,17 @@ #define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV) #define glGetUniformBlockIndex MANGLE(GetUniformBlockIndex) #define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT) +#define glGetUniformdv MANGLE(GetUniformdv) #define glGetUniformfvARB MANGLE(GetUniformfvARB) #define glGetUniformfv MANGLE(GetUniformfv) +#define glGetUniformi64vNV MANGLE(GetUniformi64vNV) #define glGetUniformIndices MANGLE(GetUniformIndices) #define glGetUniformivARB MANGLE(GetUniformivARB) #define glGetUniformiv MANGLE(GetUniformiv) #define glGetUniformLocationARB MANGLE(GetUniformLocationARB) #define glGetUniformLocation MANGLE(GetUniformLocation) #define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT) +#define glGetUniformSubroutineuiv MANGLE(GetUniformSubroutineuiv) #define glGetUniformui64vNV MANGLE(GetUniformui64vNV) #define glGetUniformuivEXT MANGLE(GetUniformuivEXT) #define glGetUniformuiv MANGLE(GetUniformuiv) @@ -803,6 +892,10 @@ #define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB) #define glGetVertexAttribiv MANGLE(GetVertexAttribiv) #define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV) +#define glGetVertexAttribLdvEXT MANGLE(GetVertexAttribLdvEXT) +#define glGetVertexAttribLdv MANGLE(GetVertexAttribLdv) +#define glGetVertexAttribLi64vNV MANGLE(GetVertexAttribLi64vNV) +#define glGetVertexAttribLui64vNV MANGLE(GetVertexAttribLui64vNV) #define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB) #define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv) #define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV) @@ -864,20 +957,25 @@ #define glIsFramebufferEXT MANGLE(IsFramebufferEXT) #define glIsFramebuffer MANGLE(IsFramebuffer) #define glIsList MANGLE(IsList) +#define glIsNameAMD MANGLE(IsNameAMD) #define glIsNamedBufferResidentNV MANGLE(IsNamedBufferResidentNV) +#define glIsNamedStringARB MANGLE(IsNamedStringARB) #define glIsObjectBufferATI MANGLE(IsObjectBufferATI) #define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV) #define glIsProgramARB MANGLE(IsProgramARB) #define glIsProgram MANGLE(IsProgram) #define glIsProgramNV MANGLE(IsProgramNV) +#define glIsProgramPipeline MANGLE(IsProgramPipeline) #define glIsQueryARB MANGLE(IsQueryARB) #define glIsQuery MANGLE(IsQuery) #define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT) #define glIsRenderbuffer MANGLE(IsRenderbuffer) +#define glIsSampler MANGLE(IsSampler) #define glIsShader MANGLE(IsShader) #define glIsSync MANGLE(IsSync) #define glIsTextureEXT MANGLE(IsTextureEXT) #define glIsTexture MANGLE(IsTexture) +#define glIsTransformFeedback MANGLE(IsTransformFeedback) #define glIsTransformFeedbackNV MANGLE(IsTransformFeedbackNV) #define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT) #define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE) @@ -915,6 +1013,8 @@ #define glLogicOp MANGLE(LogicOp) #define glMakeBufferNonResidentNV MANGLE(MakeBufferNonResidentNV) #define glMakeBufferResidentNV MANGLE(MakeBufferResidentNV) +#define glMakeNamedBufferNonResidentNV MANGLE(MakeNamedBufferNonResidentNV) +#define glMakeNamedBufferResidentNV MANGLE(MakeNamedBufferResidentNV) #define glMap1d MANGLE(Map1d) #define glMap1f MANGLE(Map1f) #define glMap2d MANGLE(Map2d) @@ -928,6 +1028,7 @@ #define glMapGrid2d MANGLE(MapGrid2d) #define glMapGrid2f MANGLE(MapGrid2f) #define glMapNamedBufferEXT MANGLE(MapNamedBufferEXT) +#define glMapNamedBufferRangeEXT MANGLE(MapNamedBufferRangeEXT) #define glMapObjectBufferATI MANGLE(MapObjectBufferATI) #define glMapParameterfvNV MANGLE(MapParameterfvNV) #define glMapParameterivNV MANGLE(MapParameterivNV) @@ -963,8 +1064,10 @@ #define glMatrixScalefEXT MANGLE(MatrixScalefEXT) #define glMatrixTranslatedEXT MANGLE(MatrixTranslatedEXT) #define glMatrixTranslatefEXT MANGLE(MatrixTranslatefEXT) +#define glMemoryBarrierEXT MANGLE(MemoryBarrierEXT) #define glMinmaxEXT MANGLE(MinmaxEXT) #define glMinmax MANGLE(Minmax) +#define glMinSampleShadingARB MANGLE(MinSampleShadingARB) #define glMinSampleShading MANGLE(MinSampleShading) #define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT) #define glMultiDrawArrays MANGLE(MultiDrawArrays) @@ -1048,6 +1151,14 @@ #define glMultiTexCoord4s MANGLE(MultiTexCoord4s) #define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB) #define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv) +#define glMultiTexCoordP1ui MANGLE(MultiTexCoordP1ui) +#define glMultiTexCoordP1uiv MANGLE(MultiTexCoordP1uiv) +#define glMultiTexCoordP2ui MANGLE(MultiTexCoordP2ui) +#define glMultiTexCoordP2uiv MANGLE(MultiTexCoordP2uiv) +#define glMultiTexCoordP3ui MANGLE(MultiTexCoordP3ui) +#define glMultiTexCoordP3uiv MANGLE(MultiTexCoordP3uiv) +#define glMultiTexCoordP4ui MANGLE(MultiTexCoordP4ui) +#define glMultiTexCoordP4uiv MANGLE(MultiTexCoordP4uiv) #define glMultiTexCoordPointerEXT MANGLE(MultiTexCoordPointerEXT) #define glMultiTexEnvfEXT MANGLE(MultiTexEnvfEXT) #define glMultiTexEnvfvEXT MANGLE(MultiTexEnvfvEXT) @@ -1080,6 +1191,7 @@ #define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf) #define glNamedBufferDataEXT MANGLE(NamedBufferDataEXT) #define glNamedBufferSubDataEXT MANGLE(NamedBufferSubDataEXT) +#define glNamedCopyBufferSubDataEXT MANGLE(NamedCopyBufferSubDataEXT) #define glNamedFramebufferRenderbufferEXT MANGLE(NamedFramebufferRenderbufferEXT) #define glNamedFramebufferTexture1DEXT MANGLE(NamedFramebufferTexture1DEXT) #define glNamedFramebufferTexture2DEXT MANGLE(NamedFramebufferTexture2DEXT) @@ -1087,8 +1199,6 @@ #define glNamedFramebufferTextureEXT MANGLE(NamedFramebufferTextureEXT) #define glNamedFramebufferTextureFaceEXT MANGLE(NamedFramebufferTextureFaceEXT) #define glNamedFramebufferTextureLayerEXT MANGLE(NamedFramebufferTextureLayerEXT) -#define glNamedMakeBufferNonResidentNV MANGLE(NamedMakeBufferNonResidentNV) -#define glNamedMakeBufferResidentNV MANGLE(NamedMakeBufferResidentNV) #define glNamedProgramLocalParameter4dEXT MANGLE(NamedProgramLocalParameter4dEXT) #define glNamedProgramLocalParameter4dvEXT MANGLE(NamedProgramLocalParameter4dvEXT) #define glNamedProgramLocalParameter4fEXT MANGLE(NamedProgramLocalParameter4fEXT) @@ -1104,6 +1214,7 @@ #define glNamedRenderbufferStorageEXT MANGLE(NamedRenderbufferStorageEXT) #define glNamedRenderbufferStorageMultisampleCoverageEXT MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT) #define glNamedRenderbufferStorageMultisampleEXT MANGLE(NamedRenderbufferStorageMultisampleEXT) +#define glNamedStringARB MANGLE(NamedStringARB) #define glNewList MANGLE(NewList) #define glNewObjectBufferATI MANGLE(NewObjectBufferATI) #define glNormal3b MANGLE(Normal3b) @@ -1121,6 +1232,8 @@ #define glNormal3s MANGLE(Normal3s) #define glNormal3sv MANGLE(Normal3sv) #define glNormalFormatNV MANGLE(NormalFormatNV) +#define glNormalP3ui MANGLE(NormalP3ui) +#define glNormalP3uiv MANGLE(NormalP3uiv) #define glNormalPointerEXT MANGLE(NormalPointerEXT) #define glNormalPointerListIBM MANGLE(NormalPointerListIBM) #define glNormalPointer MANGLE(NormalPointer) @@ -1140,6 +1253,9 @@ #define glOrtho MANGLE(Ortho) #define glPassTexCoordATI MANGLE(PassTexCoordATI) #define glPassThrough MANGLE(PassThrough) +#define glPatchParameterfv MANGLE(PatchParameterfv) +#define glPatchParameteri MANGLE(PatchParameteri) +#define glPauseTransformFeedback MANGLE(PauseTransformFeedback) #define glPauseTransformFeedbackNV MANGLE(PauseTransformFeedbackNV) #define glPixelDataRangeNV MANGLE(PixelDataRangeNV) #define glPixelMapfv MANGLE(PixelMapfv) @@ -1191,6 +1307,7 @@ #define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV) #define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT) #define glPrioritizeTextures MANGLE(PrioritizeTextures) +#define glProgramBinary MANGLE(ProgramBinary) #define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV) #define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV) #define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV) @@ -1231,39 +1348,123 @@ #define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV) #define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV) #define glProgramStringARB MANGLE(ProgramStringARB) +#define glProgramSubroutineParametersuivNV MANGLE(ProgramSubroutineParametersuivNV) +#define glProgramUniform1dEXT MANGLE(ProgramUniform1dEXT) +#define glProgramUniform1d MANGLE(ProgramUniform1d) +#define glProgramUniform1dvEXT MANGLE(ProgramUniform1dvEXT) +#define glProgramUniform1dv MANGLE(ProgramUniform1dv) #define glProgramUniform1fEXT MANGLE(ProgramUniform1fEXT) +#define glProgramUniform1f MANGLE(ProgramUniform1f) #define glProgramUniform1fvEXT MANGLE(ProgramUniform1fvEXT) +#define glProgramUniform1fv MANGLE(ProgramUniform1fv) +#define glProgramUniform1i64NV MANGLE(ProgramUniform1i64NV) +#define glProgramUniform1i64vNV MANGLE(ProgramUniform1i64vNV) #define glProgramUniform1iEXT MANGLE(ProgramUniform1iEXT) +#define glProgramUniform1i MANGLE(ProgramUniform1i) #define glProgramUniform1ivEXT MANGLE(ProgramUniform1ivEXT) +#define glProgramUniform1iv MANGLE(ProgramUniform1iv) +#define glProgramUniform1ui64NV MANGLE(ProgramUniform1ui64NV) +#define glProgramUniform1ui64vNV MANGLE(ProgramUniform1ui64vNV) #define glProgramUniform1uiEXT MANGLE(ProgramUniform1uiEXT) +#define glProgramUniform1ui MANGLE(ProgramUniform1ui) #define glProgramUniform1uivEXT MANGLE(ProgramUniform1uivEXT) +#define glProgramUniform1uiv MANGLE(ProgramUniform1uiv) +#define glProgramUniform2dEXT MANGLE(ProgramUniform2dEXT) +#define glProgramUniform2d MANGLE(ProgramUniform2d) +#define glProgramUniform2dvEXT MANGLE(ProgramUniform2dvEXT) +#define glProgramUniform2dv MANGLE(ProgramUniform2dv) #define glProgramUniform2fEXT MANGLE(ProgramUniform2fEXT) +#define glProgramUniform2f MANGLE(ProgramUniform2f) #define glProgramUniform2fvEXT MANGLE(ProgramUniform2fvEXT) +#define glProgramUniform2fv MANGLE(ProgramUniform2fv) +#define glProgramUniform2i64NV MANGLE(ProgramUniform2i64NV) +#define glProgramUniform2i64vNV MANGLE(ProgramUniform2i64vNV) #define glProgramUniform2iEXT MANGLE(ProgramUniform2iEXT) +#define glProgramUniform2i MANGLE(ProgramUniform2i) #define glProgramUniform2ivEXT MANGLE(ProgramUniform2ivEXT) +#define glProgramUniform2iv MANGLE(ProgramUniform2iv) +#define glProgramUniform2ui64NV MANGLE(ProgramUniform2ui64NV) +#define glProgramUniform2ui64vNV MANGLE(ProgramUniform2ui64vNV) #define glProgramUniform2uiEXT MANGLE(ProgramUniform2uiEXT) +#define glProgramUniform2ui MANGLE(ProgramUniform2ui) #define glProgramUniform2uivEXT MANGLE(ProgramUniform2uivEXT) +#define glProgramUniform2uiv MANGLE(ProgramUniform2uiv) +#define glProgramUniform3dEXT MANGLE(ProgramUniform3dEXT) +#define glProgramUniform3d MANGLE(ProgramUniform3d) +#define glProgramUniform3dvEXT MANGLE(ProgramUniform3dvEXT) +#define glProgramUniform3dv MANGLE(ProgramUniform3dv) #define glProgramUniform3fEXT MANGLE(ProgramUniform3fEXT) +#define glProgramUniform3f MANGLE(ProgramUniform3f) #define glProgramUniform3fvEXT MANGLE(ProgramUniform3fvEXT) +#define glProgramUniform3fv MANGLE(ProgramUniform3fv) +#define glProgramUniform3i64NV MANGLE(ProgramUniform3i64NV) +#define glProgramUniform3i64vNV MANGLE(ProgramUniform3i64vNV) #define glProgramUniform3iEXT MANGLE(ProgramUniform3iEXT) +#define glProgramUniform3i MANGLE(ProgramUniform3i) #define glProgramUniform3ivEXT MANGLE(ProgramUniform3ivEXT) +#define glProgramUniform3iv MANGLE(ProgramUniform3iv) +#define glProgramUniform3ui64NV MANGLE(ProgramUniform3ui64NV) +#define glProgramUniform3ui64vNV MANGLE(ProgramUniform3ui64vNV) #define glProgramUniform3uiEXT MANGLE(ProgramUniform3uiEXT) +#define glProgramUniform3ui MANGLE(ProgramUniform3ui) #define glProgramUniform3uivEXT MANGLE(ProgramUniform3uivEXT) +#define glProgramUniform3uiv MANGLE(ProgramUniform3uiv) +#define glProgramUniform4dEXT MANGLE(ProgramUniform4dEXT) +#define glProgramUniform4d MANGLE(ProgramUniform4d) +#define glProgramUniform4dvEXT MANGLE(ProgramUniform4dvEXT) +#define glProgramUniform4dv MANGLE(ProgramUniform4dv) #define glProgramUniform4fEXT MANGLE(ProgramUniform4fEXT) +#define glProgramUniform4f MANGLE(ProgramUniform4f) #define glProgramUniform4fvEXT MANGLE(ProgramUniform4fvEXT) +#define glProgramUniform4fv MANGLE(ProgramUniform4fv) +#define glProgramUniform4i64NV MANGLE(ProgramUniform4i64NV) +#define glProgramUniform4i64vNV MANGLE(ProgramUniform4i64vNV) #define glProgramUniform4iEXT MANGLE(ProgramUniform4iEXT) +#define glProgramUniform4i MANGLE(ProgramUniform4i) #define glProgramUniform4ivEXT MANGLE(ProgramUniform4ivEXT) +#define glProgramUniform4iv MANGLE(ProgramUniform4iv) +#define glProgramUniform4ui64NV MANGLE(ProgramUniform4ui64NV) +#define glProgramUniform4ui64vNV MANGLE(ProgramUniform4ui64vNV) #define glProgramUniform4uiEXT MANGLE(ProgramUniform4uiEXT) +#define glProgramUniform4ui MANGLE(ProgramUniform4ui) #define glProgramUniform4uivEXT MANGLE(ProgramUniform4uivEXT) +#define glProgramUniform4uiv MANGLE(ProgramUniform4uiv) +#define glProgramUniformMatrix2dvEXT MANGLE(ProgramUniformMatrix2dvEXT) +#define glProgramUniformMatrix2dv MANGLE(ProgramUniformMatrix2dv) #define glProgramUniformMatrix2fvEXT MANGLE(ProgramUniformMatrix2fvEXT) +#define glProgramUniformMatrix2fv MANGLE(ProgramUniformMatrix2fv) +#define glProgramUniformMatrix2x3dvEXT MANGLE(ProgramUniformMatrix2x3dvEXT) +#define glProgramUniformMatrix2x3dv MANGLE(ProgramUniformMatrix2x3dv) #define glProgramUniformMatrix2x3fvEXT MANGLE(ProgramUniformMatrix2x3fvEXT) +#define glProgramUniformMatrix2x3fv MANGLE(ProgramUniformMatrix2x3fv) +#define glProgramUniformMatrix2x4dvEXT MANGLE(ProgramUniformMatrix2x4dvEXT) +#define glProgramUniformMatrix2x4dv MANGLE(ProgramUniformMatrix2x4dv) #define glProgramUniformMatrix2x4fvEXT MANGLE(ProgramUniformMatrix2x4fvEXT) +#define glProgramUniformMatrix2x4fv MANGLE(ProgramUniformMatrix2x4fv) +#define glProgramUniformMatrix3dvEXT MANGLE(ProgramUniformMatrix3dvEXT) +#define glProgramUniformMatrix3dv MANGLE(ProgramUniformMatrix3dv) #define glProgramUniformMatrix3fvEXT MANGLE(ProgramUniformMatrix3fvEXT) +#define glProgramUniformMatrix3fv MANGLE(ProgramUniformMatrix3fv) +#define glProgramUniformMatrix3x2dvEXT MANGLE(ProgramUniformMatrix3x2dvEXT) +#define glProgramUniformMatrix3x2dv MANGLE(ProgramUniformMatrix3x2dv) #define glProgramUniformMatrix3x2fvEXT MANGLE(ProgramUniformMatrix3x2fvEXT) +#define glProgramUniformMatrix3x2fv MANGLE(ProgramUniformMatrix3x2fv) +#define glProgramUniformMatrix3x4dvEXT MANGLE(ProgramUniformMatrix3x4dvEXT) +#define glProgramUniformMatrix3x4dv MANGLE(ProgramUniformMatrix3x4dv) #define glProgramUniformMatrix3x4fvEXT MANGLE(ProgramUniformMatrix3x4fvEXT) +#define glProgramUniformMatrix3x4fv MANGLE(ProgramUniformMatrix3x4fv) +#define glProgramUniformMatrix4dvEXT MANGLE(ProgramUniformMatrix4dvEXT) +#define glProgramUniformMatrix4dv MANGLE(ProgramUniformMatrix4dv) #define glProgramUniformMatrix4fvEXT MANGLE(ProgramUniformMatrix4fvEXT) +#define glProgramUniformMatrix4fv MANGLE(ProgramUniformMatrix4fv) +#define glProgramUniformMatrix4x2dvEXT MANGLE(ProgramUniformMatrix4x2dvEXT) +#define glProgramUniformMatrix4x2dv MANGLE(ProgramUniformMatrix4x2dv) #define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT) +#define glProgramUniformMatrix4x2fv MANGLE(ProgramUniformMatrix4x2fv) +#define glProgramUniformMatrix4x3dvEXT MANGLE(ProgramUniformMatrix4x3dvEXT) +#define glProgramUniformMatrix4x3dv MANGLE(ProgramUniformMatrix4x3dv) #define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT) +#define glProgramUniformMatrix4x3fv MANGLE(ProgramUniformMatrix4x3fv) #define glProgramUniformui64NV MANGLE(ProgramUniformui64NV) #define glProgramUniformui64vNV MANGLE(ProgramUniformui64vNV) #define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV) @@ -1274,6 +1475,7 @@ #define glPushClientAttrib MANGLE(PushClientAttrib) #define glPushMatrix MANGLE(PushMatrix) #define glPushName MANGLE(PushName) +#define glQueryCounter MANGLE(QueryCounter) #define glRasterPos2d MANGLE(RasterPos2d) #define glRasterPos2dv MANGLE(RasterPos2dv) #define glRasterPos2f MANGLE(RasterPos2f) @@ -1300,6 +1502,7 @@ #define glRasterPos4sv MANGLE(RasterPos4sv) #define glReadBuffer MANGLE(ReadBuffer) #define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX) +#define glReadnPixelsARB MANGLE(ReadnPixelsARB) #define glReadPixels MANGLE(ReadPixels) #define glRectd MANGLE(Rectd) #define glRectdv MANGLE(Rectdv) @@ -1310,6 +1513,7 @@ #define glRects MANGLE(Rects) #define glRectsv MANGLE(Rectsv) #define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX) +#define glReleaseShaderCompiler MANGLE(ReleaseShaderCompiler) #define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT) #define glRenderbufferStorage MANGLE(RenderbufferStorage) #define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV) @@ -1345,6 +1549,7 @@ #define glResetMinmaxEXT MANGLE(ResetMinmaxEXT) #define glResetMinmax MANGLE(ResetMinmax) #define glResizeBuffersMESA MANGLE(ResizeBuffersMESA) +#define glResumeTransformFeedback MANGLE(ResumeTransformFeedback) #define glResumeTransformFeedbackNV MANGLE(ResumeTransformFeedbackNV) #define glRotated MANGLE(Rotated) #define glRotatef MANGLE(Rotatef) @@ -1357,8 +1562,17 @@ #define glSampleMaskSGIS MANGLE(SampleMaskSGIS) #define glSamplePatternEXT MANGLE(SamplePatternEXT) #define glSamplePatternSGIS MANGLE(SamplePatternSGIS) +#define glSamplerParameterf MANGLE(SamplerParameterf) +#define glSamplerParameterfv MANGLE(SamplerParameterfv) +#define glSamplerParameterIiv MANGLE(SamplerParameterIiv) +#define glSamplerParameteri MANGLE(SamplerParameteri) +#define glSamplerParameterIuiv MANGLE(SamplerParameterIuiv) +#define glSamplerParameteriv MANGLE(SamplerParameteriv) #define glScaled MANGLE(Scaled) #define glScalef MANGLE(Scalef) +#define glScissorArrayv MANGLE(ScissorArrayv) +#define glScissorIndexed MANGLE(ScissorIndexed) +#define glScissorIndexedv MANGLE(ScissorIndexedv) #define glScissor MANGLE(Scissor) #define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT) #define glSecondaryColor3b MANGLE(SecondaryColor3b) @@ -1395,6 +1609,8 @@ #define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT) #define glSecondaryColor3usv MANGLE(SecondaryColor3usv) #define glSecondaryColorFormatNV MANGLE(SecondaryColorFormatNV) +#define glSecondaryColorP3ui MANGLE(SecondaryColorP3ui) +#define glSecondaryColorP3uiv MANGLE(SecondaryColorP3uiv) #define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT) #define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM) #define glSecondaryColorPointer MANGLE(SecondaryColorPointer) @@ -1408,6 +1624,7 @@ #define glSetInvariantEXT MANGLE(SetInvariantEXT) #define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT) #define glShadeModel MANGLE(ShadeModel) +#define glShaderBinary MANGLE(ShaderBinary) #define glShaderOp1EXT MANGLE(ShaderOp1EXT) #define glShaderOp2EXT MANGLE(ShaderOp2EXT) #define glShaderOp3EXT MANGLE(ShaderOp3EXT) @@ -1509,6 +1726,14 @@ #define glTexCoord4s MANGLE(TexCoord4s) #define glTexCoord4sv MANGLE(TexCoord4sv) #define glTexCoordFormatNV MANGLE(TexCoordFormatNV) +#define glTexCoordP1ui MANGLE(TexCoordP1ui) +#define glTexCoordP1uiv MANGLE(TexCoordP1uiv) +#define glTexCoordP2ui MANGLE(TexCoordP2ui) +#define glTexCoordP2uiv MANGLE(TexCoordP2uiv) +#define glTexCoordP3ui MANGLE(TexCoordP3ui) +#define glTexCoordP3uiv MANGLE(TexCoordP3uiv) +#define glTexCoordP4ui MANGLE(TexCoordP4ui) +#define glTexCoordP4uiv MANGLE(TexCoordP4uiv) #define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT) #define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM) #define glTexCoordPointer MANGLE(TexCoordPointer) @@ -1569,73 +1794,108 @@ #define glTextureSubImage3DEXT MANGLE(TextureSubImage3DEXT) #define glTrackMatrixNV MANGLE(TrackMatrixNV) #define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV) +#define glTransformFeedbackStreamAttribsNV MANGLE(TransformFeedbackStreamAttribsNV) #define glTransformFeedbackVaryingsEXT MANGLE(TransformFeedbackVaryingsEXT) #define glTransformFeedbackVaryings MANGLE(TransformFeedbackVaryings) #define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV) #define glTranslated MANGLE(Translated) #define glTranslatef MANGLE(Translatef) +#define glUniform1d MANGLE(Uniform1d) +#define glUniform1dv MANGLE(Uniform1dv) #define glUniform1fARB MANGLE(Uniform1fARB) #define glUniform1f MANGLE(Uniform1f) #define glUniform1fvARB MANGLE(Uniform1fvARB) #define glUniform1fv MANGLE(Uniform1fv) +#define glUniform1i64NV MANGLE(Uniform1i64NV) +#define glUniform1i64vNV MANGLE(Uniform1i64vNV) #define glUniform1iARB MANGLE(Uniform1iARB) #define glUniform1i MANGLE(Uniform1i) #define glUniform1ivARB MANGLE(Uniform1ivARB) #define glUniform1iv MANGLE(Uniform1iv) +#define glUniform1ui64NV MANGLE(Uniform1ui64NV) +#define glUniform1ui64vNV MANGLE(Uniform1ui64vNV) #define glUniform1uiEXT MANGLE(Uniform1uiEXT) #define glUniform1ui MANGLE(Uniform1ui) #define glUniform1uivEXT MANGLE(Uniform1uivEXT) #define glUniform1uiv MANGLE(Uniform1uiv) +#define glUniform2d MANGLE(Uniform2d) +#define glUniform2dv MANGLE(Uniform2dv) #define glUniform2fARB MANGLE(Uniform2fARB) #define glUniform2f MANGLE(Uniform2f) #define glUniform2fvARB MANGLE(Uniform2fvARB) #define glUniform2fv MANGLE(Uniform2fv) +#define glUniform2i64NV MANGLE(Uniform2i64NV) +#define glUniform2i64vNV MANGLE(Uniform2i64vNV) #define glUniform2iARB MANGLE(Uniform2iARB) #define glUniform2i MANGLE(Uniform2i) #define glUniform2ivARB MANGLE(Uniform2ivARB) #define glUniform2iv MANGLE(Uniform2iv) +#define glUniform2ui64NV MANGLE(Uniform2ui64NV) +#define glUniform2ui64vNV MANGLE(Uniform2ui64vNV) #define glUniform2uiEXT MANGLE(Uniform2uiEXT) #define glUniform2ui MANGLE(Uniform2ui) #define glUniform2uivEXT MANGLE(Uniform2uivEXT) #define glUniform2uiv MANGLE(Uniform2uiv) +#define glUniform3d MANGLE(Uniform3d) +#define glUniform3dv MANGLE(Uniform3dv) #define glUniform3fARB MANGLE(Uniform3fARB) #define glUniform3f MANGLE(Uniform3f) #define glUniform3fvARB MANGLE(Uniform3fvARB) #define glUniform3fv MANGLE(Uniform3fv) +#define glUniform3i64NV MANGLE(Uniform3i64NV) +#define glUniform3i64vNV MANGLE(Uniform3i64vNV) #define glUniform3iARB MANGLE(Uniform3iARB) #define glUniform3i MANGLE(Uniform3i) #define glUniform3ivARB MANGLE(Uniform3ivARB) #define glUniform3iv MANGLE(Uniform3iv) +#define glUniform3ui64NV MANGLE(Uniform3ui64NV) +#define glUniform3ui64vNV MANGLE(Uniform3ui64vNV) #define glUniform3uiEXT MANGLE(Uniform3uiEXT) #define glUniform3ui MANGLE(Uniform3ui) #define glUniform3uivEXT MANGLE(Uniform3uivEXT) #define glUniform3uiv MANGLE(Uniform3uiv) +#define glUniform4d MANGLE(Uniform4d) +#define glUniform4dv MANGLE(Uniform4dv) #define glUniform4fARB MANGLE(Uniform4fARB) #define glUniform4f MANGLE(Uniform4f) #define glUniform4fvARB MANGLE(Uniform4fvARB) #define glUniform4fv MANGLE(Uniform4fv) +#define glUniform4i64NV MANGLE(Uniform4i64NV) +#define glUniform4i64vNV MANGLE(Uniform4i64vNV) #define glUniform4iARB MANGLE(Uniform4iARB) #define glUniform4i MANGLE(Uniform4i) #define glUniform4ivARB MANGLE(Uniform4ivARB) #define glUniform4iv MANGLE(Uniform4iv) +#define glUniform4ui64NV MANGLE(Uniform4ui64NV) +#define glUniform4ui64vNV MANGLE(Uniform4ui64vNV) #define glUniform4uiEXT MANGLE(Uniform4uiEXT) #define glUniform4ui MANGLE(Uniform4ui) #define glUniform4uivEXT MANGLE(Uniform4uivEXT) #define glUniform4uiv MANGLE(Uniform4uiv) #define glUniformBlockBinding MANGLE(UniformBlockBinding) #define glUniformBufferEXT MANGLE(UniformBufferEXT) +#define glUniformMatrix2dv MANGLE(UniformMatrix2dv) #define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB) #define glUniformMatrix2fv MANGLE(UniformMatrix2fv) +#define glUniformMatrix2x3dv MANGLE(UniformMatrix2x3dv) #define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv) +#define glUniformMatrix2x4dv MANGLE(UniformMatrix2x4dv) #define glUniformMatrix2x4fv MANGLE(UniformMatrix2x4fv) +#define glUniformMatrix3dv MANGLE(UniformMatrix3dv) #define glUniformMatrix3fvARB MANGLE(UniformMatrix3fvARB) #define glUniformMatrix3fv MANGLE(UniformMatrix3fv) +#define glUniformMatrix3x2dv MANGLE(UniformMatrix3x2dv) #define glUniformMatrix3x2fv MANGLE(UniformMatrix3x2fv) +#define glUniformMatrix3x4dv MANGLE(UniformMatrix3x4dv) #define glUniformMatrix3x4fv MANGLE(UniformMatrix3x4fv) +#define glUniformMatrix4dv MANGLE(UniformMatrix4dv) #define glUniformMatrix4fvARB MANGLE(UniformMatrix4fvARB) #define glUniformMatrix4fv MANGLE(UniformMatrix4fv) +#define glUniformMatrix4x2dv MANGLE(UniformMatrix4x2dv) #define glUniformMatrix4x2fv MANGLE(UniformMatrix4x2fv) +#define glUniformMatrix4x3dv MANGLE(UniformMatrix4x3dv) #define glUniformMatrix4x3fv MANGLE(UniformMatrix4x3fv) +#define glUniformSubroutinesuiv MANGLE(UniformSubroutinesuiv) #define glUniformui64NV MANGLE(Uniformui64NV) #define glUniformui64vNV MANGLE(Uniformui64vNV) #define glUnlockArraysEXT MANGLE(UnlockArraysEXT) @@ -1646,9 +1906,11 @@ #define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI) #define glUseProgram MANGLE(UseProgram) #define glUseProgramObjectARB MANGLE(UseProgramObjectARB) +#define glUseProgramStages MANGLE(UseProgramStages) #define glUseShaderProgramEXT MANGLE(UseShaderProgramEXT) #define glValidateProgramARB MANGLE(ValidateProgramARB) #define glValidateProgram MANGLE(ValidateProgram) +#define glValidateProgramPipeline MANGLE(ValidateProgramPipeline) #define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI) #define glVariantbvEXT MANGLE(VariantbvEXT) #define glVariantdvEXT MANGLE(VariantdvEXT) @@ -1659,6 +1921,16 @@ #define glVariantubvEXT MANGLE(VariantubvEXT) #define glVariantuivEXT MANGLE(VariantuivEXT) #define glVariantusvEXT MANGLE(VariantusvEXT) +#define glVDPAUFiniNV MANGLE(VDPAUFiniNV) +#define glVDPAUGetSurfaceivNV MANGLE(VDPAUGetSurfaceivNV) +#define glVDPAUInitNV MANGLE(VDPAUInitNV) +#define glVDPAUIsSurfaceNV MANGLE(VDPAUIsSurfaceNV) +#define glVDPAUMapSurfacesNV MANGLE(VDPAUMapSurfacesNV) +#define glVDPAURegisterOutputSurfaceNV MANGLE(VDPAURegisterOutputSurfaceNV) +#define glVDPAURegisterVideoSurfaceNV MANGLE(VDPAURegisterVideoSurfaceNV) +#define glVDPAUSurfaceAccessNV MANGLE(VDPAUSurfaceAccessNV) +#define glVDPAUUnmapSurfacesNV MANGLE(VDPAUUnmapSurfacesNV) +#define glVDPAUUnregisterSurfaceNV MANGLE(VDPAUUnregisterSurfaceNV) #define glVertex2d MANGLE(Vertex2d) #define glVertex2dv MANGLE(Vertex2dv) #define glVertex2f MANGLE(Vertex2f) @@ -1692,6 +1964,7 @@ #define glVertexArrayParameteriAPPLE MANGLE(VertexArrayParameteriAPPLE) #define glVertexArrayRangeAPPLE MANGLE(VertexArrayRangeAPPLE) #define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV) +#define glVertexArrayVertexAttribLOffsetEXT MANGLE(VertexArrayVertexAttribLOffsetEXT) #define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB) #define glVertexAttrib1d MANGLE(VertexAttrib1d) #define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV) @@ -1800,6 +2073,7 @@ #define glVertexAttrib4usv MANGLE(VertexAttrib4usv) #define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI) #define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB) +#define glVertexAttribDivisor MANGLE(VertexAttribDivisor) #define glVertexAttribFormatNV MANGLE(VertexAttribFormatNV) #define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT) #define glVertexAttribI1i MANGLE(VertexAttribI1i) @@ -1844,6 +2118,49 @@ #define glVertexAttribIFormatNV MANGLE(VertexAttribIFormatNV) #define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT) #define glVertexAttribIPointer MANGLE(VertexAttribIPointer) +#define glVertexAttribL1dEXT MANGLE(VertexAttribL1dEXT) +#define glVertexAttribL1d MANGLE(VertexAttribL1d) +#define glVertexAttribL1dvEXT MANGLE(VertexAttribL1dvEXT) +#define glVertexAttribL1dv MANGLE(VertexAttribL1dv) +#define glVertexAttribL1i64NV MANGLE(VertexAttribL1i64NV) +#define glVertexAttribL1i64vNV MANGLE(VertexAttribL1i64vNV) +#define glVertexAttribL1ui64NV MANGLE(VertexAttribL1ui64NV) +#define glVertexAttribL1ui64vNV MANGLE(VertexAttribL1ui64vNV) +#define glVertexAttribL2dEXT MANGLE(VertexAttribL2dEXT) +#define glVertexAttribL2d MANGLE(VertexAttribL2d) +#define glVertexAttribL2dvEXT MANGLE(VertexAttribL2dvEXT) +#define glVertexAttribL2dv MANGLE(VertexAttribL2dv) +#define glVertexAttribL2i64NV MANGLE(VertexAttribL2i64NV) +#define glVertexAttribL2i64vNV MANGLE(VertexAttribL2i64vNV) +#define glVertexAttribL2ui64NV MANGLE(VertexAttribL2ui64NV) +#define glVertexAttribL2ui64vNV MANGLE(VertexAttribL2ui64vNV) +#define glVertexAttribL3dEXT MANGLE(VertexAttribL3dEXT) +#define glVertexAttribL3d MANGLE(VertexAttribL3d) +#define glVertexAttribL3dvEXT MANGLE(VertexAttribL3dvEXT) +#define glVertexAttribL3dv MANGLE(VertexAttribL3dv) +#define glVertexAttribL3i64NV MANGLE(VertexAttribL3i64NV) +#define glVertexAttribL3i64vNV MANGLE(VertexAttribL3i64vNV) +#define glVertexAttribL3ui64NV MANGLE(VertexAttribL3ui64NV) +#define glVertexAttribL3ui64vNV MANGLE(VertexAttribL3ui64vNV) +#define glVertexAttribL4dEXT MANGLE(VertexAttribL4dEXT) +#define glVertexAttribL4d MANGLE(VertexAttribL4d) +#define glVertexAttribL4dvEXT MANGLE(VertexAttribL4dvEXT) +#define glVertexAttribL4dv MANGLE(VertexAttribL4dv) +#define glVertexAttribL4i64NV MANGLE(VertexAttribL4i64NV) +#define glVertexAttribL4i64vNV MANGLE(VertexAttribL4i64vNV) +#define glVertexAttribL4ui64NV MANGLE(VertexAttribL4ui64NV) +#define glVertexAttribL4ui64vNV MANGLE(VertexAttribL4ui64vNV) +#define glVertexAttribLFormatNV MANGLE(VertexAttribLFormatNV) +#define glVertexAttribLPointerEXT MANGLE(VertexAttribLPointerEXT) +#define glVertexAttribLPointer MANGLE(VertexAttribLPointer) +#define glVertexAttribP1ui MANGLE(VertexAttribP1ui) +#define glVertexAttribP1uiv MANGLE(VertexAttribP1uiv) +#define glVertexAttribP2ui MANGLE(VertexAttribP2ui) +#define glVertexAttribP2uiv MANGLE(VertexAttribP2uiv) +#define glVertexAttribP3ui MANGLE(VertexAttribP3ui) +#define glVertexAttribP3uiv MANGLE(VertexAttribP3uiv) +#define glVertexAttribP4ui MANGLE(VertexAttribP4ui) +#define glVertexAttribP4uiv MANGLE(VertexAttribP4uiv) #define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB) #define glVertexAttribPointer MANGLE(VertexAttribPointer) #define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV) @@ -1868,6 +2185,12 @@ #define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI) #define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI) #define glVertexFormatNV MANGLE(VertexFormatNV) +#define glVertexP2ui MANGLE(VertexP2ui) +#define glVertexP2uiv MANGLE(VertexP2uiv) +#define glVertexP3ui MANGLE(VertexP3ui) +#define glVertexP3uiv MANGLE(VertexP3uiv) +#define glVertexP4ui MANGLE(VertexP4ui) +#define glVertexP4uiv MANGLE(VertexP4uiv) #define glVertexPointerEXT MANGLE(VertexPointerEXT) #define glVertexPointerListIBM MANGLE(VertexPointerListIBM) #define glVertexPointer MANGLE(VertexPointer) @@ -1913,6 +2236,9 @@ #define glVideoCaptureStreamParameterdvNV MANGLE(VideoCaptureStreamParameterdvNV) #define glVideoCaptureStreamParameterfvNV MANGLE(VideoCaptureStreamParameterfvNV) #define glVideoCaptureStreamParameterivNV MANGLE(VideoCaptureStreamParameterivNV) +#define glViewportArrayv MANGLE(ViewportArrayv) +#define glViewportIndexedf MANGLE(ViewportIndexedf) +#define glViewportIndexedfv MANGLE(ViewportIndexedfv) #define glViewport MANGLE(Viewport) #define glWaitSync MANGLE(WaitSync) #define glWeightbvARB MANGLE(WeightbvARB) -- cgit v1.2.3 From 5c102dd94f435e97507213fbd128e50dd15f5f54 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 20 Dec 2010 13:39:36 +1000 Subject: nouveau: fix includes for latest libdrm Signed-off-by: Ben Skeggs --- src/gallium/drivers/nouveau/nouveau_winsys.h | 2 +- src/gallium/drivers/nv50/nv50_surface.c | 2 +- src/gallium/drivers/nvfx/nv04_2d.c | 2 +- src/gallium/drivers/nvfx/nvfx_vbo.c | 3 +-- src/mesa/drivers/dri/nouveau/nouveau_driver.h | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h index ab480cabd09..747b084bc45 100644 --- a/src/gallium/drivers/nouveau/nouveau_winsys.h +++ b/src/gallium/drivers/nouveau/nouveau_winsys.h @@ -10,7 +10,7 @@ #include "nouveau/nouveau_grobj.h" #include "nouveau/nouveau_notifier.h" #include "nouveau/nouveau_resource.h" -#include "nouveau/nouveau_pushbuf.h" +#include "nouveau/nv04_pushbuf.h" #ifndef NV04_PFIFO_MAX_PACKET_LEN #define NV04_PFIFO_MAX_PACKET_LEN 2047 diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index ce48022db4e..a99df76cee3 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -22,7 +22,7 @@ #define __NOUVEAU_PUSH_H__ #include -#include "nouveau/nouveau_pushbuf.h" +#include "nouveau/nv04_pushbuf.h" #include "nv50_context.h" #include "nv50_resource.h" #include "pipe/p_defines.h" diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c index e0e65e7a87f..e2fadd33e1c 100644 --- a/src/gallium/drivers/nvfx/nv04_2d.c +++ b/src/gallium/drivers/nvfx/nv04_2d.c @@ -34,11 +34,11 @@ #include #include #include -#include #include #include #include #include +#include #include "nv04_2d.h" #include "nouveau/nv_object.xml.h" diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c index 597664e7716..339b31786d6 100644 --- a/src/gallium/drivers/nvfx/nvfx_vbo.c +++ b/src/gallium/drivers/nvfx/nvfx_vbo.c @@ -9,8 +9,7 @@ #include "nvfx_resource.h" #include "nouveau/nouveau_channel.h" - -#include "nouveau/nouveau_pushbuf.h" +#include "nouveau/nv04_pushbuf.h" static inline unsigned util_guess_unique_indices_count(unsigned mode, unsigned indices) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h index 8036b18edc0..c5ac1282d0d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h @@ -38,7 +38,6 @@ #include #include "nouveau_device.h" -#include "nouveau_pushbuf.h" #include "nouveau_grobj.h" #include "nouveau_channel.h" #include "nouveau_bo.h" @@ -46,6 +45,7 @@ #include "nouveau_screen.h" #include "nouveau_state.h" #include "nouveau_surface.h" +#include "nv04_pushbuf.h" #define DRIVER_DATE "20091015" #define DRIVER_AUTHOR "Nouveau" -- cgit v1.2.3 From 3d03b4d839afeb4939b28c21ca32f6cb069f4495 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 21 Dec 2010 01:17:37 -0800 Subject: st/mesa: Clean up header file inclusion in st_draw.h. --- src/mesa/state_tracker/st_draw.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h index 2e4c468cff5..5d3c278228f 100644 --- a/src/mesa/state_tracker/st_draw.h +++ b/src/mesa/state_tracker/st_draw.h @@ -36,10 +36,11 @@ #include "main/compiler.h" #include "main/glheader.h" -#include "main/mtypes.h" struct _mesa_index_buffer; struct _mesa_prim; +struct gl_client_array; +struct gl_context; struct st_context; void st_init_draw( struct st_context *st ); -- cgit v1.2.3 From c1f0f90a976c62546efed34ecbec50b25d0f6aa7 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 21 Dec 2010 01:25:04 -0800 Subject: st/mesa: Clean up header file inclusion in st_format.h. --- src/mesa/state_tracker/st_format.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 43fa59b1006..fe195c1069b 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -31,11 +31,12 @@ #define ST_FORMAT_H #include "main/formats.h" -#include "main/mtypes.h" +#include "main/glheader.h" #include "pipe/p_defines.h" #include "pipe/p_format.h" +struct gl_context; struct pipe_screen; extern GLenum -- cgit v1.2.3 From 8b9570e685f010745e2dfb1bff00d555e2e5f6ba Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 21 Dec 2010 11:55:11 +0000 Subject: intel: Check for unsupported texture when finishing using as a render target Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32541 Signed-off-by: Chris Wilson --- src/mesa/drivers/dri/intel/intel_fbo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index f6fe7b17536..c3f528c2ae5 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -547,7 +547,8 @@ intel_finish_render_texture(struct gl_context * ctx, _glthread_GetID(), att->Texture->Name); /* Flag that this image may now be validated into the object's miptree. */ - intel_image->used_as_render_target = GL_FALSE; + if (intel_image) + intel_image->used_as_render_target = GL_FALSE; /* Since we've (probably) rendered to the texture and will (likely) use * it in the texture domain later on in this batchbuffer, flush the -- cgit v1.2.3 From fa62cf7450595b3d99259b5a212df301ca711d4b Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Tue, 21 Dec 2010 10:49:53 -0500 Subject: r600g: avoid segfault Candidates 7.10 Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600_state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index af19beb6f3c..8a69a10fc80 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1334,7 +1334,7 @@ void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = 0; } - if (vertex_buffer == NULL) + if (vertex_buffer == NULL || rbuffer == NULL) continue; offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 0d76afd6cd5..9b099df18d4 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -174,7 +174,7 @@ void r600_vertex_buffer_update(struct r600_pipe_context *rctx) rbuffer = (struct r600_resource*)vertex_buffer->buffer; offset = 0; } - if (vertex_buffer == NULL) + if (vertex_buffer == NULL || rbuffer == NULL) continue; offset += vertex_buffer->buffer_offset + r600_bo_offset(rbuffer->bo); -- cgit v1.2.3 From 4fe78d3e12fa963273de4d83b1fd55a78a5d41bf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 21 Dec 2010 13:04:07 -0800 Subject: i965: Avoid using float type for raw moves, to work around SNB issue. The SNB alt-mode math does the denorm and inf reduction even for a "raw MOV" like we do for g0 message header setup, where we are moving values that aren't actually floats. Just use UD type, where raw MOVs really are raw MOVs. Fixes glxgears since c52adfc2e1d130effea940e75690897eb5d3ceaa, but no piglit tests had regressed(!) --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 9 ++++++--- src/mesa/drivers/dri/i965/brw_wm_emit.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 9c764fe779d..2bdcacfb2ed 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1936,7 +1936,8 @@ void brw_SAMPLE(struct brw_compile *p, brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_MOV(p, m1, brw_vec8_grf(0,0)); + brw_MOV(p, retype(m1, BRW_REGISTER_TYPE_UD), + retype(brw_vec8_grf(0,0), BRW_REGISTER_TYPE_UD)); brw_MOV(p, get_element_ud(m1, 2), brw_imm_ud(newmask << 12)); brw_pop_insn_state(p); @@ -1997,7 +1998,8 @@ void brw_SAMPLE(struct brw_compile *p, */ brw_push_insn_state(p); brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, reg, reg); + brw_MOV(p, retype(reg, BRW_REGISTER_TYPE_UD), + retype(reg, BRW_REGISTER_TYPE_UD)); brw_pop_insn_state(p); } @@ -2029,7 +2031,8 @@ void brw_urb_WRITE(struct brw_compile *p, if (intel->gen >= 6) { brw_push_insn_state(p); brw_set_mask_control( p, BRW_MASK_DISABLE ); - brw_MOV(p, brw_message_reg(msg_reg_nr), src0); + brw_MOV(p, retype(brw_message_reg(msg_reg_nr), BRW_REGISTER_TYPE_UD), + retype(src0, BRW_REGISTER_TYPE_UD)); brw_pop_insn_state(p); src0 = brw_message_reg(msg_reg_nr); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index be86e0e1287..39cf96467af 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1501,7 +1501,8 @@ void emit_fb_write(struct brw_wm_compile *c, */ brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_MOV(p, brw_message_reg(0), brw_vec8_grf(0, 0)); + brw_MOV(p, retype(brw_message_reg(0), BRW_REGISTER_TYPE_UD), + retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD)); brw_pop_insn_state(p); if (target != 0) { -- cgit v1.2.3 From 2a95542088fbada4ffe5bdd2da90b215cb6a5003 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 21 Dec 2010 19:26:27 +0100 Subject: r300g: support B10G10R10A2 render targets only with DRM 2.8.0 or later versions --- src/gallium/drivers/r300/r300_screen.c | 4 +++- src/gallium/drivers/r300/r300_winsys.h | 5 +++-- src/gallium/winsys/radeon/drm/radeon_drm_common.c | 4 ++++ src/gallium/winsys/radeon/drm/radeon_r300.c | 2 ++ src/gallium/winsys/radeon/drm/radeon_winsys.h | 4 +++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 921d6f1e676..36060ab4d08 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -309,7 +309,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, unsigned usage, unsigned geom_flags) { + struct r300_winsys_screen *rws = r300_screen(screen)->rws; uint32_t retval = 0; + boolean drm_2_8_0 = rws->get_value(rws, R300_VID_DRM_2_8_0); boolean is_r500 = r300_screen(screen)->caps.is_r500; boolean is_r400 = r300_screen(screen)->caps.is_r400; boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM || @@ -363,7 +365,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)) && /* 2101010 cannot be rendered to on non-r5xx. */ - (is_r500 || !is_color2101010) && + (!is_color2101010 || (is_r500 && drm_2_8_0)) && r300_is_colorbuffer_format_supported(format)) { retval |= usage & (PIPE_BIND_RENDER_TARGET | diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 0dd330d101f..b8324afe511 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -51,8 +51,9 @@ enum r300_value_id { R300_VID_GB_PIPES, R300_VID_Z_PIPES, R300_VID_SQUARE_TILING_SUPPORT, - R300_VID_DRM_2_3_0, - R300_VID_DRM_2_6_0, + R300_VID_DRM_2_3_0, /* R500 VAP regs, MSPOS regs, fixed tex3D size checking */ + R300_VID_DRM_2_6_0, /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */ + R300_VID_DRM_2_8_0, /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer */ R300_CAN_HYPERZ, }; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_common.c b/src/gallium/winsys/radeon/drm/radeon_drm_common.c index 6bc6244115c..f38ab6e3b43 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_common.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_common.c @@ -122,6 +122,10 @@ static void do_ioctls(struct radeon_drm_winsys *winsys) (version->version_major == 2 && version->version_minor >= 6); + winsys->drm_2_8_0 = version->version_major > 2 || + (version->version_major == 2 && + version->version_minor >= 8); + info.request = RADEON_INFO_DEVICE_ID; retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index 9f59b3de461..ae7020a0639 100644 --- a/src/gallium/winsys/radeon/drm/radeon_r300.c +++ b/src/gallium/winsys/radeon/drm/radeon_r300.c @@ -211,6 +211,8 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws, return ws->drm_2_3_0; case R300_VID_DRM_2_6_0: return ws->drm_2_6_0; + case R300_VID_DRM_2_8_0: + return ws->drm_2_8_0; case R300_CAN_HYPERZ: return ws->hyperz; } diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index 81da1a25e0f..6f232143f6a 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -49,8 +49,10 @@ struct radeon_drm_winsys { boolean squaretiling; /* Square tiling support. */ /* DRM 2.3.0 (R500 VAP regs, MSPOS regs, fixed tex3D size checking) */ boolean drm_2_3_0; - /* DRM 2.6.0 (Hyper-Z, GB_Z_PEQ_CONFIG allowed on rv350->r4xx) */ + /* DRM 2.6.0 (Hyper-Z, GB_Z_PEQ_CONFIG allowed on rv350->r4xx, FG_ALPHA_VALUE) */ boolean drm_2_6_0; + /* DRM 2.8.0 (US_FORMAT regs, ARGB2101010 colorbuffer) */ + boolean drm_2_8_0; /* Hyper-Z user */ boolean hyperz; -- cgit v1.2.3 From cb4f367b268b6fbedc6673b2c6e51d107e929370 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 22 Dec 2010 02:22:09 +0100 Subject: r300g: fix precision issues with B10G10R10A2 --- src/gallium/drivers/r300/r300_texture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 6d86bc282ff..24f1d68f4a7 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -481,6 +481,8 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format) } else { if (desc->channel[i].size == 16) { modifier |= R300_US_OUT_FMT_C4_16; + } else if (desc->channel[i].size == 10) { + modifier |= R300_US_OUT_FMT_C4_10; } else { /* C4_8 seems to be used for the formats whose pixel size * is <= 32 bits. */ -- cgit v1.2.3 From 2dd189a824d4c5c5157aaf381d5e424317a8d1e4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 22 Dec 2010 14:54:17 +1000 Subject: r600g: fix evergreen segfaults. evergreen was crashing running even gears here. This is a 7.10 candidate if its broken the same. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_state_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index f488cf74ff2..3603376f738 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -182,7 +182,7 @@ void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, if (rctx->family >= CHIP_CEDAR) { for (int i = 0; i < rctx->nvertex_buffer; i++) { pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL); - evergreen_fs_resource_set(&rctx->ctx, NULL, i); + evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); } } else { for (int i = 0; i < rctx->nvertex_buffer; i++) { -- cgit v1.2.3 From af767ee1133058bb24e2183e8bf2846424c96ee0 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 12:14:44 +0800 Subject: st/egl: Make config optional for create_pixmap_surface. eglCopyBuffers or EGL_KHR_image_pixmap require creating a pixmap surface without a config. Make it just work without relying on is_pixmap_supported. --- src/gallium/state_trackers/egl/common/native.h | 4 +- src/gallium/state_trackers/egl/x11/native_dri2.c | 42 ++++++++---- src/gallium/state_trackers/egl/x11/native_ximage.c | 79 ++++++++++++++-------- 3 files changed, 79 insertions(+), 46 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 3886ca20562..a66e81def6f 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -185,7 +185,9 @@ struct native_display { const struct native_config *nconf); /** - * Create a pixmap surface. Required unless no config has pixmap_bit set. + * Create a pixmap surface. The native config may be NULL. In that case, a + * "best config" will be picked. Required unless no config has pixmap_bit + * set. */ struct native_surface *(*create_pixmap_surface)(struct native_display *ndpy, EGLNativePixmapType pix, diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 8108ce45865..92203e1176c 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -40,11 +40,6 @@ #ifdef GLX_DIRECT_RENDERING -enum dri2_surface_type { - DRI2_SURFACE_TYPE_WINDOW, - DRI2_SURFACE_TYPE_PIXMAP, -}; - struct dri2_display { struct native_display base; Display *dpy; @@ -66,7 +61,6 @@ struct dri2_display { struct dri2_surface { struct native_surface base; Drawable drawable; - enum dri2_surface_type type; enum pipe_format color_format; struct dri2_display *dri2dpy; @@ -439,12 +433,10 @@ dri2_surface_destroy(struct native_surface *nsurf) static struct dri2_surface * dri2_display_create_surface(struct native_display *ndpy, - enum dri2_surface_type type, Drawable drawable, - const struct native_config *nconf) + enum pipe_format color_format) { struct dri2_display *dri2dpy = dri2_display(ndpy); - struct dri2_config *dri2conf = dri2_config(nconf); struct dri2_surface *dri2surf; dri2surf = CALLOC_STRUCT(dri2_surface); @@ -452,9 +444,8 @@ dri2_display_create_surface(struct native_display *ndpy, return NULL; dri2surf->dri2dpy = dri2dpy; - dri2surf->type = type; dri2surf->drawable = drawable; - dri2surf->color_format = dri2conf->base.color_format; + dri2surf->color_format = color_format; dri2surf->base.destroy = dri2_surface_destroy; dri2surf->base.present = dri2_surface_present; @@ -480,8 +471,8 @@ dri2_display_create_window_surface(struct native_display *ndpy, { struct dri2_surface *dri2surf; - dri2surf = dri2_display_create_surface(ndpy, DRI2_SURFACE_TYPE_WINDOW, - (Drawable) win, nconf); + dri2surf = dri2_display_create_surface(ndpy, + (Drawable) win, nconf->color_format); return (dri2surf) ? &dri2surf->base : NULL; } @@ -492,8 +483,29 @@ dri2_display_create_pixmap_surface(struct native_display *ndpy, { struct dri2_surface *dri2surf; - dri2surf = dri2_display_create_surface(ndpy, DRI2_SURFACE_TYPE_PIXMAP, - (Drawable) pix, nconf); + if (!nconf) { + struct dri2_display *dri2dpy = dri2_display(ndpy); + uint depth, nconf_depth; + int i; + + depth = x11_drawable_get_depth(dri2dpy->xscr, (Drawable) pix); + for (i = 0; i < dri2dpy->num_configs; i++) { + nconf_depth = util_format_get_blocksizebits( + dri2dpy->configs[i].base.color_format); + /* simple depth match for now */ + if (depth == nconf_depth || + (depth == 24 && depth + 8 == nconf_depth)) { + nconf = &dri2dpy->configs[i].base; + break; + } + } + + if (!nconf) + return NULL; + } + + dri2surf = dri2_display_create_surface(ndpy, + (Drawable) pix, nconf->color_format); return (dri2surf) ? &dri2surf->base : NULL; } diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c index 84811fb6e14..3c32f379a2f 100644 --- a/src/gallium/state_trackers/egl/x11/native_ximage.c +++ b/src/gallium/state_trackers/egl/x11/native_ximage.c @@ -38,11 +38,6 @@ #include "native_x11.h" #include "x11_screen.h" -enum ximage_surface_type { - XIMAGE_SURFACE_TYPE_WINDOW, - XIMAGE_SURFACE_TYPE_PIXMAP, -}; - struct ximage_display { struct native_display base; Display *dpy; @@ -60,7 +55,6 @@ struct ximage_display { struct ximage_surface { struct native_surface base; Drawable drawable; - enum ximage_surface_type type; enum pipe_format color_format; XVisualInfo visual; struct ximage_display *xdpy; @@ -245,7 +239,6 @@ ximage_surface_destroy(struct native_surface *nsurf) static struct ximage_surface * ximage_display_create_surface(struct native_display *ndpy, - enum ximage_surface_type type, Drawable drawable, const struct native_config *nconf) { @@ -258,7 +251,6 @@ ximage_display_create_surface(struct native_display *ndpy, return NULL; xsurf->xdpy = xdpy; - xsurf->type = type; xsurf->color_format = xconf->base.color_format; xsurf->drawable = drawable; @@ -297,11 +289,37 @@ ximage_display_create_window_surface(struct native_display *ndpy, { struct ximage_surface *xsurf; - xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_WINDOW, - (Drawable) win, nconf); + xsurf = ximage_display_create_surface(ndpy, (Drawable) win, nconf); return (xsurf) ? &xsurf->base : NULL; } +static enum pipe_format +get_pixmap_format(struct native_display *ndpy, EGLNativePixmapType pix) +{ + struct ximage_display *xdpy = ximage_display(ndpy); + enum pipe_format fmt; + uint depth; + + depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix); + + switch (depth) { + case 32: + fmt = PIPE_FORMAT_B8G8R8A8_UNORM; + break; + case 24: + fmt = PIPE_FORMAT_B8G8R8X8_UNORM; + break; + case 16: + fmt = PIPE_FORMAT_B5G6R5_UNORM; + break; + default: + fmt = PIPE_FORMAT_NONE; + break; + } + + return fmt; +} + static struct native_surface * ximage_display_create_pixmap_surface(struct native_display *ndpy, EGLNativePixmapType pix, @@ -309,8 +327,26 @@ ximage_display_create_pixmap_surface(struct native_display *ndpy, { struct ximage_surface *xsurf; - xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_PIXMAP, - (Drawable) pix, nconf); + /* find the config */ + if (!nconf) { + struct ximage_display *xdpy = ximage_display(ndpy); + enum pipe_format fmt = get_pixmap_format(&xdpy->base, pix); + int i; + + if (fmt != PIPE_FORMAT_NONE) { + for (i = 0; i < xdpy->num_configs; i++) { + if (xdpy->configs[i].base.color_format == fmt) { + nconf = &xdpy->configs[i].base; + break; + } + } + } + + if (!nconf) + return NULL; + } + + xsurf = ximage_display_create_surface(ndpy, (Drawable) pix, nconf); return (xsurf) ? &xsurf->base : NULL; } @@ -408,24 +444,7 @@ ximage_display_is_pixmap_supported(struct native_display *ndpy, const struct native_config *nconf) { struct ximage_display *xdpy = ximage_display(ndpy); - enum pipe_format fmt; - uint depth; - - depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix); - switch (depth) { - case 32: - fmt = PIPE_FORMAT_B8G8R8A8_UNORM; - break; - case 24: - fmt = PIPE_FORMAT_B8G8R8X8_UNORM; - break; - case 16: - fmt = PIPE_FORMAT_B5G6R5_UNORM; - break; - default: - fmt = PIPE_FORMAT_NONE; - break; - } + enum pipe_format fmt = get_pixmap_format(&xdpy->base, pix); return (fmt == nconf->color_format); } -- cgit v1.2.3 From 0364c08d7f219ef3a250a4fd8396aacfdddf0368 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 12:19:12 +0800 Subject: st/egl: Remove unnecessary egl_g3d_find_pixmap_config. It was used to find a compatible config for a given pixmap. Now that a config is optional for pixmap surface creation, the function is not needed. --- .../state_trackers/egl/common/egl_g3d_api.c | 27 +--------------------- .../state_trackers/egl/common/egl_g3d_api.h | 3 --- .../state_trackers/egl/common/egl_g3d_image.c | 8 +------ 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 8e53e1dccba..a15c988c8bc 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -643,19 +643,13 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, struct egl_g3d_display *gdpy = egl_g3d_display(dpy); struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); _EGLContext *ctx = _eglGetCurrentContext(); - struct egl_g3d_config *gconf; struct native_surface *nsurf; struct pipe_resource *ptex; if (!gsurf->render_texture) return EGL_TRUE; - gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, target)); - if (!gconf) - return _eglError(EGL_BAD_NATIVE_PIXMAP, "eglCopyBuffers"); - - nsurf = gdpy->native->create_pixmap_surface(gdpy->native, - target, gconf->native); + nsurf = gdpy->native->create_pixmap_surface(gdpy->native, target, NULL); if (!nsurf) return _eglError(EGL_BAD_NATIVE_PIXMAP, "eglCopyBuffers"); @@ -888,25 +882,6 @@ egl_g3d_show_screen_surface(_EGLDriver *drv, _EGLDisplay *dpy, #endif /* EGL_MESA_screen_surface */ -/** - * Find a config that supports the pixmap. - */ -_EGLConfig * -egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix) -{ - struct egl_g3d_display *gdpy = egl_g3d_display(dpy); - struct egl_g3d_config *gconf; - EGLint i; - - for (i = 0; i < dpy->Configs->Size; i++) { - gconf = egl_g3d_config((_EGLConfig *) dpy->Configs->Elements[i]); - if (gdpy->native->is_pixmap_supported(gdpy->native, pix, gconf->native)) - break; - } - - return (i < dpy->Configs->Size) ? &gconf->base : NULL; -} - void egl_g3d_init_driver_api(_EGLDriver *drv) { diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.h b/src/gallium/state_trackers/egl/common/egl_g3d_api.h index d5196c12fe9..17fd7958aa6 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.h +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.h @@ -31,7 +31,4 @@ void egl_g3d_init_driver_api(_EGLDriver *drv); -_EGLConfig * -egl_g3d_find_pixmap_config(_EGLDisplay *dpy, EGLNativePixmapType pix); - #endif /* _EGL_G3D_API_H_ */ diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c index b2d6b433c5e..e6ff100de04 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c @@ -48,17 +48,11 @@ static struct pipe_resource * egl_g3d_reference_native_pixmap(_EGLDisplay *dpy, EGLNativePixmapType pix) { struct egl_g3d_display *gdpy = egl_g3d_display(dpy); - struct egl_g3d_config *gconf; struct native_surface *nsurf; struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS]; enum native_attachment natt; - gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, pix)); - if (!gconf) - return NULL; - - nsurf = gdpy->native->create_pixmap_surface(gdpy->native, - pix, gconf->native); + nsurf = gdpy->native->create_pixmap_surface(gdpy->native, pix, NULL); if (!nsurf) return NULL; -- cgit v1.2.3 From 3a93c348280767949c80ff6dde1645b77cab143d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 12:22:42 +0800 Subject: st/egl: Remove native_config::slow_config. In direct rendering scenario, it is not needed until an EGLDisplay can support both HW and SW pipe screens. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 3 --- src/gallium/state_trackers/egl/common/native.h | 1 - src/gallium/state_trackers/egl/gdi/native_gdi.c | 1 - src/gallium/state_trackers/egl/x11/native_dri2.c | 2 -- src/gallium/state_trackers/egl/x11/native_ximage.c | 2 -- 5 files changed, 9 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index a3750ac56fb..4641dd27617 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -229,9 +229,6 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf, conf->Samples = nconf->samples; conf->SampleBuffers = 0; - if (nconf->slow_config) - conf->ConfigCaveat = EGL_SLOW_CONFIG; - if (nconf->transparent_rgb) { conf->TransparentType = EGL_TRANSPARENT_RGB; conf->TransparentRedValue = nconf->transparent_rgb_values[0]; diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index a66e81def6f..58d844e5cd4 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -127,7 +127,6 @@ struct native_config { int native_visual_type; int level; int samples; - boolean slow_config; boolean transparent_rgb; int transparent_rgb_values[3]; }; diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c index d259e6edc89..2d0450604c6 100644 --- a/src/gallium/state_trackers/egl/gdi/native_gdi.c +++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c @@ -319,7 +319,6 @@ gdi_display_get_configs(struct native_display *ndpy, int *num_configs) nconf->color_format = formats[i]; nconf->window_bit = TRUE; - nconf->slow_config = TRUE; } gdpy->num_configs = count; diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 92203e1176c..83892e3f5f5 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -590,8 +590,6 @@ dri2_display_convert_config(struct native_display *ndpy, nconf->level = mode->level; nconf->samples = mode->samples; - nconf->slow_config = (mode->visualRating == GLX_SLOW_CONFIG); - if (mode->transparentPixel == GLX_TRANSPARENT_RGB) { nconf->transparent_rgb = TRUE; nconf->transparent_rgb_values[0] = mode->transparentRed; diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c index 3c32f379a2f..d4f4dd04df4 100644 --- a/src/gallium/state_trackers/egl/x11/native_ximage.c +++ b/src/gallium/state_trackers/egl/x11/native_ximage.c @@ -420,8 +420,6 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs) xconf->base.native_visual_type = xconf->visual->class; #endif - xconf->base.slow_config = TRUE; - count++; } -- cgit v1.2.3 From 975b7ef92a74c33bb853b012f377fb098e84fc46 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 12:27:35 +0800 Subject: st/egl: Remove native_config::samples. Multisample buffers are never requested. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 4 +--- src/gallium/state_trackers/egl/common/native.h | 1 - src/gallium/state_trackers/egl/x11/native_dri2.c | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 4641dd27617..d71ca866cb7 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -226,8 +226,6 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf, } conf->Level = nconf->level; - conf->Samples = nconf->samples; - conf->SampleBuffers = 0; if (nconf->transparent_rgb) { conf->TransparentType = EGL_TRANSPARENT_RGB; @@ -275,7 +273,7 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy, gconf->stvis.color_format = nconf->color_format; gconf->stvis.depth_stencil_format = depth_stencil_format; gconf->stvis.accum_format = PIPE_FORMAT_NONE; - gconf->stvis.samples = nconf->samples; + gconf->stvis.samples = 0; gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ? ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT; diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index 58d844e5cd4..654f445fca6 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -126,7 +126,6 @@ struct native_config { int native_visual_id; int native_visual_type; int level; - int samples; boolean transparent_rgb; int transparent_rgb_values[3]; }; diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index 83892e3f5f5..d60ef2aa396 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -588,7 +588,6 @@ dri2_display_convert_config(struct native_display *ndpy, nconf->native_visual_id = mode->visualID; nconf->native_visual_type = mode->visualType; nconf->level = mode->level; - nconf->samples = mode->samples; if (mode->transparentPixel == GLX_TRANSPARENT_RGB) { nconf->transparent_rgb = TRUE; -- cgit v1.2.3 From f431e0452b33ca9028e07cd85783297df6e87e69 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 22 Dec 2010 15:58:29 +1000 Subject: r600g: drop unused code in evergreen. this code was pretty much duplicated, thanks to Henri Verbeet on irc for pointing it out. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/evergreen_state.c | 2 +- src/gallium/drivers/r600/r600.h | 4 -- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 56 ---------------------- 3 files changed, 1 insertion(+), 61 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 8a69a10fc80..719b29f2ea3 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1359,7 +1359,7 @@ void evergreen_vertex_buffer_update(struct r600_pipe_context *rctx) 0x00000000, 0xFFFFFFFF, NULL); r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL); - evergreen_fs_resource_set(&rctx->ctx, rstate, i); + evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, rstate, i); } } diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index aa456d493f7..85e29665053 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -284,10 +284,6 @@ void r600_context_queries_resume(struct r600_context *ctx); int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon); void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw); -void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); -void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); -void evergreen_fs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); - void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); void evergreen_context_pipe_state_set_fs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid); diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 2175d578ec7..47d73c2e094 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -880,59 +880,3 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr ctx->pm4_dirty_cdwords = 0; } -static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) -{ - struct r600_range *range; - struct r600_block *block; - - range = &ctx->range[CTX_RANGE_ID(ctx, offset)]; - block = range->blocks[CTX_BLOCK_ID(ctx, offset)]; - block->reg[0] = state->regs[0].value; - block->reg[1] = state->regs[1].value; - block->reg[2] = state->regs[2].value; - block->reg[3] = state->regs[3].value; - block->reg[4] = state->regs[4].value; - block->reg[5] = state->regs[5].value; - block->reg[6] = state->regs[6].value; - block->reg[7] = state->regs[7].value; - r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL); - r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL); - if (state->regs[0].bo) { - /* VERTEX RESOURCE, we preted there is 2 bo to relocate so - * we have single case btw VERTEX & TEXTURE resource - */ - r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo); - r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo); - } else { - /* TEXTURE RESOURCE */ - r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); - r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); - } - if (!(block->status & R600_BLOCK_STATUS_DIRTY)) { - block->status |= R600_BLOCK_STATUS_ENABLED; - block->status |= R600_BLOCK_STATUS_DIRTY; - ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } -} - -void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid; - - evergreen_resource_set(ctx, state, offset); -} - -void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid; - - evergreen_resource_set(ctx, state, offset); -} - -void evergreen_fs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) -{ - unsigned offset = R_030000_RESOURCE0_WORD0 + 0x7C00 + 0x20 * rid; - - evergreen_resource_set(ctx, state, offset); -} -- cgit v1.2.3 From 0fb2dcc98ff46299094c308b7b4e0cde9e38d5c0 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 13:47:50 +0800 Subject: st/egl: Allow single-buffered pixmaps. All single-buffered configs were ignored before to make sure EGL_RENDER_BUFFER is settable for window surfaces. It is better to allow single-buffered configs and set EGL_WINDOW_BIT only for double-buffered ones. This way there can be single-buffered pixmaps. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 40 ++++++++-------------- .../state_trackers/egl/common/egl_g3d_api.c | 3 +- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index d71ca866cb7..f2b137a674a 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -183,17 +183,21 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf, } surface_type = 0x0; - if (nconf->window_bit) - surface_type |= EGL_WINDOW_BIT; - if (nconf->pixmap_bit) - surface_type |= EGL_PIXMAP_BIT; + /* pixmap surfaces should be EGL_SINGLE_BUFFER */ + if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) { + if (nconf->pixmap_bit) + surface_type |= EGL_PIXMAP_BIT; + } + /* the others surfaces should be EGL_BACK_BUFFER (or settable) */ + if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) { + if (nconf->window_bit) + surface_type |= EGL_WINDOW_BIT; #ifdef EGL_MESA_screen_surface - if (nconf->scanout_bit) - surface_type |= EGL_SCREEN_BIT_MESA; + if (nconf->scanout_bit) + surface_type |= EGL_SCREEN_BIT_MESA; #endif - - if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)) surface_type |= EGL_PBUFFER_BIT; + } conf->Conformant = api_mask; conf->RenderableType = api_mask; @@ -252,13 +256,9 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy, int preserve_buffer, int max_swap_interval) { struct egl_g3d_config *gconf = egl_g3d_config(conf); - EGLint buffer_mask, api_mask; + EGLint buffer_mask; EGLBoolean valid; - /* skip single-buffered configs */ - if (!(nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))) - return EGL_FALSE; - buffer_mask = 0x0; if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT)) buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK; @@ -275,22 +275,12 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy, gconf->stvis.accum_format = PIPE_FORMAT_NONE; gconf->stvis.samples = 0; + /* will be overridden per surface */ gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ? ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT; - api_mask = dpy->ClientAPIsMask; - /* this is required by EGL, not by OpenGL ES */ - if (nconf->window_bit && - gconf->stvis.render_buffer != ST_ATTACHMENT_BACK_LEFT) - api_mask &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT); - - if (!api_mask) { - _eglLog(_EGL_DEBUG, "no state tracker supports config 0x%x", - nconf->native_visual_id); - } - valid = init_config_attributes(&gconf->base, - nconf, api_mask, depth_stencil_format, + nconf, dpy->ClientAPIsMask, depth_stencil_format, preserve_buffer, max_swap_interval); if (!valid) { _eglLog(_EGL_DEBUG, "skip invalid config 0x%x", nconf->native_visual_id); diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index a15c988c8bc..aeabccfaf18 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -324,7 +324,8 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, } gsurf->stvis = gconf->stvis; - if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER) + if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER && + gconf->stvis.buffer_mask & ST_ATTACHMENT_FRONT_LEFT_MASK) gsurf->stvis.render_buffer = ST_ATTACHMENT_FRONT_LEFT; gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base); -- cgit v1.2.3 From 18bc427adecd7ecd728adc03ed73bb07878c0e8f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 13:59:58 +0800 Subject: st/egl: Plug pbuffer leaks. Unreference validated resources or remove unnecessary validations. --- src/gallium/state_trackers/egl/common/egl_g3d_api.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index aeabccfaf18..07ea6dc8b99 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -403,7 +403,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attribs) { struct egl_g3d_surface *gsurf; - struct pipe_resource *ptex = NULL; gsurf = create_pbuffer_surface(dpy, conf, attribs, "eglCreatePbufferSurface"); @@ -412,13 +411,6 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, gsurf->client_buffer_type = EGL_NONE; - if (!gsurf->stfbi->validate(gsurf->stfbi, - &gsurf->stvis.render_buffer, 1, &ptex)) { - egl_g3d_destroy_st_framebuffer(gsurf->stfbi); - FREE(gsurf); - return NULL; - } - return &gsurf->base; } @@ -478,12 +470,14 @@ egl_g3d_create_pbuffer_from_client_buffer(_EGLDriver *drv, _EGLDisplay *dpy, gsurf->client_buffer_type = buftype; gsurf->client_buffer = buffer; + /* validate now so that it fails if the client buffer is invalid */ if (!gsurf->stfbi->validate(gsurf->stfbi, &gsurf->stvis.render_buffer, 1, &ptex)) { egl_g3d_destroy_st_framebuffer(gsurf->stfbi); FREE(gsurf); return NULL; } + pipe_resource_reference(&ptex, NULL); return &gsurf->base; } -- cgit v1.2.3 From a31e2e3312cae5c4253a47dc30926ceb8c821ce3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 14:21:21 +0800 Subject: st/egl: Fix eglCopyBuffers. Flush before presenting. --- src/gallium/state_trackers/egl/common/egl_g3d_api.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 07ea6dc8b99..bce901ac9a9 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -665,14 +665,13 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT); if (ptex) { - struct pipe_resource *psrc = gsurf->render_texture; struct pipe_box src_box; + u_box_origin_2d(ptex->width0, ptex->height0, &src_box); - if (psrc) { - gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0, - gsurf->render_texture, 0, &src_box); - nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0); - } + gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0, + gsurf->render_texture, 0, &src_box); + gdpy->pipe->flush(gdpy->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0); pipe_resource_reference(&ptex, NULL); } -- cgit v1.2.3 From 341d048e4566af2f5909b2beeb9cd2b3d9a44e34 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 22 Dec 2010 01:30:41 -0500 Subject: r600g: remove useless switch statements Signed-off-by: Alex Deucher --- src/gallium/winsys/r600/drm/r600.c | 52 --------------------------------- src/gallium/winsys/r600/drm/r600_drm.c | 53 ---------------------------------- 2 files changed, 105 deletions(-) diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c index b88733f80f1..82a55acecf7 100644 --- a/src/gallium/winsys/r600/drm/r600.c +++ b/src/gallium/winsys/r600/drm/r600.c @@ -79,58 +79,6 @@ struct radeon *r600_new(int fd, unsigned device) r600_delete(r600); return NULL; } - switch (r600->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - case CHIP_PALM: - break; - case CHIP_R100: - case CHIP_RV100: - case CHIP_RS100: - case CHIP_RV200: - case CHIP_RS200: - case CHIP_R200: - case CHIP_RV250: - case CHIP_RS300: - case CHIP_RV280: - case CHIP_R300: - case CHIP_R350: - case CHIP_RV350: - case CHIP_RV380: - case CHIP_R420: - case CHIP_R423: - case CHIP_RV410: - case CHIP_RS400: - case CHIP_RS480: - case CHIP_RS600: - case CHIP_RS690: - case CHIP_RS740: - case CHIP_RV515: - case CHIP_R520: - case CHIP_RV530: - case CHIP_RV560: - case CHIP_RV570: - case CHIP_R580: - default: - R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device); - break; - } - /* setup class */ switch (r600->family) { case CHIP_R600: diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 3cbbf91878d..94ed3edb2a2 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -134,59 +134,6 @@ static struct radeon *radeon_new(int fd, unsigned device) fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->device); return radeon_decref(radeon); } - switch (radeon->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - case CHIP_PALM: - break; - case CHIP_R100: - case CHIP_RV100: - case CHIP_RS100: - case CHIP_RV200: - case CHIP_RS200: - case CHIP_R200: - case CHIP_RV250: - case CHIP_RS300: - case CHIP_RV280: - case CHIP_R300: - case CHIP_R350: - case CHIP_RV350: - case CHIP_RV380: - case CHIP_R420: - case CHIP_R423: - case CHIP_RV410: - case CHIP_RS400: - case CHIP_RS480: - case CHIP_RS600: - case CHIP_RS690: - case CHIP_RS740: - case CHIP_RV515: - case CHIP_R520: - case CHIP_RV530: - case CHIP_RV560: - case CHIP_RV570: - case CHIP_R580: - default: - fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n", - __func__, radeon->device); - break; - } - /* setup class */ switch (radeon->family) { case CHIP_R600: -- cgit v1.2.3 From 445cb9e53b1a98eb8af6ec499912a52b03fb1ce3 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 22 Dec 2010 15:13:52 +0800 Subject: st/egl: Assorted fixes for dri2_display_get_configs. Set window_bit only when the visual id is greater than zero. Correct visual types. Skip slow configs as they are not relevant. Finally, do not return duplicated configs. --- src/gallium/state_trackers/egl/x11/native_dri2.c | 40 +++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c index d60ef2aa396..adcc3b39d68 100644 --- a/src/gallium/state_trackers/egl/x11/native_dri2.c +++ b/src/gallium/state_trackers/egl/x11/native_dri2.c @@ -560,6 +560,10 @@ dri2_display_convert_config(struct native_display *ndpy, if (!mode->xRenderable || !mode->drawableType) return FALSE; + /* fast/slow configs are probably not relevant */ + if (mode->visualRating == GLX_SLOW_CONFIG) + return FALSE; + nconf->buffer_mask = 1 << NATIVE_ATTACHMENT_FRONT_LEFT; if (mode->doubleBufferMode) nconf->buffer_mask |= 1 << NATIVE_ATTACHMENT_BACK_LEFT; @@ -580,13 +584,32 @@ dri2_display_convert_config(struct native_display *ndpy, if (nconf->color_format == PIPE_FORMAT_NONE) return FALSE; - if (mode->drawableType & GLX_WINDOW_BIT) + if ((mode->drawableType & GLX_WINDOW_BIT) && mode->visualID) nconf->window_bit = TRUE; if (mode->drawableType & GLX_PIXMAP_BIT) nconf->pixmap_bit = TRUE; nconf->native_visual_id = mode->visualID; - nconf->native_visual_type = mode->visualType; + switch (mode->visualType) { + case GLX_TRUE_COLOR: + nconf->native_visual_type = TrueColor; + break; + case GLX_DIRECT_COLOR: + nconf->native_visual_type = DirectColor; + break; + case GLX_PSEUDO_COLOR: + nconf->native_visual_type = PseudoColor; + break; + case GLX_STATIC_COLOR: + nconf->native_visual_type = StaticColor; + break; + case GLX_GRAY_SCALE: + nconf->native_visual_type = GrayScale; + break; + case GLX_STATIC_GRAY: + nconf->native_visual_type = StaticGray; + break; + } nconf->level = mode->level; if (mode->transparentPixel == GLX_TRANSPARENT_RGB) { @@ -623,8 +646,17 @@ dri2_display_get_configs(struct native_display *ndpy, int *num_configs) count = 0; for (i = 0; i < num_modes; i++) { struct native_config *nconf = &dri2dpy->configs[count].base; - if (dri2_display_convert_config(&dri2dpy->base, modes, nconf)) - count++; + + if (dri2_display_convert_config(&dri2dpy->base, modes, nconf)) { + int j; + /* look for duplicates */ + for (j = 0; j < count; j++) { + if (memcmp(&dri2dpy->configs[j], nconf, sizeof(*nconf)) == 0) + break; + } + if (j == count) + count++; + } modes = modes->next; } -- cgit v1.2.3 From 4374703a9b2ce0be105ee544c8402a932e3e1f52 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Wed, 22 Dec 2010 10:52:12 -0500 Subject: i965: explicit tell header present for fb write on sandybridge Determine header present for fb write by msg length is not right for SIMD16 dispatch, and if there're more output attributes, header present is not easy to tell from msg length. This explicitly adds new param for fb write to say header present or not. Fixes many cases' hang and failure in GL conformance test. --- src/mesa/drivers/dri/i965/brw_eu.h | 3 ++- src/mesa/drivers/dri/i965/brw_eu_emit.c | 7 ++----- src/mesa/drivers/dri/i965/brw_fs.cpp | 3 ++- src/mesa/drivers/dri/i965/brw_wm_emit.c | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 4dbdc522100..119ffc72370 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -861,7 +861,8 @@ void brw_fb_WRITE(struct brw_compile *p, GLuint binding_table_index, GLuint msg_length, GLuint response_length, - GLboolean eot); + GLboolean eot, + GLboolean header_present); void brw_SAMPLE(struct brw_compile *p, struct brw_reg dest, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 2bdcacfb2ed..6d48ca0e46d 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -1812,12 +1812,12 @@ void brw_fb_WRITE(struct brw_compile *p, GLuint binding_table_index, GLuint msg_length, GLuint response_length, - GLboolean eot) + GLboolean eot, + GLboolean header_present) { struct intel_context *intel = &p->brw->intel; struct brw_instruction *insn; GLuint msg_control, msg_type; - GLboolean header_present = GL_TRUE; if (intel->gen >= 6 && binding_table_index == 0) { insn = next_insn(p, BRW_OPCODE_SENDC); @@ -1829,9 +1829,6 @@ void brw_fb_WRITE(struct brw_compile *p, insn->header.compression_control = BRW_COMPRESSION_NONE; if (intel->gen >= 6) { - if (msg_length == 4) - header_present = GL_FALSE; - /* headerless version, just submit color payload */ src0 = brw_message_reg(msg_reg_nr); diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4eead32cbbd..2de81b28371 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2163,7 +2163,8 @@ fs_visitor::generate_fb_write(fs_inst *inst) inst->target, inst->mlen, 0, - eot); + eot, + inst->header_present); } void diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 39cf96467af..56725c0d471 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1356,7 +1356,8 @@ static void fire_fb_write( struct brw_wm_compile *c, target, nr, 0, - eot); + eot, + GL_TRUE); } -- cgit v1.2.3 From 2fd718d5609af9066d04a8927dc2933512a43e4a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 22 Dec 2010 09:18:05 +0100 Subject: r600g: r600_new() and r600_delete() are unused. --- src/gallium/winsys/r600/drm/Makefile | 1 - src/gallium/winsys/r600/drm/SConscript | 1 - src/gallium/winsys/r600/drm/r600.c | 122 --------------------------------- src/gallium/winsys/r600/drm/r600_drm.c | 15 ++++ 4 files changed, 15 insertions(+), 124 deletions(-) delete mode 100644 src/gallium/winsys/r600/drm/r600.c diff --git a/src/gallium/winsys/r600/drm/Makefile b/src/gallium/winsys/r600/drm/Makefile index 91c65012c83..7310734f051 100644 --- a/src/gallium/winsys/r600/drm/Makefile +++ b/src/gallium/winsys/r600/drm/Makefile @@ -9,7 +9,6 @@ C_SOURCES = \ evergreen_hw_context.c \ radeon_bo.c \ radeon_pciid.c \ - r600.c \ r600_bo.c \ r600_drm.c \ r600_hw_context.c \ diff --git a/src/gallium/winsys/r600/drm/SConscript b/src/gallium/winsys/r600/drm/SConscript index dac0097f144..f97434e995d 100644 --- a/src/gallium/winsys/r600/drm/SConscript +++ b/src/gallium/winsys/r600/drm/SConscript @@ -7,7 +7,6 @@ r600_sources = [ 'evergreen_hw_context.c', 'radeon_bo.c', 'radeon_pciid.c', - 'r600.c', 'r600_bo.c', 'r600_drm.c', 'r600_hw_context.c', diff --git a/src/gallium/winsys/r600/drm/r600.c b/src/gallium/winsys/r600/drm/r600.c deleted file mode 100644 index 82a55acecf7..00000000000 --- a/src/gallium/winsys/r600/drm/r600.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2010 Jerome Glisse - * - * 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 - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, 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 (including the next - * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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: - * Jerome Glisse - */ -#include "xf86drm.h" -#include "radeon_drm.h" -#include "pipe/p_compiler.h" -#include "util/u_inlines.h" -#include "r600_priv.h" - -enum radeon_family r600_get_family(struct radeon *r600) -{ - return r600->family; -} - -enum chip_class r600_get_family_class(struct radeon *radeon) -{ - return radeon->chip_class; -} - -struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon) -{ - return &radeon->tiling_info; -} - -static int r600_get_device(struct radeon *r600) -{ - struct drm_radeon_info info; - - r600->device = 0; - info.request = RADEON_INFO_DEVICE_ID; - info.value = (uintptr_t)&r600->device; - return drmCommandWriteRead(r600->fd, DRM_RADEON_INFO, &info, sizeof(struct drm_radeon_info)); -} - -struct radeon *r600_new(int fd, unsigned device) -{ - struct radeon *r600; - int r; - - r600 = calloc(1, sizeof(*r600)); - if (r600 == NULL) { - return NULL; - } - r600->fd = fd; - r600->device = device; - if (fd >= 0) { - r = r600_get_device(r600); - if (r) { - R600_ERR("Failed to get device id\n"); - r600_delete(r600); - return NULL; - } - } - r600->family = radeon_family_from_device(r600->device); - if (r600->family == CHIP_UNKNOWN) { - R600_ERR("Unknown chipset 0x%04X\n", r600->device); - r600_delete(r600); - return NULL; - } - /* setup class */ - switch (r600->family) { - case CHIP_R600: - case CHIP_RV610: - case CHIP_RV630: - case CHIP_RV670: - case CHIP_RV620: - case CHIP_RV635: - case CHIP_RS780: - case CHIP_RS880: - r600->chip_class = R600; - break; - case CHIP_RV770: - case CHIP_RV730: - case CHIP_RV710: - case CHIP_RV740: - r600->chip_class = R700; - break; - case CHIP_CEDAR: - case CHIP_REDWOOD: - case CHIP_JUNIPER: - case CHIP_CYPRESS: - case CHIP_HEMLOCK: - case CHIP_PALM: - r600->chip_class = EVERGREEN; - break; - default: - R600_ERR("unknown or unsupported chipset 0x%04X\n", r600->device); - break; - } - - return r600; -} - -void r600_delete(struct radeon *r600) -{ - if (r600 == NULL) - return; - drmClose(r600->fd); - free(r600); -} diff --git a/src/gallium/winsys/r600/drm/r600_drm.c b/src/gallium/winsys/r600/drm/r600_drm.c index 94ed3edb2a2..58aacb77c9e 100644 --- a/src/gallium/winsys/r600/drm/r600_drm.c +++ b/src/gallium/winsys/r600/drm/r600_drm.c @@ -42,6 +42,21 @@ static struct radeon *radeon_new(int fd, unsigned device); +enum radeon_family r600_get_family(struct radeon *r600) +{ + return r600->family; +} + +enum chip_class r600_get_family_class(struct radeon *radeon) +{ + return radeon->chip_class; +} + +struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon) +{ + return &radeon->tiling_info; +} + static int radeon_get_device(struct radeon *radeon) { struct drm_radeon_info info; -- cgit v1.2.3 From ca8b4ca4788545a3f85efd7904f1a07b95f00c86 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 22 Dec 2010 09:18:05 +0100 Subject: r600g: Remove the unused "pframebuffer" field from r600_pipe_context. --- src/gallium/drivers/r600/evergreen_state.c | 2 -- src/gallium/drivers/r600/r600_pipe.h | 1 - src/gallium/drivers/r600/r600_state.c | 2 -- 3 files changed, 5 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 719b29f2ea3..c6f3669c9a3 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -770,8 +770,6 @@ static void evergreen_set_framebuffer_state(struct pipe_context *ctx, util_copy_framebuffer_state(&rctx->framebuffer, state); - rctx->pframebuffer = &rctx->framebuffer; - /* build states */ for (int i = 0; i < state->nr_cbufs; i++) { evergreen_cb(rctx, rstate, state, i); diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 43dbee99b0f..d9c35a44f18 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -136,7 +136,6 @@ struct r600_upload; struct r600_pipe_context { struct pipe_context context; struct blitter_context *blitter; - struct pipe_framebuffer_state *pframebuffer; unsigned family; void *custom_dsa_flush; struct r600_screen *screen; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 9b099df18d4..b68203f78f8 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1019,8 +1019,6 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx, util_copy_framebuffer_state(&rctx->framebuffer, state); - rctx->pframebuffer = &rctx->framebuffer; - /* build states */ for (int i = 0; i < state->nr_cbufs; i++) { r600_cb(rctx, rstate, state, i); -- cgit v1.2.3 From a91128030e6c19609f6bb66a871382bbe4e3e2a4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 22 Dec 2010 00:38:42 -0800 Subject: st/vega: Remove unnecessary headers. --- src/gallium/state_trackers/vega/api_masks.c | 4 ---- src/gallium/state_trackers/vega/renderer.c | 1 - src/gallium/state_trackers/vega/shader.c | 2 -- src/gallium/state_trackers/vega/text.c | 1 - src/gallium/state_trackers/vega/vg_context.c | 2 -- src/gallium/state_trackers/vega/vg_manager.c | 2 -- 6 files changed, 12 deletions(-) diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c index beb15c33a59..d96afe66387 100644 --- a/src/gallium/state_trackers/vega/api_masks.c +++ b/src/gallium/state_trackers/vega/api_masks.c @@ -32,10 +32,6 @@ #include "vg_context.h" #include "pipe/p_context.h" -#include "util/u_inlines.h" - -#include "util/u_pack_color.h" -#include "util/u_draw_quad.h" void vegaMask(VGHandle mask, VGMaskOperation operation, VGint x, VGint y, diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 7871c516c41..e42bad76492 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -28,7 +28,6 @@ #include "renderer.h" #include "vg_context.h" -#include "image.h" #include "pipe/p_context.h" #include "pipe/p_state.h" diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c index 0ed721376cf..2a6bae8a630 100644 --- a/src/gallium/state_trackers/vega/shader.c +++ b/src/gallium/state_trackers/vega/shader.c @@ -34,9 +34,7 @@ #include "renderer.h" #include "pipe/p_context.h" -#include "pipe/p_screen.h" #include "pipe/p_state.h" -#include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_math.h" #include "util/u_format.h" diff --git a/src/gallium/state_trackers/vega/text.c b/src/gallium/state_trackers/vega/text.c index 01ff602f58a..6714ee9ad35 100644 --- a/src/gallium/state_trackers/vega/text.c +++ b/src/gallium/state_trackers/vega/text.c @@ -30,7 +30,6 @@ #include "text.h" #include "image.h" #include "path.h" -#include "api.h" #ifdef OPENVG_VERSION_1_1 diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index 0844012cc3b..f36f55d6c89 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -30,7 +30,6 @@ #include "renderer.h" #include "shaders_cache.h" #include "shader.h" -#include "asm_util.h" #include "vg_manager.h" #include "api.h" #include "mask.h" @@ -40,7 +39,6 @@ #include "cso_cache/cso_context.h" -#include "util/u_simple_shaders.h" #include "util/u_memory.h" #include "util/u_blit.h" #include "util/u_sampler.h" diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c index de935768b22..ec713b7fb1d 100644 --- a/src/gallium/state_trackers/vega/vg_manager.c +++ b/src/gallium/state_trackers/vega/vg_manager.c @@ -33,14 +33,12 @@ #include "pipe/p_screen.h" #include "util/u_memory.h" #include "util/u_inlines.h" -#include "util/u_sampler.h" #include "util/u_box.h" #include "util/u_surface.h" #include "vg_api.h" #include "vg_manager.h" #include "vg_context.h" -#include "image.h" #include "api.h" static boolean -- cgit v1.2.3 From f39d0c791a1e3263528b14055aee35d9d422af9b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 22 Dec 2010 00:42:23 -0800 Subject: svga: Remove unnecessary header. --- src/gallium/drivers/svga/svga_screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 078190342a1..d0f42c614c9 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -35,7 +35,6 @@ #include "svga_resource_texture.h" #include "svga_resource.h" #include "svga_debug.h" -#include "svga_surface.h" #include "svga3d_shaderdefs.h" -- cgit v1.2.3 From 013fc334621d950ab6bf959803fe6584c6daed5e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 22 Dec 2010 00:52:05 -0800 Subject: r300g: Remove unnecessary headers. --- src/gallium/drivers/r300/r300_context.c | 2 -- src/gallium/drivers/r300/r300_emit.c | 1 - 2 files changed, 3 deletions(-) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 67b011a145c..bf1b8c33c00 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -35,8 +35,6 @@ #include "r300_screen_buffer.h" #include "r300_winsys.h" -#include - static void r300_update_num_contexts(struct r300_screen *r300screen, int diff) { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 04a5bd92d12..9e0df30e527 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -26,7 +26,6 @@ #include "util/u_format.h" #include "util/u_math.h" #include "util/u_mm.h" -#include "util/u_simple_list.h" #include "r300_context.h" #include "r300_cb.h" -- cgit v1.2.3 From 442fcd06204589dbeb0dfc12c1347cb245918d9a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 22 Dec 2010 00:55:41 -0800 Subject: llvmpipe: Remove unnecessary headers. --- src/gallium/drivers/llvmpipe/lp_jit.c | 2 -- src/gallium/drivers/llvmpipe/lp_state_fs.c | 1 - 2 files changed, 3 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index a775990f92a..482a902dd23 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -36,9 +36,7 @@ #include "util/u_memory.h" #include "gallivm/lp_bld_init.h" #include "gallivm/lp_bld_debug.h" -#include "gallivm/lp_bld_intr.h" #include "lp_context.h" -#include "lp_screen.h" #include "lp_jit.h" diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 2c4943a69f6..ae207617cc1 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -90,7 +90,6 @@ #include "lp_context.h" #include "lp_debug.h" #include "lp_perf.h" -#include "lp_screen.h" #include "lp_setup.h" #include "lp_state.h" #include "lp_tex_sample.h" -- cgit v1.2.3 From 38c8b034e2775640c588711290c244632dcc2475 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 22 Dec 2010 00:57:52 -0800 Subject: i915g: Remove unnecessary header. --- src/gallium/drivers/i915/i915_screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index f66478e729c..bdbc08e8086 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -35,7 +35,6 @@ #include "i915_debug.h" #include "i915_context.h" #include "i915_screen.h" -#include "i915_surface.h" #include "i915_resource.h" #include "i915_winsys.h" #include "i915_public.h" -- cgit v1.2.3