st_draw.c File Reference

Include dependency graph for st_draw.c:

Go to the source code of this file.

Functions

GLuint st_pipe_vertex_format (GLenum type, GLuint size, GLboolean normalized)
 Return a PIPE_FORMAT_x for the given GL datatype and size.
static void * setup_edgeflags (GLcontext *ctx, GLenum primMode, GLint start, GLint count, const struct gl_client_array *array)
static GLboolean is_interleaved_arrays (const struct st_vertex_program *vp, const struct gl_client_array **arrays, GLboolean *userSpace)
 Examine the active arrays to determine if we have interleaved vertex arrays all living in one VBO, or all living in user space.
static void get_user_arrays_bounds (const struct st_vertex_program *vp, const struct gl_client_array **arrays, GLuint max_index, const GLubyte **low, const GLubyte **high)
 Once we know all the arrays are in user space, this function computes the memory range occupied by the arrays.
static void setup_interleaved_attribs (GLcontext *ctx, const struct st_vertex_program *vp, const struct gl_client_array **arrays, GLuint max_index, GLboolean userSpace, struct pipe_vertex_buffer *vbuffer, struct pipe_vertex_element velements[])
 Set up for drawing interleaved arrays that all live in one VBO or all live in user space.
static void setup_non_interleaved_attribs (GLcontext *ctx, const struct st_vertex_program *vp, const struct gl_client_array **arrays, GLuint max_index, GLboolean *userSpace, struct pipe_vertex_buffer vbuffer[], struct pipe_vertex_element velements[])
 Set up a separate pipe_vertex_buffer and pipe_vertex_element for each vertex attribute.
static void check_uniforms (GLcontext *ctx)
 Prior to drawing, check that any uniforms referenced by the current shader have been set.
void st_draw_vbo (GLcontext *ctx, const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLuint min_index, GLuint max_index)
 This function gets plugged into the VBO module and is called when we have something to render.
void st_init_draw (struct st_context *st)
void st_destroy_draw (struct st_context *st)

Variables

static GLuint double_types [4]
static GLuint float_types [4]
static GLuint uint_types_norm [4]
static GLuint uint_types_scale [4]
static GLuint int_types_norm [4]
static GLuint int_types_scale [4]
static GLuint ushort_types_norm [4]
static GLuint ushort_types_scale [4]
static GLuint short_types_norm [4]
static GLuint short_types_scale [4]
static GLuint ubyte_types_norm [4]
static GLuint ubyte_types_scale [4]
static GLuint byte_types_norm [4]
static GLuint byte_types_scale [4]
static GLuint fixed_types [4]


Function Documentation

static void check_uniforms ( GLcontext *  ctx  )  [static]

Prior to drawing, check that any uniforms referenced by the current shader have been set.

If a uniform has not been set, issue a warning.

Definition at line 495 of file st_draw.c.

00496 {
00497    const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
00498    if (shProg && shProg->LinkStatus) {
00499       GLuint i;
00500       for (i = 0; i < shProg->Uniforms->NumUniforms; i++) {
00501          const struct gl_uniform *u = &shProg->Uniforms->Uniforms[i];
00502          if (!u->Initialized) {
00503             _mesa_warning(ctx,
00504                           "Using shader with uninitialized uniform: %s",
00505                           u->Name);
00506          }
00507       }
00508    }
00509 }

static void get_user_arrays_bounds ( const struct st_vertex_program vp,
const struct gl_client_array **  arrays,
GLuint  max_index,
const GLubyte **  low,
const GLubyte **  high 
) [static]

Once we know all the arrays are in user space, this function computes the memory range occupied by the arrays.

Definition at line 315 of file st_draw.c.

References st_vertex_program::index_to_input, MIN2, st_vertex_program::num_inputs, and stride().

