• Home
  • Raw
  • Download

Lines Matching +full:- +full:i

2  * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
53 …return (float4_array) (swrast->TexelBuffer + unit * SWRAST_MAX_WIDTH * 4 * omp_get_num_threads() +… in get_texel_array()
55 return (float4_array) (swrast->TexelBuffer + unit * SWRAST_MAX_WIDTH * 4); in get_texel_array()
77 * span->end: number of fragments to process
78 * span->array->rgba: incoming/result fragment colors
87 const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]); in texture_combine()
88 const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine; in texture_combine()
91 const GLfloat scaleRGB = (GLfloat) (1 << combine->ScaleShiftRGB); in texture_combine()
92 const GLfloat scaleA = (GLfloat) (1 << combine->ScaleShiftA); in texture_combine()
93 const GLuint numArgsRGB = combine->_NumArgsRGB; in texture_combine()
94 const GLuint numArgsA = combine->_NumArgsA; in texture_combine()
96 GLuint i, term; in texture_combine() local
97 GLuint n = span->end; in texture_combine()
98 GLchan (*rgbaChan)[4] = span->array->rgba; in texture_combine()
107 for (i = 0; i < numArgsRGB || i < numArgsA; i++) { in texture_combine()
108 ccolor[i] = malloc(4 * n * sizeof(GLfloat)); in texture_combine()
109 if (!ccolor[i]) { in texture_combine()
110 while (i) { in texture_combine()
111 free(ccolor[i]); in texture_combine()
112 i--; in texture_combine()
120 for (i = 0; i < n; i++) { in texture_combine()
121 rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]); in texture_combine()
122 rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]); in texture_combine()
123 rgba[i][BCOMP] = CHAN_TO_FLOAT(rgbaChan[i][BCOMP]); in texture_combine()
124 rgba[i][ACOMP] = CHAN_TO_FLOAT(rgbaChan[i][ACOMP]); in texture_combine()
129 combine->ModeRGB, in texture_combine()
130 combine->ModeA, in texture_combine()
131 combine->SourceRGB[0], in texture_combine()
132 combine->SourceA[0], in texture_combine()
133 combine->SourceRGB[1], in texture_combine()
134 combine->SourceA[1]); in texture_combine()
141 const GLenum srcRGB = combine->SourceRGB[term]; in texture_combine()
142 const GLenum operandRGB = combine->OperandRGB[term]; in texture_combine()
157 GLfloat red = textureUnit->EnvColor[0]; in texture_combine()
158 GLfloat green = textureUnit->EnvColor[1]; in texture_combine()
159 GLfloat blue = textureUnit->EnvColor[2]; in texture_combine()
160 GLfloat alpha = textureUnit->EnvColor[3]; in texture_combine()
161 for (i = 0; i < n; i++) { in texture_combine()
162 ASSIGN_4V(c[i], red, green, blue, alpha); in texture_combine()
172 for (i = 0; i < n; i++) { in texture_combine()
173 ASSIGN_4V(c[i], 0.0F, 0.0F, 0.0F, 0.0F); in texture_combine()
181 for (i = 0; i < n; i++) { in texture_combine()
182 ASSIGN_4V(c[i], 1.0F, 1.0F, 1.0F, 1.0F); in texture_combine()
190 const GLuint srcUnit = srcRGB - GL_TEXTURE0; in texture_combine()
191 assert(srcUnit < ctx->Const.MaxTextureUnits); in texture_combine()
192 if (!ctx->Texture.Unit[srcUnit]._Current) in texture_combine()
207 for (i = 0; i < n; i++) { in texture_combine()
208 dst[i][RCOMP] = 1.0F - src[i][RCOMP]; in texture_combine()
209 dst[i][GCOMP] = 1.0F - src[i][GCOMP]; in texture_combine()
210 dst[i][BCOMP] = 1.0F - src[i][BCOMP]; in texture_combine()
214 for (i = 0; i < n; i++) { in texture_combine()
215 dst[i][RCOMP] = in texture_combine()
216 dst[i][GCOMP] = in texture_combine()
217 dst[i][BCOMP] = src[i][ACOMP]; in texture_combine()
221 for (i = 0; i < n; i++) { in texture_combine()
222 dst[i][RCOMP] = in texture_combine()
223 dst[i][GCOMP] = in texture_combine()
224 dst[i][BCOMP] = 1.0F - src[i][ACOMP]; in texture_combine()
237 const GLenum srcA = combine->SourceA[term]; in texture_combine()
238 const GLenum operandA = combine->OperandA[term]; in texture_combine()
253 GLfloat alpha = textureUnit->EnvColor[3]; in texture_combine()
254 for (i = 0; i < n; i++) in texture_combine()
255 c[i][ACOMP] = alpha; in texture_combine()
264 for (i = 0; i < n; i++) in texture_combine()
265 c[i][ACOMP] = 0.0F; in texture_combine()
272 for (i = 0; i < n; i++) in texture_combine()
273 c[i][ACOMP] = 1.0F; in texture_combine()
280 const GLuint srcUnit = srcA - GL_TEXTURE0; in texture_combine()
281 assert(srcUnit < ctx->Const.MaxTextureUnits); in texture_combine()
282 if (!ctx->Texture.Unit[srcUnit]._Current) in texture_combine()
292 for (i = 0; i < n; i++) { in texture_combine()
293 dst[i][ACOMP] = 1.0F - src[i][ACOMP]; in texture_combine()
305 switch (combine->ModeRGB) { in texture_combine()
307 for (i = 0; i < n; i++) { in texture_combine()
308 rgba[i][RCOMP] = arg0[i][RCOMP] * scaleRGB; in texture_combine()
309 rgba[i][GCOMP] = arg0[i][GCOMP] * scaleRGB; in texture_combine()
310 rgba[i][BCOMP] = arg0[i][BCOMP] * scaleRGB; in texture_combine()
314 for (i = 0; i < n; i++) { in texture_combine()
315 rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * scaleRGB; in texture_combine()
316 rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * scaleRGB; in texture_combine()
317 rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * scaleRGB; in texture_combine()
321 if (textureUnit->EnvMode == GL_COMBINE4_NV) { in texture_combine()
323 for (i = 0; i < n; i++) { in texture_combine()
324 rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + in texture_combine()
325 arg2[i][RCOMP] * arg3[i][RCOMP]) * scaleRGB; in texture_combine()
326 rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] + in texture_combine()
327 arg2[i][GCOMP] * arg3[i][GCOMP]) * scaleRGB; in texture_combine()
328 rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] + in texture_combine()
329 arg2[i][BCOMP] * arg3[i][BCOMP]) * scaleRGB; in texture_combine()
333 /* 2-term addition */ in texture_combine()
334 for (i = 0; i < n; i++) { in texture_combine()
335 rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * scaleRGB; in texture_combine()
336 rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * scaleRGB; in texture_combine()
337 rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * scaleRGB; in texture_combine()
342 if (textureUnit->EnvMode == GL_COMBINE4_NV) { in texture_combine()
343 /* (a * b) + (c * d) - 0.5 */ in texture_combine()
344 for (i = 0; i < n; i++) { in texture_combine()
345 rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] + in texture_combine()
346 arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5F) * scaleRGB; in texture_combine()
347 rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] + in texture_combine()
348 arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5F) * scaleRGB; in texture_combine()
349 rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] + in texture_combine()
350 arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5F) * scaleRGB; in texture_combine()
354 for (i = 0; i < n; i++) { in texture_combine()
355 rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5F) * scaleRGB; in texture_combine()
356 rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5F) * scaleRGB; in texture_combine()
357 rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5F) * scaleRGB; in texture_combine()
362 for (i = 0; i < n; i++) { in texture_combine()
363 rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] + in texture_combine()
364 arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * scaleRGB; in texture_combine()
365 rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] + in texture_combine()
366 arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * scaleRGB; in texture_combine()
367 rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] + in texture_combine()
368 arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * scaleRGB; in texture_combine()
372 for (i = 0; i < n; i++) { in texture_combine()
373 rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * scaleRGB; in texture_combine()
374 rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * scaleRGB; in texture_combine()
375 rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * scaleRGB; in texture_combine()
381 for (i = 0; i < n; i++) { in texture_combine()
382 GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) + in texture_combine()
383 (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) + in texture_combine()
384 (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) in texture_combine()
387 rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot; in texture_combine()
393 for (i = 0; i < n; i++) { in texture_combine()
394 GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) + in texture_combine()
395 (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) + in texture_combine()
396 (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F)) in texture_combine()
399 rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot; in texture_combine()
403 for (i = 0; i < n; i++) { in texture_combine()
404 rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + in texture_combine()
405 arg1[i][RCOMP]) * scaleRGB; in texture_combine()
406 rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + in texture_combine()
407 arg1[i][GCOMP]) * scaleRGB; in texture_combine()
408 rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + in texture_combine()
409 arg1[i][BCOMP]) * scaleRGB; in texture_combine()
413 for (i = 0; i < n; i++) { in texture_combine()
414 rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + in texture_combine()
415 arg1[i][RCOMP] - 0.5F) * scaleRGB; in texture_combine()
416 rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + in texture_combine()
417 arg1[i][GCOMP] - 0.5F) * scaleRGB; in texture_combine()
418 rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + in texture_combine()
419 arg1[i][BCOMP] - 0.5F) * scaleRGB; in texture_combine()
423 for (i = 0; i < n; i++) { in texture_combine()
424 rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - in texture_combine()
425 arg1[i][RCOMP]) * scaleRGB; in texture_combine()
426 rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - in texture_combine()
427 arg1[i][GCOMP]) * scaleRGB; in texture_combine()
428 rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - in texture_combine()
429 arg1[i][BCOMP]) * scaleRGB; in texture_combine()
444 switch (combine->ModeA) { in texture_combine()
446 for (i = 0; i < n; i++) { in texture_combine()
447 rgba[i][ACOMP] = arg0[i][ACOMP] * scaleA; in texture_combine()
451 for (i = 0; i < n; i++) { in texture_combine()
452 rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * scaleA; in texture_combine()
456 if (textureUnit->EnvMode == GL_COMBINE4_NV) { in texture_combine()
458 for (i = 0; i < n; i++) { in texture_combine()
459 rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + in texture_combine()
460 arg2[i][ACOMP] * arg3[i][ACOMP]) * scaleA; in texture_combine()
464 /* two-term add */ in texture_combine()
465 for (i = 0; i < n; i++) { in texture_combine()
466 rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * scaleA; in texture_combine()
471 if (textureUnit->EnvMode == GL_COMBINE4_NV) { in texture_combine()
472 /* (a * b) + (c * d) - 0.5 */ in texture_combine()
473 for (i = 0; i < n; i++) { in texture_combine()
474 rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] + in texture_combine()
475 arg2[i][ACOMP] * arg3[i][ACOMP] - in texture_combine()
480 /* a + b - 0.5 */ in texture_combine()
481 for (i = 0; i < n; i++) { in texture_combine()
482 rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * scaleA; in texture_combine()
487 for (i = 0; i < n; i++) { in texture_combine()
488 rgba[i][ACOMP] = (arg0[i][ACOMP] * arg2[i][ACOMP] + in texture_combine()
489 arg1[i][ACOMP] * (1.0F - arg2[i][ACOMP])) in texture_combine()
494 for (i = 0; i < n; i++) { in texture_combine()
495 rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * scaleA; in texture_combine()
499 for (i = 0; i < n; i++) { in texture_combine()
500 rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) in texture_combine()
501 + arg1[i][ACOMP]) * scaleA; in texture_combine()
505 for (i = 0; i < n; i++) { in texture_combine()
506 rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + in texture_combine()
507 arg1[i][ACOMP] - 0.5F) * scaleA; in texture_combine()
511 for (i = 0; i < n; i++) { in texture_combine()
512 rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) in texture_combine()
513 - arg1[i][ACOMP]) * scaleA; in texture_combine()
526 if (combine->ModeRGB == GL_DOT3_RGBA_EXT || in texture_combine()
527 combine->ModeRGB == GL_DOT3_RGBA) { in texture_combine()
528 for (i = 0; i < n; i++) { in texture_combine()
529 rgba[i][ACOMP] = rgba[i][RCOMP]; in texture_combine()
533 for (i = 0; i < n; i++) { in texture_combine()
534 UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][RCOMP], rgba[i][RCOMP]); in texture_combine()
535 UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][GCOMP], rgba[i][GCOMP]); in texture_combine()
536 UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][BCOMP], rgba[i][BCOMP]); in texture_combine()
537 UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][ACOMP], rgba[i][ACOMP]); in texture_combine()
539 /* The span->array->rgba values are of CHAN type so set in texture_combine()
540 * span->array->ChanType field accordingly. in texture_combine()
542 span->array->ChanType = CHAN_TYPE; in texture_combine()
545 for (i = 0; i < numArgsRGB || i < numArgsA; i++) { in texture_combine()
546 free(ccolor[i]); in texture_combine()
564 GLuint i; in swizzle_texels() local
569 for (i = 0; i < count; i++) { in swizzle_texels()
570 vector[SWIZZLE_X] = texels[i][0]; in swizzle_texels()
571 vector[SWIZZLE_Y] = texels[i][1]; in swizzle_texels()
572 vector[SWIZZLE_Z] = texels[i][2]; in swizzle_texels()
573 vector[SWIZZLE_W] = texels[i][3]; in swizzle_texels()
574 texels[i][RCOMP] = vector[swzR]; in swizzle_texels()
575 texels[i][GCOMP] = vector[swzG]; in swizzle_texels()
576 texels[i][BCOMP] = vector[swzB]; in swizzle_texels()
577 texels[i][ACOMP] = vector[swzA]; in swizzle_texels()
592 if (!swrast->TexelBuffer) { in _swrast_texture_span()
602 if (!swrast->TexelBuffer) { in _swrast_texture_span()
611 swrast->TexelBuffer = in _swrast_texture_span()
612 malloc(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits * maxThreads * in _swrast_texture_span()
618 if (!swrast->TexelBuffer) { in _swrast_texture_span()
624 primary_rgba = malloc(span->end * 4 * sizeof(GLfloat)); in _swrast_texture_span()
631 assert(span->end <= SWRAST_MAX_WIDTH); in _swrast_texture_span()
636 if (swrast->_TextureCombinePrimary) { in _swrast_texture_span()
637 GLuint i; in _swrast_texture_span() local
638 for (i = 0; i < span->end; i++) { in _swrast_texture_span()
639 primary_rgba[i][RCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][RCOMP]); in _swrast_texture_span()
640 primary_rgba[i][GCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][GCOMP]); in _swrast_texture_span()
641 primary_rgba[i][BCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][BCOMP]); in _swrast_texture_span()
642 primary_rgba[i][ACOMP] = CHAN_TO_FLOAT(span->array->rgba[i][ACOMP]); in _swrast_texture_span()
650 for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { in _swrast_texture_span()
651 const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; in _swrast_texture_span()
652 if (texUnit->_Current) { in _swrast_texture_span()
654 span->array->attribs[VARYING_SLOT_TEX0 + unit]; in _swrast_texture_span()
655 const struct gl_texture_object *curObj = texUnit->_Current; in _swrast_texture_span()
657 GLfloat *lambda = span->array->lambda[unit]; in _swrast_texture_span()
661 if (span->arrayMask & SPAN_LAMBDA) { in _swrast_texture_span()
662 if (texUnit->LodBias + samp->LodBias != 0.0F) { in _swrast_texture_span()
664 const GLfloat bias = CLAMP(texUnit->LodBias + samp->LodBias, in _swrast_texture_span()
665 -ctx->Const.MaxTextureLodBias, in _swrast_texture_span()
666 ctx->Const.MaxTextureLodBias); in _swrast_texture_span()
667 GLuint i; in _swrast_texture_span() local
668 for (i = 0; i < span->end; i++) { in _swrast_texture_span()
669 lambda[i] += bias; in _swrast_texture_span()
673 if (samp->MinLod != -1000.0F || in _swrast_texture_span()
674 samp->MaxLod != 1000.0F) { in _swrast_texture_span()
676 const GLfloat min = samp->MinLod; in _swrast_texture_span()
677 const GLfloat max = samp->MaxLod; in _swrast_texture_span()
678 GLuint i; in _swrast_texture_span() local
679 for (i = 0; i < span->end; i++) { in _swrast_texture_span()
680 GLfloat l = lambda[i]; in _swrast_texture_span()
681 lambda[i] = CLAMP(l, min, max); in _swrast_texture_span()
685 else if (samp->MaxAnisotropy > 1.0F && in _swrast_texture_span()
686 samp->MinFilter == GL_LINEAR_MIPMAP_LINEAR) { in _swrast_texture_span()
698 /* Sample the texture (span->end = number of fragments) */ in _swrast_texture_span()
699 swrast->TextureSample[unit]( ctx, samp, in _swrast_texture_span()
700 ctx->Texture.Unit[unit]._Current, in _swrast_texture_span()
701 span->end, texcoords, lambda, texels ); in _swrast_texture_span()
704 if (curObj->_Swizzle != SWIZZLE_NOOP) { in _swrast_texture_span()
705 swizzle_texels(curObj->_Swizzle, span->end, texels); in _swrast_texture_span()
712 * We modify the span->color.rgba values. in _swrast_texture_span()
714 for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) { in _swrast_texture_span()
715 if (ctx->Texture.Unit[unit]._Current) in _swrast_texture_span()
716 texture_combine(ctx, unit, primary_rgba, swrast->TexelBuffer, span); in _swrast_texture_span()