mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 01:23:00 +00:00
Sync with trunk r63637.
svn path=/branches/shell-experiments/; revision=63640
This commit is contained in:
commit
73d72624b0
410 changed files with 4745 additions and 12328 deletions
|
@ -26,7 +26,6 @@
|
|||
#include "main/glheader.h"
|
||||
#include "main/imports.h"
|
||||
#include "main/accum.h"
|
||||
#include "main/arrayobj.h"
|
||||
#include "main/context.h"
|
||||
#include "main/framebuffer.h"
|
||||
#include "main/readpix.h"
|
||||
|
@ -37,7 +36,6 @@
|
|||
#include "main/texobj.h"
|
||||
#include "main/texstore.h"
|
||||
#include "main/bufferobj.h"
|
||||
#include "main/texturebarrier.h"
|
||||
|
||||
#include "tnl/tnl.h"
|
||||
#include "swrast/swrast.h"
|
||||
|
@ -84,14 +82,11 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
driver->ChooseTextureFormat = _mesa_choose_tex_format;
|
||||
driver->TexImage1D = _mesa_store_teximage1d;
|
||||
driver->TexImage2D = _mesa_store_teximage2d;
|
||||
driver->TexImage3D = _mesa_store_teximage3d;
|
||||
driver->TexSubImage1D = _mesa_store_texsubimage1d;
|
||||
driver->TexSubImage2D = _mesa_store_texsubimage2d;
|
||||
driver->TexSubImage3D = _mesa_store_texsubimage3d;
|
||||
driver->GetTexImage = _mesa_get_teximage;
|
||||
driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
|
||||
driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
|
||||
driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
|
||||
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
|
||||
driver->BindTexture = NULL;
|
||||
driver->NewTextureObject = _mesa_new_texture_object;
|
||||
|
@ -105,9 +100,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
|
||||
/* simple state commands */
|
||||
driver->AlphaFunc = NULL;
|
||||
driver->BlendColor = NULL;
|
||||
driver->BlendEquationSeparate = NULL;
|
||||
driver->BlendFuncSeparate = NULL;
|
||||
driver->ClearColor = NULL;
|
||||
driver->ClearDepth = NULL;
|
||||
driver->ClearStencil = NULL;
|
||||
|
@ -148,13 +140,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
driver->MapRenderbuffer = _swrast_map_soft_renderbuffer;
|
||||
driver->UnmapRenderbuffer = _swrast_unmap_soft_renderbuffer;
|
||||
|
||||
_mesa_init_texture_barrier_functions(driver);
|
||||
|
||||
/* APPLE_vertex_array_object */
|
||||
driver->NewArrayObject = _mesa_new_array_object;
|
||||
driver->DeleteArrayObject = _mesa_delete_array_object;
|
||||
driver->BindArrayObject = NULL;
|
||||
|
||||
/* T&L stuff */
|
||||
driver->CurrentExecPrimitive = 0;
|
||||
driver->CurrentSavePrimitive = 0;
|
||||
|
|
|
@ -34,11 +34,9 @@
|
|||
#include "main/glheader.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/imports.h"
|
||||
#include "main/arrayobj.h"
|
||||
#include "main/blend.h"
|
||||
#include "main/bufferobj.h"
|
||||
#include "main/buffers.h"
|
||||
#include "main/colortab.h"
|
||||
#include "main/context.h"
|
||||
#include "main/depth.h"
|
||||
#include "main/enable.h"
|
||||
|
@ -134,10 +132,6 @@ struct save_state
|
|||
GLbitfield TexGenEnabled;
|
||||
GLuint EnvMode; /* unit[0] only */
|
||||
|
||||
/** MESA_META_VERTEX */
|
||||
struct gl_array_object *ArrayObj;
|
||||
struct gl_buffer_object *ArrayBufferObj;
|
||||
|
||||
/** MESA_META_VIEWPORT */
|
||||
GLint ViewportX, ViewportY, ViewportW, ViewportH;
|
||||
GLclampd DepthNear, DepthFar;
|
||||
|
@ -152,23 +146,6 @@ struct save_state
|
|||
GLboolean RasterDiscard;
|
||||
};
|
||||
|
||||
/**
|
||||
* Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
|
||||
* This is currently shared by all the meta ops. But we could create a
|
||||
* separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc.
|
||||
*/
|
||||
struct temp_texture
|
||||
{
|
||||
GLuint TexObj;
|
||||
GLenum Target; /**< GL_TEXTURE_2D */
|
||||
GLsizei MinSize; /**< Min texture size to allocate */
|
||||
GLsizei MaxSize; /**< Max possible texture size */
|
||||
GLboolean NPOT; /**< Non-power of two size OK? */
|
||||
GLsizei Width, Height; /**< Current texture size */
|
||||
GLenum IntFormat;
|
||||
GLfloat Sright, Ttop; /**< right, top texcoords */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* State for glBlitFramebufer()
|
||||
|
@ -188,10 +165,8 @@ struct clear_state
|
|||
{
|
||||
GLuint ArrayObj;
|
||||
GLuint VBO;
|
||||
GLuint ShaderProg;
|
||||
GLint ColorLocation;
|
||||
|
||||
GLuint IntegerShaderProg;
|
||||
GLint IntegerColorLocation;
|
||||
};
|
||||
|
||||
|
@ -216,13 +191,9 @@ struct gl_meta_state
|
|||
/** Save stack depth */
|
||||
GLuint SaveStackDepth;
|
||||
|
||||
struct temp_texture TempTex;
|
||||
|
||||
struct copypix_state CopyPix; /**< For _mesa_meta_CopyPixels() */
|
||||
};
|
||||
|
||||
static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex);
|
||||
|
||||
/**
|
||||
* Initialize meta-ops for a context.
|
||||
* To be called once during context creation.
|
||||
|
@ -245,7 +216,6 @@ _mesa_meta_free(struct gl_context *ctx)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(old_context);
|
||||
_mesa_make_current(ctx, NULL, NULL);
|
||||
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
|
||||
if (old_context)
|
||||
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
|
||||
else
|
||||
|
@ -382,7 +352,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
|
|||
ctx->Texture.Unit.TexGenEnabled) {
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE);
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
|
||||
if (ctx->Extensions.ARB_texture_cube_map)
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
|
||||
|
@ -429,15 +398,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
|
|||
}
|
||||
}
|
||||
|
||||
if (state & MESA_META_VERTEX) {
|
||||
/* save vertex array object state */
|
||||
_mesa_reference_array_object(ctx, &save->ArrayObj,
|
||||
ctx->Array.ArrayObj);
|
||||
_mesa_reference_buffer_object(ctx, &save->ArrayBufferObj,
|
||||
ctx->Array.ArrayBufferObj);
|
||||
/* set some default state? */
|
||||
}
|
||||
|
||||
if (state & MESA_META_VIEWPORT) {
|
||||
/* save viewport state */
|
||||
save->ViewportX = ctx->Viewport.X;
|
||||
|
@ -621,16 +581,6 @@ _mesa_meta_end(struct gl_context *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
if (state & MESA_META_VERTEX) {
|
||||
/* restore vertex buffer object */
|
||||
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, save->ArrayBufferObj->Name);
|
||||
_mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL);
|
||||
|
||||
/* restore vertex array object */
|
||||
_mesa_BindVertexArray(save->ArrayObj->Name);
|
||||
_mesa_reference_array_object(ctx, &save->ArrayObj, NULL);
|
||||
}
|
||||
|
||||
if (state & MESA_META_VIEWPORT) {
|
||||
if (save->ViewportX != ctx->Viewport.X ||
|
||||
save->ViewportY != ctx->Viewport.Y ||
|
||||
|
@ -662,270 +612,6 @@ _mesa_meta_in_progress(struct gl_context *ctx)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert Z from a normalized value in the range [0, 1] to an object-space
|
||||
* Z coordinate in [-1, +1] so that drawing at the new Z position with the
|
||||
* default/identity ortho projection results in the original Z value.
|
||||
* Used by the meta-Clear, Draw/CopyPixels and Bitmap functions where the Z
|
||||
* value comes from the clear value or raster position.
|
||||
*/
|
||||
static INLINE GLfloat
|
||||
invert_z(GLfloat normZ)
|
||||
{
|
||||
GLfloat objZ = 1.0f - 2.0f * normZ;
|
||||
return objZ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* One-time init for a temp_texture object.
|
||||
* Choose tex target, compute max tex size, etc.
|
||||
*/
|
||||
static void
|
||||
init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
|
||||
{
|
||||
/* use 2D texture, NPOT if possible */
|
||||
tex->Target = GL_TEXTURE_2D;
|
||||
tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||
tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two;
|
||||
tex->MinSize = 16; /* 16 x 16 at least */
|
||||
assert(tex->MaxSize > 0);
|
||||
|
||||
_mesa_GenTextures(1, &tex->TexObj);
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
|
||||
{
|
||||
if (!tex->TexObj)
|
||||
return;
|
||||
_mesa_DeleteTextures(1, &tex->TexObj);
|
||||
tex->TexObj = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return pointer to temp_texture info for non-bitmap ops.
|
||||
* This does some one-time init if needed.
|
||||
*/
|
||||
static struct temp_texture *
|
||||
get_temp_texture(struct gl_context *ctx)
|
||||
{
|
||||
struct temp_texture *tex = &ctx->Meta->TempTex;
|
||||
|
||||
if (!tex->TexObj) {
|
||||
init_temp_texture(ctx, tex);
|
||||
}
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute the width/height of texture needed to draw an image of the
|
||||
* given size. Return a flag indicating whether the current texture
|
||||
* can be re-used (glTexSubImage2D) or if a new texture needs to be
|
||||
* allocated (glTexImage2D).
|
||||
* Also, compute s/t texcoords for drawing.
|
||||
*
|
||||
* \return GL_TRUE if new texture is needed, GL_FALSE otherwise
|
||||
*/
|
||||
static GLboolean
|
||||
alloc_texture(struct temp_texture *tex,
|
||||
GLsizei width, GLsizei height, GLenum intFormat)
|
||||
{
|
||||
GLboolean newTex = GL_FALSE;
|
||||
|
||||
ASSERT(width <= tex->MaxSize);
|
||||
ASSERT(height <= tex->MaxSize);
|
||||
|
||||
if (width > tex->Width ||
|
||||
height > tex->Height ||
|
||||
intFormat != tex->IntFormat) {
|
||||
/* alloc new texture (larger or different format) */
|
||||
|
||||
if (tex->NPOT) {
|
||||
/* use non-power of two size */
|
||||
tex->Width = MAX2(tex->MinSize, width);
|
||||
tex->Height = MAX2(tex->MinSize, height);
|
||||
}
|
||||
else {
|
||||
/* find power of two size */
|
||||
GLsizei w, h;
|
||||
w = h = tex->MinSize;
|
||||
while (w < width)
|
||||
w *= 2;
|
||||
while (h < height)
|
||||
h *= 2;
|
||||
tex->Width = w;
|
||||
tex->Height = h;
|
||||
}
|
||||
|
||||
tex->IntFormat = intFormat;
|
||||
|
||||
newTex = GL_TRUE;
|
||||
}
|
||||
|
||||
/* compute texcoords */
|
||||
tex->Sright = (GLfloat) width / tex->Width;
|
||||
tex->Ttop = (GLfloat) height / tex->Height;
|
||||
|
||||
return newTex;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup/load texture for glCopyPixels or glBlitFramebuffer.
|
||||
*/
|
||||
static void
|
||||
setup_copypix_texture(struct temp_texture *tex,
|
||||
GLboolean newTex,
|
||||
GLint srcX, GLint srcY,
|
||||
GLsizei width, GLsizei height, GLenum intFormat,
|
||||
GLenum filter)
|
||||
{
|
||||
_mesa_BindTexture(tex->Target, tex->TexObj);
|
||||
_mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter);
|
||||
_mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter);
|
||||
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
/* copy framebuffer image to texture */
|
||||
if (newTex) {
|
||||
/* create new tex image */
|
||||
if (tex->Width == width && tex->Height == height) {
|
||||
/* create new tex with framebuffer data */
|
||||
_mesa_CopyTexImage2D(tex->Target, 0, tex->IntFormat,
|
||||
srcX, srcY, width, height, 0);
|
||||
}
|
||||
else {
|
||||
/* create empty texture */
|
||||
_mesa_TexImage2D(tex->Target, 0, tex->IntFormat,
|
||||
tex->Width, tex->Height, 0,
|
||||
intFormat, GL_UNSIGNED_BYTE, NULL);
|
||||
/* load image */
|
||||
_mesa_CopyTexSubImage2D(tex->Target, 0,
|
||||
0, 0, srcX, srcY, width, height);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* replace existing tex image */
|
||||
_mesa_CopyTexSubImage2D(tex->Target, 0,
|
||||
0, 0, srcX, srcY, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta implementation of ctx->Driver.CopyPixels() in terms
|
||||
* of texture mapping and polygon rendering and GLSL shaders.
|
||||
*/
|
||||
void
|
||||
_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
|
||||
GLsizei width, GLsizei height,
|
||||
GLint dstX, GLint dstY, GLenum type)
|
||||
{
|
||||
struct copypix_state *copypix = &ctx->Meta->CopyPix;
|
||||
struct temp_texture *tex = get_temp_texture(ctx);
|
||||
struct vertex {
|
||||
GLfloat x, y, z, s, t;
|
||||
};
|
||||
struct vertex verts[4];
|
||||
GLboolean newTex;
|
||||
GLenum intFormat = GL_RGBA;
|
||||
|
||||
if (type != GL_COLOR ||
|
||||
ctx->_ImageTransferState ||
|
||||
ctx->Fog.Enabled ||
|
||||
width > tex->MaxSize ||
|
||||
height > tex->MaxSize) {
|
||||
/* XXX avoid this fallback */
|
||||
_swrast_CopyPixels(ctx, srcX, srcY, width, height, dstX, dstY, type);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Most GL state applies to glCopyPixels, but a there's a few things
|
||||
* we need to override:
|
||||
*/
|
||||
_mesa_meta_begin(ctx, (MESA_META_RASTERIZATION |
|
||||
MESA_META_TEXTURE |
|
||||
MESA_META_TRANSFORM |
|
||||
MESA_META_CLIP |
|
||||
MESA_META_VERTEX |
|
||||
MESA_META_VIEWPORT));
|
||||
|
||||
if (copypix->ArrayObj == 0) {
|
||||
/* one-time setup */
|
||||
|
||||
/* create vertex array object */
|
||||
_mesa_GenVertexArrays(1, ©pix->ArrayObj);
|
||||
_mesa_BindVertexArray(copypix->ArrayObj);
|
||||
|
||||
/* create vertex array buffer */
|
||||
_mesa_GenBuffersARB(1, ©pix->VBO);
|
||||
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO);
|
||||
_mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
|
||||
NULL, GL_DYNAMIC_DRAW_ARB);
|
||||
|
||||
/* setup vertex arrays */
|
||||
_mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
|
||||
_mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(s));
|
||||
_mesa_EnableClientState(GL_VERTEX_ARRAY);
|
||||
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
else {
|
||||
_mesa_BindVertexArray(copypix->ArrayObj);
|
||||
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO);
|
||||
}
|
||||
|
||||
newTex = alloc_texture(tex, width, height, intFormat);
|
||||
|
||||
/* vertex positions, texcoords (after texture allocation!) */
|
||||
{
|
||||
const GLfloat dstX0 = (GLfloat) dstX;
|
||||
const GLfloat dstY0 = (GLfloat) dstY;
|
||||
const GLfloat dstX1 = dstX + width * ctx->Pixel.ZoomX;
|
||||
const GLfloat dstY1 = dstY + height * ctx->Pixel.ZoomY;
|
||||
const GLfloat z = invert_z(ctx->Current.RasterPos[2]);
|
||||
|
||||
verts[0].x = dstX0;
|
||||
verts[0].y = dstY0;
|
||||
verts[0].z = z;
|
||||
verts[0].s = 0.0F;
|
||||
verts[0].t = 0.0F;
|
||||
verts[1].x = dstX1;
|
||||
verts[1].y = dstY0;
|
||||
verts[1].z = z;
|
||||
verts[1].s = tex->Sright;
|
||||
verts[1].t = 0.0F;
|
||||
verts[2].x = dstX1;
|
||||
verts[2].y = dstY1;
|
||||
verts[2].z = z;
|
||||
verts[2].s = tex->Sright;
|
||||
verts[2].t = tex->Ttop;
|
||||
verts[3].x = dstX0;
|
||||
verts[3].y = dstY1;
|
||||
verts[3].z = z;
|
||||
verts[3].s = 0.0F;
|
||||
verts[3].t = tex->Ttop;
|
||||
|
||||
/* upload new vertex data */
|
||||
_mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
|
||||
}
|
||||
|
||||
/* Alloc/setup texture */
|
||||
setup_copypix_texture(tex, newTex, srcX, srcY, width, height,
|
||||
GL_RGBA, GL_NEAREST);
|
||||
|
||||
_mesa_set_enable(ctx, tex->Target, GL_TRUE);
|
||||
|
||||
/* draw textured quad */
|
||||
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
_mesa_set_enable(ctx, tex->Target, GL_FALSE);
|
||||
|
||||
_mesa_meta_end(ctx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the GL data type to use for the temporary image read with
|
||||
* ReadPixels() and passed to Tex[Sub]Image().
|
||||
|
@ -1031,11 +717,6 @@ copy_tex_sub_image(struct gl_context *ctx,
|
|||
xoffset, width,
|
||||
format, type, buf, &ctx->Unpack);
|
||||
}
|
||||
else if (target == GL_TEXTURE_3D) {
|
||||
ctx->Driver.TexSubImage3D(ctx, texImage,
|
||||
xoffset, yoffset, zoffset, width, height, 1,
|
||||
format, type, buf, &ctx->Unpack);
|
||||
}
|
||||
else {
|
||||
ctx->Driver.TexSubImage2D(ctx, texImage,
|
||||
xoffset, yoffset, width, height,
|
||||
|
@ -1073,15 +754,3 @@ _mesa_meta_CopyTexSubImage2D(struct gl_context *ctx,
|
|||
rb, x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height)
|
||||
{
|
||||
copy_tex_sub_image(ctx, 3, texImage, xoffset, yoffset, zoffset,
|
||||
rb, x, y, width, height);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#define MESA_META_STENCIL_TEST 0x400
|
||||
#define MESA_META_TRANSFORM 0x800 /**< modelview/projection matrix state */
|
||||
#define MESA_META_TEXTURE 0x1000
|
||||
#define MESA_META_VERTEX 0x2000
|
||||
#define MESA_META_VIEWPORT 0x4000
|
||||
#define MESA_META_CLIP 0x8000
|
||||
#define MESA_META_SELECT_FEEDBACK 0x10000
|
||||
|
@ -88,12 +87,4 @@ _mesa_meta_CopyTexSubImage2D(struct gl_context *ctx,
|
|||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
extern void
|
||||
_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
#endif /* META_H */
|
||||
|
|
|
@ -6,15 +6,12 @@ list(APPEND SOURCE
|
|||
api_validate.c
|
||||
accum.c
|
||||
attrib.c
|
||||
arrayobj.c
|
||||
blend.c
|
||||
bufferobj.c
|
||||
buffers.c
|
||||
clear.c
|
||||
clip.c
|
||||
colortab.c
|
||||
context.c
|
||||
convolve.c
|
||||
cpuinfo.c
|
||||
depth.c
|
||||
dlist.c
|
||||
|
@ -35,7 +32,6 @@ list(APPEND SOURCE
|
|||
getstring.c
|
||||
hash.c
|
||||
hint.c
|
||||
#histogram.c
|
||||
image.c
|
||||
imports.c
|
||||
light.c
|
||||
|
@ -67,7 +63,6 @@ list(APPEND SOURCE
|
|||
texstate.c
|
||||
texstorage.c
|
||||
texstore.c
|
||||
texturebarrier.c
|
||||
varray.c
|
||||
version.c
|
||||
viewport.c
|
||||
|
@ -78,4 +73,5 @@ add_library(mesa_main STATIC ${SOURCE})
|
|||
add_pch(mesa_main precomp.h SOURCE)
|
||||
if(NOT MSVC)
|
||||
allow_warnings(mesa_main)
|
||||
add_target_compile_flags(mesa_main "-Wno-type-limits")
|
||||
endif()
|
||||
|
|
|
@ -157,7 +157,6 @@ static const int NormalFuncs[NUM_TYPES] = {
|
|||
};
|
||||
|
||||
/* Note: _gloffset_* for these may not be a compile-time constant. */
|
||||
static int SecondaryColorFuncs[NUM_TYPES];
|
||||
static int FogCoordFuncs[NUM_TYPES];
|
||||
|
||||
|
||||
|
@ -673,16 +672,6 @@ GLboolean _ae_create_context( struct gl_context *ctx )
|
|||
if (ctx->aelt_context)
|
||||
return GL_TRUE;
|
||||
|
||||
/* These _gloffset_* values may not be compile-time constants */
|
||||
SecondaryColorFuncs[0] = _gloffset_SecondaryColor3bvEXT;
|
||||
SecondaryColorFuncs[1] = _gloffset_SecondaryColor3ubvEXT;
|
||||
SecondaryColorFuncs[2] = _gloffset_SecondaryColor3svEXT;
|
||||
SecondaryColorFuncs[3] = _gloffset_SecondaryColor3usvEXT;
|
||||
SecondaryColorFuncs[4] = _gloffset_SecondaryColor3ivEXT;
|
||||
SecondaryColorFuncs[5] = _gloffset_SecondaryColor3uivEXT;
|
||||
SecondaryColorFuncs[6] = _gloffset_SecondaryColor3fvEXT;
|
||||
SecondaryColorFuncs[7] = _gloffset_SecondaryColor3dvEXT;
|
||||
|
||||
FogCoordFuncs[0] = -1;
|
||||
FogCoordFuncs[1] = -1;
|
||||
FogCoordFuncs[2] = -1;
|
||||
|
@ -734,49 +723,42 @@ static void _ae_update_state( struct gl_context *ctx )
|
|||
AEcontext *actx = AE_CONTEXT(ctx);
|
||||
AEarray *aa = actx->arrays;
|
||||
AEattrib *at = actx->attribs;
|
||||
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
|
||||
|
||||
actx->nr_vbos = 0;
|
||||
|
||||
/* conventional vertex arrays */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
|
||||
aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
|
||||
aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG];
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
|
||||
aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG];
|
||||
aa->offset = _gloffset_EdgeFlagv;
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL];
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
|
||||
aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL];
|
||||
aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0];
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR].Enabled) {
|
||||
aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR];
|
||||
aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1];
|
||||
aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG];
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
|
||||
aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_FOG];
|
||||
aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
{
|
||||
struct gl_client_array *attribArray = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX];
|
||||
struct gl_client_array *attribArray = &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX];
|
||||
if (attribArray->Enabled) {
|
||||
/* NOTE: we use generic glVertexAttribNV functions here.
|
||||
* If we ever remove GL_NV_vertex_program this will have to change.
|
||||
|
@ -793,14 +775,14 @@ static void _ae_update_state( struct gl_context *ctx )
|
|||
}
|
||||
|
||||
/* finally, vertex position */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
|
||||
aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_POS];
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) {
|
||||
aa->array = &ctx->Array.VertexAttrib[VERT_ATTRIB_POS];
|
||||
aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
|
||||
check_vbo(actx, aa->array->BufferObj);
|
||||
aa++;
|
||||
}
|
||||
|
||||
check_vbo(actx, arrayObj->ElementArrayBufferObj);
|
||||
check_vbo(actx, ctx->Array.ElementArrayBufferObj);
|
||||
|
||||
ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX);
|
||||
ASSERT(aa - actx->arrays < 32);
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#include "histogram.h"
|
||||
|
||||
#if FEATURE_GL
|
||||
|
||||
|
||||
|
@ -170,7 +168,6 @@ _mesa_create_exec_table(void)
|
|||
SET_ReadPixels(exec, _mesa_ReadPixels);
|
||||
SET_Rotated(exec, _mesa_Rotated);
|
||||
SET_Scaled(exec, _mesa_Scaled);
|
||||
SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
|
||||
SET_TexEnvf(exec, _mesa_TexEnvf);
|
||||
SET_TexEnviv(exec, _mesa_TexEnviv);
|
||||
|
||||
|
@ -208,58 +205,11 @@ _mesa_create_exec_table(void)
|
|||
SET_VertexPointer(exec, _mesa_VertexPointer);
|
||||
#endif
|
||||
|
||||
/* 1.2 */
|
||||
#if _HAVE_FULL_GL
|
||||
SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
|
||||
SET_TexImage3D(exec, _mesa_TexImage3D);
|
||||
SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
|
||||
#endif
|
||||
|
||||
/* OpenGL 1.2 GL_ARB_imaging */
|
||||
SET_BlendColor(exec, _mesa_BlendColor);
|
||||
SET_BlendEquation(exec, _mesa_BlendEquation);
|
||||
SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
|
||||
|
||||
_mesa_init_colortable_dispatch(exec);
|
||||
_mesa_init_convolve_dispatch(exec);
|
||||
_mesa_init_histogram_dispatch(exec);
|
||||
|
||||
/* 2. GL_EXT_blend_color */
|
||||
#if 0
|
||||
/* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */
|
||||
#endif
|
||||
|
||||
/* 3. GL_EXT_polygon_offset */
|
||||
#if _HAVE_FULL_GL
|
||||
SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
|
||||
#endif
|
||||
|
||||
/* 6. GL_EXT_texture3d */
|
||||
#if 0
|
||||
/* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
|
||||
/* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
|
||||
/* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
|
||||
#endif
|
||||
|
||||
/* 11. GL_EXT_histogram */
|
||||
#if 0
|
||||
SET_GetHistogramEXT(exec, _mesa_GetHistogram);
|
||||
SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
|
||||
SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
|
||||
SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
|
||||
SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
|
||||
SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
|
||||
#endif
|
||||
|
||||
/* 14. SGI_color_table */
|
||||
#if 0
|
||||
SET_ColorTableSGI(exec, _mesa_ColorTable);
|
||||
SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
|
||||
SET_GetColorTableSGI(exec, _mesa_GetColorTable);
|
||||
SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
|
||||
SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
|
||||
#endif
|
||||
|
||||
/* 30. GL_EXT_vertex_array */
|
||||
#if _HAVE_FULL_GL
|
||||
SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
|
||||
|
@ -270,11 +220,6 @@ _mesa_create_exec_table(void)
|
|||
SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
|
||||
#endif
|
||||
|
||||
/* 37. GL_EXT_blend_minmax */
|
||||
#if 0
|
||||
SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT);
|
||||
#endif
|
||||
|
||||
/* 54. GL_EXT_point_parameters */
|
||||
#if _HAVE_FULL_GL
|
||||
SET_PointParameterfEXT(exec, _mesa_PointParameterf);
|
||||
|
@ -287,11 +232,6 @@ _mesa_create_exec_table(void)
|
|||
SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
|
||||
#endif
|
||||
|
||||
/* 173. GL_INGR_blend_func_separate */
|
||||
#if _HAVE_FULL_GL
|
||||
SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT);
|
||||
#endif
|
||||
|
||||
/* 197. GL_MESA_window_pos */
|
||||
/* part of _mesa_init_rastpos_dispatch(exec); */
|
||||
|
||||
|
@ -301,43 +241,6 @@ _mesa_create_exec_table(void)
|
|||
SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
|
||||
#endif
|
||||
|
||||
/* 233. GL_NV_vertex_program */
|
||||
#if FEATURE_NV_vertex_program
|
||||
SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
|
||||
SET_GenProgramsNV(exec, _mesa_GenPrograms);
|
||||
SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
|
||||
SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
|
||||
SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
|
||||
SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
|
||||
SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
|
||||
SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
|
||||
SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
|
||||
SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
|
||||
SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
|
||||
SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
|
||||
SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
|
||||
SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
|
||||
SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
|
||||
SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
|
||||
/* glVertexAttrib*NV functions handled in api_loopback.c */
|
||||
#endif
|
||||
|
||||
/* 273. GL_APPLE_vertex_array_object */
|
||||
SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
|
||||
SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
|
||||
SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
|
||||
SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
|
||||
|
||||
/* 282. GL_NV_fragment_program */
|
||||
#if FEATURE_NV_fragment_program
|
||||
SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
|
||||
SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
|
||||
SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
|
||||
SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
|
||||
SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
|
||||
SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
|
||||
#endif
|
||||
|
||||
/* 262. GL_NV_point_sprite */
|
||||
#if _HAVE_FULL_GL
|
||||
SET_PointParameteriNV(exec, _mesa_PointParameteri);
|
||||
|
@ -381,16 +284,6 @@ _mesa_create_exec_table(void)
|
|||
SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
|
||||
#endif
|
||||
|
||||
/* GL_ARB_vertex_array_object */
|
||||
SET_BindVertexArray(exec, _mesa_BindVertexArray);
|
||||
SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
|
||||
|
||||
#if FEATURE_APPLE_object_purgeable
|
||||
SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
|
||||
SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
|
||||
SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
|
||||
#endif
|
||||
|
||||
/* GL_EXT_texture_integer */
|
||||
SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
|
||||
SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
|
||||
|
@ -399,12 +292,6 @@ _mesa_create_exec_table(void)
|
|||
SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
|
||||
SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
|
||||
|
||||
/* GL 3.0 (functions not covered by other extensions) */
|
||||
SET_GetStringi(exec, _mesa_GetStringi);
|
||||
|
||||
/* GL_NV_texture_barrier */
|
||||
SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
|
||||
|
||||
/* GL_ARB_texture_storage */
|
||||
SET_TexStorage1D(exec, _mesa_TexStorage1D);
|
||||
SET_TexStorage2D(exec, _mesa_TexStorage2D);
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#define RECTF(a,b,c,d) CALL_Rectf(GET_DISPATCH(), (a,b,c,d))
|
||||
|
||||
#define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x))
|
||||
#define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c))
|
||||
|
||||
#define ATTRIB1NV(index,x) CALL_VertexAttrib1fNV(GET_DISPATCH(), (index,x))
|
||||
#define ATTRIB2NV(index,x,y) CALL_VertexAttrib2fNV(GET_DISPATCH(), (index,x,y))
|
||||
|
@ -765,113 +764,6 @@ loopback_Rectsv(const GLshort *v1, const GLshort *v2)
|
|||
RECTF((GLfloat) v1[0], (GLfloat) v1[1], (GLfloat) v2[0], (GLfloat) v2[1]);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3bEXT_f( GLbyte red, GLbyte green, GLbyte blue )
|
||||
{
|
||||
SECONDARYCOLORF( BYTE_TO_FLOAT(red),
|
||||
BYTE_TO_FLOAT(green),
|
||||
BYTE_TO_FLOAT(blue) );
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3dEXT_f( GLdouble red, GLdouble green, GLdouble blue )
|
||||
{
|
||||
SECONDARYCOLORF( (GLfloat) red, (GLfloat) green, (GLfloat) blue );
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3iEXT_f( GLint red, GLint green, GLint blue )
|
||||
{
|
||||
SECONDARYCOLORF( INT_TO_FLOAT(red),
|
||||
INT_TO_FLOAT(green),
|
||||
INT_TO_FLOAT(blue));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3sEXT_f( GLshort red, GLshort green, GLshort blue )
|
||||
{
|
||||
SECONDARYCOLORF(SHORT_TO_FLOAT(red),
|
||||
SHORT_TO_FLOAT(green),
|
||||
SHORT_TO_FLOAT(blue));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3uiEXT_f( GLuint red, GLuint green, GLuint blue )
|
||||
{
|
||||
SECONDARYCOLORF(UINT_TO_FLOAT(red),
|
||||
UINT_TO_FLOAT(green),
|
||||
UINT_TO_FLOAT(blue));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3usEXT_f( GLushort red, GLushort green, GLushort blue )
|
||||
{
|
||||
SECONDARYCOLORF(USHORT_TO_FLOAT(red),
|
||||
USHORT_TO_FLOAT(green),
|
||||
USHORT_TO_FLOAT(blue));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3ubEXT_f( GLubyte red, GLubyte green, GLubyte blue )
|
||||
{
|
||||
SECONDARYCOLORF(UBYTE_TO_FLOAT(red),
|
||||
UBYTE_TO_FLOAT(green),
|
||||
UBYTE_TO_FLOAT(blue));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3bvEXT_f( const GLbyte *v )
|
||||
{
|
||||
SECONDARYCOLORF(BYTE_TO_FLOAT(v[0]),
|
||||
BYTE_TO_FLOAT(v[1]),
|
||||
BYTE_TO_FLOAT(v[2]));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3dvEXT_f( const GLdouble *v )
|
||||
{
|
||||
SECONDARYCOLORF( (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
|
||||
}
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3ivEXT_f( const GLint *v )
|
||||
{
|
||||
SECONDARYCOLORF(INT_TO_FLOAT(v[0]),
|
||||
INT_TO_FLOAT(v[1]),
|
||||
INT_TO_FLOAT(v[2]));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3svEXT_f( const GLshort *v )
|
||||
{
|
||||
SECONDARYCOLORF(SHORT_TO_FLOAT(v[0]),
|
||||
SHORT_TO_FLOAT(v[1]),
|
||||
SHORT_TO_FLOAT(v[2]));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3uivEXT_f( const GLuint *v )
|
||||
{
|
||||
SECONDARYCOLORF(UINT_TO_FLOAT(v[0]),
|
||||
UINT_TO_FLOAT(v[1]),
|
||||
UINT_TO_FLOAT(v[2]));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3usvEXT_f( const GLushort *v )
|
||||
{
|
||||
SECONDARYCOLORF(USHORT_TO_FLOAT(v[0]),
|
||||
USHORT_TO_FLOAT(v[1]),
|
||||
USHORT_TO_FLOAT(v[2]));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_SecondaryColor3ubvEXT_f( const GLubyte *v )
|
||||
{
|
||||
SECONDARYCOLORF(UBYTE_TO_FLOAT(v[0]),
|
||||
UBYTE_TO_FLOAT(v[1]),
|
||||
UBYTE_TO_FLOAT(v[2]));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GL_NV_vertex_program:
|
||||
|
@ -991,113 +883,6 @@ loopback_VertexAttrib4ubvNV(GLuint index, const GLubyte *v)
|
|||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs1svNV(GLuint index, GLsizei n, const GLshort *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib1svNV(index + i, v + i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
ATTRIB1NV(index + i, v[i]);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib1dvNV(index + i, v + i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs2svNV(GLuint index, GLsizei n, const GLshort *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib2svNV(index + i, v + 2 * i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
ATTRIB2NV(index + i, v[2 * i], v[2 * i + 1]);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib2dvNV(index + i, v + 2 * i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs3svNV(GLuint index, GLsizei n, const GLshort *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib3svNV(index + i, v + 3 * i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
ATTRIB3NV(index + i, v[3 * i], v[3 * i + 1], v[3 * i + 2]);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib3dvNV(index + i, v + 3 * i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs4svNV(GLuint index, GLsizei n, const GLshort *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib4svNV(index + i, v + 4 * i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
ATTRIB4NV(index + i, v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3]);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib4dvNV(index + i, v + 4 * i);
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
loopback_VertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v)
|
||||
{
|
||||
GLint i;
|
||||
for (i = n - 1; i >= 0; i--)
|
||||
loopback_VertexAttrib4ubvNV(index + i, v + 4 * i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This code never registers handlers for any of the entry points
|
||||
* listed in vtxfmt.h.
|
||||
|
@ -1133,21 +918,6 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
|
|||
SET_Color4uiv(dest, loopback_Color4uiv_f);
|
||||
SET_Color4usv(dest, loopback_Color4usv_f);
|
||||
SET_Color4ubv(dest, loopback_Color4ubv_f);
|
||||
|
||||
SET_SecondaryColor3bEXT(dest, loopback_SecondaryColor3bEXT_f);
|
||||
SET_SecondaryColor3dEXT(dest, loopback_SecondaryColor3dEXT_f);
|
||||
SET_SecondaryColor3iEXT(dest, loopback_SecondaryColor3iEXT_f);
|
||||
SET_SecondaryColor3sEXT(dest, loopback_SecondaryColor3sEXT_f);
|
||||
SET_SecondaryColor3uiEXT(dest, loopback_SecondaryColor3uiEXT_f);
|
||||
SET_SecondaryColor3usEXT(dest, loopback_SecondaryColor3usEXT_f);
|
||||
SET_SecondaryColor3ubEXT(dest, loopback_SecondaryColor3ubEXT_f);
|
||||
SET_SecondaryColor3bvEXT(dest, loopback_SecondaryColor3bvEXT_f);
|
||||
SET_SecondaryColor3dvEXT(dest, loopback_SecondaryColor3dvEXT_f);
|
||||
SET_SecondaryColor3ivEXT(dest, loopback_SecondaryColor3ivEXT_f);
|
||||
SET_SecondaryColor3svEXT(dest, loopback_SecondaryColor3svEXT_f);
|
||||
SET_SecondaryColor3uivEXT(dest, loopback_SecondaryColor3uivEXT_f);
|
||||
SET_SecondaryColor3usvEXT(dest, loopback_SecondaryColor3usvEXT_f);
|
||||
SET_SecondaryColor3ubvEXT(dest, loopback_SecondaryColor3ubvEXT_f);
|
||||
|
||||
SET_EdgeFlagv(dest, loopback_EdgeFlagv);
|
||||
|
||||
|
@ -1246,19 +1016,6 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest )
|
|||
SET_VertexAttrib4svNV(dest, loopback_VertexAttrib4svNV);
|
||||
SET_VertexAttrib4dvNV(dest, loopback_VertexAttrib4dvNV);
|
||||
SET_VertexAttrib4ubvNV(dest, loopback_VertexAttrib4ubvNV);
|
||||
SET_VertexAttribs1svNV(dest, loopback_VertexAttribs1svNV);
|
||||
SET_VertexAttribs1fvNV(dest, loopback_VertexAttribs1fvNV);
|
||||
SET_VertexAttribs1dvNV(dest, loopback_VertexAttribs1dvNV);
|
||||
SET_VertexAttribs2svNV(dest, loopback_VertexAttribs2svNV);
|
||||
SET_VertexAttribs2fvNV(dest, loopback_VertexAttribs2fvNV);
|
||||
SET_VertexAttribs2dvNV(dest, loopback_VertexAttribs2dvNV);
|
||||
SET_VertexAttribs3svNV(dest, loopback_VertexAttribs3svNV);
|
||||
SET_VertexAttribs3fvNV(dest, loopback_VertexAttribs3fvNV);
|
||||
SET_VertexAttribs3dvNV(dest, loopback_VertexAttribs3dvNV);
|
||||
SET_VertexAttribs4svNV(dest, loopback_VertexAttribs4svNV);
|
||||
SET_VertexAttribs4fvNV(dest, loopback_VertexAttribs4fvNV);
|
||||
SET_VertexAttribs4dvNV(dest, loopback_VertexAttribs4dvNV);
|
||||
SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
|
|||
/* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic
|
||||
* array [0]).
|
||||
*/
|
||||
return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled;
|
||||
return ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled;
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,14 +130,14 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
|
|||
memset(&ib, 0, sizeof(ib));
|
||||
ib.type = type;
|
||||
ib.ptr = indices;
|
||||
ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
|
||||
ib.obj = ctx->Array.ElementArrayBufferObj;
|
||||
|
||||
vbo_get_minmax_index(ctx, &prim, &ib, &min, &max);
|
||||
|
||||
if (max >= ctx->Array.ArrayObj->_MaxElement) {
|
||||
if (max >= ctx->Array._MaxElement) {
|
||||
/* the max element is out of bounds of one or more enabled arrays */
|
||||
_mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
|
||||
max, ctx->Array.ArrayObj->_MaxElement);
|
||||
max, ctx->Array._MaxElement);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
@ -197,10 +197,10 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
|
|||
return GL_FALSE;
|
||||
|
||||
/* Vertex buffer object tests */
|
||||
if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
|
||||
if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) {
|
||||
/* use indices in the buffer object */
|
||||
/* make sure count doesn't go outside buffer bounds */
|
||||
if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
|
||||
if (index_bytes(type, count) > ctx->Array.ElementArrayBufferObj->Size) {
|
||||
_mesa_warning(ctx, "glDrawElements index out of buffer bounds");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
@ -218,67 +218,6 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Error checking for glDrawRangeElements(). Includes parameter checking
|
||||
* and VBO bounds checking.
|
||||
* \return GL_TRUE if OK to render, GL_FALSE if error found
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
|
||||
GLuint start, GLuint end,
|
||||
GLsizei count, GLenum type,
|
||||
const GLvoid *indices)
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||
|
||||
if (count <= 0) {
|
||||
if (count < 0)
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!_mesa_valid_prim_mode(ctx, mode)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (end < start) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (type != GL_UNSIGNED_INT &&
|
||||
type != GL_UNSIGNED_BYTE &&
|
||||
type != GL_UNSIGNED_SHORT) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)" );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!check_valid_to_render(ctx, "glDrawRangeElements"))
|
||||
return GL_FALSE;
|
||||
|
||||
/* Vertex buffer object tests */
|
||||
if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
|
||||
/* use indices in the buffer object */
|
||||
/* make sure count doesn't go outside buffer bounds */
|
||||
if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
|
||||
_mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds");
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* not using a VBO */
|
||||
if (!indices)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!check_index_bounds(ctx, count, type, indices))
|
||||
return GL_FALSE;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called from the tnl module to error check the function parameters and
|
||||
* verify that we really can draw something.
|
||||
|
@ -305,7 +244,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
|
|||
return GL_FALSE;
|
||||
|
||||
if (ctx->Const.CheckArrayBounds) {
|
||||
if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
|
||||
if (start + count > (GLint) ctx->Array._MaxElement)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,10 +55,4 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
|
|||
GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
|
||||
GLuint start, GLuint end,
|
||||
GLsizei count, GLenum type,
|
||||
const GLvoid *indices);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,533 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.6
|
||||
*
|
||||
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
|
||||
* (C) Copyright IBM Corporation 2006
|
||||
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL OR IBM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file arrayobj.c
|
||||
* Functions for the GL_APPLE_vertex_array_object extension.
|
||||
*
|
||||
* \todo
|
||||
* The code in this file borrows a lot from bufferobj.c. There's a certain
|
||||
* amount of cruft left over from that origin that may be unnecessary.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
* \author Brian Paul
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/**
|
||||
* Look up the array object for the given ID.
|
||||
*
|
||||
* \returns
|
||||
* Either a pointer to the array object with the specified ID or \c NULL for
|
||||
* a non-existent ID. The spec defines ID 0 as being technically
|
||||
* non-existent.
|
||||
*/
|
||||
|
||||
static inline struct gl_array_object *
|
||||
lookup_arrayobj(struct gl_context *ctx, GLuint id)
|
||||
{
|
||||
if (id == 0)
|
||||
return NULL;
|
||||
else
|
||||
return (struct gl_array_object *)
|
||||
_mesa_HashLookup(ctx->Array.Objects, id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For all the vertex arrays in the array object, unbind any pointers
|
||||
* to any buffer objects (VBOs).
|
||||
* This is done just prior to array object destruction.
|
||||
*/
|
||||
static void
|
||||
unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj)
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
for (i = 0; i < Elements(obj->VertexAttrib); i++)
|
||||
_mesa_reference_buffer_object(ctx, &obj->VertexAttrib[i].BufferObj, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allocate and initialize a new vertex array object.
|
||||
*
|
||||
* This function is intended to be called via
|
||||
* \c dd_function_table::NewArrayObject.
|
||||
*/
|
||||
struct gl_array_object *
|
||||
_mesa_new_array_object( struct gl_context *ctx, GLuint name )
|
||||
{
|
||||
struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object);
|
||||
if (obj)
|
||||
_mesa_initialize_array_object(ctx, obj, name);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete an array object.
|
||||
*
|
||||
* This function is intended to be called via
|
||||
* \c dd_function_table::DeleteArrayObject.
|
||||
*/
|
||||
void
|
||||
_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
|
||||
{
|
||||
(void) ctx;
|
||||
unbind_array_object_vbos(ctx, obj);
|
||||
_mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL);
|
||||
_glthread_DESTROY_MUTEX(obj->Mutex);
|
||||
free(obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set ptr to arrayObj w/ reference counting.
|
||||
*/
|
||||
void
|
||||
_mesa_reference_array_object(struct gl_context *ctx,
|
||||
struct gl_array_object **ptr,
|
||||
struct gl_array_object *arrayObj)
|
||||
{
|
||||
if (*ptr == arrayObj)
|
||||
return;
|
||||
|
||||
if (*ptr) {
|
||||
/* Unreference the old array object */
|
||||
GLboolean deleteFlag = GL_FALSE;
|
||||
struct gl_array_object *oldObj = *ptr;
|
||||
|
||||
_glthread_LOCK_MUTEX(oldObj->Mutex);
|
||||
ASSERT(oldObj->RefCount > 0);
|
||||
oldObj->RefCount--;
|
||||
#if 0
|
||||
printf("ArrayObj %p %d DECR to %d\n",
|
||||
(void *) oldObj, oldObj->Name, oldObj->RefCount);
|
||||
#endif
|
||||
deleteFlag = (oldObj->RefCount == 0);
|
||||
_glthread_UNLOCK_MUTEX(oldObj->Mutex);
|
||||
|
||||
if (deleteFlag) {
|
||||
ASSERT(ctx->Driver.DeleteArrayObject);
|
||||
ctx->Driver.DeleteArrayObject(ctx, oldObj);
|
||||
}
|
||||
|
||||
*ptr = NULL;
|
||||
}
|
||||
ASSERT(!*ptr);
|
||||
|
||||
if (arrayObj) {
|
||||
/* reference new array object */
|
||||
_glthread_LOCK_MUTEX(arrayObj->Mutex);
|
||||
if (arrayObj->RefCount == 0) {
|
||||
/* this array's being deleted (look just above) */
|
||||
/* Not sure this can every really happen. Warn if it does. */
|
||||
_mesa_problem(NULL, "referencing deleted array object");
|
||||
*ptr = NULL;
|
||||
}
|
||||
else {
|
||||
arrayObj->RefCount++;
|
||||
#if 0
|
||||
printf("ArrayObj %p %d INCR to %d\n",
|
||||
(void *) arrayObj, arrayObj->Name, arrayObj->RefCount);
|
||||
#endif
|
||||
*ptr = arrayObj;
|
||||
}
|
||||
_glthread_UNLOCK_MUTEX(arrayObj->Mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init_array(struct gl_context *ctx,
|
||||
struct gl_client_array *array, GLint size, GLint type)
|
||||
{
|
||||
array->Size = size;
|
||||
array->Type = type;
|
||||
array->Stride = 0;
|
||||
array->StrideB = 0;
|
||||
array->Ptr = NULL;
|
||||
array->Enabled = GL_FALSE;
|
||||
array->Normalized = GL_FALSE;
|
||||
array->Integer = GL_FALSE;
|
||||
array->_ElementSize = size * _mesa_sizeof_type(type);
|
||||
/* Vertex array buffers */
|
||||
_mesa_reference_buffer_object(ctx, &array->BufferObj,
|
||||
ctx->Shared->NullBufferObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a gl_array_object's arrays.
|
||||
*/
|
||||
void
|
||||
_mesa_initialize_array_object( struct gl_context *ctx,
|
||||
struct gl_array_object *obj,
|
||||
GLuint name )
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
obj->Name = name;
|
||||
|
||||
_glthread_INIT_MUTEX(obj->Mutex);
|
||||
obj->RefCount = 1;
|
||||
|
||||
/* Init the individual arrays */
|
||||
for (i = 0; i < Elements(obj->VertexAttrib); i++) {
|
||||
switch (i) {
|
||||
case VERT_ATTRIB_WEIGHT:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_WEIGHT], 1, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_NORMAL:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_NORMAL], 3, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_COLOR1:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_COLOR1], 3, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_FOG:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_FOG], 1, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_COLOR_INDEX:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX], 1, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_EDGEFLAG:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_EDGEFLAG], 1, GL_BOOL);
|
||||
break;
|
||||
#if FEATURE_point_size_array
|
||||
case VERT_ATTRIB_POINT_SIZE:
|
||||
init_array(ctx, &obj->VertexAttrib[VERT_ATTRIB_POINT_SIZE], 1, GL_FLOAT);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
init_array(ctx, &obj->VertexAttrib[i], 4, GL_FLOAT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj,
|
||||
ctx->Shared->NullBufferObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add the given array object to the array object pool.
|
||||
*/
|
||||
static void
|
||||
save_array_object( struct gl_context *ctx, struct gl_array_object *obj )
|
||||
{
|
||||
if (obj->Name > 0) {
|
||||
/* insert into hash table */
|
||||
_mesa_HashInsert(ctx->Array.Objects, obj->Name, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the given array object from the array object pool.
|
||||
* Do not deallocate the array object though.
|
||||
*/
|
||||
static void
|
||||
remove_array_object( struct gl_context *ctx, struct gl_array_object *obj )
|
||||
{
|
||||
if (obj->Name > 0) {
|
||||
/* remove from hash table */
|
||||
_mesa_HashRemove(ctx->Array.Objects, obj->Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper for update_arrays().
|
||||
* \return min(current min, array->_MaxElement).
|
||||
*/
|
||||
static GLuint
|
||||
update_min(GLuint min, struct gl_client_array *array)
|
||||
{
|
||||
assert(array->Enabled);
|
||||
_mesa_update_array_max_element(array);
|
||||
return MIN2(min, array->_MaxElement);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Examine vertex arrays to update the gl_array_object::_MaxElement field.
|
||||
*/
|
||||
void
|
||||
_mesa_update_array_object_max_element(struct gl_context *ctx,
|
||||
struct gl_array_object *arrayObj)
|
||||
{
|
||||
GLbitfield64 enabled = arrayObj->_Enabled;
|
||||
GLuint min = ~0u;
|
||||
|
||||
while (enabled) {
|
||||
GLint attrib = _mesa_ffsll(enabled) - 1;
|
||||
enabled &= ~BITFIELD64_BIT(attrib);
|
||||
min = update_min(min, &arrayObj->VertexAttrib[attrib]);
|
||||
}
|
||||
|
||||
/* _MaxElement is one past the last legal array element */
|
||||
arrayObj->_MaxElement = min;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* API Functions */
|
||||
/**********************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Helper for _mesa_BindVertexArray() and _mesa_BindVertexArrayAPPLE().
|
||||
* \param genRequired specifies behavour when id was not generated with
|
||||
* glGenVertexArrays().
|
||||
*/
|
||||
static void
|
||||
bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
|
||||
{
|
||||
struct gl_array_object * const oldObj = ctx->Array.ArrayObj;
|
||||
struct gl_array_object *newObj = NULL;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
ASSERT(oldObj != NULL);
|
||||
|
||||
if ( oldObj->Name == id )
|
||||
return; /* rebinding the same array object- no change */
|
||||
|
||||
/*
|
||||
* Get pointer to new array object (newObj)
|
||||
*/
|
||||
if (id == 0) {
|
||||
/* The spec says there is no array object named 0, but we use
|
||||
* one internally because it simplifies things.
|
||||
*/
|
||||
newObj = ctx->Array.DefaultArrayObj;
|
||||
}
|
||||
else {
|
||||
/* non-default array object */
|
||||
newObj = lookup_arrayobj(ctx, id);
|
||||
if (!newObj) {
|
||||
if (genRequired) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexArray(id)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* For APPLE version, generate a new array object now */
|
||||
newObj = (*ctx->Driver.NewArrayObject)(ctx, id);
|
||||
if (!newObj) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE");
|
||||
return;
|
||||
}
|
||||
|
||||
save_array_object(ctx, newObj);
|
||||
}
|
||||
|
||||
if (!newObj->_Used) {
|
||||
/* The "Interactions with APPLE_vertex_array_object" section of the
|
||||
* GL_ARB_vertex_array_object spec says:
|
||||
*
|
||||
* "The first bind call, either BindVertexArray or
|
||||
* BindVertexArrayAPPLE, determines the semantic of the object."
|
||||
*/
|
||||
newObj->ARBsemantics = genRequired;
|
||||
newObj->_Used = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= VERT_BIT_ALL;
|
||||
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj);
|
||||
|
||||
/* Pass BindVertexArray call to device driver */
|
||||
if (ctx->Driver.BindArrayObject && newObj)
|
||||
ctx->Driver.BindArrayObject(ctx, newObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ARB version of glBindVertexArray()
|
||||
* This function behaves differently from glBindVertexArrayAPPLE() in
|
||||
* that this function requires all ids to have been previously generated
|
||||
* by glGenVertexArrays[APPLE]().
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BindVertexArray( GLuint id )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
bind_vertex_array(ctx, id, GL_TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Bind a new array.
|
||||
*
|
||||
* \todo
|
||||
* The binding could be done more efficiently by comparing the non-NULL
|
||||
* pointers in the old and new objects. The only arrays that are "dirty" are
|
||||
* the ones that are non-NULL in either object.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BindVertexArrayAPPLE( GLuint id )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
bind_vertex_array(ctx, id, GL_FALSE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a set of array objects.
|
||||
*
|
||||
* \param n Number of array objects to delete.
|
||||
* \param ids Array of \c n array object IDs.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
GLsizei i;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (n < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArrayAPPLE(n)");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
struct gl_array_object *obj = lookup_arrayobj(ctx, ids[i]);
|
||||
|
||||
if ( obj != NULL ) {
|
||||
ASSERT( obj->Name == ids[i] );
|
||||
|
||||
/* If the array object is currently bound, the spec says "the binding
|
||||
* for that object reverts to zero and the default vertex array
|
||||
* becomes current."
|
||||
*/
|
||||
if ( obj == ctx->Array.ArrayObj ) {
|
||||
CALL_BindVertexArrayAPPLE( ctx->Exec, (0) );
|
||||
}
|
||||
|
||||
/* The ID is immediately freed for re-use */
|
||||
remove_array_object(ctx, obj);
|
||||
|
||||
/* Unreference the array object.
|
||||
* If refcount hits zero, the object will be deleted.
|
||||
*/
|
||||
_mesa_reference_array_object(ctx, &obj, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a set of unique array object IDs and store them in \c arrays.
|
||||
* Helper for _mesa_GenVertexArrays[APPLE]() functions below.
|
||||
* \param n Number of IDs to generate.
|
||||
* \param arrays Array of \c n locations to store the IDs.
|
||||
* \param vboOnly Will arrays have to reside in VBOs?
|
||||
*/
|
||||
static void
|
||||
gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
|
||||
{
|
||||
GLuint first;
|
||||
GLint i;
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (n < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArraysAPPLE");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!arrays) {
|
||||
return;
|
||||
}
|
||||
|
||||
first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n);
|
||||
|
||||
/* Allocate new, empty array objects and return identifiers */
|
||||
for (i = 0; i < n; i++) {
|
||||
struct gl_array_object *obj;
|
||||
GLuint name = first + i;
|
||||
|
||||
obj = (*ctx->Driver.NewArrayObject)( ctx, name );
|
||||
if (!obj) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE");
|
||||
return;
|
||||
}
|
||||
save_array_object(ctx, obj);
|
||||
arrays[i] = first + i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ARB version of glGenVertexArrays()
|
||||
* All arrays will be required to live in VBOs.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
gen_vertex_arrays(ctx, n, arrays);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APPLE version of glGenVertexArraysAPPLE()
|
||||
* Arrays may live in VBOs or ordinary memory.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
gen_vertex_arrays(ctx, n, arrays);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if ID is the name of an array object.
|
||||
*
|
||||
* \param id ID of the potential array object.
|
||||
* \return \c GL_TRUE if \c id is the name of a array object,
|
||||
* \c GL_FALSE otherwise.
|
||||
*/
|
||||
GLboolean GLAPIENTRY
|
||||
_mesa_IsVertexArrayAPPLE( GLuint id )
|
||||
{
|
||||
struct gl_array_object * obj;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||
|
||||
if (id == 0)
|
||||
return GL_FALSE;
|
||||
|
||||
obj = lookup_arrayobj(ctx, id);
|
||||
|
||||
return (obj != NULL) ? GL_TRUE : GL_FALSE;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.6
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
* (C) Copyright IBM Corporation 2006
|
||||
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL OR IBM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ARRAYOBJ_H
|
||||
#define ARRAYOBJ_H
|
||||
|
||||
#include "glheader.h"
|
||||
|
||||
struct gl_context;
|
||||
|
||||
/**
|
||||
* \file arrayobj.h
|
||||
* Functions for the GL_APPLE_vertex_array_object extension.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
* \author Brian Paul
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internal functions
|
||||
*/
|
||||
|
||||
extern struct gl_array_object *
|
||||
_mesa_new_array_object( struct gl_context *ctx, GLuint name );
|
||||
|
||||
extern void
|
||||
_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
|
||||
|
||||
extern void
|
||||
_mesa_reference_array_object(struct gl_context *ctx,
|
||||
struct gl_array_object **ptr,
|
||||
struct gl_array_object *arrayObj);
|
||||
|
||||
extern void
|
||||
_mesa_initialize_array_object( struct gl_context *ctx,
|
||||
struct gl_array_object *obj, GLuint name );
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_update_array_object_max_element(struct gl_context *ctx,
|
||||
struct gl_array_object *arrayObj);
|
||||
|
||||
|
||||
/*
|
||||
* API functions
|
||||
*/
|
||||
|
||||
|
||||
void GLAPIENTRY _mesa_BindVertexArray( GLuint id );
|
||||
|
||||
void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
|
||||
|
||||
void GLAPIENTRY _mesa_DeleteVertexArraysAPPLE(GLsizei n, const GLuint *ids);
|
||||
|
||||
void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
|
||||
|
||||
void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
|
||||
|
||||
GLboolean GLAPIENTRY _mesa_IsVertexArrayAPPLE( GLuint id );
|
||||
|
||||
#endif /* ARRAYOBJ_H */
|
|
@ -529,7 +529,6 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
|
|||
if (ctx->Texture.Unit.Enabled != enabled) {
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_1D, !!(enabled & TEXTURE_1D_BIT));
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_2D, !!(enabled & TEXTURE_2D_BIT));
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_3D, !!(enabled & TEXTURE_3D_BIT));
|
||||
if (ctx->Extensions.ARB_texture_cube_map) {
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP,
|
||||
!!(enabled & TEXTURE_CUBE_BIT));
|
||||
|
@ -561,7 +560,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
|
|||
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_1D, !!(unit->Enabled & TEXTURE_1D_BIT));
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & TEXTURE_2D_BIT));
|
||||
_mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & TEXTURE_3D_BIT));
|
||||
|
||||
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode);
|
||||
_mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor);
|
||||
|
@ -725,25 +723,7 @@ _mesa_PopAttrib(void)
|
|||
_mesa_set_enable(ctx, GL_BLEND, (color->BlendEnabled & 1));
|
||||
}
|
||||
/* set same blend modes for all buffers */
|
||||
_mesa_BlendFuncSeparateEXT(color->SrcRGB,
|
||||
color->DstRGB,
|
||||
color->SrcA,
|
||||
color->DstA);
|
||||
/* This special case is because glBlendEquationSeparateEXT
|
||||
* cannot take GL_LOGIC_OP as a parameter.
|
||||
*/
|
||||
if (color->EquationRGB == color->EquationA) {
|
||||
_mesa_BlendEquation(color->EquationRGB);
|
||||
}
|
||||
else {
|
||||
_mesa_BlendEquationSeparateEXT(
|
||||
color->EquationRGB,
|
||||
color->EquationA);
|
||||
}
|
||||
_mesa_BlendColor(color->BlendColor[0],
|
||||
color->BlendColor[1],
|
||||
color->BlendColor[2],
|
||||
color->BlendColor[3]);
|
||||
_mesa_BlendFunc(color->SrcFactor, color->DstFactor);
|
||||
_mesa_LogicOp(color->LogicOp);
|
||||
_mesa_set_enable(ctx, GL_COLOR_LOGIC_OP,
|
||||
color->ColorLogicOpEnabled);
|
||||
|
@ -858,8 +838,6 @@ _mesa_PopAttrib(void)
|
|||
(GLfloat) light->Model.LocalViewer);
|
||||
_mesa_LightModelf(GL_LIGHT_MODEL_TWO_SIDE,
|
||||
(GLfloat) light->Model.TwoSide);
|
||||
_mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL,
|
||||
(GLfloat) light->Model.ColorControl);
|
||||
/* shade model */
|
||||
_mesa_ShadeModel(light->ShadeModel);
|
||||
/* color material */
|
||||
|
@ -1058,31 +1036,6 @@ copy_pixelstore(struct gl_context *ctx,
|
|||
#define GL_CLIENT_PACK_BIT (1<<20)
|
||||
#define GL_CLIENT_UNPACK_BIT (1<<21)
|
||||
|
||||
/**
|
||||
* Copy gl_array_object from src to dest.
|
||||
* 'dest' must be in an initialized state.
|
||||
*/
|
||||
static void
|
||||
copy_array_object(struct gl_context *ctx,
|
||||
struct gl_array_object *dest,
|
||||
struct gl_array_object *src)
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
/* skip Name */
|
||||
/* skip RefCount */
|
||||
|
||||
/* In theory must be the same anyway, but on recreate make sure it matches */
|
||||
dest->ARBsemantics = src->ARBsemantics;
|
||||
|
||||
for (i = 0; i < Elements(src->VertexAttrib); i++)
|
||||
_mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
|
||||
|
||||
/* _Enabled must be the same than on push */
|
||||
dest->_Enabled = src->_Enabled;
|
||||
dest->_MaxElement = src->_MaxElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy gl_array_attrib from src to dest.
|
||||
* 'dest' must be in an initialized state.
|
||||
|
@ -1090,21 +1043,30 @@ copy_array_object(struct gl_context *ctx,
|
|||
static void
|
||||
copy_array_attrib(struct gl_context *ctx,
|
||||
struct gl_array_attrib *dest,
|
||||
struct gl_array_attrib *src,
|
||||
GLboolean vbo_deleted)
|
||||
struct gl_array_attrib *src)
|
||||
{
|
||||
/* skip ArrayObj */
|
||||
/* skip DefaultArrayObj, Objects */
|
||||
dest->LockFirst = src->LockFirst;
|
||||
dest->LockCount = src->LockCount;
|
||||
/* skip NewState */
|
||||
/* skip RebindArrays */
|
||||
GLuint i;
|
||||
|
||||
if (!vbo_deleted)
|
||||
copy_array_object(ctx, dest->ArrayObj, src->ArrayObj);
|
||||
/* skip ArrayObj */
|
||||
/* skip DefaultArrayObj, Objects */
|
||||
dest->LockFirst = src->LockFirst;
|
||||
dest->LockCount = src->LockCount;
|
||||
/* skip NewState */
|
||||
/* skip RebindArrays */
|
||||
|
||||
/* skip ArrayBufferObj */
|
||||
/* skip ElementArrayBufferObj */
|
||||
|
||||
/* skip Name */
|
||||
/* skip RefCount */
|
||||
|
||||
for (i = 0; i < Elements(src->VertexAttrib); i++)
|
||||
_mesa_copy_client_array(ctx, &dest->VertexAttrib[i], &src->VertexAttrib[i]);
|
||||
|
||||
/* _Enabled must be the same than on push */
|
||||
dest->_Enabled = src->_Enabled;
|
||||
dest->_MaxElement = src->_MaxElement;
|
||||
|
||||
/* skip ArrayBufferObj */
|
||||
/* skip ElementArrayBufferObj */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1115,17 +1077,12 @@ save_array_attrib(struct gl_context *ctx,
|
|||
struct gl_array_attrib *dest,
|
||||
struct gl_array_attrib *src)
|
||||
{
|
||||
/* Set the Name, needed for restore, but do never overwrite.
|
||||
* Needs to match value in the object hash. */
|
||||
dest->ArrayObj->Name = src->ArrayObj->Name;
|
||||
/* And copy all of the rest. */
|
||||
copy_array_attrib(ctx, dest, src, GL_FALSE);
|
||||
copy_array_attrib(ctx, dest, src);
|
||||
|
||||
/* Just reference them here */
|
||||
_mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj,
|
||||
src->ArrayBufferObj);
|
||||
_mesa_reference_buffer_object(ctx, &dest->ArrayObj->ElementArrayBufferObj,
|
||||
src->ArrayObj->ElementArrayBufferObj);
|
||||
_mesa_reference_buffer_object(ctx, &dest->ElementArrayBufferObj,
|
||||
src->ElementArrayBufferObj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1136,44 +1093,12 @@ restore_array_attrib(struct gl_context *ctx,
|
|||
struct gl_array_attrib *dest,
|
||||
struct gl_array_attrib *src)
|
||||
{
|
||||
/* The ARB_vertex_array_object spec says:
|
||||
*
|
||||
* "BindVertexArray fails and an INVALID_OPERATION error is generated
|
||||
* if array is not a name returned from a previous call to
|
||||
* GenVertexArrays, or if such a name has since been deleted with
|
||||
* DeleteVertexArrays."
|
||||
*
|
||||
* Therefore popping a deleted VAO cannot magically recreate it.
|
||||
*
|
||||
* The semantics of objects created using APPLE_vertex_array_objects behave
|
||||
* differently. These objects expect to be recreated by pop. Alas.
|
||||
*/
|
||||
const GLboolean arb_vao = (src->ArrayObj->Name != 0
|
||||
&& src->ArrayObj->ARBsemantics);
|
||||
copy_array_attrib(ctx, dest, src);
|
||||
|
||||
if (arb_vao && !_mesa_IsVertexArrayAPPLE(src->ArrayObj->Name))
|
||||
return;
|
||||
|
||||
_mesa_BindVertexArrayAPPLE(src->ArrayObj->Name);
|
||||
|
||||
/* Restore or recreate the buffer objects by the names ... */
|
||||
if (!arb_vao
|
||||
|| src->ArrayBufferObj->Name == 0
|
||||
|| _mesa_IsBufferARB(src->ArrayBufferObj->Name)) {
|
||||
/* ... and restore its content */
|
||||
copy_array_attrib(ctx, dest, src, GL_FALSE);
|
||||
|
||||
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
|
||||
src->ArrayBufferObj->Name);
|
||||
} else {
|
||||
copy_array_attrib(ctx, dest, src, GL_TRUE);
|
||||
}
|
||||
|
||||
if (!arb_vao
|
||||
|| src->ArrayObj->ElementArrayBufferObj->Name == 0
|
||||
|| _mesa_IsBufferARB(src->ArrayObj->ElementArrayBufferObj->Name))
|
||||
if (src->ElementArrayBufferObj->Name == 0
|
||||
|| _mesa_IsBufferARB(src->ElementArrayBufferObj->Name))
|
||||
_mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
|
||||
src->ArrayObj->ElementArrayBufferObj->Name);
|
||||
src->ElementArrayBufferObj->Name);
|
||||
|
||||
/* Better safe than sorry?! */
|
||||
dest->RebindArrays = GL_TRUE;
|
||||
|
@ -1183,36 +1108,7 @@ restore_array_attrib(struct gl_context *ctx,
|
|||
* FIXME: of the old ArrayObj->_Enabled and the new _Enabled.
|
||||
* ... just do it.
|
||||
*/
|
||||
dest->NewState |= src->ArrayObj->_Enabled | dest->ArrayObj->_Enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* init/alloc the fields of 'attrib'.
|
||||
* Needs to the init part matching free_array_attrib_data below.
|
||||
*/
|
||||
static void
|
||||
init_array_attrib_data(struct gl_context *ctx,
|
||||
struct gl_array_attrib *attrib)
|
||||
{
|
||||
/* Get a non driver gl_array_object. */
|
||||
attrib->ArrayObj = CALLOC_STRUCT( gl_array_object );
|
||||
_mesa_initialize_array_object(ctx, attrib->ArrayObj, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free/unreference the fields of 'attrib' but don't delete it (that's
|
||||
* done later in the calling code).
|
||||
* Needs to the cleanup part matching init_array_attrib_data above.
|
||||
*/
|
||||
static void
|
||||
free_array_attrib_data(struct gl_context *ctx,
|
||||
struct gl_array_attrib *attrib)
|
||||
{
|
||||
/* We use a non driver array object, so don't just unref since we would
|
||||
* end up using the drivers DeleteArrayObject function for deletion. */
|
||||
_mesa_delete_array_object(ctx, attrib->ArrayObj);
|
||||
attrib->ArrayObj = 0;
|
||||
_mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL);
|
||||
dest->NewState |= src->_Enabled | dest->_Enabled;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1249,7 +1145,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
|
|||
if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
|
||||
struct gl_array_attrib *attr;
|
||||
attr = CALLOC_STRUCT( gl_array_attrib );
|
||||
init_array_attrib_data(ctx, attr);
|
||||
_mesa_init_varray(ctx, attr);
|
||||
save_array_attrib(ctx, attr, &ctx->Array);
|
||||
save_attrib_data(&head, GL_CLIENT_VERTEX_ARRAY_BIT, attr);
|
||||
}
|
||||
|
@ -1299,7 +1195,7 @@ _mesa_PopClientAttrib(void)
|
|||
struct gl_array_attrib * attr =
|
||||
(struct gl_array_attrib *) node->data;
|
||||
restore_array_attrib(ctx, &ctx->Array, attr);
|
||||
free_array_attrib_data(ctx, attr);
|
||||
_mesa_free_varray_data(ctx, attr);
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -97,34 +97,19 @@ legal_dst_factor(const struct gl_context *ctx, GLenum factor)
|
|||
*/
|
||||
static GLboolean
|
||||
validate_blend_factors(struct gl_context *ctx, const char *func,
|
||||
GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA)
|
||||
GLenum srcfactor, GLenum dstfactor)
|
||||
{
|
||||
if (!legal_src_factor(ctx, sfactorRGB)) {
|
||||
if (!legal_src_factor(ctx, srcfactor)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"%s(sfactorRGB = %s)", func,
|
||||
_mesa_lookup_enum_by_nr(sfactorRGB));
|
||||
_mesa_lookup_enum_by_nr(srcfactor));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!legal_dst_factor(ctx, dfactorRGB)) {
|
||||
if (!legal_dst_factor(ctx, dstfactor)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"%s(dfactorRGB = %s)", func,
|
||||
_mesa_lookup_enum_by_nr(dfactorRGB));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (sfactorA != sfactorRGB && !legal_src_factor(ctx, sfactorA)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"%s(sfactorA = %s)", func,
|
||||
_mesa_lookup_enum_by_nr(sfactorA));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (dfactorA != dfactorRGB && !legal_dst_factor(ctx, dfactorA)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"%s(dfactorA = %s)", func,
|
||||
_mesa_lookup_enum_by_nr(dfactorA));
|
||||
_mesa_lookup_enum_by_nr(dstfactor));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
@ -138,190 +123,32 @@ validate_blend_factors(struct gl_context *ctx, const char *func,
|
|||
* \param sfactor source factor operator.
|
||||
* \param dfactor destination factor operator.
|
||||
*
|
||||
* \sa glBlendFunc, glBlendFuncSeparateEXT
|
||||
* \sa glBlendFunc
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
|
||||
{
|
||||
_mesa_BlendFuncSeparateEXT(sfactor, dfactor, sfactor, dfactor);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the separate blend source/dest factors for all draw buffers.
|
||||
*
|
||||
* \param sfactorRGB RGB source factor operator.
|
||||
* \param dfactorRGB RGB destination factor operator.
|
||||
* \param sfactorA alpha source factor operator.
|
||||
* \param dfactorA alpha destination factor operator.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n",
|
||||
_mesa_lookup_enum_by_nr(sfactorRGB),
|
||||
_mesa_lookup_enum_by_nr(dfactorRGB),
|
||||
_mesa_lookup_enum_by_nr(sfactorA),
|
||||
_mesa_lookup_enum_by_nr(dfactorA));
|
||||
_mesa_debug(ctx, "glBlendFunc %s %s\n",
|
||||
_mesa_lookup_enum_by_nr(sfactor),
|
||||
_mesa_lookup_enum_by_nr(dfactor));
|
||||
|
||||
if (!validate_blend_factors(ctx, "glBlendFuncSeparate",
|
||||
sfactorRGB, dfactorRGB,
|
||||
sfactorA, dfactorA)) {
|
||||
if (!validate_blend_factors(ctx, "glBlendFunc", sfactor, dfactor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Color.SrcRGB == sfactorRGB &&
|
||||
ctx->Color.DstRGB == dfactorRGB &&
|
||||
ctx->Color.SrcA == sfactorA &&
|
||||
ctx->Color.DstA == dfactorA) {
|
||||
if (ctx->Color.SrcFactor == sfactor &&
|
||||
ctx->Color.DstFactor == dfactor) {
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
|
||||
ctx->Color.SrcRGB = sfactorRGB;
|
||||
ctx->Color.DstRGB = dfactorRGB;
|
||||
ctx->Color.SrcA = sfactorA;
|
||||
ctx->Color.DstA = dfactorA;
|
||||
if (ctx->Driver.BlendFuncSeparate) {
|
||||
ctx->Driver.BlendFuncSeparate(ctx, sfactorRGB, dfactorRGB,
|
||||
sfactorA, dfactorA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if _HAVE_FULL_GL
|
||||
/**
|
||||
* Check if given blend equation is legal.
|
||||
* \return GL_TRUE if legal, GL_FALSE otherwise.
|
||||
*/
|
||||
static GLboolean
|
||||
legal_blend_equation(const struct gl_context *ctx, GLenum mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case GL_FUNC_ADD:
|
||||
case GL_FUNC_SUBTRACT:
|
||||
case GL_FUNC_REVERSE_SUBTRACT:
|
||||
return GL_TRUE;
|
||||
case GL_MIN:
|
||||
case GL_MAX:
|
||||
return ctx->Extensions.EXT_blend_minmax;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This is really an extension function! */
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendEquation( GLenum mode )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glBlendEquation(%s)\n",
|
||||
_mesa_lookup_enum_by_nr(mode));
|
||||
|
||||
if (!legal_blend_equation(ctx, mode)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Color.EquationRGB == mode && ctx->Color.EquationA == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.EquationRGB = mode;
|
||||
ctx->Color.EquationA = mode;
|
||||
|
||||
if (ctx->Driver.BlendEquationSeparate)
|
||||
(*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode );
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glBlendEquationSeparateEXT(%s %s)\n",
|
||||
_mesa_lookup_enum_by_nr(modeRGB),
|
||||
_mesa_lookup_enum_by_nr(modeA));
|
||||
|
||||
if ( (modeRGB != modeA) && !ctx->Extensions.EXT_blend_equation_separate ) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBlendEquationSeparateEXT not supported by driver");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!legal_blend_equation(ctx, modeRGB)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeRGB)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!legal_blend_equation(ctx, modeA)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->Color.EquationRGB == modeRGB && ctx->Color.EquationA == modeA) {
|
||||
return;
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
ctx->Color.EquationRGB = modeRGB;
|
||||
ctx->Color.EquationA = modeA;
|
||||
|
||||
if (ctx->Driver.BlendEquationSeparate)
|
||||
ctx->Driver.BlendEquationSeparate(ctx, modeRGB, modeA);
|
||||
}
|
||||
|
||||
|
||||
#endif /* _HAVE_FULL_GL */
|
||||
|
||||
|
||||
/**
|
||||
* Set the blending color.
|
||||
*
|
||||
* \param red red color component.
|
||||
* \param green green color component.
|
||||
* \param blue blue color component.
|
||||
* \param alpha alpha color component.
|
||||
*
|
||||
* \sa glBlendColor().
|
||||
*
|
||||
* Clamps the parameters and updates gl_colorbuffer_attrib::BlendColor. On a
|
||||
* change, flushes the vertices and notifies the driver via
|
||||
* dd_function_table::BlendColor callback.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
|
||||
{
|
||||
GLfloat tmp[4];
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
tmp[0] = red;
|
||||
tmp[1] = green;
|
||||
tmp[2] = blue;
|
||||
tmp[3] = alpha;
|
||||
|
||||
if (TEST_EQ_4V(tmp, ctx->Color.BlendColor))
|
||||
return;
|
||||
|
||||
FLUSH_VERTICES(ctx, _NEW_COLOR);
|
||||
COPY_4FV( ctx->Color.BlendColor, tmp );
|
||||
|
||||
if (ctx->Driver.BlendColor)
|
||||
(*ctx->Driver.BlendColor)(ctx, ctx->Color.BlendColor);
|
||||
ctx->Color.SrcFactor = sfactor;
|
||||
ctx->Color.DstFactor = dfactor;
|
||||
}
|
||||
|
||||
|
||||
|
@ -507,13 +334,8 @@ void _mesa_init_color( struct gl_context * ctx )
|
|||
ctx->Color.AlphaFunc = GL_ALWAYS;
|
||||
ctx->Color.AlphaRef = 0;
|
||||
ctx->Color.BlendEnabled = 0x0;
|
||||
ctx->Color.SrcRGB = GL_ONE;
|
||||
ctx->Color.DstRGB = GL_ZERO;
|
||||
ctx->Color.SrcA = GL_ONE;
|
||||
ctx->Color.DstA = GL_ZERO;
|
||||
ctx->Color.EquationRGB = GL_FUNC_ADD;
|
||||
ctx->Color.EquationA = GL_FUNC_ADD;
|
||||
ASSIGN_4V( ctx->Color.BlendColor, 0.0, 0.0, 0.0, 0.0 );
|
||||
ctx->Color.SrcFactor = GL_ONE;
|
||||
ctx->Color.DstFactor = GL_ZERO;
|
||||
ctx->Color.IndexLogicOpEnabled = GL_FALSE;
|
||||
ctx->Color.ColorLogicOpEnabled = GL_FALSE;
|
||||
ctx->Color.LogicOp = GL_COPY;
|
||||
|
|
|
@ -42,24 +42,6 @@ extern void GLAPIENTRY
|
|||
_mesa_BlendFunc( GLenum sfactor, GLenum dfactor );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendEquation( GLenum mode );
|
||||
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_AlphaFunc( GLenum func, GLclampf ref );
|
||||
|
||||
|
|
|
@ -55,10 +55,8 @@ static inline struct gl_buffer_object **
|
|||
get_buffer_target(struct gl_context *ctx, GLenum target)
|
||||
{
|
||||
switch (target) {
|
||||
case GL_ARRAY_BUFFER_ARB:
|
||||
return &ctx->Array.ArrayBufferObj;
|
||||
case GL_ELEMENT_ARRAY_BUFFER_ARB:
|
||||
return &ctx->Array.ArrayObj->ElementArrayBufferObj;
|
||||
return &ctx->Array.ElementArrayBufferObj;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -474,16 +472,6 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
|
|||
memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
|
||||
_glthread_INIT_MUTEX(DummyBufferObject.Mutex);
|
||||
DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
|
||||
|
||||
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
|
||||
ctx->Shared->NullBufferObj);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_free_buffer_objects( struct gl_context *ctx )
|
||||
{
|
||||
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -658,7 +646,6 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
|
|||
for (i = 0; i < n; i++) {
|
||||
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
|
||||
if (bufObj) {
|
||||
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
|
||||
GLuint j;
|
||||
|
||||
ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
|
||||
|
@ -671,14 +658,11 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
|
|||
}
|
||||
|
||||
/* unbind any vertex pointers bound to this buffer */
|
||||
for (j = 0; j < Elements(arrayObj->VertexAttrib); j++) {
|
||||
unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj);
|
||||
for (j = 0; j < Elements(ctx->Array.VertexAttrib); j++) {
|
||||
unbind(ctx, &ctx->Array.VertexAttrib[j].BufferObj, bufObj);
|
||||
}
|
||||
|
||||
if (ctx->Array.ArrayBufferObj == bufObj) {
|
||||
_mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
|
||||
}
|
||||
if (arrayObj->ElementArrayBufferObj == bufObj) {
|
||||
if (ctx->Array.ElementArrayBufferObj == bufObj) {
|
||||
_mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
|
||||
}
|
||||
|
||||
|
@ -1326,286 +1310,3 @@ _mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
|
|||
ctx->Driver.FlushMappedBufferRange(ctx, offset, length, bufObj);
|
||||
}
|
||||
|
||||
|
||||
#if FEATURE_APPLE_object_purgeable
|
||||
static GLenum
|
||||
buffer_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
|
||||
{
|
||||
struct gl_buffer_object *bufObj;
|
||||
GLenum retval;
|
||||
|
||||
bufObj = _mesa_lookup_bufferobj(ctx, name);
|
||||
if (!bufObj) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectPurgeable(name = 0x%x)", name);
|
||||
return 0;
|
||||
}
|
||||
if (!_mesa_is_bufferobj(bufObj)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bufObj->Purgeable) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glObjectPurgeable(name = 0x%x) is already purgeable", name);
|
||||
return GL_VOLATILE_APPLE;
|
||||
}
|
||||
|
||||
bufObj->Purgeable = GL_TRUE;
|
||||
|
||||
retval = GL_VOLATILE_APPLE;
|
||||
if (ctx->Driver.BufferObjectPurgeable)
|
||||
retval = ctx->Driver.BufferObjectPurgeable(ctx, bufObj, option);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLenum
|
||||
texture_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
|
||||
{
|
||||
struct gl_texture_object *bufObj;
|
||||
GLenum retval;
|
||||
|
||||
bufObj = _mesa_lookup_texture(ctx, name);
|
||||
if (!bufObj) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectPurgeable(name = 0x%x)", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bufObj->Purgeable) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glObjectPurgeable(name = 0x%x) is already purgeable", name);
|
||||
return GL_VOLATILE_APPLE;
|
||||
}
|
||||
|
||||
bufObj->Purgeable = GL_TRUE;
|
||||
|
||||
retval = GL_VOLATILE_APPLE;
|
||||
if (ctx->Driver.TextureObjectPurgeable)
|
||||
retval = ctx->Driver.TextureObjectPurgeable(ctx, bufObj, option);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
GLenum GLAPIENTRY
|
||||
_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
|
||||
{
|
||||
GLenum retval;
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
|
||||
|
||||
if (name == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectPurgeable(name = 0x%x)", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (option) {
|
||||
case GL_VOLATILE_APPLE:
|
||||
case GL_RELEASED_APPLE:
|
||||
/* legal */
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glObjectPurgeable(name = 0x%x) invalid option: %d",
|
||||
name, option);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (objectType) {
|
||||
case GL_TEXTURE:
|
||||
retval = texture_object_purgeable(ctx, name, option);
|
||||
break;
|
||||
case GL_BUFFER_OBJECT_APPLE:
|
||||
retval = buffer_object_purgeable(ctx, name, option);
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glObjectPurgeable(name = 0x%x) invalid type: %d",
|
||||
name, objectType);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* In strict conformance to the spec, we must only return VOLATILE when
|
||||
* when passed the VOLATILE option. Madness.
|
||||
*
|
||||
* XXX First fix the spec, then fix me.
|
||||
*/
|
||||
return option == GL_VOLATILE_APPLE ? GL_VOLATILE_APPLE : retval;
|
||||
}
|
||||
|
||||
|
||||
static GLenum
|
||||
buffer_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
|
||||
{
|
||||
struct gl_buffer_object *bufObj;
|
||||
GLenum retval;
|
||||
|
||||
bufObj = _mesa_lookup_bufferobj(ctx, name);
|
||||
if (!bufObj) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectUnpurgeable(name = 0x%x)", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! bufObj->Purgeable) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glObjectUnpurgeable(name = 0x%x) object is "
|
||||
" already \"unpurged\"", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bufObj->Purgeable = GL_FALSE;
|
||||
|
||||
retval = option;
|
||||
if (ctx->Driver.BufferObjectUnpurgeable)
|
||||
retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GLenum
|
||||
texture_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
|
||||
{
|
||||
struct gl_texture_object *bufObj;
|
||||
GLenum retval;
|
||||
|
||||
bufObj = _mesa_lookup_texture(ctx, name);
|
||||
if (!bufObj) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectUnpurgeable(name = 0x%x)", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! bufObj->Purgeable) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glObjectUnpurgeable(name = 0x%x) object is"
|
||||
" already \"unpurged\"", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bufObj->Purgeable = GL_FALSE;
|
||||
|
||||
retval = option;
|
||||
if (ctx->Driver.TextureObjectUnpurgeable)
|
||||
retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
GLenum GLAPIENTRY
|
||||
_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
|
||||
|
||||
if (name == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectUnpurgeable(name = 0x%x)", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (option) {
|
||||
case GL_RETAINED_APPLE:
|
||||
case GL_UNDEFINED_APPLE:
|
||||
/* legal */
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glObjectUnpurgeable(name = 0x%x) invalid option: %d",
|
||||
name, option);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (objectType) {
|
||||
case GL_BUFFER_OBJECT_APPLE:
|
||||
return buffer_object_unpurgeable(ctx, name, option);
|
||||
case GL_TEXTURE:
|
||||
return texture_object_unpurgeable(ctx, name, option);
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glObjectUnpurgeable(name = 0x%x) invalid type: %d",
|
||||
name, objectType);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_buffer_object_parameteriv(struct gl_context *ctx, GLuint name,
|
||||
GLenum pname, GLint *params)
|
||||
{
|
||||
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
|
||||
if (!bufObj) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glGetObjectParameteriv(name = 0x%x) invalid object", name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pname) {
|
||||
case GL_PURGEABLE_APPLE:
|
||||
*params = bufObj->Purgeable;
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
|
||||
name, pname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_texture_object_parameteriv(struct gl_context *ctx, GLuint name,
|
||||
GLenum pname, GLint *params)
|
||||
{
|
||||
struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
|
||||
if (!texObj) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glObjectUnpurgeable(name = 0x%x)", name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pname) {
|
||||
case GL_PURGEABLE_APPLE:
|
||||
*params = texObj->Purgeable;
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
|
||||
name, pname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname,
|
||||
GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (name == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glGetObjectParameteriv(name = 0x%x)", name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (objectType) {
|
||||
case GL_TEXTURE:
|
||||
get_texture_object_parameteriv(ctx, name, pname, params);
|
||||
break;
|
||||
case GL_BUFFER_OBJECT_APPLE:
|
||||
get_buffer_object_parameteriv(ctx, name, pname, params);
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
"glGetObjectParameteriv(name = 0x%x) invalid type: %d",
|
||||
name, objectType);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* FEATURE_APPLE_object_purgeable */
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#if FEATURE_colortable
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_ColorTable( GLenum target, GLenum internalFormat,
|
||||
GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *data )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTable(target)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_ColorSubTable( GLenum target, GLsizei start,
|
||||
GLsizei count, GLenum format, GLenum type,
|
||||
const GLvoid *data )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_CopyColorTable(GLenum target, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyColorTable(target)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_CopyColorSubTable(GLenum target, GLsizei start,
|
||||
GLint x, GLint y, GLsizei width)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyColorSubTable(target)");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetColorTable( GLenum target, GLenum format,
|
||||
GLenum type, GLvoid *data )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
/* no extensions use this function */
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(target)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
|
||||
{
|
||||
/* no extensions use this function */
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glColorTableParameteriv(target)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_init_colortable_dispatch(struct _glapi_table *disp)
|
||||
{
|
||||
SET_ColorSubTable(disp, _mesa_ColorSubTable);
|
||||
SET_ColorTable(disp, _mesa_ColorTable);
|
||||
SET_ColorTableParameterfv(disp, _mesa_ColorTableParameterfv);
|
||||
SET_ColorTableParameteriv(disp, _mesa_ColorTableParameteriv);
|
||||
SET_CopyColorSubTable(disp, _mesa_CopyColorSubTable);
|
||||
SET_CopyColorTable(disp, _mesa_CopyColorTable);
|
||||
SET_GetColorTable(disp, _mesa_GetColorTable);
|
||||
SET_GetColorTableParameterfv(disp, _mesa_GetColorTableParameterfv);
|
||||
SET_GetColorTableParameteriv(disp, _mesa_GetColorTableParameteriv);
|
||||
}
|
||||
|
||||
|
||||
#endif /* FEATURE_colortable */
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.2
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef COLORTAB_H
|
||||
#define COLORTAB_H
|
||||
|
||||
|
||||
#include "compiler.h"
|
||||
#include "glheader.h"
|
||||
#include "mfeatures.h"
|
||||
|
||||
struct _glapi_table;
|
||||
|
||||
#if FEATURE_colortable
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_ColorTable( GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *table );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_ColorSubTable( GLenum target, GLsizei start,
|
||||
GLsizei count, GLenum format, GLenum type,
|
||||
const GLvoid *table );
|
||||
|
||||
extern void
|
||||
_mesa_init_colortable_dispatch(struct _glapi_table *disp);
|
||||
|
||||
#else /* FEATURE_colortable */
|
||||
|
||||
static inline void GLAPIENTRY
|
||||
_mesa_ColorTable( GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *table )
|
||||
{
|
||||
ASSERT_NO_FEATURE();
|
||||
}
|
||||
|
||||
static inline void GLAPIENTRY
|
||||
_mesa_ColorSubTable( GLenum target, GLsizei start,
|
||||
GLsizei count, GLenum format, GLenum type,
|
||||
const GLvoid *table )
|
||||
{
|
||||
ASSERT_NO_FEATURE();
|
||||
}
|
||||
|
||||
static inline void
|
||||
_mesa_init_colortable_dispatch(struct _glapi_table *disp)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* FEATURE_colortable */
|
||||
|
||||
#endif /* COLORTAB_H */
|
|
@ -97,9 +97,6 @@
|
|||
/** Line width granularity */
|
||||
#define LINE_WIDTH_GRANULARITY 0.1
|
||||
|
||||
/** Max texture palette / color table size */
|
||||
#define MAX_COLOR_TABLE_SIZE 256
|
||||
|
||||
/** Max memory to allow for a single texture image (in megabytes) */
|
||||
#define MAX_TEXTURE_MBYTES 1024
|
||||
|
||||
|
@ -135,7 +132,6 @@
|
|||
#undef MAX_WIDTH
|
||||
#undef MAX_HEIGHT
|
||||
#define MAX_TEXTURE_LEVELS 13
|
||||
#define MAX_3D_TEXTURE_LEVELS 9
|
||||
#define MAX_CUBE_TEXTURE_LEVELS 13
|
||||
#define MAX_WIDTH 4096
|
||||
#define MAX_HEIGHT 4096
|
||||
|
@ -155,9 +151,6 @@
|
|||
/** Max convolution filter height */
|
||||
#define MAX_CONVOLUTION_HEIGHT 9
|
||||
|
||||
/** For GL_ARB_texture_compression */
|
||||
#define MAX_COMPRESSED_TEXTURE_FORMATS 25
|
||||
|
||||
/** For GL_EXT_texture_filter_anisotropic */
|
||||
#define MAX_TEXTURE_MAX_ANISOTROPY 16.0
|
||||
|
||||
|
|
|
@ -373,8 +373,7 @@ _mesa_init_current(struct gl_context *ctx)
|
|||
/* redo special cases: */
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_WEIGHT], 1.0, 0.0, 0.0, 0.0 );
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_NORMAL], 0.0, 0.0, 1.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR0], 1.0, 1.0, 1.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR1], 0.0, 0.0, 0.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR], 1.0, 1.0, 1.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX], 1.0, 0.0, 0.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG], 1.0, 0.0, 0.0, 1.0 );
|
||||
}
|
||||
|
@ -392,7 +391,6 @@ _mesa_init_constants(struct gl_context *ctx)
|
|||
/* Constants, may be overriden (usually only reduced) by device drivers */
|
||||
ctx->Const.MaxTextureMbytes = MAX_TEXTURE_MBYTES;
|
||||
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
|
||||
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
|
||||
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
|
||||
ctx->Const.MaxTextureMaxAnisotropy = MAX_TEXTURE_MAX_ANISOTROPY;
|
||||
ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE;
|
||||
|
@ -407,7 +405,6 @@ _mesa_init_constants(struct gl_context *ctx)
|
|||
ctx->Const.MinLineWidthAA = MIN_LINE_WIDTH;
|
||||
ctx->Const.MaxLineWidthAA = MAX_LINE_WIDTH;
|
||||
ctx->Const.LineWidthGranularity = (GLfloat) LINE_WIDTH_GRANULARITY;
|
||||
ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE;
|
||||
ctx->Const.MaxClipPlanes = 6;
|
||||
ctx->Const.MaxLights = MAX_LIGHTS;
|
||||
ctx->Const.MaxShininess = 128.0;
|
||||
|
@ -495,7 +492,7 @@ init_attrib_groups(struct gl_context *ctx)
|
|||
_mesa_init_scissor( ctx );
|
||||
_mesa_init_stencil( ctx );
|
||||
_mesa_init_transform( ctx );
|
||||
_mesa_init_varray( ctx );
|
||||
_mesa_init_varray(ctx, &ctx->Array);
|
||||
_mesa_init_viewport( ctx );
|
||||
|
||||
if (!_mesa_init_texture( ctx ))
|
||||
|
@ -743,17 +740,12 @@ _mesa_free_context_data( struct gl_context *ctx )
|
|||
_mesa_reference_framebuffer(&ctx->ReadBuffer, NULL);
|
||||
|
||||
_mesa_free_attrib_data(ctx);
|
||||
_mesa_free_buffer_objects(ctx);
|
||||
_mesa_free_lighting_data( ctx );
|
||||
_mesa_free_eval_data( ctx );
|
||||
_mesa_free_texture_data( ctx );
|
||||
_mesa_free_matrix_data( ctx );
|
||||
_mesa_free_viewport_data( ctx );
|
||||
_mesa_free_varray_data(ctx);
|
||||
|
||||
_mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj);
|
||||
|
||||
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
|
||||
_mesa_free_varray_data(ctx, &ctx->Array);
|
||||
|
||||
/* free dispatch tables */
|
||||
free(ctx->Exec);
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.2
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Image convolution functions.
|
||||
*
|
||||
* Notes: filter kernel elements are indexed by <n> and <m> as in
|
||||
* the GL spec.
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#if FEATURE_convolve
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D");
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
|
||||
GLvoid *image)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
|
||||
GLvoid *row, GLvoid *column,
|
||||
GLvoid *span)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D");
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_init_convolve_dispatch(struct _glapi_table *disp)
|
||||
{
|
||||
SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D);
|
||||
SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D);
|
||||
SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf);
|
||||
SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv);
|
||||
SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri);
|
||||
SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv);
|
||||
SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D);
|
||||
SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D);
|
||||
SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter);
|
||||
SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv);
|
||||
SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv);
|
||||
SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D);
|
||||
SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter);
|
||||
}
|
||||
|
||||
|
||||
#endif /* FEATURE_convolve */
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CONVOLVE_H
|
||||
#define CONVOLVE_H
|
||||
|
||||
|
||||
#include "compiler.h"
|
||||
#include "mfeatures.h"
|
||||
|
||||
struct _glapi_table;
|
||||
|
||||
|
||||
#if FEATURE_convolve
|
||||
|
||||
extern void
|
||||
_mesa_init_convolve_dispatch(struct _glapi_table *disp);
|
||||
|
||||
#else /* FEATURE_convolve */
|
||||
|
||||
static inline void
|
||||
_mesa_init_convolve_dispatch(struct _glapi_table *disp)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* FEATURE_convolve */
|
||||
|
||||
#endif /* CONVOLVE_H */
|
|
@ -220,18 +220,6 @@ struct dd_function_table {
|
|||
GLint width, GLint height, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
/**
|
||||
* Called by glTexImage3D().
|
||||
*
|
||||
* \sa dd_function_table::TexImage1D.
|
||||
*/
|
||||
void (*TexImage3D)(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint internalFormat,
|
||||
GLint width, GLint height, GLint depth, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
/**
|
||||
* Called by glTexSubImage1D(). Replace a subset of the target texture
|
||||
|
@ -257,19 +245,6 @@ struct dd_function_table {
|
|||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
/**
|
||||
* Called by glTexSubImage3D().
|
||||
*
|
||||
* \sa dd_function_table::TexSubImage1D.
|
||||
*/
|
||||
void (*TexSubImage3D)(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLint depth,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -298,16 +273,6 @@ struct dd_function_table {
|
|||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
/**
|
||||
* Called by glCopyTexSubImage3D() and glCopyTexImage3D().
|
||||
*/
|
||||
void (*CopyTexSubImage3D)(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
/**
|
||||
* Called by glTexImage[123]D when user specifies a proxy texture
|
||||
* target.
|
||||
|
@ -348,18 +313,6 @@ struct dd_function_table {
|
|||
GLsizei width, GLsizei height, GLint border,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
|
||||
/**
|
||||
* Called by glCompressedTexImage3D().
|
||||
*
|
||||
* \sa dd_function_table::CompressedTexImage3D.
|
||||
*/
|
||||
void (*CompressedTexImage3D)(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint internalFormat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLint border,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
|
||||
/**
|
||||
* Called by glCompressedTexSubImage1D().
|
||||
*/
|
||||
|
@ -378,16 +331,6 @@ struct dd_function_table {
|
|||
GLsizei width, GLint height,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
|
||||
/**
|
||||
* Called by glCompressedTexSubImage3D().
|
||||
*/
|
||||
void (*CompressedTexSubImage3D)(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLint height, GLint depth,
|
||||
GLenum format,
|
||||
GLsizei imageSize, const GLvoid *data);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
@ -490,19 +433,6 @@ struct dd_function_table {
|
|||
/*@{*/
|
||||
/** Specify the alpha test function */
|
||||
void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
|
||||
/** Set the blend color */
|
||||
void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
|
||||
/** Set the blend equation */
|
||||
void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA);
|
||||
void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer,
|
||||
GLenum modeRGB, GLenum modeA);
|
||||
/** Specify pixel arithmetic */
|
||||
void (*BlendFuncSeparate)(struct gl_context *ctx,
|
||||
GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA);
|
||||
void (*BlendFuncSeparatei)(struct gl_context *ctx, GLuint buffer,
|
||||
GLenum sfactorRGB, GLenum dfactorRGB,
|
||||
GLenum sfactorA, GLenum dfactorA);
|
||||
/** Specify clear values for the color buffers */
|
||||
void (*ClearColor)(struct gl_context *ctx,
|
||||
const union gl_color_union color);
|
||||
|
@ -620,31 +550,6 @@ struct dd_function_table {
|
|||
struct gl_buffer_object *obj );
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Functions for GL_APPLE_object_purgeable
|
||||
*/
|
||||
/*@{*/
|
||||
/* variations on ObjectPurgeable */
|
||||
GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
|
||||
GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
|
||||
GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
|
||||
|
||||
/* variations on ObjectUnpurgeable */
|
||||
GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
|
||||
GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
|
||||
GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Vertex Array objects
|
||||
*/
|
||||
/*@{*/
|
||||
struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id);
|
||||
void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
|
||||
void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Support for multiple T&L engines
|
||||
|
@ -748,11 +653,6 @@ struct dd_function_table {
|
|||
void (*EndCallList)( struct gl_context *ctx );
|
||||
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* \name GL_NV_texture_barrier interface
|
||||
*/
|
||||
void (*TextureBarrier)(struct gl_context *ctx);
|
||||
};
|
||||
|
||||
|
||||
|
@ -806,8 +706,6 @@ typedef struct {
|
|||
void (GLAPIENTRYP MultiTexCoord4fvARB)( GLenum, const GLfloat * );
|
||||
void (GLAPIENTRYP Normal3f)( GLfloat, GLfloat, GLfloat );
|
||||
void (GLAPIENTRYP Normal3fv)( const GLfloat * );
|
||||
void (GLAPIENTRYP SecondaryColor3fEXT)( GLfloat, GLfloat, GLfloat );
|
||||
void (GLAPIENTRYP SecondaryColor3fvEXT)( const GLfloat * );
|
||||
void (GLAPIENTRYP TexCoord1f)( GLfloat );
|
||||
void (GLAPIENTRYP TexCoord1fv)( const GLfloat * );
|
||||
void (GLAPIENTRYP TexCoord2f)( GLfloat, GLfloat );
|
||||
|
@ -847,9 +745,6 @@ typedef struct {
|
|||
void (GLAPIENTRYP DrawArrays)( GLenum mode, GLint start, GLsizei count );
|
||||
void (GLAPIENTRYP DrawElements)( GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices );
|
||||
void (GLAPIENTRYP DrawRangeElements)( GLenum mode, GLuint start,
|
||||
GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid *indices );
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -41,77 +41,38 @@
|
|||
static void
|
||||
client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
{
|
||||
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
|
||||
GLbitfield64 flag;
|
||||
GLboolean *var;
|
||||
|
||||
switch (cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled;
|
||||
flag = VERT_BIT_POS;
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled;
|
||||
flag = VERT_BIT_NORMAL;
|
||||
break;
|
||||
case GL_COLOR_ARRAY:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled;
|
||||
flag = VERT_BIT_COLOR0;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR].Enabled;
|
||||
flag = VERT_BIT_COLOR;
|
||||
break;
|
||||
case GL_INDEX_ARRAY:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled;
|
||||
flag = VERT_BIT_COLOR_INDEX;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].Enabled;
|
||||
flag = VERT_BIT_TEX;
|
||||
break;
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled;
|
||||
flag = VERT_BIT_EDGEFLAG;
|
||||
break;
|
||||
case GL_FOG_COORDINATE_ARRAY_EXT:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled;
|
||||
var = &ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled;
|
||||
flag = VERT_BIT_FOG;
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY_EXT:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled;
|
||||
flag = VERT_BIT_COLOR1;
|
||||
break;
|
||||
|
||||
#if FEATURE_point_size_array
|
||||
case GL_POINT_SIZE_ARRAY_OES:
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled;
|
||||
flag = VERT_BIT_POINT_SIZE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if FEATURE_NV_vertex_program
|
||||
case GL_VERTEX_ATTRIB_ARRAY0_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY1_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY2_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY3_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY4_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY5_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY6_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY7_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY8_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY9_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY10_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY11_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY12_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY13_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY14_NV:
|
||||
case GL_VERTEX_ATTRIB_ARRAY15_NV:
|
||||
CHECK_EXTENSION(NV_vertex_program, cap);
|
||||
{
|
||||
GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV;
|
||||
ASSERT(VERT_ATTRIB_GENERIC(n) < Elements(ctx->Array.ArrayObj->VertexAttrib));
|
||||
var = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(n)].Enabled;
|
||||
flag = VERT_BIT_GENERIC(n);
|
||||
}
|
||||
break;
|
||||
#endif /* FEATURE_NV_vertex_program */
|
||||
|
||||
default:
|
||||
goto invalid_enum_error;
|
||||
|
@ -128,9 +89,9 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
|
|||
*var = state;
|
||||
|
||||
if (state)
|
||||
ctx->Array.ArrayObj->_Enabled |= flag;
|
||||
ctx->Array._Enabled |= flag;
|
||||
else
|
||||
ctx->Array.ArrayObj->_Enabled &= ~flag;
|
||||
ctx->Array._Enabled &= ~flag;
|
||||
|
||||
if (ctx->Driver.Enable) {
|
||||
ctx->Driver.Enable( ctx, cap, state );
|
||||
|
@ -304,7 +265,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
|||
ctx->Light.ColorMaterialEnabled = state;
|
||||
if (state) {
|
||||
_mesa_update_color_material( ctx,
|
||||
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
|
||||
ctx->Current.Attrib[VERT_ATTRIB_COLOR] );
|
||||
}
|
||||
break;
|
||||
case GL_CULL_FACE:
|
||||
|
@ -568,11 +529,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
|||
return;
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
if (!enable_texture(ctx, state, TEXTURE_3D_BIT)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_GEN_S:
|
||||
case GL_TEXTURE_GEN_T:
|
||||
case GL_TEXTURE_GEN_R:
|
||||
|
@ -886,8 +842,6 @@ _mesa_IsEnabled( GLenum cap )
|
|||
return is_texture_enabled(ctx, TEXTURE_1D_BIT);
|
||||
case GL_TEXTURE_2D:
|
||||
return is_texture_enabled(ctx, TEXTURE_2D_BIT);
|
||||
case GL_TEXTURE_3D:
|
||||
return is_texture_enabled(ctx, TEXTURE_3D_BIT);
|
||||
case GL_TEXTURE_GEN_S:
|
||||
case GL_TEXTURE_GEN_T:
|
||||
case GL_TEXTURE_GEN_R:
|
||||
|
@ -913,24 +867,21 @@ _mesa_IsEnabled( GLenum cap )
|
|||
|
||||
/* client-side state */
|
||||
case GL_VERTEX_ARRAY:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled != 0);
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled != 0);
|
||||
case GL_NORMAL_ARRAY:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0);
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled != 0);
|
||||
case GL_COLOR_ARRAY:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled != 0);
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR].Enabled != 0);
|
||||
case GL_INDEX_ARRAY:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled != 0);
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX]
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_TEX]
|
||||
.Enabled != 0);
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled != 0);
|
||||
case GL_FOG_COORDINATE_ARRAY_EXT:
|
||||
CHECK_EXTENSION(EXT_fog_coord);
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0);
|
||||
case GL_SECONDARY_COLOR_ARRAY_EXT:
|
||||
CHECK_EXTENSION(EXT_secondary_color);
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled != 0);
|
||||
return (ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled != 0);
|
||||
#if FEATURE_point_size_array
|
||||
case GL_POINT_SIZE_ARRAY_OES:
|
||||
return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled != 0);
|
||||
|
|
|
@ -61,8 +61,6 @@ struct extension {
|
|||
*/
|
||||
static const struct extension extension_table[] = {
|
||||
/* ARB Extensions */
|
||||
{ "GL_ARB_half_float_pixel", o(ARB_half_float_pixel), 2003 },
|
||||
{ "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), 2008 },
|
||||
{ "GL_ARB_map_buffer_range", o(ARB_map_buffer_range), 2008 },
|
||||
{ "GL_ARB_multisample", o(dummy_true), 1994 },
|
||||
{ "GL_ARB_point_parameters", o(EXT_point_parameters), 1997 },
|
||||
|
@ -72,12 +70,9 @@ static const struct extension extension_table[] = {
|
|||
{ "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), 2001 },
|
||||
{ "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), 2001 },
|
||||
{ "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), 2001 },
|
||||
{ "GL_ARB_texture_float", o(ARB_texture_float), 2004 },
|
||||
{ "GL_ARB_texture_mirrored_repeat", o(dummy_true), 2001 },
|
||||
{ "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), 2003 },
|
||||
{ "GL_ARB_texture_storage", o(ARB_texture_storage), 2011 },
|
||||
{ "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), 1999 },
|
||||
{ "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), 2006 },
|
||||
{ "GL_ARB_vertex_buffer_object", o(dummy_true), 2003 },
|
||||
{ "GL_ARB_window_pos", o(ARB_window_pos), 2001 },
|
||||
/* EXT extensions */
|
||||
|
@ -104,7 +99,6 @@ static const struct extension extension_table[] = {
|
|||
{ "GL_EXT_shadow_funcs", o(EXT_shadow_funcs), 2002 },
|
||||
{ "GL_EXT_stencil_wrap", o(dummy_true), 2002 },
|
||||
{ "GL_EXT_subtexture", o(dummy_true), 1995 },
|
||||
{ "GL_EXT_texture3D", o(EXT_texture3D), 1996 },
|
||||
{ "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), 2001 },
|
||||
{ "GL_EXT_texture_env_add", o(dummy_true), 1999 },
|
||||
{ "GL_EXT_texture_env_combine", o(dummy_true), 2000 },
|
||||
|
@ -116,12 +110,9 @@ static const struct extension extension_table[] = {
|
|||
{ "GL_EXT_vertex_array", o(dummy_true), 1995 },
|
||||
|
||||
/* Vendor extensions */
|
||||
{ "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), 2006 },
|
||||
{ "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), 2002 },
|
||||
{ "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), 2002 },
|
||||
{ "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), 2003 },
|
||||
{ "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), 2002 },
|
||||
{ "GL_ATI_texture_float", o(ARB_texture_float), 2002 },
|
||||
{ "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), 1998 },
|
||||
{ "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), 1996 },
|
||||
{ "GL_IBM_texture_mirrored_repeat", o(dummy_true), 1998 },
|
||||
|
@ -135,7 +126,6 @@ static const struct extension extension_table[] = {
|
|||
{ "GL_NV_light_max_exponent", o(NV_light_max_exponent), 1999 },
|
||||
{ "GL_NV_point_sprite", o(NV_point_sprite), 2001 },
|
||||
{ "GL_NV_texgen_reflection", o(NV_texgen_reflection), 1999 },
|
||||
{ "GL_NV_texture_barrier", o(NV_texture_barrier), 2009 },
|
||||
{ "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), 1999 },
|
||||
|
||||
{ 0, 0, 0},
|
||||
|
@ -183,7 +173,6 @@ static const size_t default_extensions[] = {
|
|||
o(EXT_packed_pixels),
|
||||
o(EXT_rescale_normal),
|
||||
o(EXT_separate_specular_color),
|
||||
o(EXT_texture3D),
|
||||
|
||||
/* Vendor Extensions */
|
||||
o(APPLE_packed_pixels),
|
||||
|
@ -203,8 +192,6 @@ static const size_t default_extensions[] = {
|
|||
void
|
||||
_mesa_enable_sw_extensions(struct gl_context *ctx)
|
||||
{
|
||||
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
|
||||
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
|
||||
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
|
||||
ctx->Extensions.ARB_point_sprite = GL_TRUE;
|
||||
ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
|
||||
|
@ -212,13 +199,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
|
|||
ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
|
||||
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
|
||||
/*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
|
||||
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
|
||||
ctx->Extensions.ARB_texture_storage = GL_TRUE;
|
||||
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
|
||||
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
|
||||
#if FEATURE_APPLE_object_purgeable
|
||||
ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
|
||||
#endif
|
||||
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
|
||||
ctx->Extensions.EXT_blend_color = GL_TRUE;
|
||||
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
|
||||
|
@ -240,9 +221,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
|
|||
ctx->Extensions.NV_point_sprite = GL_TRUE;
|
||||
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
|
||||
/*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
|
||||
#if FEATURE_texture_fxt1
|
||||
_mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,7 +277,6 @@ _mesa_enable_2_0_extensions(struct gl_context *ctx)
|
|||
{
|
||||
ctx->Extensions.ARB_point_sprite = GL_TRUE;
|
||||
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
|
||||
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -198,7 +198,6 @@ void _mesa_init_fog( struct gl_context * ctx )
|
|||
ctx->Fog.Density = 1.0;
|
||||
ctx->Fog.Start = 0.0;
|
||||
ctx->Fog.End = 1.0;
|
||||
ctx->Fog.ColorSumEnabled = GL_FALSE;
|
||||
ctx->Fog.FogCoordinateSource = GL_FRAGMENT_DEPTH_EXT;
|
||||
ctx->Fog._Scale = 1.0f;
|
||||
ctx->Fog.FogDistanceMode = GL_EYE_PLANE_ABSOLUTE_NV;
|
||||
|
|
|
@ -810,200 +810,6 @@ pack_float_YCBCR_REV(const GLfloat src[4], void *dst)
|
|||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGBA_FLOAT32 */
|
||||
|
||||
static void
|
||||
pack_ubyte_RGBA_FLOAT32(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = UBYTE_TO_FLOAT(src[0]);
|
||||
d[1] = UBYTE_TO_FLOAT(src[1]);
|
||||
d[2] = UBYTE_TO_FLOAT(src[2]);
|
||||
d[3] = UBYTE_TO_FLOAT(src[3]);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_RGBA_FLOAT32(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = src[0];
|
||||
d[1] = src[1];
|
||||
d[2] = src[2];
|
||||
d[3] = src[3];
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGBA_FLOAT16 */
|
||||
|
||||
static void
|
||||
pack_ubyte_RGBA_FLOAT16(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[0]));
|
||||
d[1] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[1]));
|
||||
d[2] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[2]));
|
||||
d[3] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[3]));
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_RGBA_FLOAT16(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(src[0]);
|
||||
d[1] = _mesa_float_to_half(src[1]);
|
||||
d[2] = _mesa_float_to_half(src[2]);
|
||||
d[3] = _mesa_float_to_half(src[3]);
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGB_FLOAT32 */
|
||||
|
||||
static void
|
||||
pack_ubyte_RGB_FLOAT32(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = UBYTE_TO_FLOAT(src[0]);
|
||||
d[1] = UBYTE_TO_FLOAT(src[1]);
|
||||
d[2] = UBYTE_TO_FLOAT(src[2]);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_RGB_FLOAT32(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = src[0];
|
||||
d[1] = src[1];
|
||||
d[2] = src[2];
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGB_FLOAT16 */
|
||||
|
||||
static void
|
||||
pack_ubyte_RGB_FLOAT16(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[0]));
|
||||
d[1] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[1]));
|
||||
d[2] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[2]));
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_RGB_FLOAT16(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(src[0]);
|
||||
d[1] = _mesa_float_to_half(src[1]);
|
||||
d[2] = _mesa_float_to_half(src[2]);
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_ALPHA_FLOAT32 */
|
||||
|
||||
static void
|
||||
pack_ubyte_ALPHA_FLOAT32(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = UBYTE_TO_FLOAT(src[ACOMP]);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_ALPHA_FLOAT32(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = src[ACOMP];
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_ALPHA_FLOAT16 */
|
||||
|
||||
static void
|
||||
pack_ubyte_ALPHA_FLOAT16(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[ACOMP]));
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_ALPHA_FLOAT16(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(src[ACOMP]);
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_FLOAT32 (and INTENSITY_FLOAT32, R_FLOAT32) */
|
||||
|
||||
static void
|
||||
pack_ubyte_LUMINANCE_FLOAT32(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = UBYTE_TO_FLOAT(src[RCOMP]);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_LUMINANCE_FLOAT32(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = src[RCOMP];
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_FLOAT16 (and INTENSITY_FLOAT16, R_FLOAT32) */
|
||||
|
||||
static void
|
||||
pack_ubyte_LUMINANCE_FLOAT16(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[RCOMP]));
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_LUMINANCE_FLOAT16(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(src[RCOMP]);
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 */
|
||||
|
||||
static void
|
||||
pack_ubyte_LUMINANCE_ALPHA_FLOAT32(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = UBYTE_TO_FLOAT(src[RCOMP]);
|
||||
d[1] = UBYTE_TO_FLOAT(src[ACOMP]);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_LUMINANCE_ALPHA_FLOAT32(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLfloat *d = ((GLfloat *) dst);
|
||||
d[0] = src[RCOMP];
|
||||
d[1] = src[ACOMP];
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 */
|
||||
|
||||
static void
|
||||
pack_ubyte_LUMINANCE_ALPHA_FLOAT16(const GLubyte src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[RCOMP]));
|
||||
d[1] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[ACOMP]));
|
||||
}
|
||||
|
||||
static void
|
||||
pack_float_LUMINANCE_ALPHA_FLOAT16(const GLfloat src[4], void *dst)
|
||||
{
|
||||
GLhalfARB *d = ((GLhalfARB *) dst);
|
||||
d[0] = _mesa_float_to_half(src[RCOMP]);
|
||||
d[1] = _mesa_float_to_half(src[ACOMP]);
|
||||
}
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGBA_16 */
|
||||
|
||||
static void
|
||||
|
@ -1095,19 +901,6 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format)
|
|||
table[MESA_FORMAT_Z32] = NULL;
|
||||
table[MESA_FORMAT_S8] = NULL;
|
||||
|
||||
table[MESA_FORMAT_RGBA_FLOAT32] = pack_ubyte_RGBA_FLOAT32;
|
||||
table[MESA_FORMAT_RGBA_FLOAT16] = pack_ubyte_RGBA_FLOAT16;
|
||||
table[MESA_FORMAT_RGB_FLOAT32] = pack_ubyte_RGB_FLOAT32;
|
||||
table[MESA_FORMAT_RGB_FLOAT16] = pack_ubyte_RGB_FLOAT16;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT32] = pack_ubyte_ALPHA_FLOAT32;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT16] = pack_ubyte_ALPHA_FLOAT16;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = pack_ubyte_LUMINANCE_ALPHA_FLOAT32;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = pack_ubyte_LUMINANCE_ALPHA_FLOAT16;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16;
|
||||
|
||||
/* n/a */
|
||||
table[MESA_FORMAT_RGBA_INT8] = NULL; /* pack_ubyte_RGBA_INT8 */
|
||||
table[MESA_FORMAT_RGBA_INT16] = NULL; /* pack_ubyte_RGBA_INT16 */
|
||||
|
@ -1185,20 +978,6 @@ _mesa_get_pack_float_rgba_function(gl_format format)
|
|||
table[MESA_FORMAT_Z32] = NULL;
|
||||
table[MESA_FORMAT_S8] = NULL;
|
||||
|
||||
table[MESA_FORMAT_RGBA_FLOAT32] = pack_float_RGBA_FLOAT32;
|
||||
table[MESA_FORMAT_RGBA_FLOAT16] = pack_float_RGBA_FLOAT16;
|
||||
table[MESA_FORMAT_RGB_FLOAT32] = pack_float_RGB_FLOAT32;
|
||||
table[MESA_FORMAT_RGB_FLOAT16] = pack_float_RGB_FLOAT16;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT32] = pack_float_ALPHA_FLOAT32;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT16] = pack_float_ALPHA_FLOAT16;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT32] = pack_float_LUMINANCE_FLOAT32;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT16] = pack_float_LUMINANCE_FLOAT16;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = pack_float_LUMINANCE_ALPHA_FLOAT32;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = pack_float_LUMINANCE_ALPHA_FLOAT16;
|
||||
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT32] = pack_float_LUMINANCE_FLOAT32;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT16] = pack_float_LUMINANCE_FLOAT16;
|
||||
|
||||
/* n/a */
|
||||
table[MESA_FORMAT_RGBA_INT8] = NULL;
|
||||
table[MESA_FORMAT_RGBA_INT16] = NULL;
|
||||
|
|
|
@ -590,162 +590,6 @@ unpack_S8(const void *src, GLfloat dst[][4], GLuint n)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_RGBA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLfloat *s = (const GLfloat *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] = s[i*4+0];
|
||||
dst[i][GCOMP] = s[i*4+1];
|
||||
dst[i][BCOMP] = s[i*4+2];
|
||||
dst[i][ACOMP] = s[i*4+3];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_RGBA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] = _mesa_half_to_float(s[i*4+0]);
|
||||
dst[i][GCOMP] = _mesa_half_to_float(s[i*4+1]);
|
||||
dst[i][BCOMP] = _mesa_half_to_float(s[i*4+2]);
|
||||
dst[i][ACOMP] = _mesa_half_to_float(s[i*4+3]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_RGB_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLfloat *s = (const GLfloat *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] = s[i*3+0];
|
||||
dst[i][GCOMP] = s[i*3+1];
|
||||
dst[i][BCOMP] = s[i*3+2];
|
||||
dst[i][ACOMP] = 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_RGB_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] = _mesa_half_to_float(s[i*3+0]);
|
||||
dst[i][GCOMP] = _mesa_half_to_float(s[i*3+1]);
|
||||
dst[i][BCOMP] = _mesa_half_to_float(s[i*3+2]);
|
||||
dst[i][ACOMP] = 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLfloat *s = (const GLfloat *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] = 0.0F;
|
||||
dst[i][ACOMP] = s[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] = 0.0F;
|
||||
dst[i][ACOMP] = _mesa_half_to_float(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_LUMINANCE_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLfloat *s = (const GLfloat *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] = s[i];
|
||||
dst[i][ACOMP] = 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_LUMINANCE_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] = _mesa_half_to_float(s[i]);
|
||||
dst[i][ACOMP] = 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_LUMINANCE_ALPHA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLfloat *s = (const GLfloat *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] = s[i*2+0];
|
||||
dst[i][ACOMP] = s[i*2+1];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_LUMINANCE_ALPHA_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] = _mesa_half_to_float(s[i*2+0]);
|
||||
dst[i][ACOMP] = _mesa_half_to_float(s[i*2+1]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_INTENSITY_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLfloat *s = (const GLfloat *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] =
|
||||
dst[i][ACOMP] = s[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_INTENSITY_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i][RCOMP] =
|
||||
dst[i][GCOMP] =
|
||||
dst[i][BCOMP] =
|
||||
dst[i][ACOMP] = _mesa_half_to_float(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n)
|
||||
{
|
||||
|
@ -900,19 +744,6 @@ get_unpack_rgba_function(gl_format format)
|
|||
table[MESA_FORMAT_Z32] = unpack_Z32;
|
||||
table[MESA_FORMAT_S8] = unpack_S8;
|
||||
|
||||
table[MESA_FORMAT_RGBA_FLOAT32] = unpack_RGBA_FLOAT32;
|
||||
table[MESA_FORMAT_RGBA_FLOAT16] = unpack_RGBA_FLOAT16;
|
||||
table[MESA_FORMAT_RGB_FLOAT32] = unpack_RGB_FLOAT32;
|
||||
table[MESA_FORMAT_RGB_FLOAT16] = unpack_RGB_FLOAT16;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT32] = unpack_ALPHA_FLOAT32;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT16] = unpack_ALPHA_FLOAT16;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT32] = unpack_LUMINANCE_FLOAT32;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT16] = unpack_LUMINANCE_FLOAT16;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = unpack_LUMINANCE_ALPHA_FLOAT32;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = unpack_LUMINANCE_ALPHA_FLOAT16;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT32] = unpack_INTENSITY_FLOAT32;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT16] = unpack_INTENSITY_FLOAT16;
|
||||
|
||||
table[MESA_FORMAT_RGBA_INT8] = unpack_RGBA_INT8;
|
||||
table[MESA_FORMAT_RGBA_INT16] = unpack_RGBA_INT16;
|
||||
table[MESA_FORMAT_RGBA_INT32] = unpack_RGBA_INT32;
|
||||
|
|
|
@ -406,116 +406,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
|
|||
0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */
|
||||
1, 1, 1 /* BlockWidth/Height,Bytes */
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGBA_FLOAT32,
|
||||
"MESA_FORMAT_RGBA_FLOAT32",
|
||||
GL_RGBA,
|
||||
GL_FLOAT,
|
||||
32, 32, 32, 32,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGBA_FLOAT16,
|
||||
"MESA_FORMAT_RGBA_FLOAT16",
|
||||
GL_RGBA,
|
||||
GL_FLOAT,
|
||||
16, 16, 16, 16,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 8
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGB_FLOAT32,
|
||||
"MESA_FORMAT_RGB_FLOAT32",
|
||||
GL_RGB,
|
||||
GL_FLOAT,
|
||||
32, 32, 32, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 12
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGB_FLOAT16,
|
||||
"MESA_FORMAT_RGB_FLOAT16",
|
||||
GL_RGB,
|
||||
GL_FLOAT,
|
||||
16, 16, 16, 0,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 6
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_ALPHA_FLOAT32,
|
||||
"MESA_FORMAT_ALPHA_FLOAT32",
|
||||
GL_ALPHA,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 32,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 4
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_ALPHA_FLOAT16,
|
||||
"MESA_FORMAT_ALPHA_FLOAT16",
|
||||
GL_ALPHA,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 16,
|
||||
0, 0, 0, 0, 0,
|
||||
1, 1, 2
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_FLOAT32,
|
||||
"MESA_FORMAT_LUMINANCE_FLOAT32",
|
||||
GL_LUMINANCE,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 0,
|
||||
32, 0, 0, 0, 0,
|
||||
1, 1, 4
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_FLOAT16,
|
||||
"MESA_FORMAT_LUMINANCE_FLOAT16",
|
||||
GL_LUMINANCE,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 0,
|
||||
16, 0, 0, 0, 0,
|
||||
1, 1, 2
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
|
||||
"MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32",
|
||||
GL_LUMINANCE_ALPHA,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 32,
|
||||
32, 0, 0, 0, 0,
|
||||
1, 1, 8
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
|
||||
"MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16",
|
||||
GL_LUMINANCE_ALPHA,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 16,
|
||||
16, 0, 0, 0, 0,
|
||||
1, 1, 4
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_INTENSITY_FLOAT32,
|
||||
"MESA_FORMAT_INTENSITY_FLOAT32",
|
||||
GL_INTENSITY,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 0,
|
||||
0, 32, 0, 0, 0,
|
||||
1, 1, 4
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_INTENSITY_FLOAT16,
|
||||
"MESA_FORMAT_INTENSITY_FLOAT16",
|
||||
GL_INTENSITY,
|
||||
GL_FLOAT,
|
||||
0, 0, 0, 0,
|
||||
0, 16, 0, 0, 0,
|
||||
1, 1, 2
|
||||
},
|
||||
|
||||
/* unnormalized signed int formats */
|
||||
/* unnormalized unsigned int formats */
|
||||
{
|
||||
MESA_FORMAT_ALPHA_UINT8,
|
||||
|
@ -1355,43 +1246,6 @@ _mesa_format_to_type_and_comps(gl_format format,
|
|||
*comps = 4;
|
||||
return;
|
||||
|
||||
case MESA_FORMAT_RGBA_FLOAT32:
|
||||
*datatype = GL_FLOAT;
|
||||
*comps = 4;
|
||||
return;
|
||||
case MESA_FORMAT_RGBA_FLOAT16:
|
||||
*datatype = GL_HALF_FLOAT_ARB;
|
||||
*comps = 4;
|
||||
return;
|
||||
case MESA_FORMAT_RGB_FLOAT32:
|
||||
*datatype = GL_FLOAT;
|
||||
*comps = 3;
|
||||
return;
|
||||
case MESA_FORMAT_RGB_FLOAT16:
|
||||
*datatype = GL_HALF_FLOAT_ARB;
|
||||
*comps = 3;
|
||||
return;
|
||||
case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
|
||||
*datatype = GL_FLOAT;
|
||||
*comps = 2;
|
||||
return;
|
||||
case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
|
||||
*datatype = GL_HALF_FLOAT_ARB;
|
||||
*comps = 2;
|
||||
return;
|
||||
case MESA_FORMAT_ALPHA_FLOAT32:
|
||||
case MESA_FORMAT_LUMINANCE_FLOAT32:
|
||||
case MESA_FORMAT_INTENSITY_FLOAT32:
|
||||
*datatype = GL_FLOAT;
|
||||
*comps = 1;
|
||||
return;
|
||||
case MESA_FORMAT_ALPHA_FLOAT16:
|
||||
case MESA_FORMAT_LUMINANCE_FLOAT16:
|
||||
case MESA_FORMAT_INTENSITY_FLOAT16:
|
||||
*datatype = GL_HALF_FLOAT_ARB;
|
||||
*comps = 1;
|
||||
return;
|
||||
|
||||
case MESA_FORMAT_ALPHA_UINT8:
|
||||
case MESA_FORMAT_LUMINANCE_UINT8:
|
||||
case MESA_FORMAT_INTENSITY_UINT8:
|
||||
|
@ -1654,36 +1508,6 @@ _mesa_format_matches_format_and_type(gl_format gl_format,
|
|||
case MESA_FORMAT_S8:
|
||||
return GL_FALSE;
|
||||
|
||||
case MESA_FORMAT_RGBA_FLOAT32:
|
||||
return format == GL_RGBA && type == GL_FLOAT;
|
||||
case MESA_FORMAT_RGBA_FLOAT16:
|
||||
return format == GL_RGBA && type == GL_HALF_FLOAT;
|
||||
|
||||
case MESA_FORMAT_RGB_FLOAT32:
|
||||
return format == GL_RGB && type == GL_FLOAT;
|
||||
case MESA_FORMAT_RGB_FLOAT16:
|
||||
return format == GL_RGB && type == GL_HALF_FLOAT;
|
||||
|
||||
case MESA_FORMAT_ALPHA_FLOAT32:
|
||||
return format == GL_ALPHA && type == GL_FLOAT;
|
||||
case MESA_FORMAT_ALPHA_FLOAT16:
|
||||
return format == GL_ALPHA && type == GL_HALF_FLOAT;
|
||||
|
||||
case MESA_FORMAT_LUMINANCE_FLOAT32:
|
||||
return format == GL_LUMINANCE && type == GL_FLOAT;
|
||||
case MESA_FORMAT_LUMINANCE_FLOAT16:
|
||||
return format == GL_LUMINANCE && type == GL_HALF_FLOAT;
|
||||
|
||||
case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
|
||||
return format == GL_LUMINANCE_ALPHA && type == GL_FLOAT;
|
||||
case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
|
||||
return format == GL_LUMINANCE_ALPHA && type == GL_HALF_FLOAT;
|
||||
|
||||
case MESA_FORMAT_INTENSITY_FLOAT32:
|
||||
return format == GL_INTENSITY && type == GL_FLOAT;
|
||||
case MESA_FORMAT_INTENSITY_FLOAT16:
|
||||
return format == GL_INTENSITY && type == GL_HALF_FLOAT;
|
||||
|
||||
/* FINISHME: What do we want to do for GL_EXT_texture_integer? */
|
||||
case MESA_FORMAT_ALPHA_UINT8:
|
||||
case MESA_FORMAT_ALPHA_UINT16:
|
||||
|
|
|
@ -105,24 +105,6 @@ typedef enum
|
|||
MESA_FORMAT_S8, /* SSSS SSSS */
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Floating point texture formats.
|
||||
*/
|
||||
/*@{*/
|
||||
MESA_FORMAT_RGBA_FLOAT32,
|
||||
MESA_FORMAT_RGBA_FLOAT16,
|
||||
MESA_FORMAT_RGB_FLOAT32,
|
||||
MESA_FORMAT_RGB_FLOAT16,
|
||||
MESA_FORMAT_ALPHA_FLOAT32,
|
||||
MESA_FORMAT_ALPHA_FLOAT16,
|
||||
MESA_FORMAT_LUMINANCE_FLOAT32,
|
||||
MESA_FORMAT_LUMINANCE_FLOAT16,
|
||||
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
|
||||
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
|
||||
MESA_FORMAT_INTENSITY_FLOAT32,
|
||||
MESA_FORMAT_INTENSITY_FLOAT16,
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Non-normalized signed integer formats.
|
||||
* XXX Note: these are just stand-ins for some better hardware
|
||||
|
|
|
@ -157,7 +157,7 @@ union value {
|
|||
#define CONTEXT_FIELD(field, type) \
|
||||
LOC_CONTEXT, type, offsetof(struct gl_context, field)
|
||||
#define ARRAY_FIELD(field, type) \
|
||||
LOC_ARRAY, type, offsetof(struct gl_array_object, field)
|
||||
LOC_ARRAY, type, offsetof(struct gl_array_attrib, field)
|
||||
#define CONST(value) \
|
||||
LOC_CONTEXT, TYPE_CONST, value
|
||||
|
||||
|
@ -262,12 +262,10 @@ EXTRA_EXT(IBM_rasterpos_clip);
|
|||
EXTRA_EXT(NV_point_sprite);
|
||||
EXTRA_EXT(NV_light_max_exponent);
|
||||
EXTRA_EXT(EXT_depth_bounds_test);
|
||||
EXTRA_EXT(APPLE_vertex_array_object);
|
||||
EXTRA_EXT(EXT_compiled_vertex_array);
|
||||
EXTRA_EXT2(NV_point_sprite, ARB_point_sprite);
|
||||
|
||||
static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
|
||||
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
|
||||
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
|
||||
|
||||
#define API_OPENGL_BIT (1 << API_OPENGL)
|
||||
|
@ -285,7 +283,7 @@ static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
|
|||
static const struct value_desc values[] = {
|
||||
{ GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
|
||||
{ GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
|
||||
{ GL_BLEND_SRC, CONTEXT_ENUM(Color.SrcRGB), NO_EXTRA },
|
||||
{ GL_BLEND_SRC, CONTEXT_ENUM(Color.SrcFactor), NO_EXTRA },
|
||||
{ GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers },
|
||||
{ GL_COLOR_CLEAR_VALUE, LOC_CUSTOM, TYPE_FLOATN_4, 0, NO_EXTRA },
|
||||
{ GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
|
||||
|
@ -347,19 +345,8 @@ static const struct value_desc values[] = {
|
|||
extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
|
||||
|
||||
/* XXX: OES_blend_subtract */
|
||||
{ GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.SrcRGB), NO_EXTRA },
|
||||
{ GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.DstRGB), NO_EXTRA },
|
||||
{ GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.SrcA), NO_EXTRA },
|
||||
{ GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.DstA), NO_EXTRA },
|
||||
|
||||
/* GL_BLEND_EQUATION_RGB, which is what we're really after, is
|
||||
* defined identically to GL_BLEND_EQUATION. */
|
||||
{ GL_BLEND_EQUATION, CONTEXT_ENUM(Color.EquationRGB), NO_EXTRA },
|
||||
{ GL_BLEND_EQUATION_ALPHA_EXT, CONTEXT_ENUM(Color.EquationA), NO_EXTRA },
|
||||
|
||||
/* GL_ARB_texture_compression */
|
||||
{ GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
|
||||
{ GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA },
|
||||
{ GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.SrcFactor), NO_EXTRA },
|
||||
{ GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.DstFactor), NO_EXTRA },
|
||||
|
||||
/* GL_ARB_multisample */
|
||||
{ GL_SAMPLE_ALPHA_TO_COVERAGE_ARB,
|
||||
|
@ -403,7 +390,7 @@ static const struct value_desc values[] = {
|
|||
{ GL_ALPHA_TEST, CONTEXT_BOOL(Color.AlphaEnabled), NO_EXTRA },
|
||||
{ GL_ALPHA_TEST_FUNC, CONTEXT_ENUM(Color.AlphaFunc), NO_EXTRA },
|
||||
{ GL_ALPHA_TEST_REF, LOC_CUSTOM, TYPE_FLOATN, 0, NO_EXTRA },
|
||||
{ GL_BLEND_DST, CONTEXT_ENUM(Color.DstRGB), NO_EXTRA },
|
||||
{ GL_BLEND_DST, CONTEXT_ENUM(Color.DstFactor), NO_EXTRA },
|
||||
{ GL_CLIP_DISTANCE0, CONTEXT_BIT0(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
{ GL_CLIP_DISTANCE1, CONTEXT_BIT1(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
{ GL_CLIP_DISTANCE2, CONTEXT_BIT2(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
|
@ -414,7 +401,7 @@ static const struct value_desc values[] = {
|
|||
{ GL_CLIP_DISTANCE7, CONTEXT_BIT7(Transform.ClipPlanesEnabled), extra_valid_clip_distance },
|
||||
{ GL_COLOR_MATERIAL, CONTEXT_BOOL(Light.ColorMaterialEnabled), NO_EXTRA },
|
||||
{ GL_CURRENT_COLOR,
|
||||
CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR0][0], TYPE_FLOATN_4),
|
||||
CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR][0], TYPE_FLOATN_4),
|
||||
extra_flush_current },
|
||||
{ GL_CURRENT_NORMAL,
|
||||
CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_NORMAL][0], TYPE_FLOATN_3),
|
||||
|
@ -468,10 +455,10 @@ static const struct value_desc values[] = {
|
|||
{ GL_NORMAL_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_NORMAL].Enabled), NO_EXTRA },
|
||||
{ GL_NORMAL_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA },
|
||||
{ GL_NORMAL_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_SIZE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Size), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR].Enabled), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_SIZE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR].Size), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_TYPE, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR].Type), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_STRIDE, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR].Stride), NO_EXTRA },
|
||||
{ GL_TEXTURE_COORD_ARRAY,
|
||||
LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA },
|
||||
{ GL_TEXTURE_COORD_ARRAY_SIZE,
|
||||
|
@ -493,11 +480,11 @@ static const struct value_desc values[] = {
|
|||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
{ GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_POS].BufferObj), NO_EXTRA },
|
||||
offsetof(struct gl_array_attrib, VertexAttrib[VERT_ATTRIB_POS].BufferObj), NO_EXTRA },
|
||||
{ GL_NORMAL_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA },
|
||||
offsetof(struct gl_array_attrib, VertexAttrib[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA },
|
||||
{ GL_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA },
|
||||
offsetof(struct gl_array_attrib, VertexAttrib[VERT_ATTRIB_COLOR].BufferObj), NO_EXTRA },
|
||||
{ GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
|
||||
|
||||
/* GL_OES_point_sprite */
|
||||
|
@ -512,11 +499,6 @@ static const struct value_desc values[] = {
|
|||
|
||||
{ GL_BLEND_COLOR_EXT, LOC_CUSTOM, TYPE_FLOATN_4, 0, NO_EXTRA },
|
||||
|
||||
/* OES_texture_3D */
|
||||
{ GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA },
|
||||
{ GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA },
|
||||
|
||||
{ GL_ACCUM_RED_BITS, BUFFER_INT(Visual.accumRedBits), NO_EXTRA },
|
||||
{ GL_ACCUM_GREEN_BITS, BUFFER_INT(Visual.accumGreenBits), NO_EXTRA },
|
||||
{ GL_ACCUM_BLUE_BITS, BUFFER_INT(Visual.accumBlueBits), NO_EXTRA },
|
||||
|
@ -540,8 +522,6 @@ static const struct value_desc values[] = {
|
|||
{ GL_CURRENT_RASTER_DISTANCE, CONTEXT_FLOAT(Current.RasterDistance), NO_EXTRA },
|
||||
{ GL_CURRENT_RASTER_INDEX, CONST(1), NO_EXTRA },
|
||||
{ GL_CURRENT_RASTER_POSITION, CONTEXT_FLOAT4(Current.RasterPos[0]), NO_EXTRA },
|
||||
{ GL_CURRENT_RASTER_SECONDARY_COLOR,
|
||||
CONTEXT_FIELD(Current.RasterSecondaryColor[0], TYPE_FLOATN_4), NO_EXTRA },
|
||||
{ GL_CURRENT_RASTER_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0,
|
||||
extra_valid_texture_unit },
|
||||
{ GL_CURRENT_RASTER_POSITION_VALID, CONTEXT_BOOL(Current.RasterPosValid), NO_EXTRA },
|
||||
|
@ -561,7 +541,6 @@ static const struct value_desc values[] = {
|
|||
{ GL_INDEX_OFFSET, CONTEXT_INT(Pixel.IndexOffset), NO_EXTRA },
|
||||
{ GL_INDEX_SHIFT, CONTEXT_INT(Pixel.IndexShift), NO_EXTRA },
|
||||
{ GL_INDEX_WRITEMASK, CONTEXT_INT(Color.IndexMask), NO_EXTRA },
|
||||
{ GL_LIGHT_MODEL_COLOR_CONTROL, CONTEXT_ENUM(Light.Model.ColorControl), NO_EXTRA },
|
||||
{ GL_LIGHT_MODEL_LOCAL_VIEWER, CONTEXT_BOOL(Light.Model.LocalViewer), NO_EXTRA },
|
||||
{ GL_LINE_STIPPLE, CONTEXT_BOOL(Line.StippleFlag), NO_EXTRA },
|
||||
{ GL_LINE_STIPPLE_PATTERN, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
|
||||
|
@ -638,7 +617,6 @@ static const struct value_desc values[] = {
|
|||
{ GL_STEREO, BUFFER_INT(Visual.stereoMode), NO_EXTRA },
|
||||
|
||||
{ GL_TEXTURE_1D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA },
|
||||
{ GL_TEXTURE_3D, LOC_CUSTOM, TYPE_BOOLEAN, NO_OFFSET, NO_EXTRA },
|
||||
|
||||
{ GL_TEXTURE_BINDING_1D, LOC_CUSTOM, TYPE_INT, TEXTURE_1D_INDEX, NO_EXTRA },
|
||||
|
||||
|
@ -686,19 +664,6 @@ static const struct value_desc values[] = {
|
|||
CONTEXT_MATRIX_T(ProjectionMatrixStack.Top), NO_EXTRA },
|
||||
{ GL_TRANSPOSE_TEXTURE_MATRIX_ARB, CONTEXT_MATRIX_T(TextureMatrixStack), NO_EXTRA },
|
||||
|
||||
/* GL_EXT_secondary_color */
|
||||
{ GL_CURRENT_SECONDARY_COLOR_EXT,
|
||||
CONTEXT_FIELD(Current.Attrib[VERT_ATTRIB_COLOR1][0], TYPE_FLOATN_4),
|
||||
extra_EXT_secondary_color_flush_current },
|
||||
{ GL_SECONDARY_COLOR_ARRAY_EXT, ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled),
|
||||
extra_EXT_secondary_color },
|
||||
{ GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR1].Type),
|
||||
extra_EXT_secondary_color },
|
||||
{ GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride),
|
||||
extra_EXT_secondary_color },
|
||||
{ GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Size),
|
||||
extra_EXT_secondary_color },
|
||||
|
||||
/* GL_EXT_fog_coord */
|
||||
{ GL_CURRENT_FOG_COORDINATE_EXT,
|
||||
CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]),
|
||||
|
@ -735,13 +700,11 @@ static const struct value_desc values[] = {
|
|||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
{ GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA },
|
||||
offsetof(struct gl_array_attrib, VertexAttrib[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA },
|
||||
{ GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA },
|
||||
{ GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA },
|
||||
offsetof(struct gl_array_attrib, VertexAttrib[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA },
|
||||
{ GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
|
||||
offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA },
|
||||
offsetof(struct gl_array_attrib, VertexAttrib[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA },
|
||||
|
||||
/* GL_EXT_depth_bounds_test */
|
||||
{ GL_DEPTH_BOUNDS_TEST_EXT, CONTEXT_BOOL(Depth.BoundsTest),
|
||||
|
@ -749,10 +712,6 @@ static const struct value_desc values[] = {
|
|||
{ GL_DEPTH_BOUNDS_EXT, CONTEXT_FLOAT2(Depth.BoundsMin),
|
||||
extra_EXT_depth_bounds_test },
|
||||
|
||||
/* GL_APPLE_vertex_array_object */
|
||||
{ GL_VERTEX_ARRAY_BINDING_APPLE, ARRAY_INT(Name),
|
||||
extra_APPLE_vertex_array_object },
|
||||
|
||||
/* GL_EXT_texture_integer */
|
||||
{ GL_RGBA_INTEGER_MODE_EXT, BUFFER_BOOL(_IntegerColor),
|
||||
extra_EXT_texture_integer },
|
||||
|
@ -882,7 +841,6 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
|||
switch (d->pname) {
|
||||
case GL_TEXTURE_1D:
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_TEXTURE_CUBE_MAP_ARB:
|
||||
v->value_bool = _mesa_IsEnabled(d->pname);
|
||||
break;
|
||||
|
@ -940,7 +898,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
|||
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
||||
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
||||
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
||||
array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX];
|
||||
array = &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX];
|
||||
v->value_int = *(GLuint *) ((char *) array + d->offset);
|
||||
break;
|
||||
|
||||
|
@ -1043,18 +1001,15 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
|||
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
|
||||
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
|
||||
buffer_obj = (struct gl_buffer_object **)
|
||||
((char *) ctx->Array.ArrayObj + d->offset);
|
||||
((char *) &ctx->Array + d->offset);
|
||||
v->value_int = (*buffer_obj)->Name;
|
||||
break;
|
||||
case GL_ARRAY_BUFFER_BINDING_ARB:
|
||||
v->value_int = ctx->Array.ArrayBufferObj->Name;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
|
||||
v->value_int =
|
||||
ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX].BufferObj->Name;
|
||||
ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].BufferObj->Name;
|
||||
break;
|
||||
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
|
||||
v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name;
|
||||
v->value_int = ctx->Array.ElementArrayBufferObj->Name;
|
||||
break;
|
||||
|
||||
case GL_FOG_COLOR:
|
||||
|
@ -1066,9 +1021,6 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
|
|||
v->value_float_4[2] = ctx->Color.ClearColor.f[2], 0.0F, 1.0F;
|
||||
v->value_float_4[3] = ctx->Color.ClearColor.f[3], 0.0F, 1.0F;
|
||||
break;
|
||||
case GL_BLEND_COLOR_EXT:
|
||||
COPY_4FV(v->value_float_4, ctx->Color.BlendColor);
|
||||
break;
|
||||
case GL_ALPHA_TEST_REF:
|
||||
v->value_float = ctx->Color.AlphaRef;
|
||||
break;
|
||||
|
@ -1206,7 +1158,7 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
|
|||
*p = ((char *) ctx + d->offset);
|
||||
return d;
|
||||
case LOC_ARRAY:
|
||||
*p = ((char *) ctx->Array.ArrayObj + d->offset);
|
||||
*p = ((char *)&ctx->Array + d->offset);
|
||||
return d;
|
||||
case LOC_TEXUNIT:
|
||||
unit = &ctx->Texture.Unit;
|
||||
|
|
|
@ -62,9 +62,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params );
|
|||
extern const GLubyte * GLAPIENTRY
|
||||
_mesa_GetString( GLenum name );
|
||||
|
||||
extern const GLubyte * GLAPIENTRY
|
||||
_mesa_GetStringi(GLenum name, GLuint index);
|
||||
|
||||
extern GLenum GLAPIENTRY
|
||||
_mesa_GetError( void );
|
||||
|
||||
|
|
|
@ -72,33 +72,6 @@ _mesa_GetString( GLenum name )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* GL3
|
||||
*/
|
||||
const GLubyte * GLAPIENTRY
|
||||
_mesa_GetStringi(GLenum name, GLuint index)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (!ctx)
|
||||
return NULL;
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
|
||||
|
||||
switch (name) {
|
||||
case GL_EXTENSIONS:
|
||||
if (index >= _mesa_get_extension_count(ctx)) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetStringi(index=%u)", index);
|
||||
return (const GLubyte *) 0;
|
||||
}
|
||||
return _mesa_get_enabled_extension(ctx, index);
|
||||
default:
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
|
||||
return (const GLubyte *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return pointer-valued state, such as a vertex array pointer.
|
||||
|
@ -125,28 +98,25 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
|
|||
|
||||
switch (pname) {
|
||||
case GL_VERTEX_ARRAY_POINTER:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Ptr;
|
||||
break;
|
||||
case GL_NORMAL_ARRAY_POINTER:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Ptr;
|
||||
break;
|
||||
case GL_COLOR_ARRAY_POINTER:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr;
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR].Ptr;
|
||||
break;
|
||||
case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Ptr;
|
||||
break;
|
||||
case GL_INDEX_ARRAY_POINTER:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_POINTER:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].Ptr;
|
||||
break;
|
||||
case GL_EDGE_FLAG_ARRAY_POINTER:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr;
|
||||
*params = (GLvoid *) ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr;
|
||||
break;
|
||||
case GL_FEEDBACK_BUFFER_POINTER:
|
||||
*params = ctx->Feedback.Buffer;
|
||||
|
@ -154,11 +124,6 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params )
|
|||
case GL_SELECTION_BUFFER_POINTER:
|
||||
*params = ctx->Select.Buffer;
|
||||
break;
|
||||
#if FEATURE_point_size_array
|
||||
case GL_POINT_SIZE_ARRAY_POINTER_OES:
|
||||
*params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
|
||||
return;
|
||||
|
|
|
@ -153,11 +153,6 @@ typedef void *GLeglImageOES;
|
|||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#endif
|
||||
|
||||
#ifndef GL_ATI_texture_compression_3dc
|
||||
#define GL_ATI_texture_compression_3dc 1
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Internal token to represent a GLSL shader program (a collection of
|
||||
|
|
|
@ -1,147 +0,0 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#include "histogram.h"
|
||||
|
||||
#if FEATURE_histogram
|
||||
|
||||
/**********************************************************************
|
||||
* API functions
|
||||
*/
|
||||
|
||||
|
||||
/* this is defined below */
|
||||
static void GLAPIENTRY _mesa_ResetMinmax(GLenum target);
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format,
|
||||
GLenum type, GLvoid *values)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmax");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format,
|
||||
GLenum type, GLvoid *values)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogram");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameterfv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetHistogramParameteriv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameterfv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetMinmaxParameteriv");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glHistogram");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glMinmax");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ResetHistogram(GLenum target)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glResetHistogram");
|
||||
}
|
||||
|
||||
|
||||
static void GLAPIENTRY
|
||||
_mesa_ResetMinmax(GLenum target)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glResetMinmax");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_mesa_init_histogram_dispatch(struct _glapi_table *disp)
|
||||
{
|
||||
SET_GetHistogram(disp, _mesa_GetHistogram);
|
||||
SET_GetHistogramParameterfv(disp, _mesa_GetHistogramParameterfv);
|
||||
SET_GetHistogramParameteriv(disp, _mesa_GetHistogramParameteriv);
|
||||
SET_GetMinmax(disp, _mesa_GetMinmax);
|
||||
SET_GetMinmaxParameterfv(disp, _mesa_GetMinmaxParameterfv);
|
||||
SET_GetMinmaxParameteriv(disp, _mesa_GetMinmaxParameteriv);
|
||||
SET_Histogram(disp, _mesa_Histogram);
|
||||
SET_Minmax(disp, _mesa_Minmax);
|
||||
SET_ResetHistogram(disp, _mesa_ResetHistogram);
|
||||
SET_ResetMinmax(disp, _mesa_ResetMinmax);
|
||||
}
|
||||
|
||||
#endif /* FEATURE_histogram */
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* \file histogram.h
|
||||
* Histogram.
|
||||
*
|
||||
* \if subset
|
||||
* (No-op)
|
||||
*
|
||||
* \endif
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 5.1
|
||||
*
|
||||
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HISTOGRAM_H
|
||||
#define HISTOGRAM_H
|
||||
|
||||
#include "compiler.h"
|
||||
#include "mfeatures.h"
|
||||
|
||||
struct _glapi_table;
|
||||
|
||||
#if FEATURE_histogram
|
||||
|
||||
extern void
|
||||
_mesa_init_histogram_dispatch(struct _glapi_table *disp);
|
||||
|
||||
#else /* FEATURE_histogram */
|
||||
|
||||
static inline void
|
||||
_mesa_init_histogram_dispatch(struct _glapi_table *disp)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* FEATURE_histogram */
|
||||
|
||||
#endif /* HISTOGRAM_H */
|
|
@ -125,8 +125,6 @@ _mesa_sizeof_type( GLenum type )
|
|||
return sizeof(GLfloat);
|
||||
case GL_DOUBLE:
|
||||
return sizeof(GLdouble);
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
return sizeof(GLhalfARB);
|
||||
case GL_FIXED:
|
||||
return sizeof(GLfixed);
|
||||
default:
|
||||
|
@ -157,8 +155,6 @@ _mesa_sizeof_packed_type( GLenum type )
|
|||
return sizeof(GLuint);
|
||||
case GL_INT:
|
||||
return sizeof(GLint);
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
return sizeof(GLhalfARB);
|
||||
case GL_FLOAT:
|
||||
return sizeof(GLfloat);
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
|
@ -267,8 +263,6 @@ _mesa_bytes_per_pixel( GLenum format, GLenum type )
|
|||
return comps * sizeof(GLint);
|
||||
case GL_FLOAT:
|
||||
return comps * sizeof(GLfloat);
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
return comps * sizeof(GLhalfARB);
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
case GL_UNSIGNED_BYTE_2_3_3_REV:
|
||||
if (format == GL_RGB || format == GL_BGR ||
|
||||
|
@ -384,9 +378,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||
case GL_UNSIGNED_INT:
|
||||
case GL_FLOAT:
|
||||
return GL_NO_ERROR;
|
||||
case GL_HALF_FLOAT:
|
||||
return ctx->Extensions.ARB_half_float_pixel
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
default:
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
@ -410,9 +401,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||
case GL_UNSIGNED_INT:
|
||||
case GL_FLOAT:
|
||||
return GL_NO_ERROR;
|
||||
case GL_HALF_FLOAT:
|
||||
return ctx->Extensions.ARB_half_float_pixel
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
default:
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
@ -431,9 +419,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||
case GL_UNSIGNED_SHORT_5_6_5:
|
||||
case GL_UNSIGNED_SHORT_5_6_5_REV:
|
||||
return GL_NO_ERROR;
|
||||
case GL_HALF_FLOAT:
|
||||
return ctx->Extensions.ARB_half_float_pixel
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
default:
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
@ -451,9 +436,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||
case GL_UNSIGNED_INT:
|
||||
case GL_FLOAT:
|
||||
return GL_NO_ERROR;
|
||||
case GL_HALF_FLOAT:
|
||||
return ctx->Extensions.ARB_half_float_pixel
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
default:
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
@ -476,9 +458,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
|||
case GL_UNSIGNED_INT_8_8_8_8:
|
||||
case GL_UNSIGNED_INT_8_8_8_8_REV:
|
||||
return GL_NO_ERROR;
|
||||
case GL_HALF_FLOAT:
|
||||
return ctx->Extensions.ARB_half_float_pixel
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
default:
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
|
|
@ -537,146 +537,6 @@ _mesa_bitcount_64(uint64_t n)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Convert a 4-byte float to a 2-byte half float.
|
||||
* Based on code from:
|
||||
* http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
|
||||
*/
|
||||
GLhalfARB
|
||||
_mesa_float_to_half(float val)
|
||||
{
|
||||
const fi_type fi = {val};
|
||||
const int flt_m = fi.i & 0x7fffff;
|
||||
const int flt_e = (fi.i >> 23) & 0xff;
|
||||
const int flt_s = (fi.i >> 31) & 0x1;
|
||||
int s, e, m = 0;
|
||||
GLhalfARB result;
|
||||
|
||||
/* sign bit */
|
||||
s = flt_s;
|
||||
|
||||
/* handle special cases */
|
||||
if ((flt_e == 0) && (flt_m == 0)) {
|
||||
/* zero */
|
||||
/* m = 0; - already set */
|
||||
e = 0;
|
||||
}
|
||||
else if ((flt_e == 0) && (flt_m != 0)) {
|
||||
/* denorm -- denorm float maps to 0 half */
|
||||
/* m = 0; - already set */
|
||||
e = 0;
|
||||
}
|
||||
else if ((flt_e == 0xff) && (flt_m == 0)) {
|
||||
/* infinity */
|
||||
/* m = 0; - already set */
|
||||
e = 31;
|
||||
}
|
||||
else if ((flt_e == 0xff) && (flt_m != 0)) {
|
||||
/* NaN */
|
||||
m = 1;
|
||||
e = 31;
|
||||
}
|
||||
else {
|
||||
/* regular number */
|
||||
const int new_exp = flt_e - 127;
|
||||
if (new_exp < -24) {
|
||||
/* this maps to 0 */
|
||||
/* m = 0; - already set */
|
||||
e = 0;
|
||||
}
|
||||
else if (new_exp < -14) {
|
||||
/* this maps to a denorm */
|
||||
unsigned int exp_val = (unsigned int) (-14 - new_exp); /* 2^-exp_val*/
|
||||
e = 0;
|
||||
switch (exp_val) {
|
||||
case 0:
|
||||
_mesa_warning(NULL,
|
||||
"float_to_half: logical error in denorm creation!\n");
|
||||
/* m = 0; - already set */
|
||||
break;
|
||||
case 1: m = 512 + (flt_m >> 14); break;
|
||||
case 2: m = 256 + (flt_m >> 15); break;
|
||||
case 3: m = 128 + (flt_m >> 16); break;
|
||||
case 4: m = 64 + (flt_m >> 17); break;
|
||||
case 5: m = 32 + (flt_m >> 18); break;
|
||||
case 6: m = 16 + (flt_m >> 19); break;
|
||||
case 7: m = 8 + (flt_m >> 20); break;
|
||||
case 8: m = 4 + (flt_m >> 21); break;
|
||||
case 9: m = 2 + (flt_m >> 22); break;
|
||||
case 10: m = 1; break;
|
||||
}
|
||||
}
|
||||
else if (new_exp > 15) {
|
||||
/* map this value to infinity */
|
||||
/* m = 0; - already set */
|
||||
e = 31;
|
||||
}
|
||||
else {
|
||||
/* regular */
|
||||
e = new_exp + 15;
|
||||
m = flt_m >> 13;
|
||||
}
|
||||
}
|
||||
|
||||
result = (s << 15) | (e << 10) | m;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a 2-byte half float to a 4-byte float.
|
||||
* Based on code from:
|
||||
* http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
|
||||
*/
|
||||
float
|
||||
_mesa_half_to_float(GLhalfARB val)
|
||||
{
|
||||
/* XXX could also use a 64K-entry lookup table */
|
||||
const int m = val & 0x3ff;
|
||||
const int e = (val >> 10) & 0x1f;
|
||||
const int s = (val >> 15) & 0x1;
|
||||
int flt_m, flt_e, flt_s;
|
||||
fi_type fi;
|
||||
float result;
|
||||
|
||||
/* sign bit */
|
||||
flt_s = s;
|
||||
|
||||
/* handle special cases */
|
||||
if ((e == 0) && (m == 0)) {
|
||||
/* zero */
|
||||
flt_m = 0;
|
||||
flt_e = 0;
|
||||
}
|
||||
else if ((e == 0) && (m != 0)) {
|
||||
/* denorm -- denorm half will fit in non-denorm single */
|
||||
const float half_denorm = 1.0f / 16384.0f; /* 2^-14 */
|
||||
float mantissa = ((float) (m)) / 1024.0f;
|
||||
float sign = s ? -1.0f : 1.0f;
|
||||
return sign * mantissa * half_denorm;
|
||||
}
|
||||
else if ((e == 31) && (m == 0)) {
|
||||
/* infinity */
|
||||
flt_e = 0xff;
|
||||
flt_m = 0;
|
||||
}
|
||||
else if ((e == 31) && (m != 0)) {
|
||||
/* NaN */
|
||||
flt_e = 0xff;
|
||||
flt_m = 1;
|
||||
}
|
||||
else {
|
||||
/* regular */
|
||||
flt_e = e + 112;
|
||||
flt_m = m << 13;
|
||||
}
|
||||
|
||||
fi.i = (flt_s << 31) | (flt_e << 23) | flt_m;
|
||||
result = fi.f;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
@ -1028,14 +888,14 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
|
|||
void
|
||||
_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
//#ifdef DEBUG
|
||||
char s[MAXSTRING];
|
||||
va_list args;
|
||||
va_start(args, fmtString);
|
||||
vsnprintf(s, MAXSTRING, fmtString, args);
|
||||
va_end(args);
|
||||
output_if_debug("Mesa", s, GL_FALSE);
|
||||
#endif /* DEBUG */
|
||||
//#endif /* DEBUG */
|
||||
(void) ctx;
|
||||
(void) fmtString;
|
||||
}
|
||||
|
|
|
@ -597,12 +597,6 @@ extern unsigned int
|
|||
_mesa_bitcount(unsigned int n);
|
||||
#endif
|
||||
|
||||
extern GLhalfARB
|
||||
_mesa_float_to_half(float f);
|
||||
|
||||
extern float
|
||||
_mesa_half_to_float(GLhalfARB h);
|
||||
|
||||
|
||||
extern void *
|
||||
_mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
|
||||
|
|
|
@ -418,7 +418,6 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
|
|||
void GLAPIENTRY
|
||||
_mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
||||
{
|
||||
GLenum newenum;
|
||||
GLboolean newbool;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
@ -448,21 +447,6 @@ _mesa_LightModelfv( GLenum pname, const GLfloat *params )
|
|||
else
|
||||
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
|
||||
break;
|
||||
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
||||
if (params[0] == (GLfloat) GL_SINGLE_COLOR)
|
||||
newenum = GL_SINGLE_COLOR;
|
||||
else if (params[0] == (GLfloat) GL_SEPARATE_SPECULAR_COLOR)
|
||||
newenum = GL_SEPARATE_SPECULAR_COLOR;
|
||||
else {
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(param=0x0%x)",
|
||||
(GLint) params[0] );
|
||||
return;
|
||||
}
|
||||
if (ctx->Light.Model.ColorControl == newenum)
|
||||
return;
|
||||
FLUSH_VERTICES(ctx, _NEW_LIGHT);
|
||||
ctx->Light.Model.ColorControl = newenum;
|
||||
break;
|
||||
default:
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glLightModel(pname=0x%x)", pname );
|
||||
break;
|
||||
|
@ -716,7 +700,7 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
|
|||
|
||||
if (ctx->Light.ColorMaterialEnabled) {
|
||||
FLUSH_CURRENT( ctx, 0 );
|
||||
_mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
|
||||
_mesa_update_color_material(ctx,ctx->Current.Attrib[VERT_ATTRIB_COLOR]);
|
||||
}
|
||||
|
||||
if (ctx->Driver.ColorMaterial)
|
||||
|
@ -1019,7 +1003,6 @@ _mesa_update_lighting( struct gl_context *ctx )
|
|||
|
||||
ctx->Light._NeedVertices =
|
||||
((ctx->Light._Flags & (LIGHT_POSITIONAL|LIGHT_SPOT)) ||
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR ||
|
||||
ctx->Light.Model.LocalViewer);
|
||||
|
||||
ctx->Light._NeedEyeCoords = ((ctx->Light._Flags & LIGHT_POSITIONAL) ||
|
||||
|
@ -1285,7 +1268,6 @@ init_lightmodel( struct gl_lightmodel *lm )
|
|||
ASSIGN_4V( lm->Ambient, 0.2F, 0.2F, 0.2F, 1.0F );
|
||||
lm->LocalViewer = GL_FALSE;
|
||||
lm->TwoSide = GL_FALSE;
|
||||
lm->ColorControl = GL_SINGLE_COLOR;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,12 +78,6 @@
|
|||
#define FEATURE_GL !FEATURE_ES
|
||||
#endif
|
||||
|
||||
#if defined(IN_DRI_DRIVER) || (FEATURE_GL + FEATURE_ES1 + FEATURE_ES2 > 1)
|
||||
#define FEATURE_remap_table 1
|
||||
#else
|
||||
#define FEATURE_remap_table 0
|
||||
#endif
|
||||
|
||||
#define FEATURE_dispatch 1
|
||||
#define FEATURE_texgen 1
|
||||
#define FEATURE_userclip 1
|
||||
|
@ -103,14 +97,10 @@
|
|||
#define FEATURE_pixel_transfer FEATURE_GL
|
||||
#define FEATURE_queryobj FEATURE_GL
|
||||
#define FEATURE_rastpos FEATURE_GL
|
||||
#define FEATURE_texture_fxt1 FEATURE_GL
|
||||
#define FEATURE_texture_s3tc FEATURE_GL
|
||||
|
||||
#define FEATURE_extra_context_init FEATURE_ES
|
||||
#define FEATURE_point_size_array FEATURE_ES
|
||||
|
||||
#define FEATURE_es2_glsl FEATURE_ES2
|
||||
|
||||
#define FEATURE_ARB_fragment_program 1
|
||||
#define FEATURE_ARB_vertex_program 1
|
||||
#define FEATURE_ARB_vertex_shader 1
|
||||
|
|
|
@ -96,14 +96,13 @@ typedef enum
|
|||
VERT_ATTRIB_POS = 0,
|
||||
VERT_ATTRIB_WEIGHT = 1,
|
||||
VERT_ATTRIB_NORMAL = 2,
|
||||
VERT_ATTRIB_COLOR0 = 3,
|
||||
VERT_ATTRIB_COLOR1 = 4,
|
||||
VERT_ATTRIB_FOG = 5,
|
||||
VERT_ATTRIB_COLOR_INDEX = 6,
|
||||
VERT_ATTRIB_EDGEFLAG = 7,
|
||||
VERT_ATTRIB_TEX = 8,
|
||||
VERT_ATTRIB_POINT_SIZE = 9,
|
||||
VERT_ATTRIB_MAX = 10
|
||||
VERT_ATTRIB_COLOR = 3,
|
||||
VERT_ATTRIB_FOG = 4,
|
||||
VERT_ATTRIB_COLOR_INDEX = 5,
|
||||
VERT_ATTRIB_EDGEFLAG = 6,
|
||||
VERT_ATTRIB_TEX = 7,
|
||||
VERT_ATTRIB_POINT_SIZE = 8,
|
||||
VERT_ATTRIB_MAX = 9
|
||||
} gl_vert_attrib;
|
||||
|
||||
/**
|
||||
|
@ -121,8 +120,7 @@ typedef enum
|
|||
#define VERT_BIT_POS BITFIELD64_BIT(VERT_ATTRIB_POS)
|
||||
#define VERT_BIT_WEIGHT BITFIELD64_BIT(VERT_ATTRIB_WEIGHT)
|
||||
#define VERT_BIT_NORMAL BITFIELD64_BIT(VERT_ATTRIB_NORMAL)
|
||||
#define VERT_BIT_COLOR0 BITFIELD64_BIT(VERT_ATTRIB_COLOR0)
|
||||
#define VERT_BIT_COLOR1 BITFIELD64_BIT(VERT_ATTRIB_COLOR1)
|
||||
#define VERT_BIT_COLOR BITFIELD64_BIT(VERT_ATTRIB_COLOR)
|
||||
#define VERT_BIT_FOG BITFIELD64_BIT(VERT_ATTRIB_FOG)
|
||||
#define VERT_BIT_COLOR_INDEX BITFIELD64_BIT(VERT_ATTRIB_COLOR_INDEX)
|
||||
#define VERT_BIT_EDGEFLAG BITFIELD64_BIT(VERT_ATTRIB_EDGEFLAG)
|
||||
|
@ -143,20 +141,18 @@ typedef enum
|
|||
typedef enum
|
||||
{
|
||||
FRAG_ATTRIB_WPOS = 0,
|
||||
FRAG_ATTRIB_COL0 = 1,
|
||||
FRAG_ATTRIB_COL1 = 2,
|
||||
FRAG_ATTRIB_FOGC = 3,
|
||||
FRAG_ATTRIB_TEX = 4,
|
||||
FRAG_ATTRIB_FACE = 5, /**< front/back face */
|
||||
FRAG_ATTRIB_PNTC = 6, /**< sprite/point coord */
|
||||
FRAG_ATTRIB_CLIP_DIST0 = 7,
|
||||
FRAG_ATTRIB_CLIP_DIST1 = 8,
|
||||
FRAG_ATTRIB_MAX = 9
|
||||
FRAG_ATTRIB_COL = 1,
|
||||
FRAG_ATTRIB_FOGC = 2,
|
||||
FRAG_ATTRIB_TEX = 3,
|
||||
FRAG_ATTRIB_FACE = 4, /**< front/back face */
|
||||
FRAG_ATTRIB_PNTC = 5, /**< sprite/point coord */
|
||||
FRAG_ATTRIB_CLIP_DIST0 = 6,
|
||||
FRAG_ATTRIB_CLIP_DIST1 = 7,
|
||||
FRAG_ATTRIB_MAX = 8
|
||||
} gl_frag_attrib;
|
||||
|
||||
|
||||
#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
|
||||
#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
|
||||
#define FRAG_BIT_COL (1 << FRAG_ATTRIB_COL)
|
||||
#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
|
||||
#define FRAG_BIT_TEX (1 << FRAG_ATTRIB_TEX)
|
||||
|
||||
|
@ -386,8 +382,6 @@ struct gl_lightmodel
|
|||
GLfloat Ambient[4]; /**< ambient color */
|
||||
GLboolean LocalViewer; /**< Local (or infinite) view point? */
|
||||
GLboolean TwoSide; /**< Two (or one) sided lighting? */
|
||||
GLenum ColorControl; /**< either GL_SINGLE_COLOR
|
||||
* or GL_SEPARATE_SPECULAR_COLOR */
|
||||
};
|
||||
|
||||
|
||||
|
@ -452,14 +446,9 @@ struct gl_colorbuffer_attrib
|
|||
* control, only on the fixed-pointness of the render target.
|
||||
* The query does however depend on fragment color clamping.
|
||||
*/
|
||||
GLfloat BlendColor[4]; /**< Blending color */
|
||||
|
||||
GLenum SrcRGB; /**< RGB blend source term */
|
||||
GLenum DstRGB; /**< RGB blend dest term */
|
||||
GLenum SrcA; /**< Alpha blend source term */
|
||||
GLenum DstA; /**< Alpha blend dest term */
|
||||
GLenum EquationRGB; /**< GL_ADD, GL_SUBTRACT, etc. */
|
||||
GLenum EquationA; /**< GL_ADD, GL_SUBTRACT, etc. */
|
||||
GLenum SrcFactor; /**< RGB blend source term */
|
||||
GLenum DstFactor; /**< RGB blend dest term */
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
@ -496,7 +485,6 @@ struct gl_current_attrib
|
|||
GLfloat RasterPos[4];
|
||||
GLfloat RasterDistance;
|
||||
GLfloat RasterColor[4];
|
||||
GLfloat RasterSecondaryColor[4];
|
||||
GLfloat RasterTexCoords[4];
|
||||
GLboolean RasterPosValid;
|
||||
/*@}*/
|
||||
|
@ -572,7 +560,6 @@ struct gl_fog_attrib
|
|||
GLfloat End; /**< End distance in eye coords */
|
||||
GLfloat Index; /**< Fog index */
|
||||
GLenum Mode; /**< Fog mode */
|
||||
GLboolean ColorSumEnabled;
|
||||
GLenum FogCoordinateSource; /**< GL_EXT_fog_coord */
|
||||
GLfloat _Scale; /**< (End == Start) ? 1.0 : 1.0 / (End - Start) */
|
||||
GLenum FogDistanceMode; /**< GL_NV_fog_distance */
|
||||
|
@ -833,7 +820,6 @@ struct gl_stencil_attrib
|
|||
typedef enum
|
||||
{
|
||||
TEXTURE_CUBE_INDEX,
|
||||
TEXTURE_3D_INDEX,
|
||||
TEXTURE_2D_INDEX,
|
||||
TEXTURE_1D_INDEX,
|
||||
NUM_TEXTURE_TARGETS
|
||||
|
@ -846,7 +832,6 @@ typedef enum
|
|||
*/
|
||||
/*@{*/
|
||||
#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
|
||||
#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
|
||||
#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
|
||||
#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
|
||||
/*@}*/
|
||||
|
@ -1192,77 +1177,30 @@ struct gl_client_array
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* Collection of vertex arrays. Defined by the GL_APPLE_vertex_array_object
|
||||
* extension, but a nice encapsulation in any case.
|
||||
*/
|
||||
struct gl_array_object
|
||||
{
|
||||
/** Name of the array object as received from glGenVertexArrayAPPLE. */
|
||||
GLuint Name;
|
||||
|
||||
GLint RefCount;
|
||||
_glthread_Mutex Mutex;
|
||||
|
||||
/**
|
||||
* Does the VAO use ARB semantics or Apple semantics?
|
||||
*
|
||||
* There are several ways in which ARB_vertex_array_object and
|
||||
* APPLE_vertex_array_object VAOs have differing semantics. At the very
|
||||
* least,
|
||||
*
|
||||
* - ARB VAOs require that all array data be sourced from vertex buffer
|
||||
* objects, but Apple VAOs do not.
|
||||
*
|
||||
* - ARB VAOs require that names come from GenVertexArrays.
|
||||
*
|
||||
* This flag notes which behavior governs this VAO.
|
||||
*/
|
||||
GLboolean ARBsemantics;
|
||||
|
||||
/**
|
||||
* Has this array object been bound?
|
||||
*/
|
||||
GLboolean _Used;
|
||||
|
||||
/** Vertex attribute arrays */
|
||||
struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
|
||||
|
||||
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
|
||||
GLbitfield64 _Enabled;
|
||||
|
||||
/**
|
||||
* Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs
|
||||
* we can determine the max legal (in bounds) glDrawElements array index.
|
||||
*/
|
||||
GLuint _MaxElement;
|
||||
|
||||
struct gl_buffer_object *ElementArrayBufferObj;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Vertex array state
|
||||
*/
|
||||
struct gl_array_attrib
|
||||
{
|
||||
/** Currently bound array object. See _mesa_BindVertexArrayAPPLE() */
|
||||
struct gl_array_object *ArrayObj;
|
||||
/** Vertex attribute arrays */
|
||||
struct gl_client_array VertexAttrib[VERT_ATTRIB_MAX];
|
||||
|
||||
/** The default vertex array object */
|
||||
struct gl_array_object *DefaultArrayObj;
|
||||
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
|
||||
GLbitfield64 _Enabled;
|
||||
|
||||
/** Array objects (GL_ARB/APPLE_vertex_array_object) */
|
||||
struct _mesa_HashTable *Objects;
|
||||
/**
|
||||
* Min of all enabled arrays' _MaxElement. When arrays reside inside VBOs
|
||||
* we can determine the max legal (in bounds) glDrawElements array index.
|
||||
*/
|
||||
GLuint _MaxElement;
|
||||
|
||||
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
|
||||
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
|
||||
struct gl_buffer_object *ElementArrayBufferObj;
|
||||
|
||||
GLbitfield64 NewState; /**< mask of VERT_BIT_* values */
|
||||
GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */
|
||||
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
|
||||
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
struct gl_buffer_object *ArrayBufferObj;
|
||||
GLbitfield64 NewState; /**< mask of VERT_BIT_* values */
|
||||
GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */
|
||||
};
|
||||
|
||||
|
||||
|
@ -1494,17 +1432,6 @@ struct gl_framebuffer
|
|||
void (*Delete)(struct gl_framebuffer *fb);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Precision info for shader datatypes. See glGetShaderPrecisionFormat().
|
||||
*/
|
||||
struct gl_precision
|
||||
{
|
||||
GLushort RangeMin; /**< min value exponent */
|
||||
GLushort RangeMax; /**< max value exponent */
|
||||
GLushort Precision; /**< number of mantissa bits */
|
||||
};
|
||||
|
||||
/**
|
||||
* Constants which may be overridden by device driver during context creation
|
||||
* but are never changed after that.
|
||||
|
@ -1512,8 +1439,7 @@ struct gl_precision
|
|||
struct gl_constants
|
||||
{
|
||||
GLint MaxTextureMbytes; /**< Max memory per image, in MB */
|
||||
GLint MaxTextureLevels; /**< Max mipmap levels. */
|
||||
GLint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
|
||||
GLint MaxTextureLevels; /**< Max mipmap levels. */
|
||||
GLint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
|
||||
GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
|
||||
|
||||
|
@ -1528,8 +1454,6 @@ struct gl_constants
|
|||
GLfloat MinLineWidthAA, MaxLineWidthAA; /**< antialiased */
|
||||
GLfloat LineWidthGranularity;
|
||||
|
||||
GLuint MaxColorTableSize;
|
||||
|
||||
GLuint MaxClipPlanes;
|
||||
GLuint MaxLights;
|
||||
GLfloat MaxShininess; /**< GL_NV_light_max_exponent */
|
||||
|
@ -1577,19 +1501,14 @@ struct gl_extensions
|
|||
GLboolean dummy; /* don't remove this! */
|
||||
GLboolean dummy_true; /* Set true by _mesa_init_extensions(). */
|
||||
GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
|
||||
GLboolean ARB_half_float_pixel;
|
||||
GLboolean ARB_half_float_vertex;
|
||||
GLboolean ARB_map_buffer_range;
|
||||
GLboolean ARB_point_sprite;
|
||||
GLboolean ARB_texture_cube_map;
|
||||
GLboolean ARB_texture_env_combine;
|
||||
GLboolean ARB_texture_env_crossbar;
|
||||
GLboolean ARB_texture_env_dot3;
|
||||
GLboolean ARB_texture_float;
|
||||
GLboolean ARB_texture_non_power_of_two;
|
||||
GLboolean ARB_texture_storage;
|
||||
GLboolean ARB_transpose_matrix;
|
||||
GLboolean ARB_vertex_array_object;
|
||||
GLboolean ARB_window_pos;
|
||||
GLboolean EXT_blend_color;
|
||||
GLboolean EXT_blend_equation_separate;
|
||||
|
@ -1607,14 +1526,11 @@ struct gl_extensions
|
|||
GLboolean EXT_secondary_color;
|
||||
GLboolean EXT_separate_shader_objects;
|
||||
GLboolean EXT_separate_specular_color;
|
||||
GLboolean EXT_texture3D;
|
||||
GLboolean EXT_texture_env_dot3;
|
||||
GLboolean EXT_texture_filter_anisotropic;
|
||||
GLboolean EXT_texture_integer;
|
||||
/* vendor extensions */
|
||||
GLboolean APPLE_packed_pixels;
|
||||
GLboolean APPLE_vertex_array_object;
|
||||
GLboolean APPLE_object_purgeable;
|
||||
GLboolean ATI_texture_env_combine3;
|
||||
GLboolean IBM_rasterpos_clip;
|
||||
GLboolean IBM_multimode_draw_arrays;
|
||||
|
@ -1625,7 +1541,6 @@ struct gl_extensions
|
|||
GLboolean NV_fog_distance;
|
||||
GLboolean NV_light_max_exponent;
|
||||
GLboolean NV_point_sprite;
|
||||
GLboolean NV_texture_barrier;
|
||||
GLboolean NV_texgen_reflection;
|
||||
GLboolean NV_texture_env_combine4;
|
||||
GLboolean extension_sentinel;
|
||||
|
@ -1694,8 +1609,7 @@ struct gl_matrix_stack
|
|||
#define _NEW_BUFFERS (1 << 22) /**< gl_context::Visual, DrawBuffer, */
|
||||
#define _NEW_CURRENT_ATTRIB (1 << 23) /**< gl_context::Current */
|
||||
#define _NEW_MULTISAMPLE (1 << 24) /**< gl_context::Multisample */
|
||||
#define _NEW_TRACK_MATRIX (1 << 25) /**< gl_context::VertexProgram */
|
||||
#define _NEW_BUFFER_OBJECT (1 << 26)
|
||||
#define _NEW_BUFFER_OBJECT (1 << 25)
|
||||
#define _NEW_ALL ~0
|
||||
|
||||
/**
|
||||
|
@ -1713,17 +1627,16 @@ struct gl_matrix_stack
|
|||
*/
|
||||
/*@{*/
|
||||
#define DD_FLATSHADE 0x1
|
||||
#define DD_SEPARATE_SPECULAR 0x2
|
||||
#define DD_TRI_CULL_FRONT_BACK 0x4 /* special case on some hw */
|
||||
#define DD_TRI_LIGHT_TWOSIDE 0x8
|
||||
#define DD_TRI_UNFILLED 0x10
|
||||
#define DD_TRI_SMOOTH 0x20
|
||||
#define DD_TRI_STIPPLE 0x40
|
||||
#define DD_TRI_OFFSET 0x80
|
||||
#define DD_LINE_SMOOTH 0x100
|
||||
#define DD_LINE_STIPPLE 0x200
|
||||
#define DD_POINT_SMOOTH 0x400
|
||||
#define DD_POINT_ATTEN 0x800
|
||||
#define DD_TRI_CULL_FRONT_BACK 0x2 /* special case on some hw */
|
||||
#define DD_TRI_LIGHT_TWOSIDE 0x4
|
||||
#define DD_TRI_UNFILLED 0x8
|
||||
#define DD_TRI_SMOOTH 0x10
|
||||
#define DD_TRI_STIPPLE 0x20
|
||||
#define DD_TRI_OFFSET 0x40
|
||||
#define DD_LINE_SMOOTH 0x80
|
||||
#define DD_LINE_STIPPLE 0x100
|
||||
#define DD_POINT_SMOOTH 0x200
|
||||
#define DD_POINT_ATTEN 0x400
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
|
|
@ -1568,85 +1568,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
|
|||
}
|
||||
}
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
{
|
||||
GLhalfARB *dst = (GLhalfARB *) dstAddr;
|
||||
switch (dstFormat) {
|
||||
case GL_RED:
|
||||
for (i=0;i<n;i++)
|
||||
dst[i] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
break;
|
||||
case GL_GREEN:
|
||||
for (i=0;i<n;i++)
|
||||
dst[i] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
break;
|
||||
case GL_BLUE:
|
||||
for (i=0;i<n;i++)
|
||||
dst[i] = _mesa_float_to_half(rgba[i][BCOMP]);
|
||||
break;
|
||||
case GL_ALPHA:
|
||||
for (i=0;i<n;i++)
|
||||
dst[i] = _mesa_float_to_half(rgba[i][ACOMP]);
|
||||
break;
|
||||
case GL_LUMINANCE:
|
||||
for (i=0;i<n;i++)
|
||||
dst[i] = _mesa_float_to_half(luminance[i]);
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*2+0] = _mesa_float_to_half(luminance[i]);
|
||||
dst[i*2+1] = _mesa_float_to_half(rgba[i][ACOMP]);
|
||||
}
|
||||
break;
|
||||
case GL_RG:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*2+0] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
dst[i*2+1] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
}
|
||||
break;
|
||||
case GL_RGB:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*3+0] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
dst[i*3+1] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
dst[i*3+2] = _mesa_float_to_half(rgba[i][BCOMP]);
|
||||
}
|
||||
break;
|
||||
case GL_RGBA:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*4+0] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
dst[i*4+1] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
dst[i*4+2] = _mesa_float_to_half(rgba[i][BCOMP]);
|
||||
dst[i*4+3] = _mesa_float_to_half(rgba[i][ACOMP]);
|
||||
}
|
||||
break;
|
||||
case GL_BGR:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*3+0] = _mesa_float_to_half(rgba[i][BCOMP]);
|
||||
dst[i*3+1] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
dst[i*3+2] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
}
|
||||
break;
|
||||
case GL_BGRA:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*4+0] = _mesa_float_to_half(rgba[i][BCOMP]);
|
||||
dst[i*4+1] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
dst[i*4+2] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
dst[i*4+3] = _mesa_float_to_half(rgba[i][ACOMP]);
|
||||
}
|
||||
break;
|
||||
case GL_ABGR_EXT:
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i*4+0] = _mesa_float_to_half(rgba[i][ACOMP]);
|
||||
dst[i*4+1] = _mesa_float_to_half(rgba[i][BCOMP]);
|
||||
dst[i*4+2] = _mesa_float_to_half(rgba[i][GCOMP]);
|
||||
dst[i*4+3] = _mesa_float_to_half(rgba[i][RCOMP]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
if (dstFormat == GL_RGB) {
|
||||
GLubyte *dst = (GLubyte *) dstAddr;
|
||||
|
@ -2058,23 +1979,6 @@ extract_uint_indexes(GLuint n, GLuint indexes[],
|
|||
}
|
||||
}
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
{
|
||||
GLuint i;
|
||||
const GLhalfARB *s = (const GLhalfARB *) src;
|
||||
if (unpack->SwapBytes) {
|
||||
for (i = 0; i < n; i++) {
|
||||
GLhalfARB value = s[i];
|
||||
SWAP2BYTE(value);
|
||||
indexes[i] = (GLuint) _mesa_half_to_float(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < n; i++)
|
||||
indexes[i] = (GLuint) _mesa_half_to_float(s[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_mesa_problem(NULL, "bad srcType in extract_uint_indexes");
|
||||
|
@ -2378,12 +2282,6 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
|
|||
PROCESS(bSrc, BCOMP, 0.0F, 0.0F, GLfloat, (GLfloat));
|
||||
PROCESS(aSrc, ACOMP, 1.0F, 1.0F, GLfloat, (GLfloat));
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
PROCESS(rSrc, RCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float);
|
||||
PROCESS(gSrc, GCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float);
|
||||
PROCESS(bSrc, BCOMP, 0.0F, 0.0F, GLhalfARB, _mesa_half_to_float);
|
||||
PROCESS(aSrc, ACOMP, 1.0F, 1.0F, GLhalfARB, _mesa_half_to_float);
|
||||
break;
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
{
|
||||
const GLubyte *ubsrc = (const GLubyte *) src;
|
||||
|
@ -2698,15 +2596,6 @@ clamp_float_to_uint(GLfloat f)
|
|||
return f < 0.0F ? 0 : IROUND(f);
|
||||
}
|
||||
|
||||
|
||||
static inline GLuint
|
||||
clamp_half_to_uint(GLhalfARB h)
|
||||
{
|
||||
GLfloat f = _mesa_half_to_float(h);
|
||||
return f < 0.0F ? 0 : IROUND(f);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \sa extract_float_rgba()
|
||||
*/
|
||||
|
@ -2845,12 +2734,6 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4],
|
|||
PROCESS(bSrc, BCOMP, 0, GLfloat, clamp_float_to_uint);
|
||||
PROCESS(aSrc, ACOMP, 1, GLfloat, clamp_float_to_uint);
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
PROCESS(rSrc, RCOMP, 0, GLhalfARB, clamp_half_to_uint);
|
||||
PROCESS(gSrc, GCOMP, 0, GLhalfARB, clamp_half_to_uint);
|
||||
PROCESS(bSrc, BCOMP, 0, GLhalfARB, clamp_half_to_uint);
|
||||
PROCESS(aSrc, ACOMP, 1, GLhalfARB, clamp_half_to_uint);
|
||||
break;
|
||||
case GL_UNSIGNED_BYTE_3_3_2:
|
||||
{
|
||||
const GLubyte *ubsrc = (const GLubyte *) src;
|
||||
|
@ -3891,18 +3774,6 @@ _mesa_pack_index_span( struct gl_context *ctx, GLuint n,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
{
|
||||
GLhalfARB *dst = (GLhalfARB *) dest;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i] = _mesa_float_to_half((GLfloat) source[i]);
|
||||
}
|
||||
if (dstPacking->SwapBytes) {
|
||||
_mesa_swap2( (GLushort *) dst, n );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad type in _mesa_pack_index_span");
|
||||
}
|
||||
|
@ -4118,18 +3989,6 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
{
|
||||
GLhalfARB *dst = (GLhalfARB *) dest;
|
||||
GLuint i;
|
||||
for (i=0;i<n;i++) {
|
||||
dst[i] = _mesa_float_to_half( (float) source[i] );
|
||||
}
|
||||
if (dstPacking->SwapBytes) {
|
||||
_mesa_swap2( (GLushort *) dst, n );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_BITMAP:
|
||||
if (dstPacking->LsbFirst) {
|
||||
GLubyte *dst = (GLubyte *) dest;
|
||||
|
@ -4279,20 +4138,6 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
|
|||
DEPTH_VALUES(GLfloat, 1*);
|
||||
needClamp = GL_TRUE;
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
{
|
||||
GLuint i;
|
||||
const GLhalfARB *src = (const GLhalfARB *) source;
|
||||
for (i = 0; i < n; i++) {
|
||||
GLhalfARB value = src[i];
|
||||
if (srcPacking->SwapBytes) {
|
||||
SWAP2BYTE(value);
|
||||
}
|
||||
depthValues[i] = _mesa_half_to_float(value);
|
||||
}
|
||||
needClamp = GL_TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(NULL, "bad type in _mesa_unpack_depth_span()");
|
||||
free(depthTemp);
|
||||
|
@ -4461,18 +4306,6 @@ _mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
{
|
||||
GLhalfARB *dst = (GLhalfARB *) dest;
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
dst[i] = _mesa_float_to_half(depthSpan[i]);
|
||||
}
|
||||
if (dstPacking->SwapBytes) {
|
||||
_mesa_swap2( (GLushort *) dst, n );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad type in _mesa_pack_depth_span");
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "api_exec.h"
|
||||
#include "api_loopback.h"
|
||||
#include "api_validate.h"
|
||||
#include "arrayobj.h"
|
||||
#include "attrib.h"
|
||||
#include "blend.h"
|
||||
#include "bufferobj.h"
|
||||
|
@ -14,10 +13,8 @@
|
|||
#include "clear.h"
|
||||
#include "clip.h"
|
||||
#include "colormac.h"
|
||||
#include "colortab.h"
|
||||
#include "compiler.h"
|
||||
#include "context.h"
|
||||
#include "convolve.h"
|
||||
#include "cpuinfo.h"
|
||||
#include "depth.h"
|
||||
#include "dispatch.h"
|
||||
|
@ -71,7 +68,6 @@
|
|||
#include "texstate.h"
|
||||
#include "texstorage.h"
|
||||
#include "texstore.h"
|
||||
#include "texturebarrier.h"
|
||||
#include "varray.h"
|
||||
#include "version.h"
|
||||
#include "viewport.h"
|
||||
|
|
|
@ -240,21 +240,13 @@ window_pos3f(GLfloat x, GLfloat y, GLfloat z)
|
|||
|
||||
/* raster color = current color or index */
|
||||
ctx->Current.RasterColor[0]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0], 0.0F, 1.0F);
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR][0], 0.0F, 1.0F);
|
||||
ctx->Current.RasterColor[1]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1], 0.0F, 1.0F);
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR][1], 0.0F, 1.0F);
|
||||
ctx->Current.RasterColor[2]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2], 0.0F, 1.0F);
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR][2], 0.0F, 1.0F);
|
||||
ctx->Current.RasterColor[3]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3], 0.0F, 1.0F);
|
||||
ctx->Current.RasterSecondaryColor[0]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0], 0.0F, 1.0F);
|
||||
ctx->Current.RasterSecondaryColor[1]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1], 0.0F, 1.0F);
|
||||
ctx->Current.RasterSecondaryColor[2]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2], 0.0F, 1.0F);
|
||||
ctx->Current.RasterSecondaryColor[3]
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3], 0.0F, 1.0F);
|
||||
= CLAMP(ctx->Current.Attrib[VERT_ATTRIB_COLOR][3], 0.0F, 1.0F);
|
||||
|
||||
/* raster texcoord = current texcoord */
|
||||
COPY_4FV( ctx->Current.RasterTexCoords, ctx->Current.Attrib[VERT_ATTRIB_TEX] );
|
||||
|
@ -539,7 +531,6 @@ void _mesa_init_rastpos( struct gl_context * ctx )
|
|||
ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 );
|
||||
ctx->Current.RasterDistance = 0.0;
|
||||
ASSIGN_4V( ctx->Current.RasterColor, 1.0, 1.0, 1.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.RasterSecondaryColor, 0.0, 0.0, 0.0, 1.0 );
|
||||
ASSIGN_4V( ctx->Current.RasterTexCoords, 0.0, 0.0, 0.0, 1.0 );
|
||||
ctx->Current.RasterPosValid = GL_TRUE;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
|
|||
/* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */
|
||||
static const GLenum targets[NUM_TEXTURE_TARGETS] = {
|
||||
GL_TEXTURE_CUBE_MAP,
|
||||
GL_TEXTURE_3D,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_1D
|
||||
};
|
||||
|
|
|
@ -32,15 +32,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
static void
|
||||
update_separate_specular(struct gl_context *ctx)
|
||||
{
|
||||
if (_mesa_need_secondary_color(ctx))
|
||||
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||
else
|
||||
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper for update_arrays().
|
||||
|
@ -61,7 +52,6 @@ update_min(GLuint min, struct gl_client_array *array)
|
|||
static void
|
||||
update_arrays( struct gl_context *ctx )
|
||||
{
|
||||
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
|
||||
GLuint min = ~0;
|
||||
|
||||
/* find min of _MaxElement values for all enabled arrays.
|
||||
|
@ -70,46 +60,41 @@ update_arrays( struct gl_context *ctx )
|
|||
*/
|
||||
|
||||
/* 0 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_POS]);
|
||||
}
|
||||
|
||||
/* 2 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_NORMAL]);
|
||||
}
|
||||
|
||||
/* 3 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
|
||||
}
|
||||
|
||||
/* 4 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR]);
|
||||
}
|
||||
|
||||
/* 5 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_FOG]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_FOG]);
|
||||
}
|
||||
|
||||
/* 6 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_COLOR_INDEX]);
|
||||
}
|
||||
|
||||
/* 8 */
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_TEX].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_TEX]);
|
||||
}
|
||||
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
|
||||
min = update_min(min, &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]);
|
||||
if (ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
|
||||
min = update_min(min, &ctx->Array.VertexAttrib[VERT_ATTRIB_EDGEFLAG]);
|
||||
}
|
||||
|
||||
/* _MaxElement is one past the last legal array element */
|
||||
arrayObj->_MaxElement = min;
|
||||
ctx->Array._MaxElement = min;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -263,9 +248,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
|||
if (new_state & _NEW_PIXEL)
|
||||
_mesa_update_pixel( ctx, new_state );
|
||||
|
||||
if (new_state & _DD_NEW_SEPARATE_SPECULAR)
|
||||
update_separate_specular( ctx );
|
||||
|
||||
if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
|
||||
update_viewport_matrix(ctx);
|
||||
|
||||
|
|
|
@ -37,21 +37,4 @@ _mesa_update_state(struct gl_context *ctx);
|
|||
extern void
|
||||
_mesa_update_state_locked(struct gl_context *ctx);
|
||||
|
||||
|
||||
/**
|
||||
* Is the secondary color needed?
|
||||
*/
|
||||
static inline GLboolean
|
||||
_mesa_need_secondary_color(const struct gl_context *ctx)
|
||||
{
|
||||
if (ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||
return GL_TRUE;
|
||||
|
||||
if (ctx->Fog.ColorSumEnabled)
|
||||
return GL_TRUE;
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -95,7 +95,6 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
|
|||
break;
|
||||
case GL_RGBA12:
|
||||
case GL_RGBA16:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
|
||||
|
@ -206,81 +205,6 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
|
|||
}
|
||||
}
|
||||
|
||||
if (ctx->Extensions.ARB_texture_float) {
|
||||
switch (internalFormat) {
|
||||
case GL_ALPHA16F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
break;
|
||||
case GL_ALPHA32F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
break;
|
||||
case GL_LUMINANCE16F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
break;
|
||||
case GL_LUMINANCE32F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA16F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA32F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
break;
|
||||
case GL_INTENSITY16F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
break;
|
||||
case GL_INTENSITY32F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
break;
|
||||
case GL_RGB16F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
break;
|
||||
case GL_RGB32F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
break;
|
||||
case GL_RGBA16F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
break;
|
||||
case GL_RGBA32F_ARB:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
|
||||
break;
|
||||
default:
|
||||
; /* fallthrough */
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->Extensions.EXT_texture_integer) {
|
||||
switch (internalFormat) {
|
||||
case GL_ALPHA8UI_EXT:
|
||||
|
|
|
@ -40,7 +40,6 @@ type_needs_clamping(GLenum type)
|
|||
case GL_SHORT:
|
||||
case GL_INT:
|
||||
case GL_FLOAT:
|
||||
case GL_HALF_FLOAT_ARB:
|
||||
case GL_UNSIGNED_INT_10F_11F_11F_REV:
|
||||
case GL_UNSIGNED_INT_5_9_9_9_REV:
|
||||
return GL_FALSE;
|
||||
|
@ -398,9 +397,6 @@ _mesa_get_teximage(struct gl_context *ctx,
|
|||
case GL_TEXTURE_1D:
|
||||
dimensions = 1;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
dimensions = 3;
|
||||
break;
|
||||
default:
|
||||
dimensions = 2;
|
||||
}
|
||||
|
|
|
@ -115,31 +115,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
|
|||
return GL_YCBCR_MESA;
|
||||
}
|
||||
|
||||
if (ctx->Extensions.ARB_texture_float) {
|
||||
switch (internalFormat) {
|
||||
case GL_ALPHA16F_ARB:
|
||||
case GL_ALPHA32F_ARB:
|
||||
return GL_ALPHA;
|
||||
case GL_RGBA16F_ARB:
|
||||
case GL_RGBA32F_ARB:
|
||||
return GL_RGBA;
|
||||
case GL_RGB16F_ARB:
|
||||
case GL_RGB32F_ARB:
|
||||
return GL_RGB;
|
||||
case GL_INTENSITY16F_ARB:
|
||||
case GL_INTENSITY32F_ARB:
|
||||
return GL_INTENSITY;
|
||||
case GL_LUMINANCE16F_ARB:
|
||||
case GL_LUMINANCE32F_ARB:
|
||||
return GL_LUMINANCE;
|
||||
case GL_LUMINANCE_ALPHA16F_ARB:
|
||||
case GL_LUMINANCE_ALPHA32F_ARB:
|
||||
return GL_LUMINANCE_ALPHA;
|
||||
default:
|
||||
; /* fallthrough */
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->VersionMajor >= 3 ||
|
||||
ctx->Extensions.EXT_texture_integer) {
|
||||
switch (internalFormat) {
|
||||
|
@ -304,7 +279,6 @@ _mesa_is_proxy_texture(GLenum target)
|
|||
|
||||
return (target == GL_PROXY_TEXTURE_1D ||
|
||||
target == GL_PROXY_TEXTURE_2D ||
|
||||
target == GL_PROXY_TEXTURE_3D ||
|
||||
target == GL_PROXY_TEXTURE_CUBE_MAP_ARB);
|
||||
}
|
||||
|
||||
|
@ -322,9 +296,6 @@ get_proxy_target(GLenum target)
|
|||
case GL_TEXTURE_2D:
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
return GL_PROXY_TEXTURE_2D;
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return GL_PROXY_TEXTURE_3D;
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
|
||||
|
@ -364,10 +335,6 @@ _mesa_select_tex_object(struct gl_context *ctx,
|
|||
return ctx->Texture.Unit.CurrentTex[TEXTURE_2D_INDEX];
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX];
|
||||
case GL_TEXTURE_3D:
|
||||
return ctx->Texture.Unit.CurrentTex[TEXTURE_3D_INDEX];
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX];
|
||||
default:
|
||||
_mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
|
||||
return NULL;
|
||||
|
@ -457,11 +424,6 @@ _mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
|
|||
return NULL;
|
||||
texIndex = TEXTURE_2D_INDEX;
|
||||
break;
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
if (level >= ctx->Const.Max3DTextureLevels)
|
||||
return NULL;
|
||||
texIndex = TEXTURE_3D_INDEX;
|
||||
break;
|
||||
case GL_PROXY_TEXTURE_CUBE_MAP:
|
||||
if (level >= ctx->Const.MaxCubeTextureLevels)
|
||||
return NULL;
|
||||
|
@ -506,9 +468,6 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
|
|||
case GL_TEXTURE_2D:
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
return ctx->Const.MaxTextureLevels;
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return ctx->Const.Max3DTextureLevels;
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
|
||||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
|
||||
|
@ -545,9 +504,6 @@ _mesa_get_texture_dimensions(GLenum target)
|
|||
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
|
||||
return 2;
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return 3;
|
||||
default:
|
||||
_mesa_problem(NULL, "invalid target 0x%x in get_texture_dimensions()",
|
||||
target);
|
||||
|
@ -708,13 +664,6 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
|
|||
img->Depth2 = 1;
|
||||
img->DepthLog2 = 0;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */
|
||||
img->HeightLog2 = _mesa_logbase2(img->Height2);
|
||||
img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */
|
||||
img->DepthLog2 = _mesa_logbase2(img->Depth2);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(NULL, "invalid target 0x%x in _mesa_init_teximage_fields()",
|
||||
target);
|
||||
|
@ -785,10 +734,8 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
|||
return GL_FALSE;
|
||||
if (level >= ctx->Const.MaxTextureLevels)
|
||||
return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
}
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
|
@ -799,32 +746,10 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
|||
return GL_FALSE;
|
||||
if (level >= ctx->Const.MaxTextureLevels)
|
||||
return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
|
||||
return GL_FALSE;
|
||||
}
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
|
||||
if (width < 2 * border || width > 2 * border + maxSize)
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (height < 2 * border || height > 2 * border + maxSize)
|
||||
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (depth < 2 * border || depth > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (level >= ctx->Const.Max3DTextureLevels)
|
||||
return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (depth > 0 && !_mesa_is_pow_two(depth - 2 * border))
|
||||
return GL_FALSE;
|
||||
}
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
||||
|
@ -835,12 +760,10 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
|||
return GL_FALSE;
|
||||
if (level >= ctx->Const.MaxCubeTextureLevels)
|
||||
return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
|
||||
return GL_FALSE;
|
||||
}
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
if (height > 0 && !_mesa_is_pow_two(height - 2 * border))
|
||||
return GL_FALSE;
|
||||
return GL_TRUE;
|
||||
|
||||
default:
|
||||
|
@ -898,14 +821,6 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
|
|||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
case 3:
|
||||
switch (target) {
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
default:
|
||||
_mesa_problem(ctx, "invalid dims=%u in legal_teximage_target()", dims);
|
||||
return GL_FALSE;
|
||||
|
@ -939,13 +854,6 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
|
|||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
case 3:
|
||||
switch (target) {
|
||||
case GL_TEXTURE_3D:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
default:
|
||||
_mesa_problem(ctx, "invalid dims=%u in legal_texsubimage_target()",
|
||||
dims);
|
||||
|
@ -1268,16 +1176,6 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
|
|||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
if (dimensions > 2) {
|
||||
if (zoffset < -((GLint)destTex->Border)) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset)");
|
||||
return GL_TRUE;
|
||||
}
|
||||
if (zoffset + depth > (GLint) (destTex->Depth + destTex->Border)) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage3D(zoffset+depth)");
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
|
||||
/* both source and dest must be integer-valued, or neither */
|
||||
|
@ -1786,7 +1684,6 @@ teximage(struct gl_context *ctx, GLuint dims,
|
|||
border, internalFormat, texFormat);
|
||||
|
||||
/* Give the texture to the driver. <pixels> may be null. */
|
||||
ASSERT(ctx->Driver.TexImage3D);
|
||||
switch (dims) {
|
||||
case 1:
|
||||
ctx->Driver.TexImage1D(ctx, texImage, internalFormat,
|
||||
|
@ -1798,11 +1695,6 @@ teximage(struct gl_context *ctx, GLuint dims,
|
|||
width, height, border, format,
|
||||
type, pixels, unpack);
|
||||
break;
|
||||
case 3:
|
||||
ctx->Driver.TexImage3D(ctx, texImage, internalFormat,
|
||||
width, height, depth, border, format,
|
||||
type, pixels, unpack);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "invalid dims=%u in teximage()", dims);
|
||||
}
|
||||
|
@ -1847,33 +1739,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called by the API or display list executor.
|
||||
* Note that width and height include the border.
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLint border, GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
teximage(ctx, 3, target, level, internalFormat, width, height, depth,
|
||||
border, format, type, pixels);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLint border, GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
{
|
||||
_mesa_TexImage3D(target, level, (GLint) internalFormat, width, height,
|
||||
depth, border, format, type, pixels);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement all the glTexSubImage1/2/3D() functions.
|
||||
*/
|
||||
|
@ -1947,12 +1812,6 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
|
|||
xoffset, yoffset, width, height,
|
||||
format, type, pixels, &ctx->Unpack);
|
||||
break;
|
||||
case 3:
|
||||
ctx->Driver.TexSubImage3D(ctx, texImage,
|
||||
xoffset, yoffset, zoffset,
|
||||
width, height, depth,
|
||||
format, type, pixels, &ctx->Unpack);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "unexpected dims in subteximage()");
|
||||
}
|
||||
|
@ -1994,22 +1853,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
|
|||
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_TexSubImage3D( GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
texsubimage(ctx, 3, target, level,
|
||||
xoffset, yoffset, zoffset,
|
||||
width, height, depth,
|
||||
format, type, pixels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* For glCopyTexSubImage, return the source renderbuffer to copy texel data
|
||||
* from. This depends on whether the texture contains color or depth values.
|
||||
|
@ -2218,11 +2061,6 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
|
|||
ctx->Driver.CopyTexSubImage2D(ctx, texImage, xoffset, yoffset,
|
||||
srcRb, x, y, width, height);
|
||||
break;
|
||||
case 3:
|
||||
ctx->Driver.CopyTexSubImage3D(ctx, texImage,
|
||||
xoffset, yoffset, zoffset,
|
||||
srcRb, x, y, width, height);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad dims in copytexsubimage()");
|
||||
}
|
||||
|
@ -2254,15 +2092,3 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
|
|||
copytexsubimage(ctx, 2, target, level, xoffset, yoffset, 0, x, y,
|
||||
width, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_CopyTexSubImage3D( GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
copytexsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
|
||||
x, y, width, height);
|
||||
}
|
||||
|
|
|
@ -164,18 +164,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat,
|
|||
GLenum format, GLenum type, const GLvoid *pixels );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat,
|
||||
GLsizei width, GLsizei height, GLsizei depth, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *pixels );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLint border, GLenum format, GLenum type,
|
||||
const GLvoid *pixels );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
|
||||
GLsizei width,
|
||||
|
@ -191,14 +179,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
|
|||
const GLvoid *pixels );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_TexSubImage3D( GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width, GLint border );
|
||||
|
@ -220,12 +200,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level,
|
|||
GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_CopyTexSubImage3D( GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif
|
||||
|
|
|
@ -216,7 +216,6 @@ valid_texture_object(const struct gl_texture_object *tex)
|
|||
case 0:
|
||||
case GL_TEXTURE_1D:
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_TEXTURE_CUBE_MAP_ARB:
|
||||
return GL_TRUE;
|
||||
case 0x99:
|
||||
|
@ -365,12 +364,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
|
|||
t->Image[0][baseLevel]->HeightLog2);
|
||||
maxLevels = ctx->Const.MaxTextureLevels;
|
||||
}
|
||||
else if (t->Target == GL_TEXTURE_3D) {
|
||||
GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2,
|
||||
t->Image[0][baseLevel]->HeightLog2);
|
||||
maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2));
|
||||
maxLevels = ctx->Const.Max3DTextureLevels;
|
||||
}
|
||||
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
|
||||
maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
|
||||
t->Image[0][baseLevel]->HeightLog2);
|
||||
|
@ -503,49 +496,6 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (t->Target == GL_TEXTURE_3D) {
|
||||
/* Test 3-D mipmaps */
|
||||
GLuint width = t->Image[0][baseLevel]->Width2;
|
||||
GLuint height = t->Image[0][baseLevel]->Height2;
|
||||
GLuint depth = t->Image[0][baseLevel]->Depth2;
|
||||
for (i = baseLevel + 1; i < maxLevels; i++) {
|
||||
if (width > 1) {
|
||||
width /= 2;
|
||||
}
|
||||
if (height > 1) {
|
||||
height /= 2;
|
||||
}
|
||||
if (depth > 1) {
|
||||
depth /= 2;
|
||||
}
|
||||
if (i >= minLevel && i <= maxLevel) {
|
||||
const struct gl_texture_image *img = t->Image[0][i];
|
||||
if (!img) {
|
||||
incomplete(t, "3D Image[%d] is missing", i);
|
||||
return;
|
||||
}
|
||||
if (img->_BaseFormat == GL_DEPTH_COMPONENT) {
|
||||
incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
|
||||
return;
|
||||
}
|
||||
if (img->Width2 != width) {
|
||||
incomplete(t, "3D Image[%d] bad width %u", i, img->Width2);
|
||||
return;
|
||||
}
|
||||
if (img->Height2 != height) {
|
||||
incomplete(t, "3D Image[%d] bad height %u", i, img->Height2);
|
||||
return;
|
||||
}
|
||||
if (img->Depth2 != depth) {
|
||||
incomplete(t, "3D Image[%d] bad depth %u", i, img->Depth2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (width == 1 && height == 1 && depth == 1) {
|
||||
return; /* found smallest needed mipmap, all done! */
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
|
||||
/* make sure 6 cube faces are consistant */
|
||||
GLuint width = t->Image[0][baseLevel]->Width2;
|
||||
|
@ -863,8 +813,6 @@ target_enum_to_index(GLenum target)
|
|||
return TEXTURE_1D_INDEX;
|
||||
case GL_TEXTURE_2D:
|
||||
return TEXTURE_2D_INDEX;
|
||||
case GL_TEXTURE_3D:
|
||||
return TEXTURE_3D_INDEX;
|
||||
case GL_TEXTURE_CUBE_MAP_ARB:
|
||||
return TEXTURE_CUBE_INDEX;
|
||||
default:
|
||||
|
|
|
@ -71,8 +71,6 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
|
|||
return texUnit->CurrentTex[TEXTURE_1D_INDEX];
|
||||
case GL_TEXTURE_2D:
|
||||
return texUnit->CurrentTex[TEXTURE_2D_INDEX];
|
||||
case GL_TEXTURE_3D:
|
||||
return texUnit->CurrentTex[TEXTURE_3D_INDEX];
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
if (ctx->Extensions.ARB_texture_cube_map) {
|
||||
return texUnit->CurrentTex[TEXTURE_CUBE_INDEX];
|
||||
|
@ -247,18 +245,10 @@ set_tex_parameterf(struct gl_context *ctx,
|
|||
|
||||
case GL_TEXTURE_BORDER_COLOR:
|
||||
flush(ctx);
|
||||
/* ARB_texture_float disables clamping */
|
||||
if (ctx->Extensions.ARB_texture_float) {
|
||||
texObj->Sampler.BorderColor.f[RCOMP] = params[0];
|
||||
texObj->Sampler.BorderColor.f[GCOMP] = params[1];
|
||||
texObj->Sampler.BorderColor.f[BCOMP] = params[2];
|
||||
texObj->Sampler.BorderColor.f[ACOMP] = params[3];
|
||||
} else {
|
||||
texObj->Sampler.BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F);
|
||||
texObj->Sampler.BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F);
|
||||
texObj->Sampler.BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F);
|
||||
texObj->Sampler.BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F);
|
||||
}
|
||||
texObj->Sampler.BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F);
|
||||
texObj->Sampler.BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F);
|
||||
texObj->Sampler.BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F);
|
||||
texObj->Sampler.BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F);
|
||||
return GL_TRUE;
|
||||
|
||||
default:
|
||||
|
@ -634,22 +624,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||
}
|
||||
break;
|
||||
|
||||
/* GL_ARB_texture_float */
|
||||
case GL_TEXTURE_RED_TYPE_ARB:
|
||||
case GL_TEXTURE_GREEN_TYPE_ARB:
|
||||
case GL_TEXTURE_BLUE_TYPE_ARB:
|
||||
case GL_TEXTURE_ALPHA_TYPE_ARB:
|
||||
case GL_TEXTURE_LUMINANCE_TYPE_ARB:
|
||||
case GL_TEXTURE_INTENSITY_TYPE_ARB:
|
||||
case GL_TEXTURE_DEPTH_TYPE_ARB:
|
||||
if (!ctx->Extensions.ARB_texture_float)
|
||||
goto invalid_pname;
|
||||
if (_mesa_base_format_has_channel(img->_BaseFormat, pname))
|
||||
*params = _mesa_get_format_datatype(texFormat);
|
||||
else
|
||||
*params = GL_NONE;
|
||||
break;
|
||||
|
||||
default:
|
||||
goto invalid_pname;
|
||||
}
|
||||
|
|
|
@ -502,7 +502,6 @@ alloc_proxy_textures( struct gl_context *ctx )
|
|||
*/
|
||||
static const GLenum targets[] = {
|
||||
GL_TEXTURE_CUBE_MAP_ARB,
|
||||
GL_TEXTURE_3D,
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_1D,
|
||||
};
|
||||
|
|
|
@ -58,14 +58,6 @@ legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target)
|
|||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
case 3:
|
||||
switch (target) {
|
||||
case GL_TEXTURE_3D:
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
default:
|
||||
_mesa_problem(ctx, "invalid dims=%u in legal_texobj_target()", dims);
|
||||
return GL_FALSE;
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
* code:
|
||||
* ctx->Driver.TexImage1D = _mesa_store_teximage1d;
|
||||
* ctx->Driver.TexImage2D = _mesa_store_teximage2d;
|
||||
* ctx->Driver.TexImage3D = _mesa_store_teximage3d;
|
||||
* etc...
|
||||
*
|
||||
* Texture image processing is actually kind of complicated. We have to do:
|
||||
|
@ -2563,153 +2562,6 @@ _mesa_texstore_s8(TEXSTORE_PARAMS)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store an image in any of the formats:
|
||||
* _mesa_texformat_rgba_float32
|
||||
* _mesa_texformat_rgb_float32
|
||||
* _mesa_texformat_alpha_float32
|
||||
* _mesa_texformat_luminance_float32
|
||||
* _mesa_texformat_luminance_alpha_float32
|
||||
* _mesa_texformat_intensity_float32
|
||||
*/
|
||||
static GLboolean
|
||||
_mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
|
||||
const GLint components = _mesa_components_in_format(baseFormat);
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_RGB_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_ALPHA_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_INTENSITY_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_R_FLOAT32 ||
|
||||
dstFormat == MESA_FORMAT_RG_FLOAT32);
|
||||
ASSERT(baseInternalFormat == GL_RGBA ||
|
||||
baseInternalFormat == GL_RGB ||
|
||||
baseInternalFormat == GL_ALPHA ||
|
||||
baseInternalFormat == GL_LUMINANCE ||
|
||||
baseInternalFormat == GL_LUMINANCE_ALPHA ||
|
||||
baseInternalFormat == GL_INTENSITY ||
|
||||
baseInternalFormat == GL_RED ||
|
||||
baseInternalFormat == GL_RG);
|
||||
ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLfloat));
|
||||
|
||||
if (!ctx->_ImageTransferState &&
|
||||
!srcPacking->SwapBytes &&
|
||||
baseInternalFormat == srcFormat &&
|
||||
baseInternalFormat == baseFormat &&
|
||||
srcType == GL_FLOAT) {
|
||||
/* simple memcpy path */
|
||||
memcpy_texture(ctx, dims,
|
||||
dstFormat,
|
||||
dstRowStride, dstSlices,
|
||||
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
|
||||
srcAddr, srcPacking);
|
||||
}
|
||||
else {
|
||||
/* general path */
|
||||
const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims,
|
||||
baseInternalFormat,
|
||||
baseFormat,
|
||||
srcWidth, srcHeight, srcDepth,
|
||||
srcFormat, srcType, srcAddr,
|
||||
srcPacking,
|
||||
ctx->_ImageTransferState);
|
||||
const GLfloat *srcRow = tempImage;
|
||||
GLint bytesPerRow;
|
||||
GLint img, row;
|
||||
if (!tempImage)
|
||||
return GL_FALSE;
|
||||
bytesPerRow = srcWidth * components * sizeof(GLfloat);
|
||||
for (img = 0; img < srcDepth; img++) {
|
||||
GLubyte *dstRow = dstSlices[img];
|
||||
for (row = 0; row < srcHeight; row++) {
|
||||
memcpy(dstRow, srcRow, bytesPerRow);
|
||||
dstRow += dstRowStride;
|
||||
srcRow += srcWidth * components;
|
||||
}
|
||||
}
|
||||
|
||||
free((void *) tempImage);
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* As above, but store 16-bit floats.
|
||||
*/
|
||||
static GLboolean
|
||||
_mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
|
||||
{
|
||||
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
|
||||
const GLint components = _mesa_components_in_format(baseFormat);
|
||||
|
||||
ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_RGB_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_ALPHA_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_INTENSITY_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_R_FLOAT16 ||
|
||||
dstFormat == MESA_FORMAT_RG_FLOAT16);
|
||||
ASSERT(baseInternalFormat == GL_RGBA ||
|
||||
baseInternalFormat == GL_RGB ||
|
||||
baseInternalFormat == GL_ALPHA ||
|
||||
baseInternalFormat == GL_LUMINANCE ||
|
||||
baseInternalFormat == GL_LUMINANCE_ALPHA ||
|
||||
baseInternalFormat == GL_INTENSITY ||
|
||||
baseInternalFormat == GL_RED ||
|
||||
baseInternalFormat == GL_RG);
|
||||
ASSERT(_mesa_get_format_bytes(dstFormat) == components * sizeof(GLhalfARB));
|
||||
|
||||
if (!ctx->_ImageTransferState &&
|
||||
!srcPacking->SwapBytes &&
|
||||
baseInternalFormat == srcFormat &&
|
||||
baseInternalFormat == baseFormat &&
|
||||
srcType == GL_HALF_FLOAT_ARB) {
|
||||
/* simple memcpy path */
|
||||
memcpy_texture(ctx, dims,
|
||||
dstFormat,
|
||||
dstRowStride, dstSlices,
|
||||
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
|
||||
srcAddr, srcPacking);
|
||||
}
|
||||
else {
|
||||
/* general path */
|
||||
const GLfloat *tempImage = _mesa_make_temp_float_image(ctx, dims,
|
||||
baseInternalFormat,
|
||||
baseFormat,
|
||||
srcWidth, srcHeight, srcDepth,
|
||||
srcFormat, srcType, srcAddr,
|
||||
srcPacking,
|
||||
ctx->_ImageTransferState);
|
||||
const GLfloat *src = tempImage;
|
||||
GLint img, row;
|
||||
if (!tempImage)
|
||||
return GL_FALSE;
|
||||
for (img = 0; img < srcDepth; img++) {
|
||||
GLubyte *dstRow = dstSlices[img];
|
||||
for (row = 0; row < srcHeight; row++) {
|
||||
GLhalfARB *dstTexel = (GLhalfARB *) dstRow;
|
||||
GLint i;
|
||||
for (i = 0; i < srcWidth * components; i++) {
|
||||
dstTexel[i] = _mesa_float_to_half(src[i]);
|
||||
}
|
||||
dstRow += dstRowStride;
|
||||
src += srcWidth * components;
|
||||
}
|
||||
}
|
||||
|
||||
free((void *) tempImage);
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* non-normalized, signed int8 */
|
||||
static GLboolean
|
||||
_mesa_texstore_rgba_int8(TEXSTORE_PARAMS)
|
||||
|
@ -3186,18 +3038,6 @@ _mesa_get_texstore_func(gl_format format)
|
|||
table[MESA_FORMAT_Z24_X8] = _mesa_texstore_z24_x8;
|
||||
table[MESA_FORMAT_Z32] = _mesa_texstore_z32;
|
||||
table[MESA_FORMAT_S8] = _mesa_texstore_s8;
|
||||
table[MESA_FORMAT_RGBA_FLOAT32] = _mesa_texstore_rgba_float32;
|
||||
table[MESA_FORMAT_RGBA_FLOAT16] = _mesa_texstore_rgba_float16;
|
||||
table[MESA_FORMAT_RGB_FLOAT32] = _mesa_texstore_rgba_float32;
|
||||
table[MESA_FORMAT_RGB_FLOAT16] = _mesa_texstore_rgba_float16;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT32] = _mesa_texstore_rgba_float32;
|
||||
table[MESA_FORMAT_ALPHA_FLOAT16] = _mesa_texstore_rgba_float16;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT32] = _mesa_texstore_rgba_float32;
|
||||
table[MESA_FORMAT_LUMINANCE_FLOAT16] = _mesa_texstore_rgba_float16;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = _mesa_texstore_rgba_float32;
|
||||
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = _mesa_texstore_rgba_float16;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT32] = _mesa_texstore_rgba_float32;
|
||||
table[MESA_FORMAT_INTENSITY_FLOAT16] = _mesa_texstore_rgba_float16;
|
||||
table[MESA_FORMAT_SIGNED_RGBA_16] = _mesa_texstore_signed_rgba_16;
|
||||
table[MESA_FORMAT_RGBA_16] = _mesa_texstore_rgba_16;
|
||||
|
||||
|
@ -3318,9 +3158,6 @@ store_texsubimage(struct gl_context *ctx,
|
|||
case GL_TEXTURE_1D:
|
||||
dims = 1;
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
dims = 3;
|
||||
break;
|
||||
default:
|
||||
dims = 2;
|
||||
}
|
||||
|
@ -3342,13 +3179,6 @@ store_texsubimage(struct gl_context *ctx,
|
|||
assert(yoffset == 0);
|
||||
assert(zoffset == 0);
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
/* we'll store 3D images as a series of slices */
|
||||
numSlices = depth;
|
||||
sliceOffset = zoffset;
|
||||
srcImageStride = _mesa_image_image_stride(packing, width, height,
|
||||
format, type);
|
||||
break;
|
||||
default:
|
||||
_mesa_warning(ctx, "Unexpected target 0x%x in store_texsubimage()", target);
|
||||
return;
|
||||
|
@ -3446,34 +3276,6 @@ _mesa_store_teximage2d(struct gl_context *ctx,
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* This is the fallback for Driver.TexImage3D().
|
||||
*/
|
||||
void
|
||||
_mesa_store_teximage3d(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint internalFormat,
|
||||
GLint width, GLint height, GLint depth, GLint border,
|
||||
GLenum format, GLenum type, const void *pixels,
|
||||
const struct gl_pixelstore_attrib *packing)
|
||||
{
|
||||
if (width == 0 || height == 0 || depth == 0)
|
||||
return;
|
||||
|
||||
/* allocate storage for texture data */
|
||||
if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
|
||||
width, height, depth)) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D");
|
||||
return;
|
||||
}
|
||||
|
||||
store_texsubimage(ctx, texImage,
|
||||
0, 0, 0, width, height, depth,
|
||||
format, type, pixels, packing, "glTexImage3D");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* This is the fallback for Driver.TexSubImage1D().
|
||||
|
@ -3507,20 +3309,3 @@ _mesa_store_texsubimage2d(struct gl_context *ctx,
|
|||
xoffset, yoffset, 0, width, height, 1,
|
||||
format, type, pixels, packing, "glTexSubImage2D");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is the fallback for Driver.TexSubImage3D().
|
||||
*/
|
||||
void
|
||||
_mesa_store_texsubimage3d(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type, const void *pixels,
|
||||
const struct gl_pixelstore_attrib *packing)
|
||||
{
|
||||
store_texsubimage(ctx, texImage,
|
||||
xoffset, yoffset, zoffset, width, height, depth,
|
||||
format, type, pixels, packing, "glTexSubImage3D");
|
||||
}
|
||||
|
|
|
@ -107,15 +107,6 @@ _mesa_store_teximage2d(struct gl_context *ctx,
|
|||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_store_teximage3d(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint internalFormat,
|
||||
GLint width, GLint height, GLint depth, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_store_texsubimage1d(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
|
@ -133,13 +124,4 @@ _mesa_store_texsubimage2d(struct gl_context *ctx,
|
|||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_store_texsubimage3d(struct gl_context *ctx,
|
||||
struct gl_texture_image *texImage,
|
||||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type, const GLvoid *pixels,
|
||||
const struct gl_pixelstore_attrib *packing);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2011 Marek Olšák <maraeo@gmail.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file texturebarrier.c
|
||||
* Implementation of glTextureBarrierNV.
|
||||
*
|
||||
* \author Marek Olšák <maraeo@gmail.com>
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
static void
|
||||
_mesa_texture_barrier(struct gl_context *ctx)
|
||||
{
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_init_texture_barrier_functions(struct dd_function_table *driver)
|
||||
{
|
||||
driver->TextureBarrier = _mesa_texture_barrier;
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_TextureBarrierNV(void)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
ctx->Driver.TextureBarrier(ctx);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2011 Marek Olšák <maraeo@gmail.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file texturebarrier.h
|
||||
* GL_NV_texture_barrier
|
||||
*
|
||||
* \author Marek Olšák <maraeo@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef TEXTUREBARRIER_H
|
||||
#define TEXTUREBARRIER_H
|
||||
|
||||
#include "glheader.h"
|
||||
|
||||
struct dd_function_table;
|
||||
|
||||
extern void
|
||||
_mesa_init_texture_barrier_functions(struct dd_function_table *driver);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_TextureBarrierNV(void);
|
||||
|
||||
#endif /* TEXTUREBARRIER_H */
|
|
@ -59,11 +59,6 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
|
|||
return INT_BIT;
|
||||
case GL_UNSIGNED_INT:
|
||||
return UNSIGNED_INT_BIT;
|
||||
case GL_HALF_FLOAT:
|
||||
if (ctx->Extensions.ARB_half_float_vertex)
|
||||
return HALF_BIT;
|
||||
else
|
||||
return 0x0;
|
||||
case GL_FLOAT:
|
||||
return FLOAT_BIT;
|
||||
case GL_DOUBLE:
|
||||
|
@ -123,18 +118,9 @@ update_array(struct gl_context *ctx,
|
|||
return;
|
||||
}
|
||||
|
||||
if (ctx->Array.ArrayObj->ARBsemantics &&
|
||||
!_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) {
|
||||
/* GL_ARB_vertex_array_object requires that all arrays reside in VBOs.
|
||||
* Generate GL_INVALID_OPERATION if that's not true.
|
||||
*/
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func);
|
||||
return;
|
||||
}
|
||||
|
||||
elementSize = _mesa_sizeof_type(type) * size;
|
||||
|
||||
array = &ctx->Array.ArrayObj->VertexAttrib[attrib];
|
||||
array = &ctx->Array.VertexAttrib[attrib];
|
||||
array->Size = size;
|
||||
array->Type = type;
|
||||
array->Stride = stride;
|
||||
|
@ -144,9 +130,6 @@ update_array(struct gl_context *ctx,
|
|||
array->Ptr = (const GLubyte *) ptr;
|
||||
array->_ElementSize = elementSize;
|
||||
|
||||
_mesa_reference_buffer_object(ctx, &array->BufferObj,
|
||||
ctx->Array.ArrayBufferObj);
|
||||
|
||||
ctx->NewState |= _NEW_ARRAY;
|
||||
ctx->Array.NewState |= VERT_BIT(attrib);
|
||||
}
|
||||
|
@ -190,7 +173,7 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0,
|
||||
update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR,
|
||||
legalTypes, 3, 4,
|
||||
size, type, stride, GL_TRUE, GL_FALSE, ptr);
|
||||
}
|
||||
|
@ -223,23 +206,6 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
|
|||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
|
||||
SHORT_BIT | UNSIGNED_SHORT_BIT |
|
||||
INT_BIT | UNSIGNED_INT_BIT |
|
||||
HALF_BIT | FLOAT_BIT | DOUBLE_BIT);
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
|
||||
update_array(ctx, "glSecondaryColorPointer", VERT_ATTRIB_COLOR1,
|
||||
legalTypes, 3, 4,
|
||||
size, type, stride, GL_TRUE, GL_FALSE, ptr);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *ptr)
|
||||
|
@ -614,46 +580,22 @@ _mesa_copy_client_array(struct gl_context *ctx,
|
|||
dst->_MaxElement = src->_MaxElement;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Print vertex array's fields.
|
||||
*/
|
||||
static void
|
||||
print_array(const char *name, GLint index, const struct gl_client_array *array)
|
||||
init_array(struct gl_context *ctx,
|
||||
struct gl_client_array *array, GLint size, GLint type)
|
||||
{
|
||||
if (index >= 0)
|
||||
printf(" %s[%d]: ", name, index);
|
||||
else
|
||||
printf(" %s: ", name);
|
||||
printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu), MaxElem=%u\n",
|
||||
array->Ptr, array->Type, array->Size,
|
||||
array->_ElementSize, array->StrideB,
|
||||
array->BufferObj->Name, (unsigned long) array->BufferObj->Size,
|
||||
array->_MaxElement);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print current vertex object/array info. For debug.
|
||||
*/
|
||||
void
|
||||
_mesa_print_arrays(struct gl_context *ctx)
|
||||
{
|
||||
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
|
||||
|
||||
_mesa_update_array_object_max_element(ctx, arrayObj);
|
||||
|
||||
printf("Array Object %u\n", arrayObj->Name);
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled)
|
||||
print_array("Vertex", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_POS]);
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled)
|
||||
print_array("Normal", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]);
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled)
|
||||
print_array("Color", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]);
|
||||
if (arrayObj->VertexAttrib[VERT_ATTRIB_TEX].Enabled)
|
||||
print_array("TexCoord", -1, &arrayObj->VertexAttrib[VERT_ATTRIB_TEX]);
|
||||
printf(" _MaxElement = %u\n", arrayObj->_MaxElement);
|
||||
array->Size = size;
|
||||
array->Type = type;
|
||||
array->Stride = 0;
|
||||
array->StrideB = 0;
|
||||
array->Ptr = NULL;
|
||||
array->Enabled = GL_FALSE;
|
||||
array->Normalized = GL_FALSE;
|
||||
array->Integer = GL_FALSE;
|
||||
array->_ElementSize = size * _mesa_sizeof_type(type);
|
||||
/* Vertex array buffers */
|
||||
_mesa_reference_buffer_object(ctx, &array->BufferObj,
|
||||
ctx->Shared->NullBufferObj);
|
||||
}
|
||||
|
||||
|
||||
|
@ -661,25 +603,33 @@ _mesa_print_arrays(struct gl_context *ctx)
|
|||
* Initialize vertex array state for given context.
|
||||
*/
|
||||
void
|
||||
_mesa_init_varray(struct gl_context *ctx)
|
||||
_mesa_init_varray(struct gl_context *ctx, struct gl_array_attrib *array)
|
||||
{
|
||||
ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0);
|
||||
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj,
|
||||
ctx->Array.DefaultArrayObj);
|
||||
GLuint i;
|
||||
|
||||
ctx->Array.Objects = _mesa_NewHashTable();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback for deleting an array object. Called by _mesa_HashDeleteAll().
|
||||
*/
|
||||
static void
|
||||
delete_arrayobj_cb(GLuint id, void *data, void *userData)
|
||||
{
|
||||
struct gl_array_object *arrayObj = (struct gl_array_object *) data;
|
||||
struct gl_context *ctx = (struct gl_context *) userData;
|
||||
_mesa_delete_array_object(ctx, arrayObj);
|
||||
/* Init the individual arrays */
|
||||
for (i = 0; i < Elements(array->VertexAttrib); i++) {
|
||||
switch (i) {
|
||||
case VERT_ATTRIB_WEIGHT:
|
||||
init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_WEIGHT], 1, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_NORMAL:
|
||||
init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_NORMAL], 3, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_FOG:
|
||||
init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_FOG], 1, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_COLOR_INDEX:
|
||||
init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_COLOR_INDEX], 1, GL_FLOAT);
|
||||
break;
|
||||
case VERT_ATTRIB_EDGEFLAG:
|
||||
init_array(ctx, &array->VertexAttrib[VERT_ATTRIB_EDGEFLAG], 1, GL_BOOL);
|
||||
break;
|
||||
default:
|
||||
init_array(ctx, &array->VertexAttrib[i], 4, GL_FLOAT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -687,8 +637,14 @@ delete_arrayobj_cb(GLuint id, void *data, void *userData)
|
|||
* Free vertex array state for given context.
|
||||
*/
|
||||
void
|
||||
_mesa_free_varray_data(struct gl_context *ctx)
|
||||
_mesa_free_varray_data(struct gl_context *ctx, struct gl_array_attrib* array)
|
||||
{
|
||||
_mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx);
|
||||
_mesa_DeleteHashTable(ctx->Array.Objects);
|
||||
GLuint i;
|
||||
|
||||
/* Uninit the individual arrays */
|
||||
for (i = 0; i < Elements(array->VertexAttrib); i++)
|
||||
{
|
||||
_mesa_reference_buffer_object(ctx, &array->VertexAttrib[i].BufferObj, NULL);
|
||||
memset(&array->VertexAttrib[i], 0, sizeof(struct gl_client_array));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,11 +132,6 @@ extern void GLAPIENTRY
|
|||
_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *ptr);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
|
||||
|
||||
|
@ -165,25 +160,17 @@ extern void GLAPIENTRY
|
|||
_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid *indices);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_copy_client_array(struct gl_context *ctx,
|
||||
struct gl_client_array *dst,
|
||||
struct gl_client_array *src);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_print_arrays(struct gl_context *ctx);
|
||||
|
||||
extern void
|
||||
_mesa_init_varray( struct gl_context * ctx );
|
||||
_mesa_init_varray( struct gl_context * ctx, struct gl_array_attrib *array);
|
||||
|
||||
extern void
|
||||
_mesa_free_varray_data(struct gl_context *ctx);
|
||||
_mesa_free_varray_data(struct gl_context *ctx, struct gl_array_attrib *array);
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -56,80 +56,22 @@ override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
|
|||
static void
|
||||
compute_version(struct gl_context *ctx)
|
||||
{
|
||||
GLuint major, minor;
|
||||
static const int max = 100;
|
||||
/* report openGL 1.1 */
|
||||
ctx->VersionMajor = 1;
|
||||
ctx->VersionMinor = 1;
|
||||
|
||||
const GLboolean ver_1_3 = (ctx->Extensions.ARB_texture_cube_map &&
|
||||
ctx->Extensions.ARB_texture_env_combine &&
|
||||
ctx->Extensions.ARB_texture_env_dot3);
|
||||
const GLboolean ver_1_4 = (ver_1_3 &&
|
||||
ctx->Extensions.ARB_texture_env_crossbar &&
|
||||
ctx->Extensions.ARB_window_pos &&
|
||||
ctx->Extensions.EXT_blend_color &&
|
||||
ctx->Extensions.EXT_blend_func_separate &&
|
||||
ctx->Extensions.EXT_blend_minmax &&
|
||||
ctx->Extensions.EXT_fog_coord &&
|
||||
ctx->Extensions.EXT_point_parameters &&
|
||||
ctx->Extensions.EXT_secondary_color);
|
||||
const GLboolean ver_1_5 = (ver_1_4 &&
|
||||
ctx->Extensions.EXT_shadow_funcs);
|
||||
const GLboolean ver_2_0 = (ver_1_5 &&
|
||||
ctx->Extensions.ARB_point_sprite &&
|
||||
ctx->Extensions.ARB_texture_non_power_of_two &&
|
||||
ctx->Extensions.EXT_blend_equation_separate);
|
||||
const GLboolean ver_2_1 = (ver_2_0);
|
||||
const GLboolean ver_3_0 = (ver_2_1 &&
|
||||
ctx->Extensions.ARB_half_float_pixel &&
|
||||
ctx->Extensions.ARB_half_float_vertex &&
|
||||
ctx->Extensions.ARB_map_buffer_range &&
|
||||
ctx->Extensions.ARB_texture_float &&
|
||||
ctx->Extensions.APPLE_vertex_array_object);
|
||||
override_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
|
||||
|
||||
|
||||
if (ver_3_0) {
|
||||
major = 3;
|
||||
minor = 0;
|
||||
}
|
||||
else if (ver_2_1) {
|
||||
major = 2;
|
||||
minor = 1;
|
||||
}
|
||||
else if (ver_2_0) {
|
||||
major = 2;
|
||||
minor = 0;
|
||||
}
|
||||
else if (ver_1_5) {
|
||||
major = 1;
|
||||
minor = 5;
|
||||
}
|
||||
else if (ver_1_4) {
|
||||
major = 1;
|
||||
minor = 4;
|
||||
}
|
||||
else if (ver_1_3) {
|
||||
major = 1;
|
||||
minor = 3;
|
||||
}
|
||||
else {
|
||||
major = 1;
|
||||
minor = 2;
|
||||
}
|
||||
|
||||
ctx->VersionMajor = major;
|
||||
ctx->VersionMinor = minor;
|
||||
|
||||
override_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
|
||||
|
||||
ctx->VersionString = (char *) malloc(max);
|
||||
if (ctx->VersionString) {
|
||||
_mesa_snprintf(ctx->VersionString, max,
|
||||
"%u.%u Mesa " MESA_VERSION_STRING
|
||||
ctx->VersionString = (char *) malloc(20);
|
||||
if (ctx->VersionString) {
|
||||
_mesa_snprintf(ctx->VersionString, 20,
|
||||
"%u.%u Mesa " MESA_VERSION_STRING
|
||||
#ifdef MESA_GIT_SHA1
|
||||
" (" MESA_GIT_SHA1 ")"
|
||||
" (" MESA_GIT_SHA1 ")"
|
||||
#endif
|
||||
,
|
||||
ctx->VersionMajor, ctx->VersionMinor);
|
||||
}
|
||||
,
|
||||
ctx->VersionMajor, ctx->VersionMinor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,8 +54,6 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
|
|||
SET_Materialfv(tab, vfmt->Materialfv);
|
||||
SET_Normal3f(tab, vfmt->Normal3f);
|
||||
SET_Normal3fv(tab, vfmt->Normal3fv);
|
||||
SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
|
||||
SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
|
||||
SET_TexCoord1f(tab, vfmt->TexCoord1f);
|
||||
SET_TexCoord1fv(tab, vfmt->TexCoord1fv);
|
||||
SET_TexCoord2f(tab, vfmt->TexCoord2f);
|
||||
|
@ -80,7 +78,6 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
|
|||
|
||||
SET_DrawArrays(tab, vfmt->DrawArrays);
|
||||
SET_DrawElements(tab, vfmt->DrawElements);
|
||||
SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
|
||||
|
||||
/* GL_NV_vertex_program */
|
||||
SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
|
||||
|
|
|
@ -32,3 +32,7 @@ add_pch(mesa_swrast precomp.h SOURCE)
|
|||
if(NOT MSVC)
|
||||
allow_warnings(mesa_swrast)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
add_target_compile_flags(mesa_swrast "-Wno-unused-variable")
|
||||
endif()
|
||||
|
|
|
@ -470,9 +470,6 @@ _swrast_choose_aa_line_function(struct gl_context *ctx)
|
|||
ASSERT(ctx->Line.SmoothFlag);
|
||||
|
||||
if (ctx->Texture._EnabledCoord
|
||||
|| (ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||
|| ctx->Fog.ColorSumEnabled
|
||||
|| swrast->_FogEnabled) {
|
||||
swrast->Line = aa_general_rgba_line;
|
||||
}
|
||||
|
|
|
@ -289,8 +289,7 @@ _swrast_set_aa_triangle_function(struct gl_context *ctx)
|
|||
ASSERT(ctx->Polygon.SmoothFlag);
|
||||
|
||||
if (ctx->Texture._EnabledCoord
|
||||
|| swrast->_FogEnabled
|
||||
|| _mesa_need_secondary_color(ctx)) {
|
||||
|| swrast->_FogEnabled) {
|
||||
SWRAST_CONTEXT(ctx)->Triangle = general_aa_tri;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -116,7 +116,7 @@ _swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
|
|||
ALPHA_TEST(rgba[i][ACOMP], ;);
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
const GLfloat ref = ctx->Color.AlphaRef;
|
||||
ALPHA_TEST(rgba[i][ACOMP], ;);
|
||||
}
|
||||
|
|
|
@ -292,113 +292,6 @@ blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Blend min function.
|
||||
* Any chanType ok.
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
||||
GLvoid *src, const GLvoid *dst, GLenum chanType)
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.EquationRGB == GL_MIN);
|
||||
ASSERT(ctx->Color.EquationA == GL_MIN);
|
||||
(void) ctx;
|
||||
|
||||
if (chanType == GL_UNSIGNED_BYTE) {
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) src;
|
||||
const GLubyte (*dest)[4] = (const GLubyte (*)[4]) dst;
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (chanType == GL_UNSIGNED_SHORT) {
|
||||
GLushort (*rgba)[4] = (GLushort (*)[4]) src;
|
||||
const GLushort (*dest)[4] = (const GLushort (*)[4]) dst;
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
|
||||
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
|
||||
ASSERT(chanType == GL_FLOAT);
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = MIN2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = MIN2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = MIN2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = MIN2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Blend max function.
|
||||
* Any chanType ok.
|
||||
*/
|
||||
static void _BLENDAPI
|
||||
blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
||||
GLvoid *src, const GLvoid *dst, GLenum chanType)
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(ctx->Color.EquationRGB == GL_MAX);
|
||||
ASSERT(ctx->Color.EquationA == GL_MAX);
|
||||
(void) ctx;
|
||||
|
||||
if (chanType == GL_UNSIGNED_BYTE) {
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) src;
|
||||
const GLubyte (*dest)[4] = (const GLubyte (*)[4]) dst;
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (chanType == GL_UNSIGNED_SHORT) {
|
||||
GLushort (*rgba)[4] = (GLushort (*)[4]) src;
|
||||
const GLushort (*dest)[4] = (const GLushort (*)[4]) dst;
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
|
||||
const GLfloat (*dest)[4] = (const GLfloat (*)[4]) dst;
|
||||
ASSERT(chanType == GL_FLOAT);
|
||||
for (i=0;i<n;i++) {
|
||||
if (mask[i]) {
|
||||
rgba[i][RCOMP] = MAX2( rgba[i][RCOMP], dest[i][RCOMP] );
|
||||
rgba[i][GCOMP] = MAX2( rgba[i][GCOMP], dest[i][GCOMP] );
|
||||
rgba[i][BCOMP] = MAX2( rgba[i][BCOMP], dest[i][BCOMP] );
|
||||
rgba[i][ACOMP] = MAX2( rgba[i][ACOMP], dest[i][ACOMP] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Modulate: result = src * dest
|
||||
* Any chanType ok.
|
||||
|
@ -488,68 +381,56 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
*/
|
||||
|
||||
/* Source RGB factor */
|
||||
switch (ctx->Color.SrcRGB) {
|
||||
switch (ctx->Color.SrcFactor) {
|
||||
case GL_ZERO:
|
||||
sR = sG = sB = 0.0F;
|
||||
sR = sG = sB = sA = 0.0F;
|
||||
break;
|
||||
case GL_ONE:
|
||||
sR = sG = sB = 1.0F;
|
||||
sR = sG = sB = sA = 1.0F;
|
||||
break;
|
||||
case GL_DST_COLOR:
|
||||
sR = Rd;
|
||||
sG = Gd;
|
||||
sB = Bd;
|
||||
sA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
sR = 1.0F - Rd;
|
||||
sG = 1.0F - Gd;
|
||||
sB = 1.0F - Bd;
|
||||
sA = 1.0f - Ad;
|
||||
break;
|
||||
case GL_SRC_ALPHA:
|
||||
sR = sG = sB = As;
|
||||
sR = sG = sB = sA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
sR = sG = sB = 1.0F - As;
|
||||
sR = sG = sB = sA = 1.0F - As;
|
||||
break;
|
||||
case GL_DST_ALPHA:
|
||||
sR = sG = sB = Ad;
|
||||
sR = sG = sB = sA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
sR = sG = sB = 1.0F - Ad;
|
||||
sR = sG = sB = sA = 1.0F - Ad;
|
||||
break;
|
||||
case GL_SRC_ALPHA_SATURATE:
|
||||
if (As < 1.0F - Ad) {
|
||||
sR = sG = sB = As;
|
||||
sR = sG = sB = sA = As;
|
||||
}
|
||||
else {
|
||||
sR = sG = sB = 1.0F - Ad;
|
||||
sR = sG = sB = sA = 1.0F - Ad;
|
||||
}
|
||||
break;
|
||||
case GL_CONSTANT_COLOR:
|
||||
sR = ctx->Color.BlendColor[0];
|
||||
sG = ctx->Color.BlendColor[1];
|
||||
sB = ctx->Color.BlendColor[2];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
sR = 1.0F - ctx->Color.BlendColor[0];
|
||||
sG = 1.0F - ctx->Color.BlendColor[1];
|
||||
sB = 1.0F - ctx->Color.BlendColor[2];
|
||||
break;
|
||||
case GL_CONSTANT_ALPHA:
|
||||
sR = sG = sB = ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
sR = sG = sB = 1.0F - ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_SRC_COLOR:
|
||||
sR = Rs;
|
||||
sG = Gs;
|
||||
sB = Bs;
|
||||
sA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_COLOR:
|
||||
sR = 1.0F - Rs;
|
||||
sG = 1.0F - Gs;
|
||||
sB = 1.0F - Bs;
|
||||
sA = 1.0F - As;
|
||||
break;
|
||||
default:
|
||||
/* this should never happen */
|
||||
|
@ -557,234 +438,62 @@ blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
|
|||
return;
|
||||
}
|
||||
|
||||
/* Source Alpha factor */
|
||||
switch (ctx->Color.SrcA) {
|
||||
/* Dest factor */
|
||||
switch (ctx->Color.DstFactor) {
|
||||
case GL_ZERO:
|
||||
sA = 0.0F;
|
||||
dR = dG = dB = dA = 0.0F;
|
||||
break;
|
||||
case GL_ONE:
|
||||
sA = 1.0F;
|
||||
break;
|
||||
case GL_DST_COLOR:
|
||||
sA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
sA = 1.0F - Ad;
|
||||
break;
|
||||
case GL_SRC_ALPHA:
|
||||
sA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
sA = 1.0F - As;
|
||||
break;
|
||||
case GL_DST_ALPHA:
|
||||
sA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
sA = 1.0F - Ad;
|
||||
break;
|
||||
case GL_SRC_ALPHA_SATURATE:
|
||||
sA = 1.0;
|
||||
break;
|
||||
case GL_CONSTANT_COLOR:
|
||||
sA = ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
sA = 1.0F - ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_CONSTANT_ALPHA:
|
||||
sA = ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
sA = 1.0F - ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_SRC_COLOR:
|
||||
sA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_COLOR:
|
||||
sA = 1.0F - As;
|
||||
break;
|
||||
default:
|
||||
/* this should never happen */
|
||||
sA = 0.0F;
|
||||
_mesa_problem(ctx, "Bad blend source A factor in blend_general_float");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Dest RGB factor */
|
||||
switch (ctx->Color.DstRGB) {
|
||||
case GL_ZERO:
|
||||
dR = dG = dB = 0.0F;
|
||||
break;
|
||||
case GL_ONE:
|
||||
dR = dG = dB = 1.0F;
|
||||
dR = dG = dB = dA = 1.0F;
|
||||
break;
|
||||
case GL_SRC_COLOR:
|
||||
dR = Rs;
|
||||
dG = Gs;
|
||||
dB = Bs;
|
||||
dA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_COLOR:
|
||||
dR = 1.0F - Rs;
|
||||
dG = 1.0F - Gs;
|
||||
dB = 1.0F - Bs;
|
||||
dA = 1.0F - As;
|
||||
break;
|
||||
case GL_SRC_ALPHA:
|
||||
dR = dG = dB = As;
|
||||
dR = dG = dB = dA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
dR = dG = dB = 1.0F - As;
|
||||
dR = dG = dB = dA = 1.0F - As;
|
||||
break;
|
||||
case GL_DST_ALPHA:
|
||||
dR = dG = dB = Ad;
|
||||
dR = dG = dB = dA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
dR = dG = dB = 1.0F - Ad;
|
||||
break;
|
||||
case GL_CONSTANT_COLOR:
|
||||
dR = ctx->Color.BlendColor[0];
|
||||
dG = ctx->Color.BlendColor[1];
|
||||
dB = ctx->Color.BlendColor[2];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
dR = 1.0F - ctx->Color.BlendColor[0];
|
||||
dG = 1.0F - ctx->Color.BlendColor[1];
|
||||
dB = 1.0F - ctx->Color.BlendColor[2];
|
||||
break;
|
||||
case GL_CONSTANT_ALPHA:
|
||||
dR = dG = dB = ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
dR = dG = dB = 1.0F - ctx->Color.BlendColor[3];
|
||||
dR = dG = dB = dA = 1.0F - Ad;
|
||||
break;
|
||||
case GL_DST_COLOR:
|
||||
dR = Rd;
|
||||
dG = Gd;
|
||||
dB = Bd;
|
||||
dA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
dR = 1.0F - Rd;
|
||||
dG = 1.0F - Gd;
|
||||
dB = 1.0F - Bd;
|
||||
break;
|
||||
default:
|
||||
/* this should never happen */
|
||||
dR = dG = dB = 0.0F;
|
||||
_mesa_problem(ctx, "Bad blend dest RGB factor in blend_general_float");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Dest Alpha factor */
|
||||
switch (ctx->Color.DstA) {
|
||||
case GL_ZERO:
|
||||
dA = 0.0F;
|
||||
break;
|
||||
case GL_ONE:
|
||||
dA = 1.0F;
|
||||
break;
|
||||
case GL_SRC_COLOR:
|
||||
dA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_COLOR:
|
||||
dA = 1.0F - As;
|
||||
break;
|
||||
case GL_SRC_ALPHA:
|
||||
dA = As;
|
||||
break;
|
||||
case GL_ONE_MINUS_SRC_ALPHA:
|
||||
dA = 1.0F - As;
|
||||
break;
|
||||
case GL_DST_ALPHA:
|
||||
dA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_ALPHA:
|
||||
dA = 1.0F - Ad;
|
||||
break;
|
||||
case GL_CONSTANT_COLOR:
|
||||
dA = ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_COLOR:
|
||||
dA = 1.0F - ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_CONSTANT_ALPHA:
|
||||
dA = ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_ONE_MINUS_CONSTANT_ALPHA:
|
||||
dA = 1.0F - ctx->Color.BlendColor[3];
|
||||
break;
|
||||
case GL_DST_COLOR:
|
||||
dA = Ad;
|
||||
break;
|
||||
case GL_ONE_MINUS_DST_COLOR:
|
||||
dA = 1.0F - Ad;
|
||||
break;
|
||||
default:
|
||||
/* this should never happen */
|
||||
dA = 0.0F;
|
||||
_mesa_problem(ctx, "Bad blend dest A factor in blend_general_float");
|
||||
dR = dG = dB = dA = 0.0F;
|
||||
_mesa_problem(ctx, "Bad blend dest factor in blend_general_float");
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute the blended RGB */
|
||||
switch (ctx->Color.EquationRGB) {
|
||||
case GL_FUNC_ADD:
|
||||
r = Rs * sR + Rd * dR;
|
||||
g = Gs * sG + Gd * dG;
|
||||
b = Bs * sB + Bd * dB;
|
||||
a = As * sA + Ad * dA;
|
||||
break;
|
||||
case GL_FUNC_SUBTRACT:
|
||||
r = Rs * sR - Rd * dR;
|
||||
g = Gs * sG - Gd * dG;
|
||||
b = Bs * sB - Bd * dB;
|
||||
a = As * sA - Ad * dA;
|
||||
break;
|
||||
case GL_FUNC_REVERSE_SUBTRACT:
|
||||
r = Rd * dR - Rs * sR;
|
||||
g = Gd * dG - Gs * sG;
|
||||
b = Bd * dB - Bs * sB;
|
||||
a = Ad * dA - As * sA;
|
||||
break;
|
||||
case GL_MIN:
|
||||
r = MIN2( Rd, Rs );
|
||||
g = MIN2( Gd, Gs );
|
||||
b = MIN2( Bd, Bs );
|
||||
break;
|
||||
case GL_MAX:
|
||||
r = MAX2( Rd, Rs );
|
||||
g = MAX2( Gd, Gs );
|
||||
b = MAX2( Bd, Bs );
|
||||
break;
|
||||
default:
|
||||
/* should never get here */
|
||||
r = g = b = 0.0F; /* silence uninitialized var warning */
|
||||
_mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute the blended alpha */
|
||||
switch (ctx->Color.EquationA) {
|
||||
case GL_FUNC_ADD:
|
||||
a = As * sA + Ad * dA;
|
||||
break;
|
||||
case GL_FUNC_SUBTRACT:
|
||||
a = As * sA - Ad * dA;
|
||||
break;
|
||||
case GL_FUNC_REVERSE_SUBTRACT:
|
||||
a = Ad * dA - As * sA;
|
||||
break;
|
||||
case GL_MIN:
|
||||
a = MIN2( Ad, As );
|
||||
break;
|
||||
case GL_MAX:
|
||||
a = MAX2( Ad, As );
|
||||
break;
|
||||
default:
|
||||
/* should never get here */
|
||||
a = 0.0F; /* silence uninitialized var warning */
|
||||
_mesa_problem(ctx, "unexpected BlendEquation in blend_general()");
|
||||
return;
|
||||
}
|
||||
/* compute the blended RGBA */
|
||||
r = Rs * sR + Rd * dR;
|
||||
g = Gs * sG + Gd * dG;
|
||||
b = Bs * sB + Bd * dB;
|
||||
a = As * sA + Ad * dA;
|
||||
|
||||
/* final clamping */
|
||||
#if 0
|
||||
|
@ -891,40 +600,10 @@ void
|
|||
_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType)
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
const GLenum eq = ctx->Color.EquationRGB;
|
||||
const GLenum srcRGB = ctx->Color.SrcRGB;
|
||||
const GLenum dstRGB = ctx->Color.DstRGB;
|
||||
const GLenum srcA = ctx->Color.SrcA;
|
||||
const GLenum dstA = ctx->Color.DstA;
|
||||
const GLenum srcFactor = ctx->Color.SrcFactor;
|
||||
const GLenum dstFactor = ctx->Color.DstFactor;
|
||||
|
||||
if (ctx->Color.EquationRGB != ctx->Color.EquationA) {
|
||||
swrast->BlendFunc = blend_general;
|
||||
}
|
||||
else if (eq == GL_MIN) {
|
||||
/* Note: GL_MIN ignores the blending weight factors */
|
||||
#if defined(USE_MMX_ASM)
|
||||
if (cpu_has_mmx && chanType == GL_UNSIGNED_BYTE) {
|
||||
swrast->BlendFunc = _mesa_mmx_blend_min;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
swrast->BlendFunc = blend_min;
|
||||
}
|
||||
else if (eq == GL_MAX) {
|
||||
/* Note: GL_MAX ignores the blending weight factors */
|
||||
#if defined(USE_MMX_ASM)
|
||||
if (cpu_has_mmx && chanType == GL_UNSIGNED_BYTE) {
|
||||
swrast->BlendFunc = _mesa_mmx_blend_max;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
swrast->BlendFunc = blend_max;
|
||||
}
|
||||
else if (srcRGB != srcA || dstRGB != dstA) {
|
||||
swrast->BlendFunc = blend_general;
|
||||
}
|
||||
else if (eq == GL_FUNC_ADD && srcRGB == GL_SRC_ALPHA
|
||||
&& dstRGB == GL_ONE_MINUS_SRC_ALPHA) {
|
||||
if (srcFactor == GL_SRC_ALPHA && dstFactor == GL_ONE_MINUS_SRC_ALPHA) {
|
||||
#if defined(USE_MMX_ASM)
|
||||
if (cpu_has_mmx && chanType == GL_UNSIGNED_BYTE) {
|
||||
swrast->BlendFunc = _mesa_mmx_blend_transparency;
|
||||
|
@ -940,7 +619,7 @@ _swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType)
|
|||
swrast->BlendFunc = blend_transparency_float;
|
||||
}
|
||||
}
|
||||
else if (eq == GL_FUNC_ADD && srcRGB == GL_ONE && dstRGB == GL_ONE) {
|
||||
else if (srcFactor == GL_ONE && dstFactor == GL_ONE) {
|
||||
#if defined(USE_MMX_ASM)
|
||||
if (cpu_has_mmx && chanType == GL_UNSIGNED_BYTE) {
|
||||
swrast->BlendFunc = _mesa_mmx_blend_add;
|
||||
|
@ -949,11 +628,8 @@ _swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType)
|
|||
#endif
|
||||
swrast->BlendFunc = blend_add;
|
||||
}
|
||||
else if (((eq == GL_FUNC_ADD || eq == GL_FUNC_REVERSE_SUBTRACT)
|
||||
&& (srcRGB == GL_ZERO && dstRGB == GL_SRC_COLOR))
|
||||
||
|
||||
((eq == GL_FUNC_ADD || eq == GL_FUNC_SUBTRACT)
|
||||
&& (srcRGB == GL_DST_COLOR && dstRGB == GL_ZERO))) {
|
||||
else if ((srcFactor == GL_ZERO && dstFactor == GL_SRC_COLOR)
|
||||
|| (srcFactor == GL_DST_COLOR && dstFactor == GL_ZERO)) {
|
||||
#if defined(USE_MMX_ASM)
|
||||
if (cpu_has_mmx && chanType == GL_UNSIGNED_BYTE) {
|
||||
swrast->BlendFunc = _mesa_mmx_blend_modulate;
|
||||
|
@ -962,10 +638,10 @@ _swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType)
|
|||
#endif
|
||||
swrast->BlendFunc = blend_modulate;
|
||||
}
|
||||
else if (eq == GL_FUNC_ADD && srcRGB == GL_ZERO && dstRGB == GL_ONE) {
|
||||
else if (srcFactor == GL_ZERO && dstFactor == GL_ONE) {
|
||||
swrast->BlendFunc = blend_noop;
|
||||
}
|
||||
else if (eq == GL_FUNC_ADD && srcRGB == GL_ONE && dstRGB == GL_ZERO) {
|
||||
else if (srcFactor == GL_ONE && dstFactor == GL_ZERO) {
|
||||
swrast->BlendFunc = blend_replace;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -190,22 +190,6 @@ _swrast_update_fog_state( struct gl_context *ctx )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* See if we can do early diffuse+specular (primary+secondary) color
|
||||
* add per vertex instead of per-fragment.
|
||||
*/
|
||||
static void
|
||||
_swrast_update_specular_vertex_add(struct gl_context *ctx)
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
|
||||
(ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
|
||||
|
||||
swrast->SpecularVertexAdd = (separateSpecular && !ctx->Texture._Enabled);
|
||||
}
|
||||
|
||||
|
||||
#define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK | \
|
||||
_NEW_TEXTURE | \
|
||||
_NEW_HINT | \
|
||||
|
@ -266,12 +250,6 @@ _swrast_validate_triangle( struct gl_context *ctx,
|
|||
swrast->choose_triangle( ctx );
|
||||
ASSERT(swrast->Triangle);
|
||||
|
||||
if (swrast->SpecularVertexAdd) {
|
||||
/* separate specular color, but no texture */
|
||||
swrast->SpecTriangle = swrast->Triangle;
|
||||
swrast->Triangle = _swrast_add_spec_terms_triangle;
|
||||
}
|
||||
|
||||
swrast->Triangle( ctx, v0, v1, v2 );
|
||||
}
|
||||
|
||||
|
@ -288,11 +266,6 @@ _swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWverte
|
|||
swrast->choose_line( ctx );
|
||||
ASSERT(swrast->Line);
|
||||
|
||||
if (swrast->SpecularVertexAdd) {
|
||||
swrast->SpecLine = swrast->Line;
|
||||
swrast->Line = _swrast_add_spec_terms_line;
|
||||
}
|
||||
|
||||
swrast->Line( ctx, v0, v1 );
|
||||
}
|
||||
|
||||
|
@ -308,11 +281,6 @@ _swrast_validate_point( struct gl_context *ctx, const SWvertex *v0 )
|
|||
_swrast_validate_derived( ctx );
|
||||
swrast->choose_point( ctx );
|
||||
|
||||
if (swrast->SpecularVertexAdd) {
|
||||
swrast->SpecPoint = swrast->Point;
|
||||
swrast->Point = _swrast_add_spec_terms_point;
|
||||
}
|
||||
|
||||
swrast->Point( ctx, v0 );
|
||||
}
|
||||
|
||||
|
@ -411,15 +379,9 @@ _swrast_update_active_attribs(struct gl_context *ctx)
|
|||
attribsMask = 0x0;
|
||||
|
||||
#if CHAN_TYPE == GL_FLOAT
|
||||
attribsMask |= FRAG_BIT_COL0;
|
||||
attribsMask |= FRAG_BIT_COL;
|
||||
#endif
|
||||
|
||||
if (ctx->Fog.ColorSumEnabled ||
|
||||
(ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
|
||||
attribsMask |= FRAG_BIT_COL1;
|
||||
}
|
||||
|
||||
if (swrast->_FogEnabled)
|
||||
attribsMask |= FRAG_BIT_FOGC;
|
||||
|
||||
|
@ -434,7 +396,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
|
|||
if (attribsMask & BITFIELD64_BIT(i)) {
|
||||
swrast->_ActiveAttribs[num++] = i;
|
||||
/* how should this attribute be interpolated? */
|
||||
if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1)
|
||||
if (i == FRAG_ATTRIB_COL)
|
||||
swrast->_InterpMode[i] = ctx->Light.ShadeModel;
|
||||
else
|
||||
swrast->_InterpMode[i] = GL_SMOOTH;
|
||||
|
@ -479,11 +441,6 @@ _swrast_validate_derived( struct gl_context *ctx )
|
|||
_NEW_TEXTURE))
|
||||
_swrast_update_active_attribs(ctx);
|
||||
|
||||
if (swrast->NewState & (_NEW_FOG |
|
||||
_NEW_LIGHT |
|
||||
_NEW_TEXTURE))
|
||||
_swrast_update_specular_vertex_add(ctx);
|
||||
|
||||
swrast->NewState = 0;
|
||||
swrast->StateChanges = 0;
|
||||
swrast->InvalidateState = _swrast_invalidate_state;
|
||||
|
@ -770,11 +727,6 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
|
|||
_mesa_debug(ctx, "color %d %d %d %d\n",
|
||||
v->color[0], v->color[1], v->color[2], v->color[3]);
|
||||
#endif
|
||||
_mesa_debug(ctx, "spec %g %g %g %g\n",
|
||||
v->attrib[FRAG_ATTRIB_COL1][0],
|
||||
v->attrib[FRAG_ATTRIB_COL1][1],
|
||||
v->attrib[FRAG_ATTRIB_COL1][2],
|
||||
v->attrib[FRAG_ATTRIB_COL1][3]);
|
||||
_mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]);
|
||||
_mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]);
|
||||
_mesa_debug(ctx, "pointsize %f\n", v->pointSize);
|
||||
|
|
|
@ -227,7 +227,6 @@ typedef struct
|
|||
GLbitfield NewState;
|
||||
GLuint StateChanges;
|
||||
GLenum Primitive; /* current primitive being drawn (ala glBegin) */
|
||||
GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */
|
||||
|
||||
void (*InvalidateState)( struct gl_context *ctx, GLbitfield new_state );
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||
INIT_SPAN(span, GL_BITMAP);
|
||||
_swrast_span_default_attribs(ctx, &span);
|
||||
span.arrayMask = SPAN_RGBA;
|
||||
span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
|
||||
span.arrayAttribs = FRAG_BIT_COL; /* we'll fill in COL0 attrib values */
|
||||
|
||||
if (overlapping) {
|
||||
tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat) * 4);
|
||||
|
@ -146,7 +146,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
|
|||
ASSERT(width < MAX_WIDTH);
|
||||
|
||||
for (row = 0; row < height; row++, sy += stepy, dy += stepy) {
|
||||
GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL];
|
||||
|
||||
/* Get row/span of source pixels */
|
||||
if (overlapping) {
|
||||
|
|
|
@ -409,7 +409,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
|
|||
INIT_SPAN(span, GL_BITMAP);
|
||||
_swrast_span_default_attribs(ctx, &span);
|
||||
span.arrayMask = SPAN_RGBA;
|
||||
span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */
|
||||
span.arrayAttribs = FRAG_BIT_COL; /* we're fill in COL0 attrib values */
|
||||
|
||||
if (_mesa_get_format_datatype(ctx->DrawBuffer->_ColorDrawBuffer->Format) != GL_FLOAT) {
|
||||
/* need to clamp colors before applying fragment ops */
|
||||
|
@ -426,7 +426,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
|
|||
= _mesa_image_row_stride(unpack, width, format, type);
|
||||
GLint skipPixels = 0;
|
||||
/* use span array for temp color storage */
|
||||
GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL];
|
||||
|
||||
/* if the span is wider than MAX_WIDTH we have to do it in chunks */
|
||||
while (skipPixels < width) {
|
||||
|
|
|
@ -31,7 +31,7 @@ feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv
|
|||
{
|
||||
GLfloat win[4];
|
||||
const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX];
|
||||
const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0];
|
||||
const GLfloat *color = v->attrib[FRAG_ATTRIB_COL];
|
||||
|
||||
win[0] = v->attrib[FRAG_ATTRIB_WPOS][0];
|
||||
win[1] = v->attrib[FRAG_ATTRIB_WPOS][1];
|
||||
|
|
|
@ -166,7 +166,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
|
|||
FOG_LOOP(GLushort, LINEAR_FOG);
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
ASSERT(span->array->ChanType == GL_FLOAT);
|
||||
FOG_LOOP(GLfloat, LINEAR_FOG);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
|
|||
FOG_LOOP(GLushort, EXP_FOG);
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
ASSERT(span->array->ChanType == GL_FLOAT);
|
||||
FOG_LOOP(GLfloat, EXP_FOG);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
|
|||
FOG_LOOP(GLushort, EXP2_FOG);
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
ASSERT(span->array->ChanType == GL_FLOAT);
|
||||
FOG_LOOP(GLfloat, EXP2_FOG);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
|
|||
FOG_LOOP(GLushort, BLEND_FOG);
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
ASSERT(span->array->ChanType == GL_FLOAT);
|
||||
FOG_LOOP(GLfloat, BLEND_FOG);
|
||||
}
|
||||
|
|
|
@ -149,41 +149,6 @@ draw_wide_line( struct gl_context *ctx, SWspan *span, GLboolean xMajor )
|
|||
|
||||
|
||||
|
||||
void
|
||||
_swrast_add_spec_terms_line(struct gl_context *ctx,
|
||||
const SWvertex *v0, const SWvertex *v1)
|
||||
{
|
||||
SWvertex *ncv0 = (SWvertex *)v0;
|
||||
SWvertex *ncv1 = (SWvertex *)v1;
|
||||
GLfloat rSum, gSum, bSum;
|
||||
GLchan cSave[2][4];
|
||||
|
||||
/* save original colors */
|
||||
COPY_CHAN4(cSave[0], ncv0->color);
|
||||
COPY_CHAN4(cSave[1], ncv1->color);
|
||||
/* sum v0 */
|
||||
rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0];
|
||||
gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1];
|
||||
bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2];
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum);
|
||||
/* sum v1 */
|
||||
rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0];
|
||||
gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1];
|
||||
bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2];
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum);
|
||||
/* draw */
|
||||
SWRAST_CONTEXT(ctx)->SpecLine( ctx, ncv0, ncv1 );
|
||||
/* restore original colors */
|
||||
COPY_CHAN4( ncv0->attrib[FRAG_ATTRIB_COL0], cSave[0] );
|
||||
COPY_CHAN4( ncv1->attrib[FRAG_ATTRIB_COL0], cSave[1] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/* record the current line function name */
|
||||
|
@ -215,9 +180,6 @@ void
|
|||
_swrast_choose_line( struct gl_context *ctx )
|
||||
{
|
||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
GLboolean specular = (ctx->Fog.ColorSumEnabled ||
|
||||
(ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR));
|
||||
|
||||
if (ctx->RenderMode == GL_RENDER) {
|
||||
if (ctx->Line.SmoothFlag) {
|
||||
|
@ -226,8 +188,7 @@ _swrast_choose_line( struct gl_context *ctx )
|
|||
ASSERT(swrast->Line);
|
||||
}
|
||||
else if (ctx->Texture._EnabledCoord
|
||||
|| swrast->_FogEnabled
|
||||
|| specular) {
|
||||
|| swrast->_FogEnabled) {
|
||||
USE(general_line);
|
||||
}
|
||||
else if (ctx->Depth.Test
|
||||
|
|
|
@ -153,18 +153,6 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 )
|
|||
if (dx == 0 && dy == 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
printf("%s %d,%d %g %g %g %g %g %g %g %g\n", __FUNCTION__, dx, dy,
|
||||
vert0->attrib[FRAG_ATTRIB_COL1][0],
|
||||
vert0->attrib[FRAG_ATTRIB_COL1][1],
|
||||
vert0->attrib[FRAG_ATTRIB_COL1][2],
|
||||
vert0->attrib[FRAG_ATTRIB_COL1][3],
|
||||
vert1->attrib[FRAG_ATTRIB_COL1][0],
|
||||
vert1->attrib[FRAG_ATTRIB_COL1][1],
|
||||
vert1->attrib[FRAG_ATTRIB_COL1][2],
|
||||
vert1->attrib[FRAG_ATTRIB_COL1][3]);
|
||||
*/
|
||||
|
||||
#ifdef DEPTH_TYPE
|
||||
zPtr = (DEPTH_TYPE *) _swrast_pixel_address(zrb, x0, y0);
|
||||
#endif
|
||||
|
|
|
@ -203,7 +203,7 @@ _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||
}
|
||||
else {
|
||||
logicop_uint4(ctx, 4 * span->end,
|
||||
(GLuint *) span->array->attribs[FRAG_ATTRIB_COL0],
|
||||
(GLuint *) span->array->attribs[FRAG_ATTRIB_COL],
|
||||
(const GLuint *) rbPixels, span->array->mask);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
|||
const GLuint bMask = ctx->Color.ColorMask[BCOMP] ? ~0x0 : 0x0;
|
||||
const GLuint aMask = ctx->Color.ColorMask[ACOMP] ? ~0x0 : 0x0;
|
||||
const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels;
|
||||
GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL];
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask);
|
||||
|
|
|
@ -486,33 +486,6 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add specular color to primary color, draw point, restore original
|
||||
* primary color.
|
||||
*/
|
||||
void
|
||||
_swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0)
|
||||
{
|
||||
SWvertex *ncv0 = (SWvertex *) v0; /* cast away const */
|
||||
GLfloat rSum, gSum, bSum;
|
||||
GLchan cSave[4];
|
||||
|
||||
/* save */
|
||||
COPY_CHAN4(cSave, ncv0->color);
|
||||
/* sum */
|
||||
rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0];
|
||||
gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1];
|
||||
bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2];
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum);
|
||||
/* draw */
|
||||
SWRAST_CONTEXT(ctx)->SpecPoint(ctx, ncv0);
|
||||
/* restore */
|
||||
COPY_CHAN4(ncv0->color, cSave);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Examine current state to determine which point drawing function to use.
|
||||
*/
|
||||
|
|
|
@ -82,17 +82,9 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
|
|||
span->alphaStep = 0;
|
||||
span->interpMask |= SPAN_RGBA;
|
||||
|
||||
COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor);
|
||||
ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
|
||||
ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
/* Secondary color */
|
||||
if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled)
|
||||
{
|
||||
COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor);
|
||||
ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0);
|
||||
ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
COPY_4V(span->attrStart[FRAG_ATTRIB_COL], ctx->Current.RasterColor);
|
||||
ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL], 0.0, 0.0, 0.0, 0.0);
|
||||
ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL], 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
/* fog */
|
||||
{
|
||||
|
@ -272,7 +264,7 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span)
|
|||
break;
|
||||
#endif
|
||||
case GL_FLOAT:
|
||||
interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
|
||||
interpolate_active_attribs(ctx, span, FRAG_BIT_COL);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "bad datatype 0x%x in interpolate_int_colors",
|
||||
|
@ -283,12 +275,12 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span)
|
|||
|
||||
|
||||
/**
|
||||
* Populate the FRAG_ATTRIB_COL0 array.
|
||||
* Populate the FRAG_ATTRIB_COL array.
|
||||
*/
|
||||
static inline void
|
||||
interpolate_float_colors(SWspan *span)
|
||||
{
|
||||
GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
const GLuint n = span->end;
|
||||
GLuint i;
|
||||
|
||||
|
@ -337,7 +329,7 @@ interpolate_float_colors(SWspan *span)
|
|||
}
|
||||
}
|
||||
|
||||
span->arrayAttribs |= FRAG_BIT_COL0;
|
||||
span->arrayAttribs |= FRAG_BIT_COL;
|
||||
span->array->ChanType = GL_FLOAT;
|
||||
}
|
||||
|
||||
|
@ -739,57 +731,6 @@ clip_span( struct gl_context *ctx, SWspan *span )
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add specular colors to primary colors.
|
||||
* Only called during fixed-function operation.
|
||||
* Result is float color array (FRAG_ATTRIB_COL0).
|
||||
*/
|
||||
static inline void
|
||||
add_specular(struct gl_context *ctx, SWspan *span)
|
||||
{
|
||||
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||
const GLubyte *mask = span->array->mask;
|
||||
GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*col1)[4] = span->array->attribs[FRAG_ATTRIB_COL1];
|
||||
GLuint i;
|
||||
|
||||
ASSERT(!_swrast_use_fragment_program(ctx));
|
||||
ASSERT(span->arrayMask & SPAN_RGBA);
|
||||
ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_COL1);
|
||||
(void) swrast; /* silence warning */
|
||||
|
||||
if (span->array->ChanType == GL_FLOAT) {
|
||||
if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
|
||||
interpolate_active_attribs(ctx, span, FRAG_BIT_COL0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* need float colors */
|
||||
if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) {
|
||||
interpolate_float_colors(span);
|
||||
}
|
||||
}
|
||||
|
||||
if ((span->arrayAttribs & FRAG_BIT_COL1) == 0) {
|
||||
/* XXX could avoid this and interpolate COL1 in the loop below */
|
||||
interpolate_active_attribs(ctx, span, FRAG_BIT_COL1);
|
||||
}
|
||||
|
||||
ASSERT(span->arrayAttribs & FRAG_BIT_COL0);
|
||||
ASSERT(span->arrayAttribs & FRAG_BIT_COL1);
|
||||
|
||||
for (i = 0; i < span->end; i++) {
|
||||
if (mask[i]) {
|
||||
col0[i][0] += col1[i][0];
|
||||
col0[i][1] += col1[i][1];
|
||||
col0[i][2] += col1[i][2];
|
||||
}
|
||||
}
|
||||
|
||||
span->array->ChanType = GL_FLOAT;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply antialiasing coverage value to alpha values.
|
||||
*/
|
||||
|
@ -815,7 +756,7 @@ apply_aa_coverage(SWspan *span)
|
|||
}
|
||||
}
|
||||
else {
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
for (i = 0; i < span->end; i++) {
|
||||
rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i];
|
||||
/* clamp later */
|
||||
|
@ -830,7 +771,7 @@ apply_aa_coverage(SWspan *span)
|
|||
static inline void
|
||||
clamp_colors(SWspan *span)
|
||||
{
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
GLuint i;
|
||||
ASSERT(span->array->ChanType == GL_FLOAT);
|
||||
for (i = 0; i < span->end; i++) {
|
||||
|
@ -854,7 +795,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output)
|
|||
GLvoid *src, *dst;
|
||||
|
||||
if (output > 0 || span->array->ChanType == GL_FLOAT) {
|
||||
src = span->array->attribs[FRAG_ATTRIB_COL0 + output];
|
||||
src = span->array->attribs[FRAG_ATTRIB_COL + output];
|
||||
span->array->ChanType = GL_FLOAT;
|
||||
}
|
||||
else if (span->array->ChanType == GL_UNSIGNED_BYTE) {
|
||||
|
@ -872,7 +813,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output)
|
|||
dst = span->array->rgba16;
|
||||
}
|
||||
else {
|
||||
dst = span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
dst = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
}
|
||||
|
||||
_mesa_convert_colors(span->array->ChanType, src,
|
||||
|
@ -1140,15 +1081,6 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
|
|||
|
||||
ASSERT(span->arrayMask & SPAN_RGBA);
|
||||
|
||||
if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) {
|
||||
/* Add primary and specular (diffuse + specular) colors */
|
||||
if (ctx->Fog.ColorSumEnabled ||
|
||||
(ctx->Light.Enabled &&
|
||||
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
|
||||
add_specular(ctx, span);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fog */
|
||||
if (swrast->_FogEnabled) {
|
||||
_swrast_fog_rgba_span(ctx, span);
|
||||
|
@ -1187,7 +1119,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
|
|||
span->array->rgba = span->array->rgba8;
|
||||
}
|
||||
else {
|
||||
span->array->rgba = (void *)span->array->attribs[FRAG_ATTRIB_COL0];
|
||||
span->array->rgba = (void *)span->array->attribs[FRAG_ATTRIB_COL];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -325,79 +325,6 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
|
|||
NULL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGBA_FLOAT32,
|
||||
fetch_texel_1d_f_rgba_f32,
|
||||
fetch_texel_2d_f_rgba_f32,
|
||||
fetch_texel_3d_f_rgba_f32
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGBA_FLOAT16,
|
||||
fetch_texel_1d_f_rgba_f16,
|
||||
fetch_texel_2d_f_rgba_f16,
|
||||
fetch_texel_3d_f_rgba_f16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGB_FLOAT32,
|
||||
fetch_texel_1d_f_rgb_f32,
|
||||
fetch_texel_2d_f_rgb_f32,
|
||||
fetch_texel_3d_f_rgb_f32
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_RGB_FLOAT16,
|
||||
fetch_texel_1d_f_rgb_f16,
|
||||
fetch_texel_2d_f_rgb_f16,
|
||||
fetch_texel_3d_f_rgb_f16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_ALPHA_FLOAT32,
|
||||
fetch_texel_1d_f_alpha_f32,
|
||||
fetch_texel_2d_f_alpha_f32,
|
||||
fetch_texel_3d_f_alpha_f32
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_ALPHA_FLOAT16,
|
||||
fetch_texel_1d_f_alpha_f16,
|
||||
fetch_texel_2d_f_alpha_f16,
|
||||
fetch_texel_3d_f_alpha_f16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_FLOAT32,
|
||||
fetch_texel_1d_f_luminance_f32,
|
||||
fetch_texel_2d_f_luminance_f32,
|
||||
fetch_texel_3d_f_luminance_f32
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_FLOAT16,
|
||||
fetch_texel_1d_f_luminance_f16,
|
||||
fetch_texel_2d_f_luminance_f16,
|
||||
fetch_texel_3d_f_luminance_f16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
|
||||
fetch_texel_1d_f_luminance_alpha_f32,
|
||||
fetch_texel_2d_f_luminance_alpha_f32,
|
||||
fetch_texel_3d_f_luminance_alpha_f32
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
|
||||
fetch_texel_1d_f_luminance_alpha_f16,
|
||||
fetch_texel_2d_f_luminance_alpha_f16,
|
||||
fetch_texel_3d_f_luminance_alpha_f16
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_INTENSITY_FLOAT32,
|
||||
fetch_texel_1d_f_intensity_f32,
|
||||
fetch_texel_2d_f_intensity_f32,
|
||||
fetch_texel_3d_f_intensity_f32
|
||||
},
|
||||
{
|
||||
MESA_FORMAT_INTENSITY_FLOAT16,
|
||||
fetch_texel_1d_f_intensity_f16,
|
||||
fetch_texel_2d_f_intensity_f16,
|
||||
fetch_texel_3d_f_intensity_f16
|
||||
},
|
||||
|
||||
{
|
||||
MESA_FORMAT_ALPHA_UINT8,
|
||||
NULL,
|
||||
|
|
|
@ -97,219 +97,6 @@ static void FETCH(f_z16)(const struct swrast_texture_image *texImage,
|
|||
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGBA_F32 ******************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
|
||||
texel[RCOMP] = src[0];
|
||||
texel[GCOMP] = src[1];
|
||||
texel[BCOMP] = src[2];
|
||||
texel[ACOMP] = src[3];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGBA_F16 ******************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
|
||||
texel[RCOMP] = _mesa_half_to_float(src[0]);
|
||||
texel[GCOMP] = _mesa_half_to_float(src[1]);
|
||||
texel[BCOMP] = _mesa_half_to_float(src[2]);
|
||||
texel[ACOMP] = _mesa_half_to_float(src[3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGB_F32 *******************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
|
||||
texel[RCOMP] = src[0];
|
||||
texel[GCOMP] = src[1];
|
||||
texel[BCOMP] = src[2];
|
||||
texel[ACOMP] = 1.0F;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_RGB_F16 *******************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
|
||||
texel[RCOMP] = _mesa_half_to_float(src[0]);
|
||||
texel[GCOMP] = _mesa_half_to_float(src[1]);
|
||||
texel[BCOMP] = _mesa_half_to_float(src[2]);
|
||||
texel[ACOMP] = 1.0F;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_ALPHA_F32 *****************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = 0.0F;
|
||||
texel[ACOMP] = src[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_ALPHA_F32 *****************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = 0.0F;
|
||||
texel[ACOMP] = _mesa_half_to_float(src[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = src[0];
|
||||
texel[ACOMP] = 1.0F;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = _mesa_half_to_float(src[0]);
|
||||
texel[ACOMP] = 1.0F;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = src[0];
|
||||
texel[ACOMP] = src[1];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] = _mesa_half_to_float(src[0]);
|
||||
texel[ACOMP] = _mesa_half_to_float(src[1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_INTENSITY_F32 *************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] =
|
||||
texel[ACOMP] = src[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* MESA_FORMAT_INTENSITY_F16 *************************************************/
|
||||
|
||||
/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
|
||||
* returning 4 GLfloats.
|
||||
*/
|
||||
static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
|
||||
GLint i, GLint j, GLint k, GLfloat *texel )
|
||||
{
|
||||
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
|
||||
texel[RCOMP] =
|
||||
texel[GCOMP] =
|
||||
texel[BCOMP] =
|
||||
texel[ACOMP] = _mesa_half_to_float(src[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Begin Hardware formats
|
||||
*/
|
||||
|
|
|
@ -1665,325 +1665,6 @@ sample_lambda_2d_aniso(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* 3-D Texture Sampling Functions */
|
||||
/**********************************************************************/
|
||||
|
||||
/**
|
||||
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
|
||||
*/
|
||||
static inline void
|
||||
sample_3d_nearest(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj,
|
||||
const struct gl_texture_image *img,
|
||||
const GLfloat texcoord[4],
|
||||
GLfloat rgba[4])
|
||||
{
|
||||
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||
const GLint width = img->Width2; /* without border, power of two */
|
||||
const GLint height = img->Height2; /* without border, power of two */
|
||||
const GLint depth = img->Depth2; /* without border, power of two */
|
||||
GLint i, j, k;
|
||||
(void) ctx;
|
||||
|
||||
i = nearest_texel_location(tObj->Sampler.WrapS, img, width, texcoord[0]);
|
||||
j = nearest_texel_location(tObj->Sampler.WrapT, img, height, texcoord[1]);
|
||||
k = nearest_texel_location(tObj->Sampler.WrapR, img, depth, texcoord[2]);
|
||||
|
||||
if (i < 0 || i >= (GLint) img->Width ||
|
||||
j < 0 || j >= (GLint) img->Height ||
|
||||
k < 0 || k >= (GLint) img->Depth) {
|
||||
/* Need this test for GL_CLAMP_TO_BORDER mode */
|
||||
get_border_color(tObj, img, rgba);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i, j, k, rgba);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
|
||||
*/
|
||||
static void
|
||||
sample_3d_linear(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj,
|
||||
const struct gl_texture_image *img,
|
||||
const GLfloat texcoord[4],
|
||||
GLfloat rgba[4])
|
||||
{
|
||||
const struct swrast_texture_image *swImg = swrast_texture_image_const(img);
|
||||
const GLint width = img->Width2;
|
||||
const GLint height = img->Height2;
|
||||
const GLint depth = img->Depth2;
|
||||
GLint i0, j0, k0, i1, j1, k1;
|
||||
GLbitfield useBorderColor = 0x0;
|
||||
GLfloat a, b, c;
|
||||
GLfloat t000[4], t010[4], t001[4], t011[4];
|
||||
GLfloat t100[4], t110[4], t101[4], t111[4];
|
||||
|
||||
linear_texel_locations(tObj->Sampler.WrapS, img, width, texcoord[0], &i0, &i1, &a);
|
||||
linear_texel_locations(tObj->Sampler.WrapT, img, height, texcoord[1], &j0, &j1, &b);
|
||||
linear_texel_locations(tObj->Sampler.WrapR, img, depth, texcoord[2], &k0, &k1, &c);
|
||||
|
||||
if (img->Border) {
|
||||
i0 += img->Border;
|
||||
i1 += img->Border;
|
||||
j0 += img->Border;
|
||||
j1 += img->Border;
|
||||
k0 += img->Border;
|
||||
k1 += img->Border;
|
||||
}
|
||||
else {
|
||||
/* check if sampling texture border color */
|
||||
if (i0 < 0 || i0 >= width) useBorderColor |= I0BIT;
|
||||
if (i1 < 0 || i1 >= width) useBorderColor |= I1BIT;
|
||||
if (j0 < 0 || j0 >= height) useBorderColor |= J0BIT;
|
||||
if (j1 < 0 || j1 >= height) useBorderColor |= J1BIT;
|
||||
if (k0 < 0 || k0 >= depth) useBorderColor |= K0BIT;
|
||||
if (k1 < 0 || k1 >= depth) useBorderColor |= K1BIT;
|
||||
}
|
||||
|
||||
/* Fetch texels */
|
||||
if (useBorderColor & (I0BIT | J0BIT | K0BIT)) {
|
||||
get_border_color(tObj, img, t000);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i0, j0, k0, t000);
|
||||
}
|
||||
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
|
||||
get_border_color(tObj, img, t100);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i1, j0, k0, t100);
|
||||
}
|
||||
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
|
||||
get_border_color(tObj, img, t010);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i0, j1, k0, t010);
|
||||
}
|
||||
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
|
||||
get_border_color(tObj, img, t110);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i1, j1, k0, t110);
|
||||
}
|
||||
|
||||
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
|
||||
get_border_color(tObj, img, t001);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i0, j0, k1, t001);
|
||||
}
|
||||
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
|
||||
get_border_color(tObj, img, t101);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i1, j0, k1, t101);
|
||||
}
|
||||
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
|
||||
get_border_color(tObj, img, t011);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i0, j1, k1, t011);
|
||||
}
|
||||
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
|
||||
get_border_color(tObj, img, t111);
|
||||
}
|
||||
else {
|
||||
swImg->FetchTexel(swImg, i1, j1, k1, t111);
|
||||
}
|
||||
|
||||
/* trilinear interpolation of samples */
|
||||
lerp_rgba_3d(rgba, a, b, c, t000, t100, t010, t110, t001, t101, t011, t111);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sample_3d_nearest_mipmap_nearest(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj,
|
||||
GLuint n, const GLfloat texcoord[][4],
|
||||
const GLfloat lambda[], GLfloat rgba[][4] )
|
||||
{
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++) {
|
||||
GLint level = nearest_mipmap_level(tObj, lambda[i]);
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sample_3d_linear_mipmap_nearest(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj,
|
||||
GLuint n, const GLfloat texcoord[][4],
|
||||
const GLfloat lambda[], GLfloat rgba[][4])
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(lambda != NULL);
|
||||
for (i = 0; i < n; i++) {
|
||||
GLint level = nearest_mipmap_level(tObj, lambda[i]);
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[0][level], texcoord[i], rgba[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sample_3d_nearest_mipmap_linear(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj,
|
||||
GLuint n, const GLfloat texcoord[][4],
|
||||
const GLfloat lambda[], GLfloat rgba[][4])
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(lambda != NULL);
|
||||
for (i = 0; i < n; i++) {
|
||||
GLint level = linear_mipmap_level(tObj, lambda[i]);
|
||||
if (level >= tObj->_MaxLevel) {
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->_MaxLevel],
|
||||
texcoord[i], rgba[i]);
|
||||
}
|
||||
else {
|
||||
GLfloat t0[4], t1[4]; /* texels */
|
||||
const GLfloat f = FRAC(lambda[i]);
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
|
||||
lerp_rgba(rgba[i], f, t0, t1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sample_3d_linear_mipmap_linear(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj,
|
||||
GLuint n, const GLfloat texcoord[][4],
|
||||
const GLfloat lambda[], GLfloat rgba[][4])
|
||||
{
|
||||
GLuint i;
|
||||
ASSERT(lambda != NULL);
|
||||
for (i = 0; i < n; i++) {
|
||||
GLint level = linear_mipmap_level(tObj, lambda[i]);
|
||||
if (level >= tObj->_MaxLevel) {
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->_MaxLevel],
|
||||
texcoord[i], rgba[i]);
|
||||
}
|
||||
else {
|
||||
GLfloat t0[4], t1[4]; /* texels */
|
||||
const GLfloat f = FRAC(lambda[i]);
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[0][level ], texcoord[i], t0);
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
|
||||
lerp_rgba(rgba[i], f, t0, t1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Sample 3D texture, nearest filtering for both min/magnification */
|
||||
static void
|
||||
sample_nearest_3d(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj, GLuint n,
|
||||
const GLfloat texcoords[][4], const GLfloat lambda[],
|
||||
GLfloat rgba[][4])
|
||||
{
|
||||
GLuint i;
|
||||
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
|
||||
(void) lambda;
|
||||
for (i = 0; i < n; i++) {
|
||||
sample_3d_nearest(ctx, tObj, image, texcoords[i], rgba[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Sample 3D texture, linear filtering for both min/magnification */
|
||||
static void
|
||||
sample_linear_3d(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj, GLuint n,
|
||||
const GLfloat texcoords[][4],
|
||||
const GLfloat lambda[], GLfloat rgba[][4])
|
||||
{
|
||||
GLuint i;
|
||||
struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
|
||||
(void) lambda;
|
||||
for (i = 0; i < n; i++) {
|
||||
sample_3d_linear(ctx, tObj, image, texcoords[i], rgba[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Sample 3D texture, using lambda to choose between min/magnification */
|
||||
static void
|
||||
sample_lambda_3d(struct gl_context *ctx,
|
||||
const struct gl_texture_object *tObj, GLuint n,
|
||||
const GLfloat texcoords[][4], const GLfloat lambda[],
|
||||
GLfloat rgba[][4])
|
||||
{
|
||||
GLuint minStart, minEnd; /* texels with minification */
|
||||
GLuint magStart, magEnd; /* texels with magnification */
|
||||
GLuint i;
|
||||
|
||||
ASSERT(lambda != NULL);
|
||||
compute_min_mag_ranges(tObj, n, lambda,
|
||||
&minStart, &minEnd, &magStart, &magEnd);
|
||||
|
||||
if (minStart < minEnd) {
|
||||
/* do the minified texels */
|
||||
GLuint m = minEnd - minStart;
|
||||
switch (tObj->Sampler.MinFilter) {
|
||||
case GL_NEAREST:
|
||||
for (i = minStart; i < minEnd; i++)
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
|
||||
texcoords[i], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR:
|
||||
for (i = minStart; i < minEnd; i++)
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
|
||||
texcoords[i], rgba[i]);
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_NEAREST:
|
||||
sample_3d_nearest_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
|
||||
lambda + minStart, rgba + minStart);
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_NEAREST:
|
||||
sample_3d_linear_mipmap_nearest(ctx, tObj, m, texcoords + minStart,
|
||||
lambda + minStart, rgba + minStart);
|
||||
break;
|
||||
case GL_NEAREST_MIPMAP_LINEAR:
|
||||
sample_3d_nearest_mipmap_linear(ctx, tObj, m, texcoords + minStart,
|
||||
lambda + minStart, rgba + minStart);
|
||||
break;
|
||||
case GL_LINEAR_MIPMAP_LINEAR:
|
||||
sample_3d_linear_mipmap_linear(ctx, tObj, m, texcoords + minStart,
|
||||
lambda + minStart, rgba + minStart);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "Bad min filter in sample_3d_texture");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (magStart < magEnd) {
|
||||
/* do the magnified texels */
|
||||
switch (tObj->Sampler.MagFilter) {
|
||||
case GL_NEAREST:
|
||||
for (i = magStart; i < magEnd; i++)
|
||||
sample_3d_nearest(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
|
||||
texcoords[i], rgba[i]);
|
||||
break;
|
||||
case GL_LINEAR:
|
||||
for (i = magStart; i < magEnd; i++)
|
||||
sample_3d_linear(ctx, tObj, tObj->Image[0][tObj->BaseLevel],
|
||||
texcoords[i], rgba[i]);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(ctx, "Bad mag filter in sample_3d_texture");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/* Texture Cube Map Sampling Functions */
|
||||
/**********************************************************************/
|
||||
|
@ -2461,17 +2142,6 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
|
|||
|
||||
return func;
|
||||
}
|
||||
case GL_TEXTURE_3D:
|
||||
if (needLambda) {
|
||||
return &sample_lambda_3d;
|
||||
}
|
||||
else if (t->Sampler.MinFilter == GL_LINEAR) {
|
||||
return &sample_linear_3d;
|
||||
}
|
||||
else {
|
||||
ASSERT(t->Sampler.MinFilter == GL_NEAREST);
|
||||
return &sample_nearest_3d;
|
||||
}
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
if (needLambda) {
|
||||
return &sample_lambda_cube;
|
||||
|
|
|
@ -203,15 +203,6 @@ _swrast_map_teximage(struct gl_context *ctx,
|
|||
|
||||
map = swImage->Buffer;
|
||||
|
||||
if (texImage->TexObject->Target == GL_TEXTURE_3D) {
|
||||
GLuint sliceSize = _mesa_format_image_size(texImage->TexFormat,
|
||||
texImage->Width,
|
||||
texImage->Height,
|
||||
1);
|
||||
assert(slice < texImage->Depth);
|
||||
map += slice * sliceSize;
|
||||
}
|
||||
|
||||
/* apply x/y offset to map address */
|
||||
map += stride * (y / bh) + texelSize * (x / bw);
|
||||
|
||||
|
|
|
@ -867,56 +867,6 @@ nodraw_triangle( struct gl_context *ctx,
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is used when separate specular color is enabled, but not
|
||||
* texturing. We add the specular color to the primary color,
|
||||
* draw the triangle, then restore the original primary color.
|
||||
* Inefficient, but seldom needed.
|
||||
*/
|
||||
void
|
||||
_swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0,
|
||||
const SWvertex *v1, const SWvertex *v2)
|
||||
{
|
||||
SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */
|
||||
SWvertex *ncv1 = (SWvertex *)v1;
|
||||
SWvertex *ncv2 = (SWvertex *)v2;
|
||||
GLfloat rSum, gSum, bSum;
|
||||
GLchan cSave[3][4];
|
||||
|
||||
/* save original colors */
|
||||
COPY_CHAN4( cSave[0], ncv0->color );
|
||||
COPY_CHAN4( cSave[1], ncv1->color );
|
||||
COPY_CHAN4( cSave[2], ncv2->color );
|
||||
/* sum v0 */
|
||||
rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0];
|
||||
gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1];
|
||||
bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2];
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum);
|
||||
/* sum v1 */
|
||||
rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0];
|
||||
gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1];
|
||||
bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2];
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum);
|
||||
/* sum v2 */
|
||||
rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[FRAG_ATTRIB_COL1][0];
|
||||
gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[FRAG_ATTRIB_COL1][1];
|
||||
bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[FRAG_ATTRIB_COL1][2];
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[0], rSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[1], gSum);
|
||||
UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[2], bSum);
|
||||
/* draw */
|
||||
SWRAST_CONTEXT(ctx)->SpecTriangle( ctx, ncv0, ncv1, ncv2 );
|
||||
/* restore original colors */
|
||||
COPY_CHAN4( ncv0->color, cSave[0] );
|
||||
COPY_CHAN4( ncv1->color, cSave[1] );
|
||||
COPY_CHAN4( ncv2->color, cSave[2] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
|
@ -970,7 +920,6 @@ _swrast_choose_triangle( struct gl_context *ctx )
|
|||
* needs to be interpolated.
|
||||
*/
|
||||
if (ctx->Texture._EnabledCoord ||
|
||||
_mesa_need_secondary_color(ctx) ||
|
||||
swrast->_FogEnabled) {
|
||||
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
|
||||
const struct gl_texture_object *texObj2D;
|
||||
|
@ -999,7 +948,6 @@ _swrast_choose_triangle( struct gl_context *ctx )
|
|||
&& texImg->Width == swImg->RowStride
|
||||
&& (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888)
|
||||
&& minFilter == magFilter
|
||||
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
|
||||
&& !swrast->_FogEnabled
|
||||
&& ctx->Texture.Unit.EnvMode != GL_COMBINE_EXT
|
||||
&& ctx->Texture.Unit.EnvMode != GL_COMBINE4_NV) {
|
||||
|
|
|
@ -361,32 +361,32 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
|
|||
GLfloat eMaj_da = (GLfloat) (vMax->color[ACOMP] - vMin->color[ACOMP]);
|
||||
GLfloat eBot_da = (GLfloat) (vMid->color[ACOMP] - vMin->color[ACOMP]);
|
||||
# endif
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
|
||||
span.attrStepY[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
|
||||
span.attrStepY[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
|
||||
span.attrStepY[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
|
||||
span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][0]);
|
||||
span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][1]);
|
||||
span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][2]);
|
||||
span.attrStepX[FRAG_ATTRIB_COL][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr);
|
||||
span.attrStepY[FRAG_ATTRIB_COL][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx);
|
||||
span.attrStepX[FRAG_ATTRIB_COL][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg);
|
||||
span.attrStepY[FRAG_ATTRIB_COL][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx);
|
||||
span.attrStepX[FRAG_ATTRIB_COL][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db);
|
||||
span.attrStepY[FRAG_ATTRIB_COL][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx);
|
||||
span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL][0]);
|
||||
span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL][1]);
|
||||
span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL][2]);
|
||||
# ifdef INTERP_ALPHA
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
|
||||
span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
|
||||
span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3]);
|
||||
span.attrStepX[FRAG_ATTRIB_COL][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da);
|
||||
span.attrStepY[FRAG_ATTRIB_COL][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx);
|
||||
span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL][3]);
|
||||
# endif /* INTERP_ALPHA */
|
||||
}
|
||||
else {
|
||||
ASSERT(ctx->Light.ShadeModel == GL_FLAT);
|
||||
span.interpMask |= SPAN_FLAT;
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][0] = span.attrStepY[FRAG_ATTRIB_COL0][0] = 0.0F;
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][1] = span.attrStepY[FRAG_ATTRIB_COL0][1] = 0.0F;
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][2] = span.attrStepY[FRAG_ATTRIB_COL0][2] = 0.0F;
|
||||
span.attrStepX[FRAG_ATTRIB_COL][0] = span.attrStepY[FRAG_ATTRIB_COL][0] = 0.0F;
|
||||
span.attrStepX[FRAG_ATTRIB_COL][1] = span.attrStepY[FRAG_ATTRIB_COL][1] = 0.0F;
|
||||
span.attrStepX[FRAG_ATTRIB_COL][2] = span.attrStepY[FRAG_ATTRIB_COL][2] = 0.0F;
|
||||
span.redStep = 0;
|
||||
span.greenStep = 0;
|
||||
span.blueStep = 0;
|
||||
# ifdef INTERP_ALPHA
|
||||
span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F;
|
||||
span.attrStepX[FRAG_ATTRIB_COL][3] = span.attrStepY[FRAG_ATTRIB_COL][3] = 0.0F;
|
||||
span.alphaStep = 0;
|
||||
# endif
|
||||
}
|
||||
|
@ -636,26 +636,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
|
|||
#ifdef INTERP_RGB
|
||||
if (ctx->Light.ShadeModel == GL_SMOOTH) {
|
||||
rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP])
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF;
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL][0] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL][0] * adjy) + FIXED_HALF;
|
||||
gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP])
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF;
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL][1] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL][1] * adjy) + FIXED_HALF;
|
||||
bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP])
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF;
|
||||
fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]);
|
||||
fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]);
|
||||
fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]);
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL][2] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL][2] * adjy) + FIXED_HALF;
|
||||
fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL][0]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL][0]);
|
||||
fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL][1]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL][1]);
|
||||
fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL][2]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL][2]);
|
||||
# ifdef INTERP_ALPHA
|
||||
aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP])
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF;
|
||||
fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]);
|
||||
+ span.attrStepX[FRAG_ATTRIB_COL][3] * adjx
|
||||
+ span.attrStepY[FRAG_ATTRIB_COL][3] * adjy) + FIXED_HALF;
|
||||
fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL][3]
|
||||
+ dxOuter * span.attrStepX[FRAG_ATTRIB_COL][3]);
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -156,7 +156,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
|
|||
else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT)
|
||||
zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba16;
|
||||
else
|
||||
zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL0];
|
||||
zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL];
|
||||
|
||||
COPY_4V(zoomed.attrStart[FRAG_ATTRIB_WPOS], span->attrStart[FRAG_ATTRIB_WPOS]);
|
||||
COPY_4V(zoomed.attrStepX[FRAG_ATTRIB_WPOS], span->attrStepX[FRAG_ATTRIB_WPOS]);
|
||||
|
@ -173,7 +173,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
|
|||
/* we'll generate an array of colorss */
|
||||
zoomed.interpMask = span->interpMask & ~SPAN_RGBA;
|
||||
zoomed.arrayMask |= SPAN_RGBA;
|
||||
zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */
|
||||
zoomed.arrayAttribs |= FRAG_BIT_COL; /* we'll produce these values */
|
||||
ASSERT(span->arrayMask & SPAN_RGBA);
|
||||
}
|
||||
else if (format == GL_DEPTH_COMPONENT) {
|
||||
|
@ -225,7 +225,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
|
|||
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
|
||||
ASSERT(j >= 0);
|
||||
ASSERT(j < span->end);
|
||||
COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL0][i], rgba[j]);
|
||||
COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL][i], rgba[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,10 +263,10 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
|
|||
GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x;
|
||||
ASSERT(j >= 0);
|
||||
ASSERT(j < span->end);
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL0][i][0] = rgb[j][0];
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL0][i][1] = rgb[j][1];
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL0][i][2] = rgb[j][2];
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL0][i][3] = 1.0F;
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL][i][0] = rgb[j][0];
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL][i][1] = rgb[j][1];
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL][i][2] = rgb[j][2];
|
||||
zoomed.array->attribs[FRAG_ATTRIB_COL][i][3] = 1.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@
|
|||
* primitives unaccelerated), hook in swrast_setup instead.
|
||||
*/
|
||||
typedef struct {
|
||||
GLfloat attrib[32][4];
|
||||
GLfloat attrib[FRAG_ATTRIB_MAX][4];
|
||||
GLchan color[4]; /** integer color */
|
||||
GLfloat pointSize;
|
||||
} SWvertex;
|
||||
|
||||
|
||||
#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0
|
||||
#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL
|
||||
|
||||
|
||||
struct swrast_device_driver;
|
||||
|
|
|
@ -125,15 +125,11 @@ setup_vertex_format(struct gl_context *ctx)
|
|||
|
||||
EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] );
|
||||
|
||||
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR0)) {
|
||||
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR)) {
|
||||
if (swsetup->intColors)
|
||||
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color );
|
||||
EMIT_ATTR( _TNL_ATTRIB_COLOR, EMIT_4CHAN_4F_RGBA, color );
|
||||
else
|
||||
EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[FRAG_ATTRIB_COL0]);
|
||||
}
|
||||
|
||||
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) {
|
||||
EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]);
|
||||
EMIT_ATTR( _TNL_ATTRIB_COLOR, EMIT_4F, attrib[FRAG_ATTRIB_COL]);
|
||||
}
|
||||
|
||||
if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) {
|
||||
|
|
|
@ -130,26 +130,18 @@ static void _swsetup_render_tri(struct gl_context *ctx,
|
|||
|
||||
if (ctx->Light.ShadeModel == GL_FLAT) {
|
||||
GLchan c[2][4];
|
||||
GLfloat s[2][4];
|
||||
|
||||
/* save colors/indexes for v0, v1 vertices */
|
||||
COPY_CHAN4(c[0], v0->color);
|
||||
COPY_CHAN4(c[1], v1->color);
|
||||
COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]);
|
||||
COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]);
|
||||
|
||||
/* copy v2 color/indexes to v0, v1 indexes */
|
||||
COPY_CHAN4(v0->color, v2->color);
|
||||
COPY_CHAN4(v1->color, v2->color);
|
||||
COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
|
||||
COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]);
|
||||
|
||||
render(ctx, ef, e0, e1, e2, v0, v1, v2);
|
||||
|
||||
COPY_CHAN4(v0->color, c[0]);
|
||||
COPY_CHAN4(v1->color, c[1]);
|
||||
COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]);
|
||||
COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]);
|
||||
}
|
||||
else {
|
||||
render(ctx, ef, e0, e1, e2, v0, v1, v2);
|
||||
|
|
|
@ -37,7 +37,6 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e
|
|||
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
|
||||
GLchan saved_color[3][4] = { { 0 } };
|
||||
GLfloat saved_col0[3][4] = { { 0 } };
|
||||
GLfloat saved_spec[3][4] = { { 0 } };
|
||||
#endif
|
||||
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
|
||||
SWvertex *v[3];
|
||||
|
@ -79,9 +78,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e
|
|||
COPY_CHAN4(saved_color[2], v[2]->color);
|
||||
}
|
||||
else {
|
||||
COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL0]);
|
||||
COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL0]);
|
||||
COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]);
|
||||
COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL]);
|
||||
COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL]);
|
||||
COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL]);
|
||||
}
|
||||
|
||||
if (VB->BackfaceColorPtr->stride) {
|
||||
|
@ -91,9 +90,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e
|
|||
SS_COLOR(v[2]->color, vbcolor[e2]);
|
||||
}
|
||||
else {
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[e0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[e1]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[e2]);
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL], vbcolor[e0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL], vbcolor[e1]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL], vbcolor[e2]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -104,31 +103,12 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e
|
|||
SS_COLOR(v[2]->color, vbcolor[0]);
|
||||
}
|
||||
else {
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]);
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL], vbcolor[0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL], vbcolor[0]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL], vbcolor[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (VB->BackfaceSecondaryColorPtr) {
|
||||
GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data;
|
||||
|
||||
COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]);
|
||||
COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]);
|
||||
COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]);
|
||||
|
||||
if (VB->BackfaceSecondaryColorPtr->stride) {
|
||||
SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]);
|
||||
SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]);
|
||||
SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]);
|
||||
}
|
||||
else {
|
||||
SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[0]);
|
||||
SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[0]);
|
||||
SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -210,17 +190,11 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e
|
|||
COPY_CHAN4(v[2]->color, saved_color[2]);
|
||||
}
|
||||
else {
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], saved_col0[0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], saved_col0[1]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], saved_col0[2]);
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL], saved_col0[0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL], saved_col0[1]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL], saved_col0[2]);
|
||||
}
|
||||
}
|
||||
|
||||
if (VB->BackfaceSecondaryColorPtr) {
|
||||
COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]);
|
||||
COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]);
|
||||
COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -101,10 +101,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
|
|||
*/
|
||||
tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS);
|
||||
|
||||
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0);
|
||||
|
||||
if (_mesa_need_secondary_color(ctx))
|
||||
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR1);
|
||||
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR);
|
||||
|
||||
if (ctx->Texture._EnabledCoord) {
|
||||
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX);
|
||||
|
|
|
@ -79,12 +79,15 @@ enum {
|
|||
_TNL_ATTRIB_POS = 0,
|
||||
_TNL_ATTRIB_WEIGHT = 1,
|
||||
_TNL_ATTRIB_NORMAL = 2,
|
||||
_TNL_ATTRIB_COLOR0 = 3,
|
||||
_TNL_ATTRIB_COLOR1 = 4,
|
||||
_TNL_ATTRIB_FOG = 5,
|
||||
_TNL_ATTRIB_COLOR_INDEX = 6,
|
||||
_TNL_ATTRIB_EDGEFLAG = 7,
|
||||
_TNL_ATTRIB_TEX = 8,
|
||||
_TNL_ATTRIB_COLOR = 3,
|
||||
_TNL_ATTRIB_FOG = 4,
|
||||
_TNL_ATTRIB_COLOR_INDEX = 5,
|
||||
_TNL_ATTRIB_EDGEFLAG = 6,
|
||||
_TNL_ATTRIB_TEX = 7,
|
||||
/* This is really a VERT_RESULT, not an attrib. Need to fix
|
||||
* tnl to understand the difference.
|
||||
*/
|
||||
_TNL_ATTRIB_POINTSIZE = 8,
|
||||
|
||||
/* These alias with the generics, but they are not active
|
||||
* concurrently, so it's not a problem. The TNL module
|
||||
|
@ -96,50 +99,29 @@ enum {
|
|||
* generic attribute in order to pick up per-vertex material
|
||||
* data.
|
||||
*/
|
||||
_TNL_ATTRIB_MAT_FRONT_AMBIENT = 10,
|
||||
_TNL_ATTRIB_MAT_BACK_AMBIENT = 11,
|
||||
_TNL_ATTRIB_MAT_FRONT_DIFFUSE = 12,
|
||||
_TNL_ATTRIB_MAT_BACK_DIFFUSE = 13,
|
||||
_TNL_ATTRIB_MAT_FRONT_SPECULAR = 14,
|
||||
_TNL_ATTRIB_MAT_BACK_SPECULAR = 15,
|
||||
_TNL_ATTRIB_MAT_FRONT_EMISSION = 16,
|
||||
_TNL_ATTRIB_MAT_BACK_EMISSION = 17,
|
||||
_TNL_ATTRIB_MAT_FRONT_SHININESS = 18,
|
||||
_TNL_ATTRIB_MAT_BACK_SHININESS = 19,
|
||||
_TNL_ATTRIB_MAT_FRONT_INDEXES = 20,
|
||||
_TNL_ATTRIB_MAT_BACK_INDEXES = 21,
|
||||
_TNL_ATTRIB_MAT_FRONT_AMBIENT = 9,
|
||||
_TNL_ATTRIB_MAT_BACK_AMBIENT = 10,
|
||||
_TNL_ATTRIB_MAT_FRONT_DIFFUSE = 11,
|
||||
_TNL_ATTRIB_MAT_BACK_DIFFUSE = 12,
|
||||
_TNL_ATTRIB_MAT_FRONT_SPECULAR = 13,
|
||||
_TNL_ATTRIB_MAT_BACK_SPECULAR = 14,
|
||||
_TNL_ATTRIB_MAT_FRONT_EMISSION = 15,
|
||||
_TNL_ATTRIB_MAT_BACK_EMISSION = 16,
|
||||
_TNL_ATTRIB_MAT_FRONT_SHININESS = 17,
|
||||
_TNL_ATTRIB_MAT_BACK_SHININESS = 18,
|
||||
_TNL_ATTRIB_MAT_FRONT_INDEXES = 29,
|
||||
_TNL_ATTRIB_MAT_BACK_INDEXES = 20,
|
||||
|
||||
/* This is really a VERT_RESULT, not an attrib. Need to fix
|
||||
* tnl to understand the difference.
|
||||
*/
|
||||
_TNL_ATTRIB_POINTSIZE = 9,
|
||||
|
||||
_TNL_ATTRIB_MAX = 22
|
||||
_TNL_ATTRIB_MAX = 21
|
||||
} ;
|
||||
|
||||
#define _TNL_ATTRIB_GENERIC(n) (_TNL_ATTRIB_GENERIC0 + (n))
|
||||
|
||||
/* special index used for handing invalid glVertexAttribute() indices */
|
||||
#define _TNL_ATTRIB_ERROR (_TNL_ATTRIB_GENERIC15 + 1)
|
||||
|
||||
/**
|
||||
* Handy attribute ranges:
|
||||
*/
|
||||
#define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT
|
||||
#define _TNL_LAST_PROG _TNL_ATTRIB_TEX
|
||||
|
||||
#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT
|
||||
#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES
|
||||
|
||||
/* Number of available texture attributes */
|
||||
#define _TNL_NUM_TEX 8
|
||||
|
||||
/* Number of available generic attributes */
|
||||
#define _TNL_NUM_GENERIC 16
|
||||
|
||||
/* Number of attributes used for evaluators */
|
||||
#define _TNL_NUM_EVAL 16
|
||||
|
||||
|
||||
#define PRIM_BEGIN 0x10
|
||||
#define PRIM_END 0x20
|
||||
|
@ -184,7 +166,6 @@ struct vertex_buffer
|
|||
GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */
|
||||
GLvector4f *BackfaceIndexPtr;
|
||||
GLvector4f *BackfaceColorPtr;
|
||||
GLvector4f *BackfaceSecondaryColorPtr;
|
||||
|
||||
const struct _mesa_prim *Primitive;
|
||||
GLuint PrimitiveCount;
|
||||
|
|
|
@ -73,24 +73,6 @@ static void free_space(struct gl_context *ctx)
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
static void
|
||||
convert_half_to_float(const struct gl_client_array *input,
|
||||
const GLubyte *ptr, GLfloat *fptr,
|
||||
GLuint count, GLuint sz)
|
||||
{
|
||||
GLuint i, j;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
GLhalfARB *in = (GLhalfARB *)ptr;
|
||||
|
||||
for (j = 0; j < sz; j++) {
|
||||
*fptr++ = _mesa_half_to_float(in[j]);
|
||||
}
|
||||
ptr += input->StrideB;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Convert fixed-point to floating-point.
|
||||
*
|
||||
|
@ -168,9 +150,6 @@ static void _tnl_import_array( struct gl_context *ctx,
|
|||
case GL_DOUBLE:
|
||||
CONVERT(GLdouble, (GLfloat));
|
||||
break;
|
||||
case GL_HALF_FLOAT:
|
||||
convert_half_to_float(input, ptr, fptr, count, sz);
|
||||
break;
|
||||
case GL_FIXED:
|
||||
convert_fixed_to_float(input, ptr, fptr, count);
|
||||
break;
|
||||
|
@ -271,7 +250,6 @@ static void bind_inputs( struct gl_context *ctx,
|
|||
/* These should perhaps be part of _TNL_ATTRIB_* */
|
||||
VB->BackfaceColorPtr = NULL;
|
||||
VB->BackfaceIndexPtr = NULL;
|
||||
VB->BackfaceSecondaryColorPtr = NULL;
|
||||
|
||||
/* Clipping and drawing code still requires this to be a packed
|
||||
* array of ubytes which can be written into. TODO: Fix and
|
||||
|
|
|
@ -104,8 +104,7 @@ static void
|
|||
shade_rastpos(struct gl_context *ctx,
|
||||
const GLfloat vertex[4],
|
||||
const GLfloat normal[3],
|
||||
GLfloat Rcolor[4],
|
||||
GLfloat Rspec[4])
|
||||
GLfloat Rcolor[4])
|
||||
{
|
||||
/*const*/ GLfloat (*base)[3] = ctx->Light._BaseColor;
|
||||
const struct gl_light *light;
|
||||
|
@ -209,14 +208,8 @@ shade_rastpos(struct gl_context *ctx,
|
|||
GET_SHINE_TAB_ENTRY( ctx->_ShineTable[0], n_dot_h, spec_coef );
|
||||
|
||||
if (spec_coef > 1.0e-10) {
|
||||
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR) {
|
||||
ACC_SCALE_SCALAR_3V( specularContrib, spec_coef,
|
||||
ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef,
|
||||
light->_MatSpecular[0]);
|
||||
}
|
||||
else {
|
||||
ACC_SCALE_SCALAR_3V( diffuseContrib, spec_coef,
|
||||
light->_MatSpecular[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,10 +222,6 @@ shade_rastpos(struct gl_context *ctx,
|
|||
Rcolor[1] = CLAMP(diffuseColor[1], 0.0F, 1.0F);
|
||||
Rcolor[2] = CLAMP(diffuseColor[2], 0.0F, 1.0F);
|
||||
Rcolor[3] = CLAMP(diffuseColor[3], 0.0F, 1.0F);
|
||||
Rspec[0] = CLAMP(specularColor[0], 0.0F, 1.0F);
|
||||
Rspec[1] = CLAMP(specularColor[1], 0.0F, 1.0F);
|
||||
Rspec[2] = CLAMP(specularColor[2], 0.0F, 1.0F);
|
||||
Rspec[3] = CLAMP(specularColor[3], 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
|
@ -421,15 +410,12 @@ _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
|
|||
if (ctx->Light.Enabled) {
|
||||
/* lighting */
|
||||
shade_rastpos( ctx, vObj, norm,
|
||||
ctx->Current.RasterColor,
|
||||
ctx->Current.RasterSecondaryColor );
|
||||
ctx->Current.RasterColor );
|
||||
}
|
||||
else {
|
||||
/* use current color */
|
||||
COPY_4FV(ctx->Current.RasterColor,
|
||||
ctx->Current.Attrib[VERT_ATTRIB_COLOR0]);
|
||||
COPY_4FV(ctx->Current.RasterSecondaryColor,
|
||||
ctx->Current.Attrib[VERT_ATTRIB_COLOR1]);
|
||||
ctx->Current.Attrib[VERT_ATTRIB_COLOR]);
|
||||
}
|
||||
|
||||
/* texture coords */
|
||||
|
|
|
@ -50,7 +50,6 @@ struct material_cursor {
|
|||
struct light_stage_data {
|
||||
GLvector4f Input;
|
||||
GLvector4f LitColor[2];
|
||||
GLvector4f LitSecondary[2];
|
||||
light_func *light_func_tab;
|
||||
|
||||
struct material_cursor mat[MAT_ATTRIB_MAX];
|
||||
|
@ -113,7 +112,7 @@ prepare_materials(struct gl_context *ctx,
|
|||
const GLuint bitmask = ctx->Light.ColorMaterialBitmask;
|
||||
for (i = 0 ; i < MAT_ATTRIB_MAX ; i++)
|
||||
if (bitmask & (1<<i))
|
||||
VB->AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->AttribPtr[_TNL_ATTRIB_COLOR0];
|
||||
VB->AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->AttribPtr[_TNL_ATTRIB_COLOR];
|
||||
}
|
||||
|
||||
/* Now, for each material attribute that's tracking vertex color, save
|
||||
|
@ -246,9 +245,6 @@ static void validate_lighting( struct gl_context *ctx,
|
|||
return;
|
||||
|
||||
if (ctx->Light._NeedVertices) {
|
||||
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||
tab = _tnl_light_spec_tab;
|
||||
else
|
||||
tab = _tnl_light_tab;
|
||||
}
|
||||
else {
|
||||
|
@ -290,13 +286,9 @@ static GLboolean init_lighting( struct gl_context *ctx,
|
|||
_mesa_vector4f_alloc( &store->Input, 0, size, 32 );
|
||||
_mesa_vector4f_alloc( &store->LitColor[0], 0, size, 32 );
|
||||
_mesa_vector4f_alloc( &store->LitColor[1], 0, size, 32 );
|
||||
_mesa_vector4f_alloc( &store->LitSecondary[0], 0, size, 32 );
|
||||
_mesa_vector4f_alloc( &store->LitSecondary[1], 0, size, 32 );
|
||||
|
||||
store->LitColor[0].size = 4;
|
||||
store->LitColor[1].size = 4;
|
||||
store->LitSecondary[0].size = 3;
|
||||
store->LitSecondary[1].size = 3;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
@ -312,8 +304,6 @@ static void dtr( struct tnl_pipeline_stage *stage )
|
|||
_mesa_vector4f_free( &store->Input );
|
||||
_mesa_vector4f_free( &store->LitColor[0] );
|
||||
_mesa_vector4f_free( &store->LitColor[1] );
|
||||
_mesa_vector4f_free( &store->LitSecondary[0] );
|
||||
_mesa_vector4f_free( &store->LitSecondary[1] );
|
||||
FREE( store );
|
||||
stage->privatePtr = NULL;
|
||||
}
|
||||
|
|
|
@ -28,13 +28,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
# define NR_SIDES 2
|
||||
#else
|
||||
# define NR_SIDES 1
|
||||
#endif
|
||||
|
||||
|
||||
/* define TRACE to trace lighting code */
|
||||
/* #define TRACE 1 */
|
||||
|
||||
|
@ -60,10 +53,8 @@ static void TAG(light_rgba_spec)( struct gl_context *ctx,
|
|||
const GLfloat *normal = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data;
|
||||
|
||||
GLfloat (*Fcolor)[4] = (GLfloat (*)[4]) store->LitColor[0].data;
|
||||
GLfloat (*Fspec)[4] = (GLfloat (*)[4]) store->LitSecondary[0].data;
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
GLfloat (*Bcolor)[4] = (GLfloat (*)[4]) store->LitColor[1].data;
|
||||
GLfloat (*Bspec)[4] = (GLfloat (*)[4]) store->LitSecondary[1].data;
|
||||
#endif
|
||||
|
||||
const GLuint nr = VB->Count;
|
||||
|
@ -72,13 +63,11 @@ static void TAG(light_rgba_spec)( struct gl_context *ctx,
|
|||
fprintf(stderr, "%s\n", __FUNCTION__ );
|
||||
#endif
|
||||
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->LitSecondary[0];
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
|
||||
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
|
||||
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
VB->BackfaceColorPtr = &store->LitColor[1];
|
||||
VB->BackfaceSecondaryColorPtr = &store->LitSecondary[1];
|
||||
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
|
||||
#endif
|
||||
|
||||
|
@ -220,12 +209,10 @@ static void TAG(light_rgba_spec)( struct gl_context *ctx,
|
|||
} /*loop over lights*/
|
||||
|
||||
COPY_3V( Fcolor[j], sum[0] );
|
||||
COPY_3V( Fspec[j], spec[0] );
|
||||
Fcolor[j][3] = sumA[0];
|
||||
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
COPY_3V( Bcolor[j], sum[1] );
|
||||
COPY_3V( Bspec[j], spec[1] );
|
||||
Bcolor[j][3] = sumA[1];
|
||||
#endif
|
||||
}
|
||||
|
@ -259,7 +246,7 @@ static void TAG(light_rgba)( struct gl_context *ctx,
|
|||
fprintf(stderr, "%s\n", __FUNCTION__ );
|
||||
#endif
|
||||
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
|
||||
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
|
||||
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
|
@ -449,7 +436,7 @@ static void TAG(light_fast_rgba_single)( struct gl_context *ctx,
|
|||
|
||||
(void) input; /* doesn't refer to Eye or Obj */
|
||||
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
VB->BackfaceColorPtr = &store->LitColor[1];
|
||||
#endif
|
||||
|
@ -559,7 +546,7 @@ static void TAG(light_fast_rgba)( struct gl_context *ctx,
|
|||
sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3];
|
||||
sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3];
|
||||
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0];
|
||||
VB->AttribPtr[_TNL_ATTRIB_COLOR] = &store->LitColor[0];
|
||||
#if IDX & LIGHT_TWOSIDE
|
||||
VB->BackfaceColorPtr = &store->LitColor[1];
|
||||
#endif
|
||||
|
@ -648,4 +635,3 @@ static void TAG(init_light_tab)( void )
|
|||
|
||||
#undef TAG
|
||||
#undef IDX
|
||||
#undef NR_SIDES
|
||||
|
|
|
@ -1065,8 +1065,7 @@ void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc )
|
|||
GLuint j;
|
||||
|
||||
for (j = 0; j < attr_count; j++) {
|
||||
if (a[j].attrib == VERT_ATTRIB_COLOR0 ||
|
||||
a[j].attrib == VERT_ATTRIB_COLOR1) {
|
||||
if (a[j].attrib == VERT_ATTRIB_COLOR) {
|
||||
|
||||
memcpy( vdst + a[j].vertoffset,
|
||||
vsrc + a[j].vertoffset,
|
||||
|
@ -1099,15 +1098,6 @@ void _tnl_generic_interp_extras( struct gl_context *ctx,
|
|||
VB->BackfaceColorPtr->data[out],
|
||||
VB->BackfaceColorPtr->data[in] );
|
||||
}
|
||||
|
||||
if (VB->BackfaceSecondaryColorPtr) {
|
||||
assert(VB->BackfaceSecondaryColorPtr->stride == 4 * sizeof(GLfloat));
|
||||
|
||||
INTERP_3F( t,
|
||||
VB->BackfaceSecondaryColorPtr->data[dst],
|
||||
VB->BackfaceSecondaryColorPtr->data[out],
|
||||
VB->BackfaceSecondaryColorPtr->data[in] );
|
||||
}
|
||||
|
||||
if (VB->BackfaceIndexPtr) {
|
||||
VB->BackfaceIndexPtr->data[dst][0] = LINTERP( t,
|
||||
|
@ -1134,11 +1124,6 @@ void _tnl_generic_copy_pv_extras( struct gl_context *ctx,
|
|||
VB->BackfaceColorPtr->data[src] );
|
||||
}
|
||||
|
||||
if (VB->BackfaceSecondaryColorPtr) {
|
||||
COPY_4FV( VB->BackfaceSecondaryColorPtr->data[dst],
|
||||
VB->BackfaceSecondaryColorPtr->data[src] );
|
||||
}
|
||||
|
||||
if (VB->BackfaceIndexPtr) {
|
||||
VB->BackfaceIndexPtr->data[dst][0] = VB->BackfaceIndexPtr->data[src][0];
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue