Compare commits
	
		
			6 Commits
		
	
	
		
			mesa_7_6_1
			...
			mesa_7_1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 6d9b25e522 | ||
|  | 31bad23f0f | ||
|  | 29b9b25e72 | ||
|  | e794f496c6 | ||
|  | 68067c66d3 | ||
|  | ad5474e995 | 
							
								
								
									
										8
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Makefile
									
									
									
									
									
								
							| @@ -174,10 +174,10 @@ ultrix-gcc: | ||||
|  | ||||
| # Rules for making release tarballs | ||||
|  | ||||
| DIRECTORY = Mesa-7.1-rc4 | ||||
| LIB_NAME = MesaLib-7.1-rc4 | ||||
| DEMO_NAME = MesaDemos-7.1-rc4 | ||||
| GLUT_NAME = MesaGLUT-7.1-rc4 | ||||
| DIRECTORY = Mesa-7.1 | ||||
| LIB_NAME = MesaLib-7.1 | ||||
| DEMO_NAME = MesaDemos-7.1 | ||||
| GLUT_NAME = MesaGLUT-7.1 | ||||
|  | ||||
| MAIN_FILES = \ | ||||
| 	$(DIRECTORY)/Makefile*						\ | ||||
|   | ||||
| @@ -48,6 +48,7 @@ a:visited { | ||||
| <li><a href="lists.html" target="MainFrame">Mailing Lists</a> | ||||
| <li><a href="bugs.html" target="MainFrame">Bug Database</a> | ||||
| <li><a href="webmaster.html" target="MainFrame">Webmaster</a> | ||||
| <li><a href="http://dri.freedesktop.org/" target="MainFrame">Wiki</a> | ||||
| </ul> | ||||
|  | ||||
| <b>User Topics</b> | ||||
|   | ||||
| @@ -9,6 +9,8 @@ | ||||
| <H1>Downloading</H1> | ||||
|  | ||||
| <p> | ||||
| Current development release: <b>7.1</b> | ||||
| <br> | ||||
| Last stable release: <b>7.0.4</b> | ||||
| </p> | ||||
|  | ||||
|   | ||||
| @@ -22,9 +22,10 @@ for modern GPUs. | ||||
|  | ||||
| <p> | ||||
| Mesa ties into several other open-source projects: the  | ||||
| <a href="http://dri.sf.net/" target="_parent">Direct Rendering Infrastructure</a> | ||||
| and <a href="http://x.org" target="_parent">X.org</a> to provide OpenGL | ||||
| support to users of X on Linux, FreeBSD and other operating systems. | ||||
| <a href="http://dri.freedesktop.org/" target="_parent">Direct Rendering  | ||||
| Infrastructure</a> and <a href="http://x.org" target="_parent">X.org</a> to  | ||||
| provide OpenGL support to users of X on Linux, FreeBSD and other operating  | ||||
| systems. | ||||
| </p> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| <H1>Mailing Lists</H1> | ||||
|  | ||||
|  | ||||
| <p>There are four Mesa mailing lists: | ||||
| <p>There are four Mesa 3D / DRI mailing lists: | ||||
| </p> | ||||
|  | ||||
| <ul> | ||||
| @@ -19,14 +19,14 @@ versions are sent to this list. | ||||
| </li> | ||||
| <br> | ||||
| <li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users" | ||||
| target="_parent">mesa3d-users</a> - intended for users of the Mesa library. | ||||
| target="_parent">mesa3d-users</a> - intended for users of the Mesa and DRI. | ||||
| Newbie questions are appropriate, but please try the general OpenGL | ||||
| resources and Mesa documentation first. | ||||
| resources and Mesa/DRI documentation first. | ||||
| </li> | ||||
| <br> | ||||
| <li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev" | ||||
| target="_parent">mesa3d-dev</a> - for discussion of Mesa development. | ||||
| Not for beginners. | ||||
| target="_parent">mesa3d-dev</a> - for discussion of Mesa and Direct Rendering  | ||||
| Infrastructure development. Not for beginners. | ||||
| </li> | ||||
| <br> | ||||
| <li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-commit" | ||||
| @@ -37,6 +37,9 @@ Note: the old mesa3d-cvs list is no longer in use. | ||||
| </li> | ||||
| </ul> | ||||
|  | ||||
| <p>For mailing lists about Direct Rendering Modules (drm) in Linux/BSD  | ||||
| kernels, see <a href="http://dri.freedesktop.org/wiki/MailingLists">wiki</a>. | ||||
|  | ||||
| <p> | ||||
| <b>Notice</b>: non-member posts to any of these lists will be automatically | ||||
| rejected. | ||||
|   | ||||
| @@ -11,6 +11,16 @@ | ||||
| <H1>News</H1> | ||||
|  | ||||
|  | ||||
| <h2>August 26, 2008</h2> | ||||
| <p> | ||||
| <a href="relnotes-7.1.html">Mesa 7.1</a> is released. | ||||
| This is a new development release. | ||||
| It should be relatively stable, but those especially concerned about | ||||
| stability should wait for the 7.2 release or use Mesa 7.0.4 (the | ||||
| previous stable release). | ||||
| </p> | ||||
|  | ||||
|  | ||||
| <h2>August 16, 2008</h2> | ||||
| <p> | ||||
| <a href="relnotes-7.0.4.html">Mesa 7.0.4</a> is released. | ||||
|   | ||||
| @@ -8,13 +8,21 @@ | ||||
|  | ||||
| <body bgcolor="#eeeeee"> | ||||
|  | ||||
| <H1>Mesa 7.1 Release Notes / May XX, 2008</H1> | ||||
| <H1>Mesa 7.1 Release Notes / August 26, 2008</H1> | ||||
|  | ||||
| <p> | ||||
| Mesa 7.1 is a new development release. | ||||
| There have been many internal code changes since Mesa 7.0.x. | ||||
| It should be relatively stable, but those who are especially concerned about | ||||
| stability should wait for Mesa 7.2. | ||||
| stability should wait for Mesa 7.2 or use Mesa 7.0.4 (the previous stable | ||||
| release). | ||||
| </p> | ||||
| </> | ||||
| Note that this version of Mesa does not use the GEM memory manager. | ||||
| The master branch of git uses GEM. | ||||
| </p> | ||||
| <p> | ||||
| DRM version 2.3.1 should be used with Mesa 7.1 | ||||
| </p> | ||||
|  | ||||
|  | ||||
| @@ -27,9 +35,11 @@ TBD | ||||
| <h2>New features</h2> | ||||
| <ul> | ||||
| <li>autoconf-based configuration (and clean-up of Makefiles) | ||||
| <li>Assorted DRI driver enhancements | ||||
| <li>Reduced dependencies between X server and Mesa | ||||
| <li>GL_EXT_texture_from_pixmap extension for Xlib driver | ||||
| <li>Support for the GL shading language with i965 driver (implemented by Intel) | ||||
| <li>ATI R500 series support (Radeon X1300–X1950) in r300 DRI driver | ||||
| </ul> | ||||
|  | ||||
|  | ||||
| @@ -37,6 +47,7 @@ TBD | ||||
| <ul> | ||||
| <li>Numerous GLSL fixes | ||||
| <li>Fixed some error code/detection bugs in the GLSL-related API functions | ||||
| <li>Lots of DRI driver fixes. | ||||
| </ul> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /* | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  6.5.1 | ||||
|  * Version:  7.1 | ||||
|  * | ||||
|  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved. | ||||
|  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
|   | ||||
| @@ -85,7 +85,7 @@ compute_version(const GLcontext *ctx) | ||||
|                               ctx->Extensions.ARB_texture_non_power_of_two && | ||||
|                               ctx->Extensions.EXT_blend_equation_separate); | ||||
|    const GLboolean ver_2_1 = (ver_2_0 && | ||||
|                               ctx->Extensions.ARB_shading_language_120 && | ||||
|                               /*ctx->Extensions.ARB_shading_language_120 &&*/ | ||||
|                               ctx->Extensions.EXT_pixel_buffer_object && | ||||
|                               ctx->Extensions.EXT_texture_sRGB); | ||||
|    if (ver_2_1) | ||||
| @@ -121,12 +121,6 @@ _mesa_GetString( GLenum name ) | ||||
|    static const char *vendor = "Brian Paul"; | ||||
|    static const char *renderer = "Mesa"; | ||||
|  | ||||
| #if FEATURE_ARB_shading_language_120_foo /* support not complete! */ | ||||
|    static const char *sl_version = "1.20"; | ||||
| #elif FEATURE_ARB_shading_language_100 | ||||
|    static const char *sl_version = "1.10"; | ||||
| #endif | ||||
|  | ||||
|    if (!ctx) | ||||
|       return NULL; | ||||
|  | ||||
| @@ -154,8 +148,10 @@ _mesa_GetString( GLenum name ) | ||||
|          return (const GLubyte *) ctx->Extensions.String; | ||||
| #if FEATURE_ARB_shading_language_100 | ||||
|       case GL_SHADING_LANGUAGE_VERSION_ARB: | ||||
|          if (ctx->Extensions.ARB_shading_language_100) | ||||
|             return (const GLubyte *) sl_version; | ||||
|          if (ctx->Extensions.ARB_shading_language_120) | ||||
|             return (const GLubyte *) "1.20"; | ||||
|          else if (ctx->Extensions.ARB_shading_language_100) | ||||
|             return (const GLubyte *) "1.10"; | ||||
|          goto error; | ||||
| #endif | ||||
| #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \ | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * Mesa 3-D graphics library | ||||
|  * Version:  7.1 | ||||
|  * | ||||
|  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved. | ||||
|  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved. | ||||
|  * | ||||
|  * Permission is hereby granted, free of charge, to any person obtaining a | ||||
|  * copy of this software and associated documentation files (the "Software"), | ||||
| @@ -31,7 +31,7 @@ | ||||
| #define MESA_MAJOR 7 | ||||
| #define MESA_MINOR 1 | ||||
| #define MESA_PATCH 0 | ||||
| #define MESA_VERSION_STRING "7.1 rc4" | ||||
| #define MESA_VERSION_STRING "7.1" | ||||
|  | ||||
| /* To make version comparison easy */ | ||||
| #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||||
|   | ||||
| @@ -29,9 +29,9 @@ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "glheader.h" | ||||
| #include "imports.h" | ||||
| #include "macros.h" | ||||
| #include "main/glheader.h" | ||||
| #include "main/imports.h" | ||||
| #include "main/macros.h" | ||||
| #include "prog_instruction.h" | ||||
| #include "prog_parameter.h" | ||||
| #include "prog_statevars.h" | ||||
| @@ -277,6 +277,26 @@ _mesa_add_uniform(struct gl_program_parameter_list *paramList, | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Mark the named uniform as 'used'. | ||||
|  */ | ||||
| void | ||||
| _mesa_use_uniform(struct gl_program_parameter_list *paramList, | ||||
|                   const char *name) | ||||
| { | ||||
|    GLuint i; | ||||
|    for (i = 0; i < paramList->NumParameters; i++) { | ||||
|       struct gl_program_parameter *p = paramList->Parameters + i; | ||||
|       if (p->Type == PROGRAM_UNIFORM && _mesa_strcmp(p->Name, name) == 0) { | ||||
|          p->Used = GL_TRUE; | ||||
|          /* Note that large uniforms may occupy several slots so we're | ||||
|           * not done searching yet. | ||||
|           */ | ||||
|       } | ||||
|    } | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Add a sampler to the parameter list. | ||||
|  * \param name  uniform's name | ||||
| @@ -591,21 +611,24 @@ _mesa_clone_parameter_list(const struct gl_program_parameter_list *list) | ||||
|    /** Not too efficient, but correct */ | ||||
|    for (i = 0; i < list->NumParameters; i++) { | ||||
|       struct gl_program_parameter *p = list->Parameters + i; | ||||
|       struct gl_program_parameter *pCopy; | ||||
|       GLuint size = MIN2(p->Size, 4); | ||||
|       GLint j = _mesa_add_parameter(clone, p->Type, p->Name, size, p->DataType, | ||||
|                                     list->ParameterValues[i], NULL); | ||||
|       ASSERT(j >= 0); | ||||
|       pCopy = clone->Parameters + j; | ||||
|       pCopy->Used = p->Used; | ||||
|       /* copy state indexes */ | ||||
|       if (p->Type == PROGRAM_STATE_VAR) { | ||||
|          GLint k; | ||||
|          struct gl_program_parameter *q = clone->Parameters + j; | ||||
|          for (k = 0; k < STATE_LENGTH; k++) { | ||||
|             q->StateIndexes[k] = p->StateIndexes[k]; | ||||
|             pCopy->StateIndexes[k] = p->StateIndexes[k]; | ||||
|          } | ||||
|       } | ||||
|       else { | ||||
|          clone->Parameters[j].Size = p->Size; | ||||
|       } | ||||
|        | ||||
|    } | ||||
|  | ||||
|    clone->StateFlags = list->StateFlags; | ||||
|   | ||||
| @@ -31,7 +31,7 @@ | ||||
| #ifndef PROG_PARAMETER_H | ||||
| #define PROG_PARAMETER_H | ||||
|  | ||||
| #include "mtypes.h" | ||||
| #include "main/mtypes.h" | ||||
| #include "prog_statevars.h" | ||||
|  | ||||
|  | ||||
| @@ -48,6 +48,7 @@ struct gl_program_parameter | ||||
|    enum register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ | ||||
|    GLenum DataType;         /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ | ||||
|    GLuint Size;             /**< Number of components (1..4) */ | ||||
|    GLboolean Used;          /**< Helper flag for GLSL uniform tracking */ | ||||
|    /** | ||||
|     * A sequence of STATE_* tokens and integers to identify GL state. | ||||
|     */ | ||||
| @@ -112,6 +113,10 @@ extern GLint | ||||
| _mesa_add_uniform(struct gl_program_parameter_list *paramList, | ||||
|                   const char *name, GLuint size, GLenum datatype); | ||||
|  | ||||
| extern void | ||||
| _mesa_use_uniform(struct gl_program_parameter_list *paramList, | ||||
|                   const char *name); | ||||
|  | ||||
| extern GLint | ||||
| _mesa_add_sampler(struct gl_program_parameter_list *paramList, | ||||
|                   const char *name, GLenum datatype); | ||||
|   | ||||
| @@ -473,32 +473,33 @@ vec4 pow(const vec4 a, const vec4 b) | ||||
|  | ||||
| float exp(const float a) | ||||
| { | ||||
|    const float e = 2.71828; | ||||
|    __asm float_power __retVal, e, a; | ||||
|    // NOTE: log2(e) = 1.44269502 | ||||
|    float t = a * 1.44269502; | ||||
|    __asm float_exp2 __retVal, t; | ||||
| } | ||||
|  | ||||
| vec2 exp(const vec2 a) | ||||
| { | ||||
|    const float e = 2.71828; | ||||
|    __asm float_power __retVal.x, e, a.x; | ||||
|    __asm float_power __retVal.y, e, a.y; | ||||
|    vec2 t = a * 1.44269502; | ||||
|    __asm float_exp2 __retVal.x, t.x; | ||||
|    __asm float_exp2 __retVal.y, t.y; | ||||
| } | ||||
|  | ||||
| vec3 exp(const vec3 a) | ||||
| { | ||||
|    const float e = 2.71828; | ||||
|    __asm float_power __retVal.x, e, a.x; | ||||
|    __asm float_power __retVal.y, e, a.y; | ||||
|    __asm float_power __retVal.z, e, a.z; | ||||
|    vec3 t = a * 1.44269502; | ||||
|    __asm float_exp2 __retVal.x, t.x; | ||||
|    __asm float_exp2 __retVal.y, t.y; | ||||
|    __asm float_exp2 __retVal.z, t.z; | ||||
| } | ||||
|  | ||||
| vec4 exp(const vec4 a) | ||||
| { | ||||
|    const float e = 2.71828; | ||||
|    __asm float_power __retVal.x, e, a.x; | ||||
|    __asm float_power __retVal.y, e, a.y; | ||||
|    __asm float_power __retVal.z, e, a.z; | ||||
|    __asm float_power __retVal.w, e, a.w; | ||||
|    vec4 t = a * 1.44269502; | ||||
|    __asm float_exp2 __retVal.x, t.x; | ||||
|    __asm float_exp2 __retVal.y, t.y; | ||||
|    __asm float_exp2 __retVal.z, t.z; | ||||
|    __asm float_exp2 __retVal.w, t.w; | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1481,7 +1481,7 @@ _slang_simple_writemask(GLuint writemask, GLuint swizzle) | ||||
|  * \return GL_FALSE for simple writemasks, GL_TRUE for non-simple | ||||
|  */ | ||||
| static GLboolean | ||||
| swizzle_to_writemask(GLuint swizzle, | ||||
| swizzle_to_writemask(slang_assemble_ctx *A, GLuint swizzle, | ||||
|                      GLuint *writemaskOut, GLuint *swizzleOut) | ||||
| { | ||||
|    GLuint mask = 0x0, newSwizzle[4]; | ||||
| @@ -1495,6 +1495,18 @@ swizzle_to_writemask(GLuint swizzle, | ||||
|          break; | ||||
|       } | ||||
|       assert(swz >= 0 && swz <= 3); | ||||
|  | ||||
|       if (swizzle != SWIZZLE_XXXX && | ||||
|           swizzle != SWIZZLE_YYYY && | ||||
|           swizzle != SWIZZLE_ZZZZ && | ||||
|           swizzle != SWIZZLE_WWWW && | ||||
|           (mask & (1 << swz))) { | ||||
|          /* a channel can't be specified twice (ex: ".xyyz") */ | ||||
|          slang_info_log_error(A->log, "Invalid writemask '%s'", | ||||
|                               _mesa_swizzle_string(swizzle, 0, 0)); | ||||
|          return GL_FALSE; | ||||
|       } | ||||
|  | ||||
|       mask |= (1 << swz); | ||||
|    } | ||||
|    assert(mask <= 0xf); | ||||
| @@ -1590,11 +1602,11 @@ resolve_swizzle(const slang_operation *oper) | ||||
|  * As above, but produce a writemask. | ||||
|  */ | ||||
| static GLuint | ||||
| resolve_writemask(const slang_operation *oper) | ||||
| resolve_writemask(slang_assemble_ctx *A, const slang_operation *oper) | ||||
| { | ||||
|    GLuint swizzle = resolve_swizzle(oper); | ||||
|    GLuint writemask, swizzleOut; | ||||
|    swizzle_to_writemask(swizzle, &writemask, &swizzleOut); | ||||
|    swizzle_to_writemask(A, swizzle, &writemask, &swizzleOut); | ||||
|    return writemask; | ||||
| } | ||||
|  | ||||
| @@ -1668,7 +1680,7 @@ _slang_gen_asm(slang_assemble_ctx *A, slang_operation *oper, | ||||
|  | ||||
|       dest_oper = &oper->children[0]; | ||||
|  | ||||
|       writemask = resolve_writemask(dest_oper); | ||||
|       writemask = resolve_writemask(A, dest_oper); | ||||
|  | ||||
|       n0 = _slang_gen_operation(A, dest_oper); | ||||
|       if (!n0) | ||||
| @@ -1980,6 +1992,12 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, | ||||
|       fun = _slang_locate_struct_constructor(A, name); | ||||
|    } | ||||
|  | ||||
|    /* | ||||
|     * At this point, some heuristics are used to try to find a function | ||||
|     * that matches the calling signature by means of casting or "unrolling" | ||||
|     * of constructors. | ||||
|     */ | ||||
|  | ||||
|    if (!fun && _slang_is_vec_mat_type(name)) { | ||||
|       /* Next, if this call looks like a vec() or mat() constructor call, | ||||
|        * try "unwinding" the args to satisfy a constructor. | ||||
| @@ -1995,7 +2013,7 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, | ||||
|       } | ||||
|    } | ||||
|  | ||||
|    if (!fun) { | ||||
|    if (!fun && _slang_is_vec_mat_type(name)) { | ||||
|       /* Next, try casting args to the types of the formal parameters */ | ||||
|       int numArgs = oper->num_children; | ||||
|       fun = _slang_find_function_by_argc(A->space.funcs, name, numArgs); | ||||
| @@ -2008,6 +2026,13 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name, | ||||
|       assert(fun); | ||||
|    } | ||||
|  | ||||
|    if (!fun) { | ||||
|       slang_info_log_error(A->log, | ||||
|                            "Function '%s' not found (check argument types)", | ||||
|                            name); | ||||
|       return NULL; | ||||
|    } | ||||
|  | ||||
|    n = _slang_gen_function_call(A, fun, oper, dest); | ||||
|  | ||||
|    if (n && !n->Store && !dest | ||||
| @@ -2716,7 +2741,11 @@ _slang_assignment_compatible(slang_assemble_ctx *A, | ||||
|    slang_typeinfo t0, t1; | ||||
|    GLuint sz0, sz1; | ||||
|  | ||||
|     | ||||
|    if (op0->type == SLANG_OPER_POSTINCREMENT || | ||||
|        op0->type == SLANG_OPER_POSTDECREMENT) { | ||||
|       return GL_FALSE; | ||||
|    } | ||||
|  | ||||
|    slang_typeinfo_construct(&t0); | ||||
|    _slang_typeof_operation(A, op0, &t0); | ||||
|  | ||||
| @@ -3020,7 +3049,7 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper) | ||||
|       if (lhs && rhs) { | ||||
|          /* convert lhs swizzle into writemask */ | ||||
|          GLuint writemask, newSwizzle; | ||||
|          if (!swizzle_to_writemask(lhs->Store->Swizzle, | ||||
|          if (!swizzle_to_writemask(A, lhs->Store->Swizzle, | ||||
|                                    &writemask, &newSwizzle)) { | ||||
|             /* Non-simple writemask, need to swizzle right hand side in | ||||
|              * order to put components into the right place. | ||||
|   | ||||
| @@ -108,7 +108,9 @@ writemask_to_swizzle(GLuint writemask) | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Swizzle a swizzle.  That is, return swz2(swz1) | ||||
|  * Swizzle a swizzle (function composition). | ||||
|  * That is, return swz2(swz1), or said another way: swz1.szw2 | ||||
|  * Example: swizzle_swizzle(".zwxx", ".xxyw") yields ".zzwx" | ||||
|  */ | ||||
| GLuint | ||||
| _slang_swizzle_swizzle(GLuint swz1, GLuint swz2) | ||||
| @@ -279,7 +281,7 @@ storage_to_src_reg(struct prog_src_register *src, const slang_ir_storage *st) | ||||
|    while (st->Parent) { | ||||
|       st = st->Parent; | ||||
|       index += st->Index; | ||||
|       swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle); | ||||
|       swizzle = _slang_swizzle_swizzle(fix_swizzle(st->Swizzle), swizzle); | ||||
|    } | ||||
|  | ||||
|    assert(st->File >= 0); | ||||
| @@ -1636,6 +1638,88 @@ emit_struct_field(slang_emit_info *emitInfo, slang_ir_node *n) | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Emit code for a variable declaration. | ||||
|  * This usually doesn't result in any code generation, but just | ||||
|  * memory allocation. | ||||
|  */ | ||||
| static struct prog_instruction * | ||||
| emit_var_decl(slang_emit_info *emitInfo, slang_ir_node *n) | ||||
| { | ||||
|    struct prog_instruction *inst; | ||||
|  | ||||
|    assert(n->Store); | ||||
|    assert(n->Store->File != PROGRAM_UNDEFINED); | ||||
|    assert(n->Store->Size > 0); | ||||
|    /*assert(n->Store->Index < 0);*/ | ||||
|  | ||||
|    if (!n->Var || n->Var->isTemp) { | ||||
|       /* a nameless/temporary variable, will be freed after first use */ | ||||
|       /*NEW*/ | ||||
|       if (n->Store->Index < 0 && !_slang_alloc_temp(emitInfo->vt, n->Store)) { | ||||
|          slang_info_log_error(emitInfo->log, | ||||
|                               "Ran out of registers, too many temporaries"); | ||||
|          return NULL; | ||||
|       } | ||||
|    } | ||||
|    else { | ||||
|       /* a regular variable */ | ||||
|       _slang_add_variable(emitInfo->vt, n->Var); | ||||
|       if (!_slang_alloc_var(emitInfo->vt, n->Store)) { | ||||
|          slang_info_log_error(emitInfo->log, | ||||
|                               "Ran out of registers, too many variables"); | ||||
|          return NULL; | ||||
|       } | ||||
|       /* | ||||
|         printf("IR_VAR_DECL %s %d store %p\n", | ||||
|         (char*) n->Var->a_name, n->Store->Index, (void*) n->Store); | ||||
|       */ | ||||
|       assert(n->Var->aux == n->Store); | ||||
|    } | ||||
|    if (emitInfo->EmitComments) { | ||||
|       /* emit NOP with comment describing the variable's storage location */ | ||||
|       char s[1000]; | ||||
|       sprintf(s, "TEMP[%d]%s = variable %s (size %d)", | ||||
|               n->Store->Index, | ||||
|               _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE),  | ||||
|               (n->Var ? (char *) n->Var->a_name : "anonymous"), | ||||
|               n->Store->Size); | ||||
|       inst = emit_comment(emitInfo, s); | ||||
|       return inst; | ||||
|    } | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Emit code for a reference to a variable. | ||||
|  * Actually, no code is generated but we may do some memory alloation. | ||||
|  * In particular, state vars (uniforms) are allocated on an as-needed basis. | ||||
|  */ | ||||
| static struct prog_instruction * | ||||
| emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) | ||||
| { | ||||
|    assert(n->Store); | ||||
|    assert(n->Store->File != PROGRAM_UNDEFINED); | ||||
|  | ||||
|    if (n->Store->File == PROGRAM_STATE_VAR && n->Store->Index < 0) { | ||||
|       n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters); | ||||
|    } | ||||
|    else if (n->Store->File == PROGRAM_UNIFORM) { | ||||
|       /* mark var as used */ | ||||
|       _mesa_use_uniform(emitInfo->prog->Parameters, (char *) n->Var->a_name); | ||||
|    } | ||||
|  | ||||
|    if (n->Store->Index < 0) { | ||||
|       /* probably ran out of registers */ | ||||
|       return NULL; | ||||
|    } | ||||
|    assert(n->Store->Size > 0); | ||||
|  | ||||
|    return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| static struct prog_instruction * | ||||
| emit(slang_emit_info *emitInfo, slang_ir_node *n) | ||||
| { | ||||
| @@ -1671,64 +1755,14 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) | ||||
|  | ||||
|    case IR_VAR_DECL: | ||||
|       /* Variable declaration - allocate a register for it */ | ||||
|       assert(n->Store); | ||||
|       assert(n->Store->File != PROGRAM_UNDEFINED); | ||||
|       assert(n->Store->Size > 0); | ||||
|       /*assert(n->Store->Index < 0);*/ | ||||
|       if (!n->Var || n->Var->isTemp) { | ||||
|          /* a nameless/temporary variable, will be freed after first use */ | ||||
|          /*NEW*/ | ||||
|          if (n->Store->Index < 0 && !_slang_alloc_temp(emitInfo->vt, n->Store)) { | ||||
|             slang_info_log_error(emitInfo->log, | ||||
|                                  "Ran out of registers, too many temporaries"); | ||||
|             return NULL; | ||||
|          } | ||||
|       } | ||||
|       else { | ||||
|          /* a regular variable */ | ||||
|          _slang_add_variable(emitInfo->vt, n->Var); | ||||
|          if (!_slang_alloc_var(emitInfo->vt, n->Store)) { | ||||
|             slang_info_log_error(emitInfo->log, | ||||
|                                  "Ran out of registers, too many variables"); | ||||
|             return NULL; | ||||
|          } | ||||
|          /* | ||||
|          printf("IR_VAR_DECL %s %d store %p\n", | ||||
|                 (char*) n->Var->a_name, n->Store->Index, (void*) n->Store); | ||||
|          */ | ||||
|          assert(n->Var->aux == n->Store); | ||||
|       } | ||||
|       if (emitInfo->EmitComments) { | ||||
|          /* emit NOP with comment describing the variable's storage location */ | ||||
|          char s[1000]; | ||||
|          sprintf(s, "TEMP[%d]%s = variable %s (size %d)", | ||||
|                  n->Store->Index, | ||||
|                  _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE),  | ||||
|                  (n->Var ? (char *) n->Var->a_name : "anonymous"), | ||||
|                  n->Store->Size); | ||||
|          inst = emit_comment(emitInfo, s); | ||||
|          return inst; | ||||
|       } | ||||
|       return NULL; | ||||
|       inst = emit_var_decl(emitInfo, n); | ||||
|       return inst; | ||||
|  | ||||
|    case IR_VAR: | ||||
|       /* Reference to a variable | ||||
|        * Storage should have already been resolved/allocated. | ||||
|        */ | ||||
|       assert(n->Store); | ||||
|       assert(n->Store->File != PROGRAM_UNDEFINED); | ||||
|  | ||||
|       if (n->Store->File == PROGRAM_STATE_VAR && | ||||
|           n->Store->Index < 0) { | ||||
|          n->Store->Index = _slang_alloc_statevar(n, emitInfo->prog->Parameters); | ||||
|       } | ||||
|  | ||||
|       if (n->Store->Index < 0) { | ||||
|          /* probably ran out of registers */ | ||||
|          return NULL; | ||||
|       } | ||||
|       assert(n->Store->Size > 0); | ||||
|       break; | ||||
|       return emit_var_ref(emitInfo, n); | ||||
|  | ||||
|    case IR_ELEMENT: | ||||
|       return emit_array_element(emitInfo, n); | ||||
| @@ -1939,6 +1973,7 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, | ||||
|    GET_CURRENT_CONTEXT(ctx); | ||||
|    GLboolean success; | ||||
|    slang_emit_info emitInfo; | ||||
|    GLuint maxUniforms; | ||||
|  | ||||
|    emitInfo.log = log; | ||||
|    emitInfo.vt = vt; | ||||
| @@ -1955,6 +1990,19 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, | ||||
|       emitInfo.EmitHighLevelInstructions = GL_TRUE; | ||||
|    }       | ||||
|  | ||||
|    /* Check uniform/constant limits */ | ||||
|    if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) { | ||||
|       maxUniforms = ctx->Const.FragmentProgram.MaxUniformComponents / 4; | ||||
|    } | ||||
|    else { | ||||
|       assert(prog->Target == GL_VERTEX_PROGRAM_ARB); | ||||
|       maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; | ||||
|    } | ||||
|    if (prog->Parameters->NumParameters > maxUniforms) { | ||||
|       slang_info_log_error(log, "Constant/uniform register limit exceeded"); | ||||
|       return GL_FALSE; | ||||
|    } | ||||
|  | ||||
|    (void) emit(&emitInfo, n); | ||||
|  | ||||
|    /* finish up by adding the END opcode to program */ | ||||
|   | ||||
| @@ -173,7 +173,7 @@ link_uniform_vars(struct gl_shader_program *shProg, | ||||
|        * Furthermore, we'll need to fix the state-var's size/datatype info. | ||||
|        */ | ||||
|  | ||||
|       if (p->Type == PROGRAM_UNIFORM || | ||||
|       if ((p->Type == PROGRAM_UNIFORM && p->Used) || | ||||
|           p->Type == PROGRAM_SAMPLER) { | ||||
|          _mesa_append_uniform(shProg->Uniforms, p->Name, prog->Target, i); | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user