00319 {
00320    const GLubyte *low_addr = NULL;
00321    GLuint attr;
00322    GLint stride;
00323 
00324    for (attr = 0; attr < vp->num_inputs; attr++) {
00325       const GLuint mesaAttr = vp->index_to_input[attr];
00326       const GLubyte *start = arrays[mesaAttr]->Ptr;
00327       stride = arrays[mesaAttr]->StrideB;
00328       if (attr == 0) {
00329          low_addr = start;
00330       }
00331       else {
00332          low_addr = MIN2(low_addr, start);
00333       }
00334    }
00335 
00336    *low = low_addr;
00337    *high = low_addr + (max_index + 1) * stride;
00338 }

static GLboolean is_interleaved_arrays ( const struct st_vertex_program vp,
const struct gl_client_array **  arrays,
GLboolean *  userSpace 
) [static]

Examine the active arrays to determine if we have interleaved vertex arrays all living in one VBO, or all living in user space.

Parameters:
userSpace returns whether the arrays are in user space.

Definition at line 260 of file st_draw.c.

References abs(), st_vertex_program::index_to_input, st_vertex_program::num_inputs, and stride().

00263 {
00264    GLuint attr;
00265    const struct gl_buffer_object *firstBufObj = NULL;
00266    GLint firstStride = -1;
00267    GLuint num_client_arrays = 0;
00268    const GLubyte *client_addr = NULL;
00269 
00270    for (attr = 0; attr < vp->num_inputs; attr++) {
00271       const GLuint mesaAttr = vp->index_to_input[attr];
00272       const struct gl_buffer_object *bufObj = arrays[mesaAttr]->BufferObj;
00273       const GLsizei stride = arrays[mesaAttr]->StrideB; /* in bytes */
00274 
00275       if (firstStride < 0) {
00276          firstStride = stride;
00277       }
00278       else if (firstStride != stride) {
00279          return GL_FALSE;
00280       }
00281          
00282       if (!bufObj || !bufObj->Name) {
00283          num_client_arrays++;
00284          /* Try to detect if the client-space arrays are
00285           * "close" to each other.
00286           */
00287          if (!client_addr) {
00288             client_addr = arrays[mesaAttr]->Ptr;
00289          }
00290          else if (abs(arrays[mesaAttr]->Ptr - client_addr) > firstStride) {
00291             /* arrays start too far apart */
00292             return GL_FALSE;
00293          }
00294       }
00295       else if (!firstBufObj) {
00296          firstBufObj = bufObj;
00297       }
00298       else if (bufObj != firstBufObj) {
00299          return GL_FALSE;
00300       }
00301    }
00302 
00303    *userSpace = (num_client_arrays == vp->num_inputs);
00304    /*printf("user space: %d\n", (int) *userSpace);*/
00305 
00306    return GL_TRUE;
00307 }

static void* setup_edgeflags ( GLcontext *  ctx,
GLenum  primMode,
GLint  start,
GLint  count,
const struct gl_client_array *  array 
) [static]

Definition at line 207 of file st_draw.c.

References st_buffer_object::buffer, pipe_buffer_map(), pipe_buffer_unmap(), PIPE_BUFFER_USAGE_CPU_READ, pipe_context::screen, pipe_context::set_edgeflags, and st_buffer_object().

00209 {
00210    struct pipe_context *pipe = ctx->st->pipe;
00211 
00212    if ((primMode == GL_TRIANGLES ||
00213         primMode == GL_QUADS ||
00214         primMode == GL_POLYGON) &&
00215        (ctx->Polygon.FrontMode != GL_FILL ||
00216         ctx->Polygon.BackMode != GL_FILL)) {
00217       /* need edge flags */
00218       GLint i;
00219       unsigned *vec;
00220       struct st_buffer_object *stobj = st_buffer_object(array->BufferObj);
00221       ubyte *map;
00222 
00223       if (!stobj)
00224          return NULL;
00225 
00226       vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32);
00227       if (!vec)
00228          return NULL;
00229 
00230       map = pipe_buffer_map(pipe->screen, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
00231       map = ADD_POINTERS(map, array->Ptr);
00232 
00233       for (i = 0; i < count; i++) {
00234          if (*((float *) map))
00235             vec[i/32] |= 1 << (i % 32);
00236 
00237          map += array->StrideB;
00238       }
00239 
00240       pipe_buffer_unmap(pipe->screen, stobj->buffer);
00241 
00242       pipe->set_edgeflags(pipe, vec);
00243 
00244       return vec;
00245    }
00246    else {
00247       /* edge flags not needed */
00248       pipe->set_edgeflags(pipe, NULL);
00249       return NULL;
00250    }
00251 }

