mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-16 05:00:19 +01:00
New files...
This commit is contained in:
parent
ad2ac216fa
commit
b014986fdb
6 changed files with 2299 additions and 0 deletions
1536
src/mesa/main/api_loopback.c
Normal file
1536
src/mesa/main/api_loopback.c
Normal file
File diff suppressed because it is too large
Load diff
14
src/mesa/main/api_loopback.h
Normal file
14
src/mesa/main/api_loopback.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef API_LOOPBACK_H
|
||||
#define API_LOOPBACK_H
|
||||
|
||||
#include "glheader.h"
|
||||
|
||||
struct _glapi_table;
|
||||
|
||||
extern void _mesa_loopback_prefer_float( struct _glapi_table *dest,
|
||||
GLboolean prefer_float_colors );
|
||||
|
||||
extern void _mesa_loopback_init_api_table( struct _glapi_table *dest,
|
||||
GLboolean prefer_float_colors );
|
||||
|
||||
#endif
|
||||
551
src/mesa/main/api_noop.c
Normal file
551
src/mesa/main/api_noop.c
Normal file
|
|
@ -0,0 +1,551 @@
|
|||
#include "glheader.h"
|
||||
#include "api_noop.h"
|
||||
#include "context.h"
|
||||
#include "colormac.h"
|
||||
#include "light.h"
|
||||
#include "macros.h"
|
||||
#include "mmath.h"
|
||||
#include "mtypes.h"
|
||||
|
||||
#ifdef __i386__
|
||||
#define COPY_FLOAT(a,b) *(int*)&(a) = *(int*)&(b)
|
||||
#else
|
||||
#define COPY_FLOAT(a,b) (a) = (b)
|
||||
#endif
|
||||
|
||||
/* In states where certain vertex components are required for t&l or
|
||||
* rasterization, we still need to keep track of the current values.
|
||||
* These functions provide this service by keeping uptodate the
|
||||
* 'ctx->Current' struct for all data elements not included in the
|
||||
* currently enabled hardware vertex.
|
||||
*
|
||||
*/
|
||||
void _mesa_noop_EdgeFlag( GLboolean b )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Current.EdgeFlag = b;
|
||||
}
|
||||
|
||||
void _mesa_noop_EdgeFlagv( const GLboolean *b )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Current.EdgeFlag = *b;
|
||||
}
|
||||
|
||||
void _mesa_noop_FogCoordfEXT( GLfloat a )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Current.FogCoord = a;
|
||||
}
|
||||
|
||||
void _mesa_noop_FogCoordfvEXT( const GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Current.FogCoord = *v;
|
||||
}
|
||||
|
||||
void _mesa_noop_Indexi( GLint i )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Current.Index = i;
|
||||
}
|
||||
|
||||
void _mesa_noop_Indexiv( const GLint *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ctx->Current.Index = *v;
|
||||
}
|
||||
|
||||
void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Normal;
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
COPY_FLOAT(dest[2], c);
|
||||
}
|
||||
|
||||
void _mesa_noop_Normal3fv( const GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Normal;
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
COPY_FLOAT(dest[2], v[2]);
|
||||
}
|
||||
|
||||
void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_material mat[2];
|
||||
GLuint bitmask = gl_material_bitmask( ctx, face, pname, ~0,
|
||||
"_mesa_noop_Materialfv" );
|
||||
if (bitmask == 0)
|
||||
return;
|
||||
|
||||
if (bitmask & FRONT_AMBIENT_BIT) {
|
||||
COPY_4FV( mat[0].Ambient, params );
|
||||
}
|
||||
if (bitmask & BACK_AMBIENT_BIT) {
|
||||
COPY_4FV( mat[1].Ambient, params );
|
||||
}
|
||||
if (bitmask & FRONT_DIFFUSE_BIT) {
|
||||
COPY_4FV( mat[0].Diffuse, params );
|
||||
}
|
||||
if (bitmask & BACK_DIFFUSE_BIT) {
|
||||
COPY_4FV( mat[1].Diffuse, params );
|
||||
}
|
||||
if (bitmask & FRONT_SPECULAR_BIT) {
|
||||
COPY_4FV( mat[0].Specular, params );
|
||||
}
|
||||
if (bitmask & BACK_SPECULAR_BIT) {
|
||||
COPY_4FV( mat[1].Specular, params );
|
||||
}
|
||||
if (bitmask & FRONT_EMISSION_BIT) {
|
||||
COPY_4FV( mat[0].Emission, params );
|
||||
}
|
||||
if (bitmask & BACK_EMISSION_BIT) {
|
||||
COPY_4FV( mat[1].Emission, params );
|
||||
}
|
||||
if (bitmask & FRONT_SHININESS_BIT) {
|
||||
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F );
|
||||
mat[0].Shininess = shininess;
|
||||
}
|
||||
if (bitmask & BACK_SHININESS_BIT) {
|
||||
GLfloat shininess = CLAMP( params[0], 0.0F, 128.0F );
|
||||
mat[1].Shininess = shininess;
|
||||
}
|
||||
if (bitmask & FRONT_INDEXES_BIT) {
|
||||
mat[0].AmbientIndex = params[0];
|
||||
mat[0].DiffuseIndex = params[1];
|
||||
mat[0].SpecularIndex = params[2];
|
||||
}
|
||||
if (bitmask & BACK_INDEXES_BIT) {
|
||||
mat[1].AmbientIndex = params[0];
|
||||
mat[1].DiffuseIndex = params[1];
|
||||
mat[1].SpecularIndex = params[2];
|
||||
}
|
||||
|
||||
gl_update_material( ctx, mat, bitmask );
|
||||
}
|
||||
|
||||
void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
color[0] = a;
|
||||
color[1] = b;
|
||||
color[2] = c;
|
||||
color[3] = d;
|
||||
}
|
||||
|
||||
void _mesa_noop_Color4ubv( const GLubyte *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
COPY_4UBV( color, v );
|
||||
}
|
||||
|
||||
void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[0], a);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[1], b);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[2], c);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[3], d);
|
||||
}
|
||||
|
||||
void _mesa_noop_Color4fv( const GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
FLOAT_RGBA_TO_CHAN_RGBA( color, v );
|
||||
}
|
||||
|
||||
void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
color[0] = a;
|
||||
color[1] = b;
|
||||
color[2] = c;
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_Color3ubv( const GLubyte *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
color[0] = v[0];
|
||||
color[1] = v[1];
|
||||
color[2] = v[2];
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[0], a);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[1], b);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[2], c);
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_Color3fv( const GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.Color;
|
||||
FLOAT_RGB_TO_CHAN_RGB( color, v );
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
dest[1] = 0;
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
dest[1] = 0;
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
COPY_FLOAT(dest[2], c);
|
||||
dest[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
COPY_FLOAT(dest[2], v[2]);
|
||||
dest[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b,
|
||||
GLfloat c, GLfloat d )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
COPY_FLOAT(dest[2], c);
|
||||
dest[3] = d;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLuint unit = target - GL_TEXTURE0_ARB;
|
||||
|
||||
/* unit is unsigned -- cannot be less than zero.
|
||||
*/
|
||||
if (unit < MAX_TEXTURE_UNITS)
|
||||
{
|
||||
GLfloat *dest = ctx->Current.Texcoord[unit];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
COPY_FLOAT(dest[2], v[2]);
|
||||
COPY_FLOAT(dest[3], v[3]);
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.SecondaryColor;
|
||||
color[0] = a;
|
||||
color[1] = b;
|
||||
color[2] = c;
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.SecondaryColor;
|
||||
color[0] = v[0];
|
||||
color[1] = v[1];
|
||||
color[2] = v[2];
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.SecondaryColor;
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[0], a);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[1], b);
|
||||
FLOAT_COLOR_TO_UBYTE_COLOR(color[2], c);
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLubyte *color = ctx->Current.SecondaryColor;
|
||||
FLOAT_RGB_TO_CHAN_RGB( color, v );
|
||||
color[3] = 255;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord1f( GLfloat a )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
dest[1] = 0;
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord1fv( GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
dest[1] = 0;
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord2fv( GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
dest[2] = 0;
|
||||
dest[3] = 1;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
COPY_FLOAT(dest[2], c);
|
||||
dest[3] = 1;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord3fv( GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
COPY_FLOAT(dest[2], v[2]);
|
||||
dest[3] = 1;
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], a);
|
||||
COPY_FLOAT(dest[1], b);
|
||||
COPY_FLOAT(dest[2], c);
|
||||
COPY_FLOAT(dest[3], d);
|
||||
}
|
||||
|
||||
void _mesa_noop_TexCoord4fv( GLfloat *v )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLfloat *dest = ctx->Current.Texcoord[0];
|
||||
COPY_FLOAT(dest[0], v[0]);
|
||||
COPY_FLOAT(dest[1], v[1]);
|
||||
COPY_FLOAT(dest[2], v[2]);
|
||||
COPY_FLOAT(dest[3], v[3]);
|
||||
}
|
||||
|
||||
/* Execute a glRectf() function. This is not suitable for GL_COMPILE
|
||||
* modes (as the test for outside begin/end is not compiled),
|
||||
* but may be useful for drivers in circumstances which exclude
|
||||
* display list interactions.
|
||||
*
|
||||
* (None of the functions in this file are suitable for GL_COMPILE
|
||||
* modes).
|
||||
*/
|
||||
void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
|
||||
{
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx, "_mesa_noop_Rectf");
|
||||
}
|
||||
|
||||
glBegin( GL_QUADS );
|
||||
glVertex2f( x1, y1 );
|
||||
glVertex2f( x2, y1 );
|
||||
glVertex2f( x2, y2 );
|
||||
glVertex2f( x1, y2 );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
/* Some very basic support for arrays. Drivers without explicit array
|
||||
* support can hook these in, but it may be more efficient to fall
|
||||
* back to swtnl. Particularly if the driver is implementing a
|
||||
* software fastpath rather than driving a hardware t&l unit.
|
||||
*/
|
||||
|
||||
/* A codegen implementation of this which hardwires the multiplies and
|
||||
* inlines the called functions would fly:
|
||||
*/
|
||||
void _mesa_noop_ArrayElement( GLint elt )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
int i;
|
||||
for (i = 0 ; i < ctx->Array._nr_enabled ; i++) {
|
||||
struct gl_client_array *a = ctx->Array._enabled[i];
|
||||
a->_EltFunc( a->Data + elt * a->StrideB );
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
||||
{
|
||||
GLint i;
|
||||
for (i = start ; i <= count ; i++)
|
||||
glArrayElement( i );
|
||||
}
|
||||
|
||||
|
||||
void _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLint i;
|
||||
|
||||
if (count <= 0) {
|
||||
if (count < 0) {
|
||||
gl_error( ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
for (i = 0 ; i < count ; i++)
|
||||
glArrayElement( ((GLubyte *)indices)[i] );
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
for (i = 0 ; i < count ; i++)
|
||||
glArrayElement( ((GLushort *)indices)[i] );
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
for (i = 0 ; i < count ; i++)
|
||||
glArrayElement( ((GLuint *)indices)[i] );
|
||||
break;
|
||||
default:
|
||||
gl_error( ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _mesa_noop_DrawRangeElements(GLenum mode, GLuint start,
|
||||
GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid *indices)
|
||||
{
|
||||
glDrawElements( mode, count, type, indices );
|
||||
}
|
||||
|
||||
#endif
|
||||
101
src/mesa/main/api_noop.h
Normal file
101
src/mesa/main/api_noop.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
|
||||
#ifndef _API_NOOP_H
|
||||
#define _API_NOOP_H
|
||||
|
||||
|
||||
#include "glheader.h"
|
||||
#include "mtypes.h"
|
||||
#include "context.h"
|
||||
|
||||
/* In states where certain vertex components are required for t&l or
|
||||
* rasterization, we still need to keep track of the current values.
|
||||
* These functions provide this service by keeping uptodate the
|
||||
* 'ctx->Current' struct for all data elements not included in the
|
||||
* currently enabled hardware vertex.
|
||||
*
|
||||
*/
|
||||
extern void _mesa_noop_EdgeFlag( GLboolean b );
|
||||
|
||||
extern void _mesa_noop_EdgeFlagv( const GLboolean *b );
|
||||
|
||||
extern void _mesa_noop_FogCoordfEXT( GLfloat a );
|
||||
|
||||
extern void _mesa_noop_FogCoordfvEXT( const GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_Indexi( GLint i );
|
||||
|
||||
extern void _mesa_noop_Indexiv( const GLint *v );
|
||||
|
||||
extern void _mesa_noop_Normal3f( GLfloat a, GLfloat b, GLfloat c );
|
||||
|
||||
extern void _mesa_noop_Normal3fv( const GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_Materialfv( GLenum face, GLenum pname, const GLfloat *param );
|
||||
|
||||
extern void _mesa_noop_Color4ub( GLubyte a, GLubyte b, GLubyte c, GLubyte d );
|
||||
|
||||
extern void _mesa_noop_Color4ubv( const GLubyte *v );
|
||||
|
||||
extern void _mesa_noop_Color4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
|
||||
|
||||
extern void _mesa_noop_Color4fv( const GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_Color3ub( GLubyte a, GLubyte b, GLubyte c );
|
||||
|
||||
extern void _mesa_noop_Color3ubv( const GLubyte *v );
|
||||
|
||||
extern void _mesa_noop_Color3f( GLfloat a, GLfloat b, GLfloat c );
|
||||
|
||||
extern void _mesa_noop_Color3fv( const GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a,
|
||||
GLfloat b );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a,
|
||||
GLfloat b, GLfloat c);
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a,
|
||||
GLfloat b, GLfloat c, GLfloat d );
|
||||
|
||||
extern void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c );
|
||||
|
||||
extern void _mesa_noop_SecondaryColor3ubvEXT( const GLubyte *v );
|
||||
|
||||
extern void _mesa_noop_SecondaryColor3fEXT( GLfloat a, GLfloat b, GLfloat c );
|
||||
|
||||
extern void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_TexCoord1f( GLfloat a );
|
||||
|
||||
extern void _mesa_noop_TexCoord1fv( GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b );
|
||||
|
||||
extern void _mesa_noop_TexCoord2fv( GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c );
|
||||
|
||||
extern void _mesa_noop_TexCoord3fv( GLfloat *v );
|
||||
|
||||
extern void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d );
|
||||
|
||||
extern void _mesa_noop_TexCoord4fv( GLfloat *v );
|
||||
|
||||
|
||||
/* Not strictly a noop -- translate Rectf down to Begin/End and
|
||||
* vertices. Closer to the loopback operations, but doesn't meet the
|
||||
* criteria for inclusion there (cannot be used in the Save table).
|
||||
*/
|
||||
extern void _mesa_noop_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
|
||||
|
||||
#endif
|
||||
89
src/mesa/main/vtxfmt.c
Normal file
89
src/mesa/main/vtxfmt.c
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#include "glheader.h"
|
||||
#include "api_loopback.h"
|
||||
#include "mtypes.h"
|
||||
#include "vtxfmt.h"
|
||||
|
||||
|
||||
|
||||
static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
|
||||
{
|
||||
tab->ArrayElement = vfmt->ArrayElement;
|
||||
tab->Color3f = vfmt->Color3f;
|
||||
tab->Color3fv = vfmt->Color3fv;
|
||||
tab->Color3ub = vfmt->Color3ub;
|
||||
tab->Color3ubv = vfmt->Color3ubv;
|
||||
tab->Color4f = vfmt->Color4f;
|
||||
tab->Color4fv = vfmt->Color4fv;
|
||||
tab->Color4ub = vfmt->Color4ub;
|
||||
tab->Color4ubv = vfmt->Color4ubv;
|
||||
tab->EdgeFlag = vfmt->EdgeFlag;
|
||||
tab->EdgeFlagv = vfmt->EdgeFlagv;
|
||||
tab->EvalCoord1f = vfmt->EvalCoord1f;
|
||||
tab->EvalCoord1fv = vfmt->EvalCoord1fv;
|
||||
tab->EvalCoord2f = vfmt->EvalCoord2f;
|
||||
tab->EvalCoord2fv = vfmt->EvalCoord2fv;
|
||||
tab->EvalPoint1 = vfmt->EvalPoint1;
|
||||
tab->EvalPoint2 = vfmt->EvalPoint2;
|
||||
tab->FogCoordfEXT = vfmt->FogCoordfEXT;
|
||||
tab->FogCoordfvEXT = vfmt->FogCoordfvEXT;
|
||||
tab->Indexi = vfmt->Indexi;
|
||||
tab->Indexiv = vfmt->Indexiv;
|
||||
tab->Materialfv = vfmt->Materialfv;
|
||||
tab->MultiTexCoord1fARB = vfmt->MultiTexCoord1fARB;
|
||||
tab->MultiTexCoord1fvARB = vfmt->MultiTexCoord1fvARB;
|
||||
tab->MultiTexCoord2fARB = vfmt->MultiTexCoord2fARB;
|
||||
tab->MultiTexCoord2fvARB = vfmt->MultiTexCoord2fvARB;
|
||||
tab->MultiTexCoord3fARB = vfmt->MultiTexCoord3fARB;
|
||||
tab->MultiTexCoord3fvARB = vfmt->MultiTexCoord3fvARB;
|
||||
tab->MultiTexCoord4fARB = vfmt->MultiTexCoord4fARB;
|
||||
tab->MultiTexCoord4fvARB = vfmt->MultiTexCoord4fvARB;
|
||||
tab->Normal3f = vfmt->Normal3f;
|
||||
tab->Normal3fv = vfmt->Normal3fv;
|
||||
tab->SecondaryColor3fEXT = vfmt->SecondaryColor3fEXT;
|
||||
tab->SecondaryColor3fvEXT = vfmt->SecondaryColor3fvEXT;
|
||||
tab->SecondaryColor3ubEXT = vfmt->SecondaryColor3ubEXT;
|
||||
tab->SecondaryColor3ubvEXT = vfmt->SecondaryColor3ubvEXT;
|
||||
tab->TexCoord1f = vfmt->TexCoord1f;
|
||||
tab->TexCoord1fv = vfmt->TexCoord1fv;
|
||||
tab->TexCoord2f = vfmt->TexCoord2f;
|
||||
tab->TexCoord2fv = vfmt->TexCoord2fv;
|
||||
tab->TexCoord3f = vfmt->TexCoord3f;
|
||||
tab->TexCoord3fv = vfmt->TexCoord3fv;
|
||||
tab->TexCoord4f = vfmt->TexCoord4f;
|
||||
tab->TexCoord4fv = vfmt->TexCoord4fv;
|
||||
tab->Vertex2f = vfmt->Vertex2f;
|
||||
tab->Vertex2fv = vfmt->Vertex2fv;
|
||||
tab->Vertex3f = vfmt->Vertex3f;
|
||||
tab->Vertex3fv = vfmt->Vertex3fv;
|
||||
tab->Vertex4f = vfmt->Vertex4f;
|
||||
tab->Vertex4fv = vfmt->Vertex4fv;
|
||||
tab->Begin = vfmt->Begin;
|
||||
tab->End = vfmt->End;
|
||||
|
||||
/* tab->NewList = vfmt->NewList; */
|
||||
tab->CallList = vfmt->CallList;
|
||||
|
||||
tab->Rectf = vfmt->Rectf;
|
||||
tab->DrawArrays = vfmt->DrawArrays;
|
||||
tab->DrawElements = vfmt->DrawElements;
|
||||
tab->DrawRangeElements = vfmt->DrawRangeElements;
|
||||
tab->EvalMesh1 = vfmt->EvalMesh1;
|
||||
tab->EvalMesh2 = vfmt->EvalMesh2;
|
||||
}
|
||||
|
||||
|
||||
void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
|
||||
{
|
||||
install_vtxfmt( ctx->Exec, vfmt );
|
||||
if (ctx->ExecPrefersFloat != vfmt->prefer_float_colors)
|
||||
_mesa_loopback_prefer_float( ctx->Exec, vfmt->prefer_float_colors );
|
||||
}
|
||||
|
||||
|
||||
void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
|
||||
{
|
||||
install_vtxfmt( ctx->Save, vfmt );
|
||||
if (ctx->SavePrefersFloat != vfmt->prefer_float_colors)
|
||||
_mesa_loopback_prefer_float( ctx->Save, vfmt->prefer_float_colors );
|
||||
}
|
||||
|
||||
8
src/mesa/main/vtxfmt.h
Normal file
8
src/mesa/main/vtxfmt.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef _VTXFMT_H_
|
||||
#define _VTXFMT_H_
|
||||
|
||||
extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt );
|
||||
extern void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt );
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Reference in a new issue