diff options
| author | Nian Wu <nian.wu@intel.com> | 2007-03-21 17:00:32 +0800 | 
|---|---|---|
| committer | Nian Wu <nian.wu@intel.com> | 2007-03-21 17:00:32 +0800 | 
| commit | 8ba06464ac8de726390899e790e15b40df08001e (patch) | |
| tree | 8427cef9e66f329166b7cf366e09fa99e060f896 | |
| parent | 76444d042c841aa4e060db46c0668c17da97a1f6 (diff) | |
| parent | 4b5d6c0435acd84c13e0db3785758fed0bc48fe1 (diff) | |
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
| -rw-r--r-- | src/mesa/drivers/dri/common/dri_bufmgr.c | 2 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/i965/brw_tex.c | 12 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.c | 1 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_context.h | 1 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_fifo.c | 1 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_object.c | 18 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/r300/r300_context.h | 55 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/r300/r300_fragprog.c | 51 | ||||
| -rw-r--r-- | src/mesa/main/image.c | 19 | ||||
| -rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
| -rw-r--r-- | src/mesa/main/texstore.c | 2 | 
12 files changed, 73 insertions, 92 deletions
| diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 370b56c3a3..65d6545965 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -431,7 +431,7 @@ void  driBOCreateList(int target, drmBOList * list)  {     _glthread_LOCK_MUTEX(bmMutex); -   BM_CKFATAL(drmBOCreateList(20, list)); +   BM_CKFATAL(drmBOCreateList(target, list));     _glthread_UNLOCK_MUTEX(bmMutex);  } diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index 467aec64a0..9d4b9867d2 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -154,19 +154,13 @@ brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat,     case GL_RGB_S3TC:     case GL_RGB4_S3TC: -   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: -       return &_mesa_texformat_rgb_dxt1; - -   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: -       return &_mesa_texformat_rgba_dxt1; -     case GL_RGBA_S3TC:     case GL_RGBA4_S3TC:     case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: -       return &_mesa_texformat_rgba_dxt3; -     case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: -       return &_mesa_texformat_rgba_dxt5; +   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: +   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: +     return &_mesa_texformat_rgb_dxt1; /* there is no rgba support? */     case GL_DEPTH_COMPONENT:     case GL_DEPTH_COMPONENT16: diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index aec7b19771..f217c4404e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -352,6 +352,7 @@ static void nouveauDoSwapBuffers(nouveauContextPtr nmesa,  		OUT_RING       (((box->y2 - box->y1) << 16) |  				(box->x2 - box->x1));  	} +	FIRE_RING();  	UNLOCK_HARDWARE(nmesa);  #endif diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index f79a8675f4..87e4479da3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -45,6 +45,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.  #include "xmlconfig.h"  typedef struct nouveau_fifo_t{ +	int channel;  	u_int32_t* buffer;  	u_int32_t* mmio;  	u_int32_t put_base; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c index 67b5aa4f8a..bd2b2eddd0 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c @@ -124,6 +124,7 @@ GLboolean nouveauFifoInit(nouveauContextPtr nmesa)  	}  	/* Setup our initial FIFO tracking params */ +	nmesa->fifo.channel  = fifo_init.channel;  	nmesa->fifo.put_base = fifo_init.put_base;  	nmesa->fifo.current  = 0;  	nmesa->fifo.put      = 0; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c index 468b18e6d9..b71acff430 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_object.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c @@ -10,8 +10,9 @@ GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa,  	drm_nouveau_object_init_t cto;  	int ret; -	cto.handle = handle; -	cto.class  = class; +	cto.channel = nmesa->fifo.channel; +	cto.handle  = handle; +	cto.class   = class;  	ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_OBJECT_INIT, &cto, sizeof(cto));  	return ret == 0; @@ -28,12 +29,13 @@ GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa,  	drm_nouveau_dma_object_init_t dma;  	int ret; -	dma.class  = class; -	dma.handle = handle; -	dma.target = target; -	dma.access = access; -	dma.offset = offset; -	dma.size   = size; +	dma.channel = nmesa->fifo.channel; +	dma.class   = class; +	dma.handle  = handle; +	dma.target  = target; +	dma.access  = access; +	dma.offset  = offset; +	dma.size    = size;  	ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_DMA_OBJECT_INIT,  				  &dma, sizeof(dma));  	return ret == 0; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index e00080fce1..65bde99671 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -328,7 +328,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc  	static const __DRIversion ddx_expected = { 1, 2, 0 };  	static const __DRIversion dri_expected = { 4, 0, 0 };  	static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; -#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 4 +#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 5  #error nouveau_drm.h version doesn't match expected version  #endif  	dri_interface = interface; diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index bbe44f5e7f..fe261dbbc6 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -71,7 +71,7 @@ typedef struct r300_context *r300ContextPtr;  /* Checkpoint.. for convenience */  #define CPT	{ fprintf(stderr, "%s:%s line %d\n", __FILE__, __FUNCTION__, __LINE__); }  /* From http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html . -   I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble  +   I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble     with other compilers ... GLUE!  */  #if 1 @@ -548,7 +548,7 @@ struct r300_stencilbuffer_state {  /* Perhaps more if we store programs in vmem? */  /* drm_r300_cmd_header_t->vpu->count is unsigned char */  #define VSF_MAX_FRAGMENT_LENGTH (255*4) -	 +  /* Can be tested with colormat currently. */  #define VSF_MAX_FRAGMENT_TEMPS (14) @@ -593,7 +593,7 @@ struct r300_vertex_shader_state {  	int unknown_ptr2;  /* pointer within program space */  	int unknown_ptr3;  /* pointer within program space */  	}; -	 +  extern int hw_tcl_on;  //#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Current) @@ -602,16 +602,16 @@ extern int hw_tcl_on;  /* Should but doesnt work */  //#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->curr_vp) -//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) :  +//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && (OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit)))) :  //	(r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))) -//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) :  +//#define TMU_ENABLED(ctx, unit) (hw_tcl_on ? ctx->Texture.Unit[unit]._ReallyEnabled && OutputsWritten & (1<<(VERT_RESULT_TEX0+(unit))) :  //	ctx->Texture.Unit[unit]._ReallyEnabled && r300->state.render_inputs & (_TNL_BIT_TEX0<<(unit)))  #define TMU_ENABLED(ctx, unit) (ctx->Texture.Unit[unit]._ReallyEnabled)  /* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.   * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly. - */	 + */  struct r300_vertex_program_key {  	GLuint InputsRead; @@ -622,9 +622,9 @@ struct r300_vertex_program {  	struct r300_vertex_program *next;  	struct r300_vertex_program_key key;  	int translated; -	 +  	struct r300_vertex_shader_fragment program; -	 +  	int pos_end;  	int num_temporaries; /* Number of temp vars used by program */  	int wpos_idx; @@ -662,19 +662,19 @@ struct reg_lifetime {  	   This is -1 if the register has been assigned to a Mesa register  	   and the last access to the register has not yet been emitted */  	int free; -	 +  	/* Index of the first slot where this register is currently reserved.  	   This is used to stop e.g. a scalar operation from being moved  	   before the allocation time of a register that was first allocated  	   for a vector operation. */  	int reserved; -	 +  	/* Index of the first slot in which the register can be used as a  	   source without losing the value that is written by the last  	   emitted instruction that writes to the register */  	int vector_valid;  	int scalar_valid; -	 +  	/* Index to the slot where the register was last read.  	   This is also the first slot in which the register may be written again */  	int vector_lastread; @@ -694,7 +694,7 @@ struct reg_lifetime {  #define SLOT_OP_BOTH     (SLOT_OP_VECTOR | SLOT_OP_SCALAR)  struct r300_pfs_compile_slot { -	/* Bitmask indicating which parts of the slot are used, using SLOT_ constants  +	/* Bitmask indicating which parts of the slot are used, using SLOT_ constants  	   defined above */  	unsigned int used; @@ -708,18 +708,18 @@ struct r300_pfs_compile_slot {   */  struct r300_pfs_compile_state {  	int nrslots;       /* number of ALU slots used so far */ -	 +  	/* Track which (parts of) slots are already filled with instructions */  	struct r300_pfs_compile_slot slot[PFS_MAX_ALU_INST]; -	 +  	/* Track the validity of R300 temporaries */  	struct reg_lifetime hwtemps[PFS_NUM_TEMP_REGS]; -	 +  	/* Used to map Mesa's inputs/temps onto hardware temps */  	int temp_in_use;  	struct reg_acc temps[PFS_NUM_TEMP_REGS];  	struct reg_acc inputs[32]; /* don't actually need 32... */ -	 +  	/* Track usage of hardware temps, for register allocation,  	 * indirection detection, etc. */  	GLuint used_in_node; @@ -779,9 +779,6 @@ struct r300_fragment_program {  	int max_temp_idx; -	/* the index of the sin constant is stored here */ -	GLint const_sin[2]; -  	GLuint optimization;  }; @@ -808,10 +805,10 @@ struct radeon_vertex_buffer {  	void *Elts;  	int elt_size;  	int elt_min, elt_max; /* debug */ -	 +  	struct dt AttribPtr[VERT_ATTRIB_MAX]; -	 -	const struct _mesa_prim  *Primitive;	               + +	const struct _mesa_prim  *Primitive;  	GLuint      PrimitiveCount;  	GLint LockFirst;  	GLsizei LockCount; @@ -843,16 +840,16 @@ struct r300_state {  	GLuint *Elts;  	struct r300_dma_region elt_dma; -	 -	DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for.  -				 They are the same as tnl->render_inputs for fixed pipeline */	 -	 + +	DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for. +				 They are the same as tnl->render_inputs for fixed pipeline */ +  	struct {  		int transform_offset;  /* Transform matrix offset, -1 if none */  		} vap_param;  /* vertex processor parameter allocation - tells where to write parameters */ -	 +  	struct r300_stencilbuffer_state stencil; -	 +  };  #define R300_FALLBACK_NONE 0 @@ -904,7 +901,7 @@ struct r300_buffer_object {  	struct gl_buffer_object mesa_obj;  	int id;  }; -		 +  #define R300_CONTEXT(ctx)		((r300ContextPtr)(ctx->DriverCtx))  static __inline GLuint r300PackColor( GLuint cpp, diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index 2145c48b80..0d7d1f1af2 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -1401,14 +1401,6 @@ static GLfloat SinCosConsts[2][4] = {  }; -static void make_sin_const(struct r300_fragment_program *rp) -{ -	if(rp->const_sin[0] == -1) { -		rp->const_sin[0] = emit_const4fv(rp, SinCosConsts[0]); -		rp->const_sin[1] = emit_const4fv(rp, SinCosConsts[1]); -	} -} -  /**   * Emit a LIT instruction.   * \p flags may be PFS_FLAG_SAT @@ -1516,6 +1508,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  	struct prog_instruction *fpi;  	GLuint src[3], dest, temp[2];  	int flags, mask = 0; +	int const_sin[2];  	if (!inst || inst[0].Opcode == OPCODE_END) {  		ERROR("empty program?\n"); @@ -1568,15 +1561,16 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			 *   result = sin(x)  			 */  			temp[0] = get_temp_reg(rp); -			make_sin_const(rp); +			const_sin[0] = emit_const4fv(rp, SinCosConsts[0]); +			const_sin[1] = emit_const4fv(rp, SinCosConsts[1]);  			src[0] = t_scalar_src(rp, fpi->SrcReg[0]);  			/* add 0.5*PI and do range reduction */  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X,  				   swizzle(src[0], X, X, X, X), -				   swizzle(rp->const_sin[1], Z, Z, Z, Z), -				   swizzle(rp->const_sin[1], X, X, X, X), +				   swizzle(const_sin[1], Z, Z, Z, Z), +				   swizzle(const_sin[1], X, X, X, X),  				   0);  			emit_arith(rp, PFS_OP_FRC, temp[0], WRITEMASK_X, @@ -1587,15 +1581,15 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z,  				   swizzle(temp[0], X, X, X, X), -				   swizzle(rp->const_sin[1], W, W, W, W), //2*PI -				   negate(swizzle(rp->const_sin[0], Z, Z, Z, Z)), //-PI +				   swizzle(const_sin[1], W, W, W, W), //2*PI +				   negate(swizzle(const_sin[0], Z, Z, Z, Z)), //-PI  				   0);  			/* SIN */  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y,  				   swizzle(temp[0], Z, Z, Z, Z), -				   rp->const_sin[0], +				   const_sin[0],  				   pfs_zero,  				   0); @@ -1614,7 +1608,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  	    		emit_arith(rp, PFS_OP_MAD, dest, mask,  				   swizzle(temp[0], Y, Y, Y, Y), -				   swizzle(rp->const_sin[0], W, W, W, W), +				   swizzle(const_sin[0], W, W, W, W),  				   swizzle(temp[0], X, X, X, X),  				   flags); @@ -1808,19 +1802,20 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			 */  			temp[0] = get_temp_reg(rp);  			temp[1] = get_temp_reg(rp); -			make_sin_const(rp); +			const_sin[0] = emit_const4fv(rp, SinCosConsts[0]); +			const_sin[1] = emit_const4fv(rp, SinCosConsts[1]);  			src[0] = t_scalar_src(rp, fpi->SrcReg[0]);  			/* x = -abs(x)+0.5*PI */  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z, -				   swizzle(rp->const_sin[0], Z, Z, Z, Z), //PI +				   swizzle(const_sin[0], Z, Z, Z, Z), //PI  				   pfs_half,  				   negate(abs(swizzle(keep(src[0]), X, X, X, X))),  				   0);  			/* C*x (sin) */  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_W, -				   swizzle(rp->const_sin[0], Y, Y, Y, Y), +				   swizzle(const_sin[0], Y, Y, Y, Y),  				   swizzle(keep(src[0]), X, X, X, X),  				   pfs_zero,  				   0); @@ -1828,13 +1823,13 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			/* B*x, C*x (cos) */  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y,  			           swizzle(temp[0], Z, Z, Z, Z), -				   rp->const_sin[0], +				   const_sin[0],  			           pfs_zero,  				   0);  			/* B*x (sin) */  			emit_arith(rp, PFS_OP_MAD, temp[1], WRITEMASK_W, -				   swizzle(rp->const_sin[0], X, X, X, X), +				   swizzle(const_sin[0], X, X, X, X),  				   keep(src[0]),  				   pfs_zero,  				   0); @@ -1864,7 +1859,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			/* dest.xy = mad(temp.xy, P, temp2.wz) */  			emit_arith(rp, PFS_OP_MAD, dest, mask & (WRITEMASK_X | WRITEMASK_Y),  				   temp[0], -				   swizzle(rp->const_sin[0], W, W, W, W), +				   swizzle(const_sin[0], W, W, W, W),  				   swizzle(temp[1], W, Z, Y, X),  				   flags); @@ -1895,7 +1890,8 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			 */  			temp[0] = get_temp_reg(rp); -			make_sin_const(rp); +			const_sin[0] = emit_const4fv(rp, SinCosConsts[0]); +			const_sin[1] = emit_const4fv(rp, SinCosConsts[1]);  			src[0] = t_scalar_src(rp, fpi->SrcReg[0]); @@ -1903,7 +1899,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X,  				   swizzle(keep(src[0]), X, X, X, X), -				   swizzle(rp->const_sin[1], Z, Z, Z, Z), +				   swizzle(const_sin[1], Z, Z, Z, Z),  				   pfs_half,  				   0); @@ -1915,15 +1911,15 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_Z,  				   swizzle(temp[0], X, X, X, X), -				   swizzle(rp->const_sin[1], W, W, W, W), //2*PI -				   negate(swizzle(rp->const_sin[0], Z, Z, Z, Z)), //PI +				   swizzle(const_sin[1], W, W, W, W), //2*PI +				   negate(swizzle(const_sin[0], Z, Z, Z, Z)), //PI  				   0);  			/* SIN */  			emit_arith(rp, PFS_OP_MAD, temp[0], WRITEMASK_X | WRITEMASK_Y,  				   swizzle(temp[0], Z, Z, Z, Z), -				   rp->const_sin[0], +				   const_sin[0],  				   pfs_zero,  				   0); @@ -1942,7 +1938,7 @@ static GLboolean parse_program(struct r300_fragment_program *rp)  	    		emit_arith(rp, PFS_OP_MAD, dest, mask,  				   swizzle(temp[0], Y, Y, Y, Y), -				   swizzle(rp->const_sin[0], W, W, W, W), +				   swizzle(const_sin[0], W, W, W, W),  				   swizzle(temp[0], X, X, X, X),  				   flags); @@ -2124,7 +2120,6 @@ static void init_program(r300ContextPtr r300, struct r300_fragment_program *rp)  	rp->max_temp_idx = 0;  	rp->node[0].alu_end = -1;  	rp->node[0].tex_end = -1; -	rp->const_sin[0] = -1;  	_mesa_memset(cs, 0, sizeof(*rp->cs));  	for (i=0;i<PFS_MAX_ALU_INST;i++) { diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 44729b7419..394a7c65cd 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1211,24 +1211,15 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],     if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {        /* compute luminance values */ -      if (transferOps & IMAGE_RED_TO_LUMINANCE) { -         /* Luminance = Red (glGetTexImage) */ +      if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {           for (i = 0; i < n; i++) { -            luminance[i] = rgba[i][RCOMP]; +            GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; +            luminance[i] = CLAMP(sum, 0.0F, 1.0F);           }        }        else { -         /* Luminance = Red + Green + Blue (glReadPixels) */ -         if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) { -            for (i = 0; i < n; i++) { -               GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; -               luminance[i] = CLAMP(sum, 0.0F, 1.0F); -            } -         } -         else { -            for (i = 0; i < n; i++) { -               luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; -            } +         for (i = 0; i < n; i++) { +            luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];           }        }     } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 65246eb116..df77c6cbf9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2562,7 +2562,6 @@ struct matrix_stack  #define IMAGE_HISTOGRAM_BIT                       0x200  #define IMAGE_MIN_MAX_BIT                         0x400  #define IMAGE_CLAMP_BIT                           0x800 /* extra */ -#define IMAGE_RED_TO_LUMINANCE                    0x1000  /** Pixel Transfer ops up to convolution */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 2098bdddbf..a570525155 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3630,7 +3630,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,                 }                 _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,                                            format, type, dest, -                                          &ctx->Pack, IMAGE_RED_TO_LUMINANCE); +                                          &ctx->Pack, 0x0 /*image xfer ops*/);              } /* format */           } /* row */        } /* img */ | 