static void setup_interleaved_attribs ( GLcontext *  ctx,
const struct st_vertex_program vp,
const struct gl_client_array **  arrays,
GLuint  max_index,
GLboolean  userSpace,
struct pipe_vertex_buffer vbuffer,
struct pipe_vertex_element  velements[] 
) [static]

Set up for drawing interleaved arrays that all live in one VBO or all live in user space.

Parameters:
vbuffer returns vertex buffer info
velements returns vertex element info

Definition at line 348 of file st_draw.c.

References assert, st_buffer_object::buffer, pipe_vertex_buffer::buffer, pipe_vertex_buffer::buffer_offset, get_user_arrays_bounds(), st_vertex_program::index_to_input, pipe_vertex_buffer::max_index, pipe_vertex_element::nr_components, st_vertex_program::num_inputs, pipe_buffer_reference(), pipe_user_buffer_create(), pipe_vertex_buffer::pitch, pipe_context::screen, pipe_vertex_element::src_format, pipe_vertex_element::src_offset, st_buffer_object(), st_pipe_vertex_format(), stride(), and pipe_vertex_element::vertex_buffer_index.

00355 {
00356    struct pipe_context *pipe = ctx->st->pipe;
00357    GLuint attr;
00358    const GLubyte *offset0;
00359 
00360    for (attr = 0; attr < vp->num_inputs; attr++) {
00361       const GLuint mesaAttr = vp->index_to_input[attr];
00362       struct gl_buffer_object *bufobj = arrays[mesaAttr]->BufferObj;
00363       struct st_buffer_object *stobj = st_buffer_object(bufobj);
00364       GLsizei stride = arrays[mesaAttr]->StrideB;
00365 
00366       /*printf("stobj %u = %p\n", attr, (void*)stobj);*/
00367 
00368       if (attr == 0) {
00369          if (userSpace) {
00370             const GLubyte *low, *high;
00371             get_user_arrays_bounds(vp, arrays, max_index, &low, &high);
00372             /*printf("user buffer range: %p %p  %d\n", low, high, high-low);*/
00373             vbuffer->buffer =
00374                pipe_user_buffer_create(pipe->screen, (void *) low, high - low);
00375             vbuffer->buffer_offset = 0;
00376             offset0 = low;
00377          }
00378          else {
00379             vbuffer->buffer = NULL;
00380             pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
00381             vbuffer->buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
00382             offset0 = arrays[mesaAttr]->Ptr;
00383          }
00384          vbuffer->pitch = stride; /* in bytes */
00385          vbuffer->max_index = max_index;
00386       }
00387 
00388       velements[attr].src_offset =
00389          (unsigned) (arrays[mesaAttr]->Ptr - offset0);
00390       velements[attr].vertex_buffer_index = 0;
00391       velements[attr].nr_components = arrays[mesaAttr]->Size;
00392       velements[attr].src_format =
00393          st_pipe_vertex_format(arrays[mesaAttr]->Type,
00394                                arrays[mesaAttr]->Size,
00395                                arrays[mesaAttr]->Normalized);
00396       assert(velements[attr].src_format);
00397    }
00398 }

static void setup_non_interleaved_attribs ( GLcontext *  ctx,
const struct st_vertex_program vp,
const struct gl_client_array **  arrays,
GLuint  max_index,
GLboolean *  userSpace,
struct pipe_vertex_buffer  vbuffer[],
struct pipe_vertex_element  velements[] 
) [static]

