summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-09 23:27:41 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:51:02 +0200
commit68a0e15f44cf351eab97a734b1cffeade1873fdf (patch)
tree99162f29dc09f7f0c11e89d5508d9f7c337f6892 /src/mesa/swrast
parent585c5cf8a514783d9ed31dba3aa432797dd5f0e8 (diff)
mesa: replace VP/FP/ATIfs _Enabled flags with helper functions
These are only used in the GL compatibility profile. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_context.c7
-rw-r--r--src/mesa/swrast/s_span.c13
-rw-r--r--src/mesa/swrast/s_triangle.c4
3 files changed, 13 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 71389c698f2..9f3d21f91d1 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -29,6 +29,7 @@
#include "main/bufferobj.h"
#include "main/mtypes.h"
#include "main/samplerobj.h"
+#include "main/state.h"
#include "main/stencil.h"
#include "main/teximage.h"
#include "program/prog_parameter.h"
@@ -109,7 +110,7 @@ _swrast_update_rasterflags( struct gl_context *ctx )
rasterMask |= FRAGPROG_BIT;
}
- if (ctx->ATIFragmentShader._Enabled) {
+ if (_mesa_ati_fragment_shader_enabled(ctx)) {
rasterMask |= ATIFRAGSHADER_BIT;
}
@@ -289,7 +290,7 @@ _swrast_update_specular_vertex_add(struct gl_context *ctx)
swrast->SpecularVertexAdd = (separateSpecular
&& ctx->Texture._MaxEnabledTexImageUnit == -1
&& !_swrast_use_fragment_program(ctx)
- && !ctx->ATIFragmentShader._Enabled);
+ && !_mesa_ati_fragment_shader_enabled(ctx));
}
@@ -504,7 +505,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
attribsMask = ctx->FragmentProgram._Current->info.inputs_read;
attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */
}
- else if (ctx->ATIFragmentShader._Enabled) {
+ else if (_mesa_ati_fragment_shader_enabled(ctx)) {
attribsMask = VARYING_BIT_COL0 | VARYING_BIT_COL1 |
VARYING_BIT_FOGC | VARYING_BITS_TEX_ANY;
}
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 81835636a57..47a73e99f3d 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -39,6 +39,7 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/samplerobj.h"
+#include "main/state.h"
#include "main/stencil.h"
#include "main/teximage.h"
@@ -143,7 +144,7 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
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) {
@@ -524,7 +525,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span)
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;
@@ -565,7 +566,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span)
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;
@@ -977,7 +978,7 @@ static inline void
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);
@@ -1009,7 +1010,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span)
_swrast_exec_fragment_program(ctx, span);
}
else {
- assert(ctx->ATIFragmentShader._Enabled);
+ assert(_mesa_ati_fragment_shader_enabled(ctx));
_swrast_exec_fragment_shader(ctx, span);
}
}
@@ -1139,7 +1140,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
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;
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 9e4f81e0e0a..a4113e5582b 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -1042,7 +1042,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
*/
if (ctx->Texture._EnabledCoordUnits ||
_swrast_use_fragment_program(ctx) ||
- ctx->ATIFragmentShader._Enabled ||
+ _mesa_ati_fragment_shader_enabled(ctx) ||
_mesa_need_secondary_color(ctx) ||
swrast->_FogEnabled) {
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
@@ -1071,7 +1071,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
/* First see if we can use an optimized 2-D texture function */
if (ctx->Texture._EnabledCoordUnits == 0x1
&& !_swrast_use_fragment_program(ctx)
- && !ctx->ATIFragmentShader._Enabled
+ && !_mesa_ati_fragment_shader_enabled(ctx)
&& ctx->Texture._MaxEnabledTexImageUnit == 0
&& ctx->Texture.Unit[0]._Current->Target == GL_TEXTURE_2D
&& samp->WrapS == GL_REPEAT