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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
735
735
   ss->DefaultCubeMap->RefCount += MAX_TEXTURE_IMAGE_UNITS;
736
736
   ss->DefaultRect->RefCount += MAX_TEXTURE_IMAGE_UNITS;
737
737
 
 
738
   _glthread_INIT_MUTEX(ss->TexMutex);
 
739
   ss->TextureStateStamp = 0;
 
740
 
 
741
 
738
742
#if FEATURE_EXT_framebuffer_object
739
743
   ss->FrameBuffers = _mesa_NewHashTable();
740
744
   if (!ss->FrameBuffers)
872
876
   _mesa_delete_array_object(ctx, arrayObj);
873
877
}
874
878
 
 
879
/**
 
880
 * Callback for deleting an shader object.  Called by _mesa_HashDeleteAll().
 
881
 */
 
882
static void
 
883
delete_shaderobj_cb(GLuint id, void *data, void *userData)
 
884
{
 
885
   /* XXX probably need to fix this */
 
886
   _mesa_free(data);
 
887
}
 
888
 
875
889
 
876
890
/**
877
891
 * Deallocate a shared state object and all children structures.
934
948
   _mesa_DeleteHashTable(ss->ArrayObjects);
935
949
 
936
950
#if FEATURE_ARB_shader_objects
 
951
   _mesa_HashDeleteAll(ss->GL2Objects, delete_shaderobj_cb, ctx);
937
952
   _mesa_DeleteHashTable(ss->GL2Objects);
938
953
#endif
939
954
 
1048
1063
   ctx->Const.VertexProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
1049
1064
   ctx->Const.VertexProgram.MaxEnvParams = MAX_NV_VERTEX_PROGRAM_PARAMS;
1050
1065
   ctx->Const.VertexProgram.MaxAddressRegs = MAX_VERTEX_PROGRAM_ADDRESS_REGS;
 
1066
   ctx->Const.VertexProgram.MaxUniformComponents = MAX_VERTEX_UNIFORM_COMPONENTS;
1051
1067
   init_natives(&ctx->Const.VertexProgram);
1052
1068
#endif
1053
1069
#if FEATURE_ARB_fragment_program
1061
1077
   ctx->Const.FragmentProgram.MaxLocalParams = MAX_PROGRAM_LOCAL_PARAMS;
1062
1078
   ctx->Const.FragmentProgram.MaxEnvParams = MAX_NV_FRAGMENT_PROGRAM_PARAMS;
1063
1079
   ctx->Const.FragmentProgram.MaxAddressRegs = MAX_FRAGMENT_PROGRAM_ADDRESS_REGS;
 
1080
   ctx->Const.FragmentProgram.MaxUniformComponents = MAX_FRAGMENT_UNIFORM_COMPONENTS;
1064
1081
   init_natives(&ctx->Const.FragmentProgram);
1065
1082
#endif
1066
1083
   ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
1069
1086
   /* If we're running in the X server, do bounds checking to prevent
1070
1087
    * segfaults and server crashes!
1071
1088
    */
1072
 
#if defined(XFree86LOADER) && defined(IN_MODULE)
 
1089
#if defined(XFree86Server)
1073
1090
   ctx->Const.CheckArrayBounds = GL_TRUE;
1074
1091
#else
1075
1092
   ctx->Const.CheckArrayBounds = GL_FALSE;
1087
1104
   ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
1088
1105
#endif
1089
1106
 
 
1107
#if FEATURE_ARB_vertex_shader
 
1108
   ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
 
1109
   ctx->Const.MaxVaryingFloats = MAX_VARYING_FLOATS;
 
1110
#endif
 
1111
 
1090
1112
   /* sanity checks */
1091
1113
   ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits,
1092
1114
                                             ctx->Const.MaxTextureCoordUnits));
1629
1651
initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb)
1630
1652
{
1631
1653
   GLuint width, height;
1632
 
   ASSERT(ctx->Driver.GetBufferSize);
1633
 
   ctx->Driver.GetBufferSize(fb, &width, &height);
1634
 
   if (ctx->Driver.ResizeBuffers)
1635
 
      ctx->Driver.ResizeBuffers(ctx, fb, width, height);
1636
 
   fb->Initialized = GL_TRUE;
 
1654
   if (ctx->Driver.GetBufferSize) {
 
1655
      ctx->Driver.GetBufferSize(fb, &width, &height);
 
1656
      if (ctx->Driver.ResizeBuffers)
 
1657
         ctx->Driver.ResizeBuffers(ctx, fb, width, height);
 
1658
      fb->Initialized = GL_TRUE;
 
1659
   }
1637
1660
}
1638
1661
 
1639
1662
 
1706
1729
 
1707
1730
         newCtx->NewState |= _NEW_BUFFERS;
1708
1731
 
 
1732
#if 1
 
1733
         /* We want to get rid of these lines: */
 
1734
 
1709
1735
#if _HAVE_FULL_GL
1710
1736
         if (!drawBuffer->Initialized) {
1711
1737
            initialize_framebuffer_size(newCtx, drawBuffer);
1713
1739
         if (readBuffer != drawBuffer && !readBuffer->Initialized) {
1714
1740
            initialize_framebuffer_size(newCtx, readBuffer);
1715
1741
         }
1716
 
#endif
 
1742
 
 
1743
         _mesa_resizebuffers(newCtx);
 
1744
#endif
 
1745
 
 
1746
#else
 
1747
         /* We want the drawBuffer and readBuffer to be initialized by
 
1748
          * the driver.
 
1749
          * This generally means the Width and Height match the actual
 
1750
          * window size and the renderbuffers (both hardware and software
 
1751
          * based) are allocated to match.  The later can generally be
 
1752
          * done with a call to _mesa_resize_framebuffer().
 
1753
          *
 
1754
          * It's theoretically possible for a buffer to have zero width
 
1755
          * or height, but for now, assert check that the driver did what's
 
1756
          * expected of it.
 
1757
          */
 
1758
         ASSERT(drawBuffer->Width > 0);
 
1759
         ASSERT(drawBuffer->Height > 0);
 
1760
#endif
 
1761
 
1717
1762
         if (newCtx->FirstTimeCurrent) {
1718
1763
            /* set initial viewport and scissor size now */
1719
1764
            _mesa_set_viewport(newCtx, 0, 0,