Changeset 3598 for trunk/src/opengl/mesa/pb.c
- Timestamp:
- May 23, 2000, 10:41:28 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/mesa/pb.c
r2938 r3598 1 /* $Id: pb.c,v 1. 1 2000-02-29 00:50:07 sandervlExp $ */1 /* $Id: pb.c,v 1.2 2000-05-23 20:40:42 jeroen Exp $ */ 2 2 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 39 39 * the number of function calls. 40 40 */ 41 /* $XFree86: xc/lib/GL/mesa/src/pb.c,v 1.3 1999/04/04 00:20:28 dawes Exp $ */42 41 43 42 … … 45 44 #include "all.h" 46 45 #else 47 #ifndef XFree86Server 48 #include <stdlib.h> 49 #include <string.h> 50 #else 51 #include "GL/xf86glx.h" 52 #endif 46 #include "glheader.h" 53 47 #include "alpha.h" 54 48 #include "alphabuf.h" … … 64 58 #include "texture.h" 65 59 #include "types.h" 60 #include "mem.h" 66 61 #endif 67 62 … … 74 69 { 75 70 struct pixel_buffer *pb; 76 pb = (struct pixel_buffer *) calloc(sizeof(struct pixel_buffer), 1);71 pb = CALLOC_STRUCT(pixel_buffer); 77 72 if (pb) { 78 73 int i, j; … … 114 109 115 110 if (bufferBit == FRONT_LEFT_BIT) 116 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_LEFT);111 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); 117 112 else if (bufferBit == FRONT_RIGHT_BIT) 118 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_RIGHT);113 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); 119 114 else if (bufferBit == BACK_LEFT_BIT) 120 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_LEFT);115 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); 121 116 else 122 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_RIGHT);117 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); 123 118 124 119 /* make copy of incoming indexes */ … … 135 130 136 131 /* restore default dest buffer */ 137 (void) (*ctx->Driver.Set Buffer)( ctx, ctx->Color.DriverDrawBuffer);132 (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer); 138 133 } 139 134 … … 160 155 161 156 if (bufferBit == FRONT_LEFT_BIT) { 162 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_LEFT);163 ctx-> Buffer->Alpha = ctx->Buffer->FrontLeftAlpha;157 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_LEFT); 158 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontLeftAlpha; 164 159 } 165 160 else if (bufferBit == FRONT_RIGHT_BIT) { 166 ( *ctx->Driver.SetBuffer)( ctx, GL_FRONT_RIGHT);167 ctx-> Buffer->Alpha = ctx->Buffer->FrontRightAlpha;161 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_FRONT_RIGHT); 162 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->FrontRightAlpha; 168 163 } 169 164 else if (bufferBit == BACK_LEFT_BIT) { 170 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_LEFT);171 ctx-> Buffer->Alpha = ctx->Buffer->BackLeftAlpha;165 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_LEFT); 166 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackLeftAlpha; 172 167 } 173 168 else { 174 ( *ctx->Driver.SetBuffer)( ctx, GL_BACK_RIGHT);175 ctx-> Buffer->Alpha = ctx->Buffer->BackRightAlpha;169 (void) (*ctx->Driver.SetDrawBuffer)( ctx, GL_BACK_RIGHT); 170 ctx->DrawBuffer->Alpha = ctx->DrawBuffer->BackRightAlpha; 176 171 } 177 172 … … 183 178 } 184 179 else if (ctx->Color.BlendEnabled) { 185 gl_blend_pixels( ctx, n, x, y, rgbaTmp, mask );180 _mesa_blend_pixels( ctx, n, x, y, rgbaTmp, mask ); 186 181 } 187 182 if (ctx->Color.SWmasking) { … … 190 185 191 186 (*ctx->Driver.WriteRGBAPixels)( ctx, n, x, y, 192 187 (const GLubyte (*)[4])rgbaTmp, mask ); 193 188 if (ctx->RasterMask & ALPHABUF_BIT) { 194 189 gl_write_alpha_pixels( ctx, n, x, y, 195 190 (const GLubyte (*)[4])rgbaTmp, mask ); 196 191 } 197 192 } … … 199 194 200 195 /* restore default dest buffer */ 201 (void) (*ctx->Driver.Set Buffer)( ctx, ctx->Color.DriverDrawBuffer);196 (void) (*ctx->Driver.SetDrawBuffer)( ctx, ctx->Color.DriverDrawBuffer); 202 197 } 203 198 … … 239 234 /* initialize mask array and clip pixels simultaneously */ 240 235 { 241 GLint xmin = ctx-> Buffer->Xmin;242 GLint xmax = ctx-> Buffer->Xmax;243 GLint ymin = ctx-> Buffer->Ymin;244 GLint ymax = ctx-> Buffer->Ymax;236 GLint xmin = ctx->DrawBuffer->Xmin; 237 GLint xmax = ctx->DrawBuffer->Xmax; 238 GLint ymin = ctx->DrawBuffer->Ymin; 239 GLint ymax = ctx->DrawBuffer->Ymax; 245 240 GLint *x = PB->x; 246 241 GLint *y = PB->y; … … 256 251 */ 257 252 if (PB->mono && ctx->MutablePixels) { 258 253 /* Copy mono color to all pixels */ 259 254 GLuint i; 260 255 for (i=0; i<PB->count; i++) { … … 269 264 if (ctx->MutablePixels || !PB->mono) { 270 265 271 266 if (ctx->Texture.ReallyEnabled) { 272 267 int texUnit; 273 268 for (texUnit=0;texUnit<MAX_TEXTURE_UNITS;texUnit++) { 274 269 gl_texture_pixels( ctx, texUnit, 275 270 PB->count, PB->s[texUnit], PB->t[texUnit], 276 271 PB->u[texUnit], PB->lambda[texUnit], 277 272 PB->rgba); 278 273 } 279 274 } 280 275 281 276 if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR … … 285 280 } 286 281 287 if (ctx->Fog.Enabled 288 && (ctx->FogMode == FOG_FRAGMENT || PB->primitive==GL_BITMAP)) { 289 gl_fog_rgba_pixels( ctx, PB->count, PB->z, PB->rgba ); 290 } 282 if (ctx->Fog.Enabled 283 && (ctx->Hint.Fog==GL_NICEST || PB->primitive==GL_BITMAP 284 || ctx->Texture.ReallyEnabled)) { 285 _mesa_fog_rgba_pixels( ctx, PB->count, PB->z, PB->rgba ); 286 } 291 287 292 288 /* Scissoring already done above */ 293 289 294 if (ctx->Color.AlphaEnabled) { 295 if (gl_alpha_test( ctx, PB->count, 296 (const GLubyte (*)[4])PB->rgba, mask )==0) { 297 goto CleanUp; 298 } 299 } 300 301 if (ctx->Stencil.Enabled) { 302 /* first stencil test */ 303 if (gl_stencil_pixels( ctx, PB->count, PB->x, PB->y, mask )==0) { 304 goto CleanUp; 305 } 306 /* depth buffering w/ stencil */ 307 gl_depth_stencil_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 308 } 309 else if (ctx->Depth.Test) { 310 /* regular depth testing */ 311 (*ctx->Driver.DepthTestPixels)( ctx, PB->count, PB->x, PB->y, 312 PB->z, mask ); 313 } 290 if (ctx->Color.AlphaEnabled) { 291 if (_mesa_alpha_test( ctx, PB->count, 292 (const GLubyte (*)[4]) PB->rgba, mask )==0) { 293 goto CleanUp; 294 } 295 } 296 297 if (ctx->Stencil.Enabled) { 298 /* first stencil test */ 299 if (gl_stencil_and_depth_test_pixels(ctx, PB->count, 300 PB->x, PB->y, PB->z, mask) == 0) { 301 goto CleanUp; 302 } 303 } 304 else if (ctx->Depth.Test) { 305 /* regular depth testing */ 306 _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 307 } 314 308 315 309 … … 326 320 } 327 321 else if (ctx->Color.BlendEnabled) { 328 gl_blend_pixels( ctx, PB->count, PB->x, PB->y, PB->rgba, mask);322 _mesa_blend_pixels( ctx, PB->count, PB->x, PB->y, PB->rgba, mask); 329 323 } 330 324 if (ctx->Color.SWmasking) { … … 334 328 (*ctx->Driver.WriteRGBAPixels)( ctx, PB->count, PB->x, PB->y, 335 329 (const GLubyte (*)[4]) PB->rgba, 336 330 mask ); 337 331 if (ctx->RasterMask & ALPHABUF_BIT) { 338 332 gl_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, 339 333 (const GLubyte (*)[4]) PB->rgba, mask ); 340 334 } 341 335 } 342 336 } 343 337 else { 344 338 /* Same color for all pixels */ 345 339 346 340 /* Scissoring already done above */ 347 341 348 if (ctx->Color.AlphaEnabled) { 349 if (gl_alpha_test( ctx, PB->count, 350 (const GLubyte (*)[4]) PB->rgba, mask )==0) { 351 goto CleanUp; 352 } 353 } 354 355 if (ctx->Stencil.Enabled) { 356 /* first stencil test */ 357 if (gl_stencil_pixels( ctx, PB->count, PB->x, PB->y, mask )==0) { 358 goto CleanUp; 359 } 360 /* depth buffering w/ stencil */ 361 gl_depth_stencil_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 362 } 363 else if (ctx->Depth.Test) { 364 /* regular depth testing */ 365 (*ctx->Driver.DepthTestPixels)( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 366 } 342 if (ctx->Color.AlphaEnabled) { 343 if (_mesa_alpha_test( ctx, PB->count, 344 (const GLubyte (*)[4]) PB->rgba, mask )==0) { 345 goto CleanUp; 346 } 347 } 348 349 if (ctx->Stencil.Enabled) { 350 /* first stencil test */ 351 if (gl_stencil_and_depth_test_pixels(ctx, PB->count, 352 PB->x, PB->y, PB->z, mask) == 0) { 353 goto CleanUp; 354 } 355 } 356 else if (ctx->Depth.Test) { 357 /* regular depth testing */ 358 _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 359 } 367 360 368 361 if (ctx->Color.DrawBuffer == GL_NONE) { … … 390 383 blue = PB->color[BCOMP]; 391 384 alpha = PB->color[ACOMP]; 392 385 (*ctx->Driver.Color)( ctx, red, green, blue, alpha ); 393 386 394 387 (*ctx->Driver.WriteMonoRGBAPixels)( ctx, PB->count, PB->x, PB->y, mask ); … … 408 401 /* If we may be writting pixels with different indexes... */ 409 402 if (PB->mono && ctx->MutablePixels) { 410 403 /* copy index to all pixels */ 411 404 GLuint n = PB->count, indx = PB->index; 412 405 GLuint *pbindex = PB->i; 413 406 do { 414 407 *pbindex++ = indx; 415 408 n--; 416 409 } while (n); 417 410 } 418 411 419 412 if (ctx->MutablePixels || !PB->mono) { 420 413 421 422 && (ctx-> FogMode==FOG_FRAGMENT || PB->primitive==GL_BITMAP)) {423 gl_fog_ci_pixels( ctx, PB->count, PB->z, PB->i );424 414 if (ctx->Fog.Enabled 415 && (ctx->Hint.Fog==GL_NICEST || PB->primitive==GL_BITMAP)) { 416 _mesa_fog_ci_pixels( ctx, PB->count, PB->z, PB->i ); 417 } 425 418 426 419 /* Scissoring already done above */ 427 420 428 if (ctx->Stencil.Enabled) { 429 /* first stencil test */ 430 if (gl_stencil_pixels( ctx, PB->count, PB->x, PB->y, mask )==0) { 431 goto CleanUp; 432 } 433 /* depth buffering w/ stencil */ 434 gl_depth_stencil_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 435 } 436 else if (ctx->Depth.Test) { 437 /* regular depth testing */ 438 (*ctx->Driver.DepthTestPixels)( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 439 } 421 if (ctx->Stencil.Enabled) { 422 /* first stencil test */ 423 if (gl_stencil_and_depth_test_pixels(ctx, PB->count, 424 PB->x, PB->y, PB->z, mask) == 0) { 425 goto CleanUp; 426 } 427 } 428 else if (ctx->Depth.Test) { 429 /* regular depth testing */ 430 _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 431 } 440 432 441 433 if (ctx->RasterMask & MULTI_DRAW_BIT) { … … 459 451 } 460 452 else { 461 453 /* Same color index for all pixels */ 462 454 463 455 /* Scissoring already done above */ 464 456 465 if (ctx->Stencil.Enabled) { 466 /* first stencil test */ 467 if (gl_stencil_pixels( ctx, PB->count, PB->x, PB->y, mask )==0) { 468 goto CleanUp; 469 } 470 /* depth buffering w/ stencil */ 471 gl_depth_stencil_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 472 } 473 else if (ctx->Depth.Test) { 474 /* regular depth testing */ 475 (*ctx->Driver.DepthTestPixels)( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 476 } 457 if (ctx->Stencil.Enabled) { 458 /* first stencil test */ 459 if (gl_stencil_and_depth_test_pixels(ctx, PB->count, 460 PB->x, PB->y, PB->z, mask) == 0) { 461 goto CleanUp; 462 } 463 } 464 else if (ctx->Depth.Test) { 465 /* regular depth testing */ 466 _mesa_depth_test_pixels( ctx, PB->count, PB->x, PB->y, PB->z, mask ); 467 } 477 468 478 469 if (ctx->RasterMask & MULTI_DRAW_BIT) {
Note:
See TracChangeset
for help on using the changeset viewer.