Set up a separate pipe_vertex_buffer and pipe_vertex_element for each vertex attribute.

Parameters:
vbuffer returns vertex buffer info
velements returns vertex element info

Definition at line 408 of file st_draw.c.

References assert, pipe_vertex_buffer::buffer, st_buffer_object::buffer, pipe_vertex_buffer::buffer_offset, st_vertex_program::index_to_input, pipe_vertex_buffer::max_index, pipe_vertex_element::nr_components, st_vertex_program::num_inputs, pipe_buffer_reference(), pipe_user_buffer_create(), pipe_vertex_buffer::pitch, pipe_context::screen, pipe_vertex_element::src_format, pipe_vertex_element::src_offset, st_buffer_object(), st_pipe_vertex_format(), stride(), and pipe_vertex_element::vertex_buffer_index.

00415 {
00416    struct pipe_context *pipe = ctx->st->pipe;
00417    GLuint attr;
00418 
00419    for (attr = 0; attr < vp->num_inputs; attr++) {
00420       const GLuint mesaAttr = vp->index_to_input[attr];
00421       struct gl_buffer_object *bufobj = arrays[mesaAttr]->BufferObj;
00422       GLsizei stride = arrays[mesaAttr]->StrideB;
00423 
00424       *userSpace = GL_FALSE;
00425 
00426       if (bufobj && bufobj->Name) {
00427          /* Attribute data is in a VBO.
00428           * Recall that for VBOs, the gl_client_array->Ptr field is
00429           * really an offset from the start of the VBO, not a pointer.
00430           */
00431          struct st_buffer_object *stobj = st_buffer_object(bufobj);
00432          assert(stobj->buffer);
00433          /*printf("stobj %u = %p\n", attr, (void*) stobj);*/
00434 
00435          vbuffer[attr].buffer = NULL;
00436          pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, stobj->buffer);
00437          vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
00438          velements[attr].src_offset = 0;
00439       }
00440       else {
00441          /* attribute data is in user-space memory, not a VBO */
00442          uint bytes;
00443          /*printf("user-space array %d stride %d\n", attr, stride);*/
00444         
00445          *userSpace = GL_TRUE;
00446 
00447          /* wrap user data */
00448          if (arrays[mesaAttr]->Ptr) {
00449             /* user's vertex array */
00450             if (arrays[mesaAttr]->StrideB) {
00451                bytes = arrays[mesaAttr]->StrideB * (max_index + 1);
00452             }
00453             else {
00454                bytes = arrays[mesaAttr]->Size
00455                   * _mesa_sizeof_type(arrays[mesaAttr]->Type);
00456             }
00457             vbuffer[attr].buffer = pipe_user_buffer_create(pipe->screen,
00458                            (void *) arrays[mesaAttr]->Ptr, bytes);
00459          }
00460          else {
00461             /* no array, use ctx->Current.Attrib[] value */
00462             bytes = sizeof(ctx->Current.Attrib[0]);
00463             vbuffer[attr].buffer = pipe_user_buffer_create(pipe->screen,
00464                            (void *) ctx->Current.Attrib[mesaAttr], bytes);
00465             stride = 0;
00466          }
00467 
00468          vbuffer[attr].buffer_offset = 0;
00469          velements[attr].src_offset = 0;
00470       }
00471 
00472       assert(velements[attr].src_offset <= 2048); /* 11-bit field */
00473 
00474       /* common-case setup */
00475       vbuffer[attr].pitch = stride; /* in bytes */
00476       vbuffer[attr].max_index = max_index;
00477       velements[attr].vertex_buffer_index = attr;
00478       velements[attr].nr_components = arrays[mesaAttr]->Size;
00479       velements[attr].src_format
00480          = st_pipe_vertex_format(arrays[mesaAttr]->Type,
00481                                  arrays[mesaAttr]->Size,
00482                                  arrays[mesaAttr]->Normalized);
00483       assert(velements[attr].src_format);
00484    }
00485 }

void st_destroy_draw ( struct st_context st  ) 

