~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/main/buffers.c

  • Committer: Package Import Robot
  • Author(s): Timo Aaltonen
  • Date: 2012-08-23 15:37:30 UTC
  • mfrom: (1.7.6)
  • Revision ID: package-import@ubuntu.com-20120823153730-c499sefj7btu4386
Tags: 9.0~git20120821.c1114c61-0ubuntu1
* Merge from unreleased debian git.
  - Includes support for ATI Trinity PCI IDs (LP: #1009089)
* rules, control, libgl1-mesa-swx11*: Remove swx11 support.
* Refresh patches:
  - drop 115_llvm_dynamic_linking.diff,
    117_nullptr_check_in_query_version.patch, and
    118_glsl_initialize_samplers.patch, all upstream
  - disable 116_use_shared_galliumcore.diff until it's reviewed and
    reworked to apply
* not-installed, libegl1-mesa-drivers-install.linux.in: Updated to
  match the single-pass build.
* libgl1-mesa-dri.*install.in: Drop libglsl.so, it's included in
  libdricore.so now.
* rules: Don't disable GLU on the common flags, we need to build it
  on the dri target.
* libglu*install.in: Fix the source file paths to match the build target.
  Drop the static lib from -dev since only shared libs get built.
* libgl1-mesa-dev.install.in: Fix the source file paths to match the
  build target.
* libgl1-mesa-dri.install.linux.in: Don't try to install libgallium.so,
  which isn't built yet.
* rules: Enable llvmpipe on armhf to see if it works or not.
* rules: Remove bin/install-sh on clean, and don't create a symlink for
  it.
* control: Add Pre-Depends on dpkg-dev due to the binaries using xz
  compression.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "colormac.h"
36
36
#include "context.h"
37
37
#include "enums.h"
 
38
#include "fbobject.h"
38
39
#include "mtypes.h"
39
40
 
40
41
 
51
52
 * \return  bitmask of BUFFER_BIT_* flags
52
53
 */
53
54
static GLbitfield
54
 
supported_buffer_bitmask(const struct gl_context *ctx, const struct gl_framebuffer *fb)
 
55
supported_buffer_bitmask(const struct gl_context *ctx,
 
56
                         const struct gl_framebuffer *fb)
55
57
{
56
58
   GLbitfield mask = 0x0;
57
59
 
58
 
   if (fb->Name > 0) {
 
60
   if (_mesa_is_user_fbo(fb)) {
59
61
      /* A user-created renderbuffer */
60
62
      GLuint i;
61
63
      ASSERT(ctx->Extensions.EXT_framebuffer_object);
242
244
      destMask = draw_buffer_enum_to_bitmask(buffer);
243
245
      if (destMask == BAD_MASK) {
244
246
         /* totally bogus buffer */
245
 
         _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer=0x%x)", buffer);
 
247
         _mesa_error(ctx, GL_INVALID_ENUM,
 
248
                     "glDrawBuffer(buffer=0x%x)", buffer);
246
249
         return;
247
250
      }
248
251
      destMask &= supportedMask;
340
343
      ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
341
344
}
342
345
 
 
346
 
343
347
/**
344
348
 * Performs necessary state updates when _mesa_drawbuffers makes an
345
349
 * actual change.
354
358
      struct gl_framebuffer *fb = ctx->DrawBuffer;
355
359
 
356
360
      /* Flag the FBO as requiring validation. */
357
 
      if (fb->Name != 0) {
 
361
      if (_mesa_is_user_fbo(fb)) {
358
362
         fb->_Status = 0;
359
363
      }
360
364
   }
361
365
#endif
362
366
}
363
367
 
 
368
 
364
369
/**
365
370
 * Helper function to set the GL_DRAW_BUFFER state in the context and
366
371
 * current FBO.  Called via glDrawBuffer(), glDrawBuffersARB()
402
407
   if (n == 1) {
403
408
      GLuint count = 0, destMask0 = destMask[0];
404
409
      while (destMask0) {
405
 
         GLint bufIndex = _mesa_ffs(destMask0) - 1;
 
410
         GLint bufIndex = ffs(destMask0) - 1;
406
411
         if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
407
412
            updated_drawbuffers(ctx);
408
413
            fb->_ColorDrawBufferIndexes[count] = bufIndex;
417
422
      GLuint count = 0;
418
423
      for (buf = 0; buf < n; buf++ ) {
419
424
         if (destMask[buf]) {
420
 
            GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;
 
425
            GLint bufIndex = ffs(destMask[buf]) - 1;
421
426
            /* only one bit should be set in the destMask[buf] field */
422
427
            ASSERT(_mesa_bitcount(destMask[buf]) == 1);
423
428
            if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
448
453
      fb->ColorDrawBuffer[buf] = GL_NONE;
449
454
   }
450
455
 
451
 
   if (fb->Name == 0) {
 
456
   if (_mesa_is_winsys_fbo(fb)) {
452
457
      /* also set context drawbuffer state */
453
458
      for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
454
459
         if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
472
477
   GLuint i;
473
478
 
474
479
   /* should be a window system FBO */
475
 
   assert(ctx->DrawBuffer->Name == 0);
 
480
   assert(_mesa_is_winsys_fbo(ctx->DrawBuffer));
476
481
 
477
482
   for (i = 0; i < ctx->Const.MaxDrawBuffers; i++)
478
483
      buffers[i] = ctx->Color.DrawBuffer[i];
493
498
{
494
499
   struct gl_framebuffer *fb = ctx->ReadBuffer;
495
500
 
496
 
   if (fb->Name == 0) {
 
501
   if (_mesa_is_winsys_fbo(fb)) {
497
502
      /* Only update the per-context READ_BUFFER state if we're bound to
498
503
       * a window-system framebuffer.
499
504
       */
529
534
   if (MESA_VERBOSE & VERBOSE_API)
530
535
      _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
531
536
 
532
 
   if (fb->Name > 0 && buffer == GL_NONE) {
 
537
   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
533
538
      /* This is legal for user-created framebuffer objects */
534
539
      srcBuffer = -1;
535
540
   }