*/
#include "c99_math.h"
+#include "main/errors.h"
#include "main/glheader.h"
#include "main/format_pack.h"
#include "main/format_unpack.h"
#include "main/macros.h"
-#include "main/imports.h"
+
#include "main/image.h"
#include "main/samplerobj.h"
+#include "main/state.h"
+#include "main/stencil.h"
#include "main/teximage.h"
#include "s_atifragshader.h"
if (ctx->DrawBuffer->Visual.depthBits <= 16)
span->z = FloatToFixed(ctx->Current.RasterPos[2] * depthMax + 0.5F);
else {
- GLfloat tmpf = ctx->Current.RasterPos[2] * depthMax;
+ GLfloat tmpf = ctx->Current.RasterPos[2] * depthMax;
tmpf = MIN2(tmpf, depthMax);
span->z = (GLint)tmpf;
}
const GLuint attr = VARYING_SLOT_TEX0 + i;
const GLfloat *tc = ctx->Current.RasterTexCoords[i];
if (_swrast_use_fragment_program(ctx) ||
- ctx->ATIFragmentShader._Enabled) {
+ _mesa_ati_fragment_shader_enabled(ctx)) {
COPY_4V(span->attrStart[attr], tc);
}
else if (tc[3] > 0.0F) {
if (ctx->DrawBuffer->Visual.depthBits <= 16) {
GLfixed zval = span->z;
- GLuint *z = span->array->z;
+ GLuint *z = span->array->z;
for (i = 0; i < n; i++) {
z[i] = FixedToInt(zval);
zval += span->zStep;
GLfloat x = sqrtf(dudx * dudx + dvdx * dvdx);
GLfloat y = sqrtf(dudy * dudy + dvdy * dvdy);
GLfloat rho = MAX2(x, y);
- GLfloat lambda = LOG2(rho);
+ GLfloat lambda = log2f(rho);
return lambda;
}
maxU = MAX2(dsdx2, dsdy2) * texW;
maxV = MAX2(dtdx2, dtdy2) * texH;
rho = MAX2(maxU, maxV);
- lambda = LOG2(rho);
+ lambda = logf2(rho);
return lambda;
}
#endif
if (needLambda) {
GLuint i;
if (_swrast_use_fragment_program(ctx)
- || ctx->ATIFragmentShader._Enabled) {
+ || _mesa_ati_fragment_shader_enabled(ctx)) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
else {
GLuint i;
if (_swrast_use_fragment_program(ctx) ||
- ctx->ATIFragmentShader._Enabled) {
+ _mesa_ati_fragment_shader_enabled(ctx)) {
/* do perspective correction but don't divide s, t, r by q */
const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3];
GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx;
* For arrays of values, shift them left.
*/
for (i = 0; i < VARYING_SLOT_MAX; i++) {
- if (span->interpMask & (1 << i)) {
+ if (span->interpMask & (1u << i)) {
GLuint j;
for (j = 0; j < 4; j++) {
span->attrStart[i][j] += leftClip * span->attrStepX[i][j];
shade_texture_span(struct gl_context *ctx, SWspan *span)
{
if (_swrast_use_fragment_program(ctx) ||
- ctx->ATIFragmentShader._Enabled) {
+ _mesa_ati_fragment_shader_enabled(ctx)) {
/* programmable shading */
if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) {
convert_color_type(span, span->array->ChanType, GL_FLOAT, 0);
_swrast_exec_fragment_program(ctx, span);
}
else {
- assert(ctx->ATIFragmentShader._Enabled);
+ assert(_mesa_ati_fragment_shader_enabled(ctx));
_swrast_exec_fragment_shader(ctx, span);
}
}
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
- gl_pack_ubyte_rgba_func pack_ubyte = NULL;
- gl_pack_float_rgba_func pack_float = NULL;
+ mesa_pack_ubyte_rgba_func pack_ubyte = NULL;
+ mesa_pack_float_rgba_func pack_float = NULL;
GLuint i;
if (datatype == GL_UNSIGNED_BYTE)
_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
- const GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
const GLbitfield origInterpMask = span->interpMask;
const GLbitfield origArrayMask = span->arrayMask;
const GLbitfield64 origArrayAttribs = span->arrayAttribs;
const GLenum origChanType = span->array->ChanType;
void * const origRgba = span->array->rgba;
const GLboolean shader = (_swrast_use_fragment_program(ctx)
- || ctx->ATIFragmentShader._Enabled);
+ || _mesa_ati_fragment_shader_enabled(ctx));
const GLboolean shaderOrTexture = shader || ctx->Texture._EnabledCoordUnits;
struct gl_framebuffer *fb = ctx->DrawBuffer;
}
/* Stencil and Z testing */
- if (ctx->Stencil._Enabled || ctx->Depth.Test) {
+ if (_mesa_stencil_is_enabled(ctx) || ctx->Depth.Test) {
if (!(span->arrayMask & SPAN_Z))
_swrast_span_interpolate_z(ctx, span);
- if (ctx->Transform.DepthClamp)
+ if (ctx->Transform.DepthClampNear && ctx->Transform.DepthClampFar)
_swrast_depth_clamp_span(ctx, span);
- if (ctx->Stencil._Enabled) {
+ if (_mesa_stencil_is_enabled(ctx)) {
/* Combined Z/stencil tests */
if (!_swrast_stencil_and_ztest_span(ctx, span)) {
/* all fragments failed test */
/* We had to wait until now to check for glColorMask(0,0,0,0) because of
* the occlusion test.
*/
- if (fb->_NumColorDrawBuffers == 1 && colorMask[0] == 0x0) {
+ if (fb->_NumColorDrawBuffers == 1 &&
+ !GET_COLORMASK(ctx->Color.ColorMask, 0)) {
/* no colors to write */
goto end;
}
{
const GLuint numBuffers = fb->_NumColorDrawBuffers;
const struct gl_program *fp = ctx->FragmentProgram._Current;
- const GLboolean multiFragOutputs =
+ const GLboolean multiFragOutputs =
_swrast_use_fragment_program(ctx)
&& fp->info.outputs_written >= (1 << FRAG_RESULT_DATA0);
/* Save srcColorType because convert_color_type() can change it */
_swrast_blend_span(ctx, rb, span);
}
- if (colorMask[buf] != 0xffffffff) {
+ if (GET_COLORMASK(ctx->Color.ColorMask, buf) != 0xf) {
_swrast_mask_rgba_span(ctx, rb, span, buf);
}