Ignore:
Timestamp:
Mar 11, 2000, 10:05:07 AM (25 years ago)
Author:
jeroen
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/api1.c

    r2938 r3079  
    1 /* $Id: api1.c,v 1.1 2000-02-29 00:49:57 sandervl Exp $ */
     1/* $Id: api1.c,v 1.2 2000-03-11 09:05:06 jeroen Exp $ */
    22
    33/*
     
    5454#endif
    5555
     56#include <misc.h>
     57
    5658/*
    5759 * Part 1 of API functions
     
    8587 * function pointer.
    8688 */
    87 #define ARRAY_ELT( IM, i )                                      \
    88 {                                                               \
    89    GLuint count = IM->Count;                                    \
    90    IM->Elt[count] = i;                                          \
    91    IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) |   \
    92                       VERT_ELT);                                \
    93    IM->FlushElt |= IM->ArrayEltFlush;                           \
    94    IM->Count = count += IM->ArrayIncr;                          \
    95    if (count == VB_MAX)                                         \
    96       IM->maybe_transform_vb( IM );                             \
     89#define ARRAY_ELT( IM, i )                                      \
     90{                                                               \
     91   GLuint count = IM->Count;                                    \
     92   IM->Elt[count] = i;                                          \
     93   IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) |   \
     94                      VERT_ELT);                                \
     95   IM->FlushElt |= IM->ArrayEltFlush;                           \
     96   IM->Count = count += IM->ArrayIncr;                          \
     97   if (count == VB_MAX)                                         \
     98      IM->maybe_transform_vb( IM );                             \
    9799}
    98100
     
    125127   if (mode < GL_POINTS || mode > GL_POLYGON) {
    126128      gl_compile_error( CC, GL_INVALID_ENUM, "glBegin" );
    127       return;           
     129      return;
    128130   }
    129131
     
    251253 * color-material and vertex arrays.
    252254 */
    253 #define COLOR( IM, r,g,b,a )                    \
    254 {                                               \
    255    GLuint count = IM->Count;                    \
    256    IM->Flag[count] |= VERT_RGBA;                \
    257    IM->Color[count][0] = r;                     \
    258    IM->Color[count][1] = g;                     \
    259    IM->Color[count][2] = b;                     \
    260    IM->Color[count][3] = a;                     \
     255#define COLOR( IM, r,g,b,a )                    \
     256{                                               \
     257   GLuint count = IM->Count;                    \
     258   IM->Flag[count] |= VERT_RGBA;                \
     259   IM->Color[count][0] = r;                     \
     260   IM->Color[count][1] = g;                     \
     261   IM->Color[count][2] = b;                     \
     262   IM->Color[count][3] = a;                     \
    261263}
    262264
    263265#if 0
    264 #define COLOR4F( IM, r,g,b,a )                          \
    265 {                                                       \
    266    GLuint count = IM->Count;                            \
    267    IM->Flag[count] |= VERT_RGBA | VERT_FLOAT_RGBA;      \
    268    IM->FloatColor[count][0] = r;                        \
    269    IM->FloatColor[count][1] = g;                        \
    270    IM->FloatColor[count][2] = b;                        \
    271    IM->FloatColor[count][3] = a;                        \
     266#define COLOR4F( IM, r,g,b,a )                          \
     267{                                                       \
     268   GLuint count = IM->Count;                            \
     269   IM->Flag[count] |= VERT_RGBA | VERT_FLOAT_RGBA;      \
     270   IM->FloatColor[count][0] = r;                        \
     271   IM->FloatColor[count][1] = g;                        \
     272   IM->FloatColor[count][2] = b;                        \
     273   IM->FloatColor[count][3] = a;                        \
    272274}
    273275#else
    274 #define COLOR4F(IM, r, g, b, a)                 \
    275 {                                               \
    276    GLubyte col[4];                              \
    277    FLOAT_COLOR_TO_UBYTE_COLOR(col[0], r);       \
    278    FLOAT_COLOR_TO_UBYTE_COLOR(col[1], g);       \
    279    FLOAT_COLOR_TO_UBYTE_COLOR(col[2], b);       \
    280    FLOAT_COLOR_TO_UBYTE_COLOR(col[3], a);       \
    281    COLORV( IM, col );                           \
     276#define COLOR4F(IM, r, g, b, a)                 \
     277{                                               \
     278   GLubyte col[4];                              \
     279   FLOAT_COLOR_TO_UBYTE_COLOR(col[0], r);       \
     280   FLOAT_COLOR_TO_UBYTE_COLOR(col[1], g);       \
     281   FLOAT_COLOR_TO_UBYTE_COLOR(col[2], b);       \
     282   FLOAT_COLOR_TO_UBYTE_COLOR(col[3], a);       \
     283   COLORV( IM, col );                           \
    282284}
    283285#endif
     
    285287
    286288
    287 #define COLORV( IM, v )                         \
    288 {                                               \
    289    GLuint count = IM->Count;                    \
    290    IM->Flag[count] |= VERT_RGBA;                \
    291    COPY_4UBV(IM->Color[count], v);              \
     289#define COLORV( IM, v )                         \
     290{                                               \
     291   GLuint count = IM->Count;                    \
     292   IM->Flag[count] |= VERT_RGBA;                \
     293   COPY_4UBV(IM->Color[count], v);              \
    292294}
    293295
     
    297299   GET_IMMEDIATE;
    298300   COLOR( IM,
    299           BYTE_TO_UBYTE(red),
    300           BYTE_TO_UBYTE(green),
    301           BYTE_TO_UBYTE(blue),
    302           255 );
     301          BYTE_TO_UBYTE(red),
     302          BYTE_TO_UBYTE(green),
     303          BYTE_TO_UBYTE(blue),
     304          255 );
    303305}
    304306
     
    339341   GET_IMMEDIATE;
    340342   COLOR( IM, INT_TO_UBYTE(red),
    341           INT_TO_UBYTE(green),
    342           INT_TO_UBYTE(blue),
    343           255);
     343          INT_TO_UBYTE(green),
     344          INT_TO_UBYTE(blue),
     345          255);
    344346}
    345347
     
    349351   GET_IMMEDIATE;
    350352   COLOR( IM, SHORT_TO_UBYTE(red),
    351           SHORT_TO_UBYTE(green),
    352           SHORT_TO_UBYTE(blue),
    353           255);
     353          SHORT_TO_UBYTE(green),
     354          SHORT_TO_UBYTE(blue),
     355          255);
    354356}
    355357
     
    366368   GET_IMMEDIATE;
    367369   COLOR( IM, UINT_TO_UBYTE(red),
    368           UINT_TO_UBYTE(green),
    369           UINT_TO_UBYTE(blue),
    370           255 );
     370          UINT_TO_UBYTE(green),
     371          UINT_TO_UBYTE(blue),
     372          255 );
    371373}
    372374
     
    376378   GET_IMMEDIATE;
    377379   COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green),
    378           USHORT_TO_UBYTE(blue),
    379           255 );
     380          USHORT_TO_UBYTE(blue),
     381          255 );
    380382}
    381383
     
    385387   GET_IMMEDIATE;
    386388   COLOR( IM, BYTE_TO_UBYTE(red), BYTE_TO_UBYTE(green),
    387           BYTE_TO_UBYTE(blue), BYTE_TO_UBYTE(alpha) );
     389          BYTE_TO_UBYTE(blue), BYTE_TO_UBYTE(alpha) );
    388390}
    389391
    390392
    391393void GLAPIENTRY glColor4d(CTX_ARG GLdouble red, GLdouble green, GLdouble blue,
    392                            GLdouble alpha )
     394                           GLdouble alpha )
    393395{
    394396   GLubyte col[4];
     
    426428   GET_IMMEDIATE;
    427429   COLOR( IM, INT_TO_UBYTE(red), INT_TO_UBYTE(green),
    428           INT_TO_UBYTE(blue), INT_TO_UBYTE(alpha) );
     430          INT_TO_UBYTE(blue), INT_TO_UBYTE(alpha) );
    429431}
    430432
     
    435437   GET_IMMEDIATE;
    436438   COLOR( IM, SHORT_TO_UBYTE(red), SHORT_TO_UBYTE(green),
    437           SHORT_TO_UBYTE(blue), SHORT_TO_UBYTE(alpha) );
     439          SHORT_TO_UBYTE(blue), SHORT_TO_UBYTE(alpha) );
    438440}
    439441
     
    450452   GET_IMMEDIATE;
    451453   COLOR( IM, UINT_TO_UBYTE(red), UINT_TO_UBYTE(green),
    452           UINT_TO_UBYTE(blue), UINT_TO_UBYTE(alpha) );
     454          UINT_TO_UBYTE(blue), UINT_TO_UBYTE(alpha) );
    453455}
    454456
     
    458460   GET_IMMEDIATE;
    459461   COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green),
    460           USHORT_TO_UBYTE(blue), USHORT_TO_UBYTE(alpha) );
     462          USHORT_TO_UBYTE(blue), USHORT_TO_UBYTE(alpha) );
    461463}
    462464
     
    466468   GET_IMMEDIATE;
    467469   COLOR( IM, BYTE_TO_UBYTE(v[0]), BYTE_TO_UBYTE(v[1]),
    468           BYTE_TO_UBYTE(v[2]), 255 );
     470          BYTE_TO_UBYTE(v[2]), 255 );
    469471}
    470472
     
    505507   GET_IMMEDIATE;
    506508   COLOR( IM, INT_TO_UBYTE(v[0]), INT_TO_UBYTE(v[1]),
    507           INT_TO_UBYTE(v[2]), 255 );
     509          INT_TO_UBYTE(v[2]), 255 );
    508510}
    509511
     
    513515   GET_IMMEDIATE;
    514516   COLOR( IM, SHORT_TO_UBYTE(v[0]), SHORT_TO_UBYTE(v[1]),
    515           SHORT_TO_UBYTE(v[2]), 255 );
     517          SHORT_TO_UBYTE(v[2]), 255 );
    516518}
    517519
     
    528530   GET_IMMEDIATE;
    529531   COLOR( IM, UINT_TO_UBYTE(v[0]), UINT_TO_UBYTE(v[1]),
    530           UINT_TO_UBYTE(v[2]), 255 );
     532          UINT_TO_UBYTE(v[2]), 255 );
    531533}
    532534
     
    536538   GET_IMMEDIATE;
    537539   COLOR( IM, USHORT_TO_UBYTE(v[0]), USHORT_TO_UBYTE(v[1]),
    538           USHORT_TO_UBYTE(v[2]), 255 );
     540          USHORT_TO_UBYTE(v[2]), 255 );
    539541
    540542}
     
    545547   GET_IMMEDIATE;
    546548   COLOR( IM, BYTE_TO_UBYTE(v[0]), BYTE_TO_UBYTE(v[1]),
    547           BYTE_TO_UBYTE(v[2]), BYTE_TO_UBYTE(v[3]) );
     549          BYTE_TO_UBYTE(v[2]), BYTE_TO_UBYTE(v[3]) );
    548550}
    549551
     
    585587   GET_IMMEDIATE;
    586588   COLOR( IM, INT_TO_UBYTE(v[0]), INT_TO_UBYTE(v[1]),
    587           INT_TO_UBYTE(v[2]), INT_TO_UBYTE(v[3]) );
     589          INT_TO_UBYTE(v[2]), INT_TO_UBYTE(v[3]) );
    588590}
    589591
     
    593595   GET_IMMEDIATE;
    594596   COLOR( IM, SHORT_TO_UBYTE(v[0]), SHORT_TO_UBYTE(v[1]),
    595           SHORT_TO_UBYTE(v[2]), SHORT_TO_UBYTE(v[3]) );
     597          SHORT_TO_UBYTE(v[2]), SHORT_TO_UBYTE(v[3]) );
    596598}
    597599
     
    608610   GET_IMMEDIATE;
    609611   COLOR( IM, UINT_TO_UBYTE(v[0]), UINT_TO_UBYTE(v[1]),
    610           UINT_TO_UBYTE(v[2]), UINT_TO_UBYTE(v[3]) );
     612          UINT_TO_UBYTE(v[2]), UINT_TO_UBYTE(v[3]) );
    611613}
    612614
     
    616618   GET_IMMEDIATE;
    617619   COLOR( IM, USHORT_TO_UBYTE(v[0]), USHORT_TO_UBYTE(v[1]),
    618           USHORT_TO_UBYTE(v[2]), USHORT_TO_UBYTE(v[3]) );
     620          USHORT_TO_UBYTE(v[2]), USHORT_TO_UBYTE(v[3]) );
    619621}
    620622
     
    833835   state = IM->BeginState;
    834836   inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1);
    835    state |= inflags << 2;       /* errors */
     837   state |= inflags << 2;       /* errors */
    836838
    837839   if (MESA_VERBOSE&VERBOSE_API) {
    838840      if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
    839         fprintf(stderr, "glEnd(IM %d), BeginState is %x, errors %x\n",
    840                 IM->id, state,
    841                 inflags<<2);
     841        fprintf(stderr, "glEnd(IM %d), BeginState is %x, errors %x\n",
     842                IM->id, state,
     843                inflags<<2);
    842844      else
    843         fprintf(stderr, ">");
     845        fprintf(stderr, ">");
    844846   }
    845847
     
    857859
    858860      if (IM->FlushElt) {
    859         gl_exec_array_elements( IM->backref, IM, last, count );
    860         IM->FlushElt = 0;
     861        gl_exec_array_elements( IM->backref, IM, last, count );
     862        IM->FlushElt = 0;
    861863      }
    862864   }
     
    881883   if (MESA_VERBOSE&VERBOSE_API) {
    882884      if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
    883         fprintf(stderr, "gl_End(IM %d), BeginState is %x, errors %x\n",
    884                 IM->id, state,
    885                 inflags<<2);
     885        fprintf(stderr, "gl_End(IM %d), BeginState is %x, errors %x\n",
     886                IM->id, state,
     887                inflags<<2);
    886888      else
    887         fprintf(stderr, ">");
     889        fprintf(stderr, ">");
    888890   }
    889891
    890    state |= inflags << 2;       /* errors */
     892   state |= inflags << 2;       /* errors */
    891893
    892894   if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1))
     
    902904
    903905      if (IM->FlushElt) {
    904         gl_exec_array_elements( ctx, IM, last, count );
    905         IM->FlushElt = 0;
     906        gl_exec_array_elements( ctx, IM, last, count );
     907        IM->FlushElt = 0;
    906908      }
    907909   }
     
    950952
    951953
    952 #define EVALCOORD1(IM, x)                               \
    953 {                                                       \
    954    GLuint count = IM->Count++;                          \
    955    IM->Flag[count] |= VERT_EVAL_C1;                     \
    956    ASSIGN_4V(IM->Obj[count], x, 0, 0, 1);               \
    957    if (count == VB_MAX-1)                               \
    958       IM->maybe_transform_vb( IM );                     \
    959 }
    960 
    961 #define EVALCOORD2(IM, x, y)                            \
    962 {                                                       \
    963    GLuint count = IM->Count++;                          \
    964    IM->Flag[count] |= VERT_EVAL_C2;                     \
    965    ASSIGN_4V(IM->Obj[count], x, y, 0, 1);               \
    966    if (count == VB_MAX-1)                               \
    967       IM->maybe_transform_vb( IM );                     \
    968 }
    969 
    970 #define EVALPOINT1(IM, x)                               \
    971 {                                                       \
    972    GLuint count = IM->Count++;                          \
    973    IM->Flag[count] |= VERT_EVAL_P1;                     \
    974    ASSIGN_4V(IM->Obj[count], x, 0, 0, 1);               \
    975    if (count == VB_MAX-1)                               \
    976       IM->maybe_transform_vb( IM );                     \
    977 }
    978 
    979 #define EVALPOINT2(IM, x, y)                            \
    980 {                                                       \
    981    GLuint count = IM->Count++;                          \
    982    IM->Flag[count] |= VERT_EVAL_P2;                     \
    983    ASSIGN_4V(IM->Obj[count], x, y, 0, 1);               \
    984    if (count == VB_MAX-1)                               \
    985       IM->maybe_transform_vb( IM );                     \
     954#define EVALCOORD1(IM, x)                               \
     955{                                                       \
     956   GLuint count = IM->Count++;                          \
     957   IM->Flag[count] |= VERT_EVAL_C1;                     \
     958   ASSIGN_4V(IM->Obj[count], x, 0, 0, 1);               \
     959   if (count == VB_MAX-1)                               \
     960      IM->maybe_transform_vb( IM );                     \
     961}
     962
     963#define EVALCOORD2(IM, x, y)                            \
     964{                                                       \
     965   GLuint count = IM->Count++;                          \
     966   IM->Flag[count] |= VERT_EVAL_C2;                     \
     967   ASSIGN_4V(IM->Obj[count], x, y, 0, 1);               \
     968   WriteLog("OPENGL32: EVALCOORD2 (%f,%f) IM: %08X - cnt %d\n",x,y,IM,count); \
     969   if (count == VB_MAX-1)                               \
     970   {WriteLog("OPENGL32: EVALCOORD2 is calling maybe_transform\n"); \
     971      IM->maybe_transform_vb( IM );                     }\
     972}
     973
     974#define EVALPOINT1(IM, x)                               \
     975{                                                       \
     976   GLuint count = IM->Count++;                          \
     977   IM->Flag[count] |= VERT_EVAL_P1;                     \
     978   ASSIGN_4V(IM->Obj[count], x, 0, 0, 1);               \
     979   if (count == VB_MAX-1)                               \
     980      IM->maybe_transform_vb( IM );                     \
     981}
     982
     983#define EVALPOINT2(IM, x, y)                            \
     984{                                                       \
     985   GLuint count = IM->Count++;                          \
     986   IM->Flag[count] |= VERT_EVAL_P2;                     \
     987   ASSIGN_4V(IM->Obj[count], x, y, 0, 1);               \
     988   if (count == VB_MAX-1)                               \
     989      IM->maybe_transform_vb( IM );                     \
    986990}
    987991
     
    11731177      case GL_FOG_END:
    11741178      case GL_FOG_INDEX:
    1175         p[0] = (GLfloat) *params;
    1176         break;
     1179        p[0] = (GLfloat) *params;
     1180        break;
    11771181      case GL_FOG_COLOR:
    1178         p[0] = INT_TO_FLOAT( params[0] );
    1179         p[1] = INT_TO_FLOAT( params[1] );
    1180         p[2] = INT_TO_FLOAT( params[2] );
    1181         p[3] = INT_TO_FLOAT( params[3] );
    1182         break;
     1182        p[0] = INT_TO_FLOAT( params[0] );
     1183        p[1] = INT_TO_FLOAT( params[1] );
     1184        p[2] = INT_TO_FLOAT( params[2] );
     1185        p[3] = INT_TO_FLOAT( params[3] );
     1186        break;
    11831187      default:
    11841188         /* Error will be caught later in gl_Fogfv */
     
    14771481
    14781482
    1479 #define INDEX( c )                              \
    1480 {                                               \
    1481    GLuint count;                                \
    1482    GET_IMMEDIATE;                               \
    1483    count = IM->Count;                           \
    1484    IM->Index[count] = c;                        \
    1485    IM->Flag[count] |= VERT_INDEX;               \
     1483#define INDEX( c )                              \
     1484{                                               \
     1485   GLuint count;                                \
     1486   GET_IMMEDIATE;                               \
     1487   count = IM->Count;                           \
     1488   IM->Index[count] = c;                        \
     1489   IM->Flag[count] |= VERT_INDEX;               \
    14861490}
    14871491
     
    17401744
    17411745   for (i=0;i<16;i++) {
    1742           fm[i] = (GLfloat) m[i];
     1746          fm[i] = (GLfloat) m[i];
    17431747   }
    17441748
     
    19461950
    19471951   for (i=0;i<16;i++) {
    1948           fm[i] = (GLfloat) m[i];
     1952          fm[i] = (GLfloat) m[i];
    19491953   }
    19501954
     
    19741978 *     (ie shared) normals.
    19751979 */
    1976 #define NORMAL( x,y,z )                         \
    1977 {                                               \
    1978    GLuint count;                                \
    1979    GLfloat *normal;                             \
    1980    GET_IMMEDIATE;                               \
    1981    count = IM->Count;                           \
    1982    IM->Flag[count] |= VERT_NORM;                \
    1983    normal = IM->Normal[count];                  \
    1984    ASSIGN_3V(normal, x,y,z);                    \
     1980#define NORMAL( x,y,z )                         \
     1981{                                               \
     1982   GLuint count;                                \
     1983   GLfloat *normal;                             \
     1984   GET_IMMEDIATE;                               \
     1985   count = IM->Count;                           \
     1986   IM->Flag[count] |= VERT_NORM;                \
     1987   normal = IM->Normal[count];                  \
     1988   ASSIGN_3V(normal, x,y,z);                    \
    19851989}
    19861990
     
    19891993{
    19901994   NORMAL( BYTE_TO_FLOAT(nx),
    1991            BYTE_TO_FLOAT(ny),
    1992            BYTE_TO_FLOAT(nz) );
     1995           BYTE_TO_FLOAT(ny),
     1996           BYTE_TO_FLOAT(nz) );
    19931997}
    19941998
     
    20092013{
    20102014   NORMAL( INT_TO_FLOAT(nx),
    2011            INT_TO_FLOAT(ny),
    2012            INT_TO_FLOAT(nz) );
     2015           INT_TO_FLOAT(ny),
     2016           INT_TO_FLOAT(nz) );
    20132017}
    20142018
     
    20172021{
    20182022   NORMAL( SHORT_TO_FLOAT(nx),
    2019            SHORT_TO_FLOAT(ny),
    2020            SHORT_TO_FLOAT(nz) );
     2023           SHORT_TO_FLOAT(ny),
     2024           SHORT_TO_FLOAT(nz) );
    20212025}
    20222026
     
    20252029{
    20262030   NORMAL( BYTE_TO_FLOAT(v[0]),
    2027            BYTE_TO_FLOAT(v[1]),
    2028            BYTE_TO_FLOAT(v[2]) );
     2031           BYTE_TO_FLOAT(v[1]),
     2032           BYTE_TO_FLOAT(v[2]) );
    20292033}
    20302034
     
    20452049{
    20462050   NORMAL( INT_TO_FLOAT(v[0]),
    2047            INT_TO_FLOAT(v[1]),
    2048            INT_TO_FLOAT(v[2]) );
     2051           INT_TO_FLOAT(v[1]),
     2052           INT_TO_FLOAT(v[2]) );
    20492053}
    20502054
     
    20532057{
    20542058   NORMAL( SHORT_TO_FLOAT(v[0]),
    2055            SHORT_TO_FLOAT(v[1]),
    2056            SHORT_TO_FLOAT(v[2]) );
    2057 }
    2058 
     2059           SHORT_TO_FLOAT(v[1]),
     2060           SHORT_TO_FLOAT(v[2]) );
     2061}
     2062
Note: See TracChangeset for help on using the changeset viewer.