mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[OPENGL32/MESA]
* Zap some more unneeded variables/functions. CORE-7499 svn path=/trunk/; revision=64072
This commit is contained in:
parent
57ab19b141
commit
726d95b525
5 changed files with 0 additions and 403 deletions
|
@ -100,21 +100,6 @@ solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4])
|
|||
#define SOLVE_PLANE(X, Y, PLANE) \
|
||||
((PLANE[3] + PLANE[0] * (X) + PLANE[1] * (Y)) / -PLANE[2])
|
||||
|
||||
|
||||
/*
|
||||
* Return 1 / solve_plane().
|
||||
*/
|
||||
static inline GLfloat
|
||||
solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4])
|
||||
{
|
||||
const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y;
|
||||
if (denom == 0.0F)
|
||||
return 0.0F;
|
||||
else
|
||||
return -plane[2] / denom;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Solve plane and return clamped GLchan value.
|
||||
*/
|
||||
|
|
|
@ -273,68 +273,6 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span)
|
|||
span->arrayMask |= SPAN_RGBA;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populate the FRAG_ATTRIB_COL array.
|
||||
*/
|
||||
static inline void
|
||||
interpolate_float_colors(SWspan *span)
|
||||
{
|
||||
GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
const GLuint n = span->end;
|
||||
GLuint i;
|
||||
|
||||
assert(!(span->arrayAttribs & FRAG_BIT_COL0));
|
||||
|
||||
if (span->arrayMask & SPAN_RGBA) {
|
||||
/* convert array of int colors */
|
||||
for (i = 0; i < n; i++) {
|
||||
col0[i][0] = UBYTE_TO_FLOAT(span->array->rgba8[i][0]);
|
||||
col0[i][1] = UBYTE_TO_FLOAT(span->array->rgba8[i][1]);
|
||||
col0[i][2] = UBYTE_TO_FLOAT(span->array->rgba8[i][2]);
|
||||
col0[i][3] = UBYTE_TO_FLOAT(span->array->rgba8[i][3]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* interpolate red/green/blue/alpha to get float colors */
|
||||
ASSERT(span->interpMask & SPAN_RGBA);
|
||||
if (span->interpMask & SPAN_FLAT) {
|
||||
GLfloat r = FixedToFloat(span->red);
|
||||
GLfloat g = FixedToFloat(span->green);
|
||||
GLfloat b = FixedToFloat(span->blue);
|
||||
GLfloat a = FixedToFloat(span->alpha);
|
||||
for (i = 0; i < n; i++) {
|
||||
ASSIGN_4V(col0[i], r, g, b, a);
|
||||
}
|
||||
}
|
||||
else {
|
||||
GLfloat r = FixedToFloat(span->red);
|
||||
GLfloat g = FixedToFloat(span->green);
|
||||
GLfloat b = FixedToFloat(span->blue);
|
||||
GLfloat a = FixedToFloat(span->alpha);
|
||||
GLfloat dr = FixedToFloat(span->redStep);
|
||||
GLfloat dg = FixedToFloat(span->greenStep);
|
||||
GLfloat db = FixedToFloat(span->blueStep);
|
||||
GLfloat da = FixedToFloat(span->alphaStep);
|
||||
for (i = 0; i < n; i++) {
|
||||
col0[i][0] = r;
|
||||
col0[i][1] = g;
|
||||
col0[i][2] = b;
|
||||
col0[i][3] = a;
|
||||
r += dr;
|
||||
g += dg;
|
||||
b += db;
|
||||
a += da;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
span->arrayAttribs |= FRAG_BIT_COL;
|
||||
span->array->ChanType = GL_FLOAT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fill in the span.zArray array from the span->z, zStep values.
|
||||
*/
|
||||
|
@ -525,41 +463,6 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span)
|
|||
} /* if */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array.
|
||||
*/
|
||||
static inline void
|
||||
interpolate_wpos(struct gl_context *ctx, SWspan *span)
|
||||
{
|
||||
GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
|
||||
GLuint i;
|
||||
const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
|
||||
GLfloat w, dw;
|
||||
|
||||
if (span->arrayMask & SPAN_XY) {
|
||||
for (i = 0; i < span->end; i++) {
|
||||
wpos[i][0] = (GLfloat) span->array->x[i];
|
||||
wpos[i][1] = (GLfloat) span->array->y[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < span->end; i++) {
|
||||
wpos[i][0] = (GLfloat) span->x + i;
|
||||
wpos[i][1] = (GLfloat) span->y;
|
||||
}
|
||||
}
|
||||
|
||||
dw = span->attrStepX[FRAG_ATTRIB_WPOS][3];
|
||||
w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dw;
|
||||
for (i = 0; i < span->end; i++) {
|
||||
wpos[i][2] = (GLfloat) span->array->z[i] * zScale;
|
||||
wpos[i][3] = w;
|
||||
w += dw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the current polygon stipple pattern to a span of pixels.
|
||||
*/
|
||||
|
@ -764,25 +667,6 @@ apply_aa_coverage(SWspan *span)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clamp span's float colors to [0,1]
|
||||
*/
|
||||
static inline void
|
||||
clamp_colors(SWspan *span)
|
||||
{
|
||||
GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL];
|
||||
GLuint i;
|
||||
ASSERT(span->array->ChanType == GL_FLOAT);
|
||||
for (i = 0; i < span->end; i++) {
|
||||
rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
|
||||
rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F);
|
||||
rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F);
|
||||
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the span's color arrays to the given type.
|
||||
* The only way 'output' can be greater than zero is when we have a fragment
|
||||
|
|
|
@ -33,35 +33,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
/**
|
||||
* Convert an 8-bit sRGB value from non-linear space to a
|
||||
* linear RGB value in [0, 1].
|
||||
* Implemented with a 256-entry lookup table.
|
||||
*/
|
||||
static inline GLfloat
|
||||
nonlinear_to_linear(GLubyte cs8)
|
||||
{
|
||||
static GLfloat table[256];
|
||||
static GLboolean tableReady = GL_FALSE;
|
||||
if (!tableReady) {
|
||||
/* compute lookup table now */
|
||||
GLuint i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
const GLfloat cs = UBYTE_TO_FLOAT(i);
|
||||
if (cs <= 0.04045) {
|
||||
table[i] = cs / 12.92f;
|
||||
}
|
||||
else {
|
||||
table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
}
|
||||
tableReady = GL_TRUE;
|
||||
}
|
||||
return table[cs8];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Texel fetch routines for all supported formats
|
||||
*/
|
||||
#define DIM 1
|
||||
|
|
|
@ -58,26 +58,6 @@ lerp_2d(GLfloat a, GLfloat b,
|
|||
return LERP(b, temp0, temp1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do 3D/trilinear interpolation of float values.
|
||||
* \sa lerp_2d
|
||||
*/
|
||||
static inline GLfloat
|
||||
lerp_3d(GLfloat a, GLfloat b, GLfloat c,
|
||||
GLfloat v000, GLfloat v100, GLfloat v010, GLfloat v110,
|
||||
GLfloat v001, GLfloat v101, GLfloat v011, GLfloat v111)
|
||||
{
|
||||
const GLfloat temp00 = LERP(a, v000, v100);
|
||||
const GLfloat temp10 = LERP(a, v010, v110);
|
||||
const GLfloat temp01 = LERP(a, v001, v101);
|
||||
const GLfloat temp11 = LERP(a, v011, v111);
|
||||
const GLfloat temp0 = LERP(b, temp00, temp10);
|
||||
const GLfloat temp1 = LERP(b, temp01, temp11);
|
||||
return LERP(c, temp0, temp1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do linear interpolation of colors.
|
||||
*/
|
||||
|
@ -105,26 +85,6 @@ lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b,
|
|||
result[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do trilinear interpolation of colors.
|
||||
*/
|
||||
static inline void
|
||||
lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c,
|
||||
const GLfloat t000[4], const GLfloat t100[4],
|
||||
const GLfloat t010[4], const GLfloat t110[4],
|
||||
const GLfloat t001[4], const GLfloat t101[4],
|
||||
const GLfloat t011[4], const GLfloat t111[4])
|
||||
{
|
||||
GLuint k;
|
||||
/* compiler should unroll these short loops */
|
||||
for (k = 0; k < 4; k++) {
|
||||
result[k] = lerp_3d(a, b, c, t000[k], t100[k], t010[k], t110[k],
|
||||
t001[k], t101[k], t011[k], t111[k]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used for GL_REPEAT wrap mode. Using A % B doesn't produce the
|
||||
* right results for A<0. Casting to A to be unsigned only works if B
|
||||
|
@ -256,7 +216,6 @@ nearest_texel_location(GLenum wrapMode,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Power of two image sizes only */
|
||||
static inline void
|
||||
linear_repeat_texel_location(GLuint size, GLfloat s,
|
||||
|
@ -268,110 +227,6 @@ linear_repeat_texel_location(GLuint size, GLfloat s,
|
|||
*weight = FRAC(u);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode.
|
||||
*/
|
||||
static inline GLint
|
||||
clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max)
|
||||
{
|
||||
return IFLOOR( CLAMP(coord, 0.0F, max - 1) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* As above, but GL_LINEAR filtering.
|
||||
*/
|
||||
static inline void
|
||||
clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
|
||||
GLint *i0out, GLint *i1out, GLfloat *weight)
|
||||
{
|
||||
GLfloat fcol;
|
||||
/* Not exactly what the spec says, but it matches NVIDIA output */
|
||||
fcol = CLAMP(coord - 0.5F, 0.0F, max - 1);
|
||||
*weight = FRAC(fcol);
|
||||
*i0out = IFLOOR(fcol);
|
||||
*i1out = *i0out + 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute slice/image to use for 1D or 2D array texture.
|
||||
*/
|
||||
static inline GLint
|
||||
tex_array_slice(GLfloat coord, GLsizei size)
|
||||
{
|
||||
GLint slice = IFLOOR(coord + 0.5f);
|
||||
slice = CLAMP(slice, 0, size - 1);
|
||||
return slice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute nearest integer texcoords for given texobj and coordinate.
|
||||
* NOTE: only used for depth texture sampling.
|
||||
*/
|
||||
static inline void
|
||||
nearest_texcoord(const struct gl_texture_object *texObj,
|
||||
GLuint level,
|
||||
const GLfloat texcoord[4],
|
||||
GLint *i, GLint *j, GLint *k)
|
||||
{
|
||||
const struct gl_texture_image *img = texObj->Image[0][level];
|
||||
const GLint width = img->Width;
|
||||
const GLint height = img->Height;
|
||||
|
||||
switch (texObj->Target) {
|
||||
case GL_TEXTURE_1D:
|
||||
*i = nearest_texel_location(texObj->Sampler.WrapS, img, width, texcoord[0]);
|
||||
*j = 0;
|
||||
*k = 0;
|
||||
break;
|
||||
case GL_TEXTURE_2D:
|
||||
*i = nearest_texel_location(texObj->Sampler.WrapS, img, width, texcoord[0]);
|
||||
*j = nearest_texel_location(texObj->Sampler.WrapT, img, height, texcoord[1]);
|
||||
*k = 0;
|
||||
break;
|
||||
default:
|
||||
*i = *j = *k = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute linear integer texcoords for given texobj and coordinate.
|
||||
* NOTE: only used for depth texture sampling.
|
||||
*/
|
||||
static inline void
|
||||
linear_texcoord(const struct gl_texture_object *texObj,
|
||||
GLuint level,
|
||||
const GLfloat texcoord[4],
|
||||
GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice,
|
||||
GLfloat *wi, GLfloat *wj)
|
||||
{
|
||||
const struct gl_texture_image *img = texObj->Image[0][level];
|
||||
const GLint width = img->Width;
|
||||
const GLint height = img->Height;
|
||||
|
||||
switch (texObj->Target) {
|
||||
case GL_TEXTURE_1D:
|
||||
case GL_TEXTURE_2D:
|
||||
linear_texel_locations(texObj->Sampler.WrapS, img, width,
|
||||
texcoord[0], i0, i1, wi);
|
||||
linear_texel_locations(texObj->Sampler.WrapT, img, height,
|
||||
texcoord[1], j0, j1, wj);
|
||||
*slice = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
*slice = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* For linear interpolation between mipmap levels N and N+1, this function
|
||||
* computes N.
|
||||
|
@ -1962,101 +1817,6 @@ sample_lambda_cube(struct gl_context *ctx,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare texcoord against depth sample. Return 1.0 or the ambient value.
|
||||
*/
|
||||
static inline GLfloat
|
||||
shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample,
|
||||
GLfloat ambient)
|
||||
{
|
||||
switch (function) {
|
||||
case GL_LEQUAL:
|
||||
return (coord <= depthSample) ? 1.0F : ambient;
|
||||
case GL_GEQUAL:
|
||||
return (coord >= depthSample) ? 1.0F : ambient;
|
||||
case GL_LESS:
|
||||
return (coord < depthSample) ? 1.0F : ambient;
|
||||
case GL_GREATER:
|
||||
return (coord > depthSample) ? 1.0F : ambient;
|
||||
case GL_EQUAL:
|
||||
return (coord == depthSample) ? 1.0F : ambient;
|
||||
case GL_NOTEQUAL:
|
||||
return (coord != depthSample) ? 1.0F : ambient;
|
||||
case GL_ALWAYS:
|
||||
return 1.0F;
|
||||
case GL_NEVER:
|
||||
return ambient;
|
||||
case GL_NONE:
|
||||
return depthSample;
|
||||
default:
|
||||
_mesa_problem(NULL, "Bad compare func in shadow_compare");
|
||||
return ambient;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare texcoord against four depth samples.
|
||||
*/
|
||||
static inline GLfloat
|
||||
shadow_compare4(GLenum function, GLfloat coord,
|
||||
GLfloat depth00, GLfloat depth01,
|
||||
GLfloat depth10, GLfloat depth11,
|
||||
GLfloat ambient, GLfloat wi, GLfloat wj)
|
||||
{
|
||||
const GLfloat d = (1.0F - (GLfloat) ambient) * 0.25F;
|
||||
GLfloat luminance = 1.0F;
|
||||
|
||||
switch (function) {
|
||||
case GL_LEQUAL:
|
||||
if (coord > depth00) luminance -= d;
|
||||
if (coord > depth01) luminance -= d;
|
||||
if (coord > depth10) luminance -= d;
|
||||
if (coord > depth11) luminance -= d;
|
||||
return luminance;
|
||||
case GL_GEQUAL:
|
||||
if (coord < depth00) luminance -= d;
|
||||
if (coord < depth01) luminance -= d;
|
||||
if (coord < depth10) luminance -= d;
|
||||
if (coord < depth11) luminance -= d;
|
||||
return luminance;
|
||||
case GL_LESS:
|
||||
if (coord >= depth00) luminance -= d;
|
||||
if (coord >= depth01) luminance -= d;
|
||||
if (coord >= depth10) luminance -= d;
|
||||
if (coord >= depth11) luminance -= d;
|
||||
return luminance;
|
||||
case GL_GREATER:
|
||||
if (coord <= depth00) luminance -= d;
|
||||
if (coord <= depth01) luminance -= d;
|
||||
if (coord <= depth10) luminance -= d;
|
||||
if (coord <= depth11) luminance -= d;
|
||||
return luminance;
|
||||
case GL_EQUAL:
|
||||
if (coord != depth00) luminance -= d;
|
||||
if (coord != depth01) luminance -= d;
|
||||
if (coord != depth10) luminance -= d;
|
||||
if (coord != depth11) luminance -= d;
|
||||
return luminance;
|
||||
case GL_NOTEQUAL:
|
||||
if (coord == depth00) luminance -= d;
|
||||
if (coord == depth01) luminance -= d;
|
||||
if (coord == depth10) luminance -= d;
|
||||
if (coord == depth11) luminance -= d;
|
||||
return luminance;
|
||||
case GL_ALWAYS:
|
||||
return 1.0F;
|
||||
case GL_NEVER:
|
||||
return ambient;
|
||||
case GL_NONE:
|
||||
/* ordinary bilinear filtering */
|
||||
return lerp_2d(wi, wj, depth00, depth10, depth01, depth11);
|
||||
default:
|
||||
_mesa_problem(NULL, "Bad compare func in sample_compare4");
|
||||
return ambient;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We use this function when a texture object is in an "incomplete" state.
|
||||
* When a fragment program attempts to sample an incomplete texture we
|
||||
|
|
|
@ -199,9 +199,6 @@ static GLboolean *_tnl_import_edgeflag( struct gl_context *ctx,
|
|||
return space;
|
||||
}
|
||||
|
||||
static const GLfloat zero_floats[4] = {0.0, 0.0, 0.0, 0.0};
|
||||
|
||||
|
||||
static void bind_inputs( struct gl_context *ctx,
|
||||
const struct gl_client_array *inputs[],
|
||||
GLint count,
|
||||
|
|
Loading…
Reference in a new issue