Definition at line 693 of file st_draw.c.

00694 {
00695 }

void st_draw_vbo ( GLcontext *  ctx,
const struct gl_client_array **  arrays,
const struct _mesa_prim *  prims,
GLuint  nr_prims,
const struct _mesa_index_buffer *  ib,
GLuint  min_index,
GLuint  max_index 
)

This function gets plugged into the VBO module and is called when we have something to render.

Basically, translate the information into the format expected by gallium.

Definition at line 518 of file st_draw.c.

References assert, pipe_vertex_buffer::buffer, st_buffer_object::buffer, check_uniforms(), pipe_context::draw_arrays, pipe_context::draw_elements, pipe_context::draw_range_elements, is_interleaved_arrays(), mode, pipe_vertex_element::nr_components, st_vertex_program::num_inputs, pf_name(), pipe_buffer_reference(), pipe_user_buffer_create(), pipe_context::screen, pipe_context::set_vertex_buffers, pipe_context::set_vertex_elements, setup_edgeflags(), setup_interleaved_attribs(), setup_non_interleaved_attribs(), pipe_vertex_element::src_format, pipe_vertex_element::src_offset, st_buffer_object(), st_validate_state(), and pipe_vertex_element::vertex_buffer_index.

00525 {
00526    struct pipe_context *pipe = ctx->st->pipe;
00527    const struct st_vertex_program *vp;
00528    const struct pipe_shader_state *vs;
00529    struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
00530    GLuint attr;
00531    struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
00532    unsigned num_vbuffers, num_velements;
00533    GLboolean userSpace;
00534 
00535    /* sanity check for pointer arithmetic below */
00536    assert(sizeof(arrays[0]->Ptr[0]) == 1);
00537 
00538    st_validate_state(ctx->st);
00539 
00540    /* must get these after state validation! */
00541    vp = ctx->st->vp;
00542    vs = &ctx->st->vp->state;
00543 
00544    if (MESA_VERBOSE & VERBOSE_GLSL) {
00545       check_uniforms(ctx);
00546    }
00547 
00548    /*
00549     * Setup the vbuffer[] and velements[] arrays.
00550     */
00551    if (is_interleaved_arrays(vp, arrays, &userSpace)) {
00552       /*printf("Draw interleaved\n");*/
00553       setup_interleaved_attribs(ctx, vp, arrays, max_index, userSpace,
00554                                 vbuffer, velements);
00555       num_vbuffers = 1;
00556       num_velements = vp->num_inputs;
00557       if (num_velements == 0)
00558          num_vbuffers = 0;
00559    }
00560    else {
00561       /*printf("Draw non-interleaved\n");*/
00562       setup_non_interleaved_attribs(ctx, vp, arrays, max_index,
00563                                     &userSpace, vbuffer, velements);
00564       num_vbuffers = vp->num_inputs;
00565       num_velements = vp->num_inputs;
00566    }
00567 
00568 #if 0
00569    {
00570       GLuint i;
00571       for (i = 0; i < num_vbuffers; i++) {
00572          printf("buffers[%d].pitch = %u\n", i, vbuffer[i].pitch);
00573          printf("buffers[%d].max_index = %u\n", i, vbuffer[i].max_index);
00574          printf("buffers[%d].buffer_offset = %u\n", i, vbuffer[i].buffer_offset);
00575          printf("buffers[%d].buffer = %p\n", i, (void*) vbuffer[i].buffer);
00576       }
00577       for (i = 0; i < num_velements; i++) {
00578          printf("vlements[%d].vbuffer_index = %u\n", i, velements[i].vertex_buffer_index);
00579          printf("vlements[%d].src_offset = %u\n", i, velements[i].src_offset);
00580          printf("vlements[%d].nr_comps = %u\n", i, velements[i].nr_components);
00581          printf("vlements[%d].format = %s\n", i, pf_name(velements[i].src_format));
00582       }
00583    }
00584 #endif
00585 
00586    pipe->set_vertex_buffers(pipe, num_vbuffers, vbuffer);
00587    pipe->set_vertex_elements(pipe, num_velements, velements);
00588 
00589    if (num_vbuffers == 0 || num_velements == 0)
00590       return;
00591 
00592    /* do actual drawing */
00593    if (ib) {
00594       /* indexed primitive */
00595       struct gl_buffer_object *bufobj = ib->obj;
00596       struct pipe_buffer *indexBuf = NULL;
00597       unsigned indexSize, indexOffset, i;
00598 
00599       switch (ib->type) {
00600       case GL_UNSIGNED_INT:
00601          indexSize = 4;
00602          break;
00603       case GL_UNSIGNED_SHORT:
00604          indexSize = 2;
00605          break;
00606       case GL_UNSIGNED_BYTE:
00607          indexSize = 1;
00608          break;
00609       default:
00610          assert(0);
00611          return;
00612       }
00613 
00614       /* get/create the index buffer object */
00615       if (bufobj && bufobj->Name) {
00616          /* elements/indexes are in a real VBO */
00617          struct st_buffer_object *stobj = st_buffer_object(bufobj);
00618          pipe_buffer_reference(pipe->screen, &indexBuf, stobj->buffer);
00619          indexOffset = (unsigned) ib->ptr / indexSize;
00620       }
00621       else {
00622          /* element/indicies are in user space memory */
00623          indexBuf = pipe_user_buffer_create(pipe->screen, (void *) ib->ptr,
00624                                             ib->count * indexSize);
00625          indexOffset = 0;
00626       }
00627 
00628       /* draw */
00629       if (nr_prims == 1 && pipe->draw_range_elements != NULL) {
00630          i = 0;
00631 
00632          /* XXX: exercise temporary path to pass min/max directly
00633           * through to driver & draw module.  These interfaces still
00634           * need a bit of work...
00635           */
00636          setup_edgeflags(ctx, prims[i].mode,
00637                          prims[i].start + indexOffset, prims[i].count,
00638                          arrays[VERT_ATTRIB_EDGEFLAG]);
00639 
00640          pipe->draw_range_elements(pipe, indexBuf, indexSize,
00641                                    min_index,
00642                                    max_index,
00643                                    prims[i].mode,
00644                                    prims[i].start + indexOffset, prims[i].count);
00645       }
00646       else {
00647          for (i = 0; i < nr_prims; i++) {
00648             setup_edgeflags(ctx, prims[i].mode,
00649                             prims[i].start + indexOffset, prims[i].count,
00650                             arrays[VERT_ATTRIB_EDGEFLAG]);
00651             
00652             pipe->draw_elements(pipe, indexBuf, indexSize,
00653                                 prims[i].mode,
00654                                 prims[i].start + indexOffset, prims[i].count);
00655          }
00656       }
00657 
00658       pipe_buffer_reference(pipe->screen, &indexBuf, NULL);
00659    }
00660    else {
00661       /* non-indexed */
00662       GLuint i;
00663       for (i = 0; i < nr_prims; i++) {
00664          setup_edgeflags(ctx, prims[i].mode,
00665                          prims[i].start, prims[i].count,
00666                          arrays[VERT_ATTRIB_EDGEFLAG]);
00667 
00668          pipe->draw_arrays(pipe, prims[i].mode, prims[i].start, prims[i].count);
00669       }
00670    }
00671 
00672    /* unreference buffers (frees wrapped user-space buffer objects) */
00673    for (attr = 0; attr < num_vbuffers; attr++) {
00674       pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
00675       assert(!vbuffer[attr].buffer);
00676    }
00677 
00678    if (userSpace) 
00679    {
00680       pipe->set_vertex_buffers(pipe, 0, NULL);
00681    }
00682 }

void st_init_draw ( struct st_context st  ) 

Definition at line 685 of file st_draw.c.

References st_context::ctx, and st_draw_vbo().

00686 {
00687    GLcontext *ctx = st->ctx;
00688 
00689    vbo_set_draw_func(ctx, st_draw_vbo);
00690 }

GLuint st_pipe_vertex_format ( GLenum  type,
GLuint  size,
GLboolean  normalized 
)

Return a PIPE_FORMAT_x for the given GL datatype and size.

Definition at line 162 of file st_draw.c.

References assert, byte_types_norm, byte_types_scale, double_types, fixed_types, float_types, int_types_norm, int_types_scale, short_types_norm, short_types_scale, ubyte_types_norm, ubyte_types_scale, uint_types_norm, uint_types_scale, ushort_types_norm, and ushort_types_scale.

00163 {
00164    assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
00165           type == GL_FIXED);
00166    assert(size >= 1);
00167    assert(size <= 4);
00168 
00169    if (normalized) {
00170       switch (type) {
00171       case GL_DOUBLE: return double_types[size-1];
00172       case GL_FLOAT: return float_types[size-1];
00173       case GL_INT: return int_types_norm[size-1];
00174       case GL_SHORT: return short_types_norm[size-1];
00175       case GL_BYTE: return byte_types_norm[size-1];
00176       case GL_UNSIGNED_INT: return uint_types_norm[size-1];
00177       case GL_UNSIGNED_SHORT: return ushort_types_norm[size-1];
00178       case GL_UNSIGNED_BYTE: return ubyte_types_norm[size-1];
00179       case GL_FIXED: return fixed_types[size-1];
00180       default: assert(0); return 0;
00181       }      
00182    }
00183    else {
00184       switch (type) {
00185       case GL_DOUBLE: return double_types[size-1];
00186       case GL_FLOAT: return float_types[size-1];
00187       case GL_INT: return int_types_scale[size-1];
00188       case GL_SHORT: return short_types_scale[size-1];
00189       case GL_BYTE: return byte_types_scale[size-1];
00190       case GL_UNSIGNED_INT: return uint_types_scale[size-1];
00191       case GL_UNSIGNED_SHORT: return ushort_types_scale[size-1];
00192       case GL_UNSIGNED_BYTE: return ubyte_types_scale[size-1];
00193       case GL_FIXED: return fixed_types[size-1];
00194       default: assert(0); return 0;
00195       }      
00196    }
00197    return 0; /* silence compiler warning */
00198 }


Variable Documentation

GLuint byte_types_norm[4] [static]

Initial value:

Definition at line 135 of file st_draw.c.

GLuint byte_types_scale[4] [static]

Initial value:

Definition at line 142 of file st_draw.c.

GLuint double_types[4] [static]

Initial value:

Definition at line 51 of file st_draw.c.

GLuint fixed_types[4] [static]

Initial value:

Definition at line 149 of file st_draw.c.

GLuint float_types[4] [static]

Initial value:

Definition at line 58 of file st_draw.c.

GLuint int_types_norm[4] [static]

Initial value:

Definition at line 79 of file st_draw.c.

GLuint int_types_scale[4] [static]

Initial value:

Definition at line 86 of file st_draw.c.

GLuint short_types_norm[4] [static]

Initial value:

Definition at line 107 of file st_draw.c.

GLuint short_types_scale[4] [static]

Initial value:

Definition at line 114 of file st_draw.c.

GLuint ubyte_types_norm[4] [static]

Initial value:

Definition at line 121 of file st_draw.c.

GLuint ubyte_types_scale[4] [static]

Initial value:

Definition at line 128 of file st_draw.c.

GLuint uint_types_norm[4] [static]

Initial value:

Definition at line 65 of file st_draw.c.

GLuint uint_types_scale[4] [static]

Initial value:

Definition at line 72 of file st_draw.c.

GLuint ushort_types_norm[4] [static]

Initial value:

Definition at line 93 of file st_draw.c.

GLuint ushort_types_scale[4] [static]

Initial value:

Definition at line 100 of file st_draw.c.


Generated on Tue Sep 29 06:25:54 2009 for Gallium3D by  doxygen 1.5.4