radeon: Drop the remaining driver usage of _ReallyEnabled.
[mesa.git] / src / mesa / drivers / dri / r200 / r200_fragshader.c
index d514b28219ade521136ef3478e97f0178090dbd1..ca772f1c8728383caff91703c2ec912060c75a5e 100644 (file)
  **************************************************************************/
 
 #include "main/glheader.h"
+#include "main/atifragshader.h"
 #include "main/macros.h"
 #include "main/enums.h"
 #include "tnl/t_context.h"
-#include "shader/atifragshader.h"
-#include "shader/program.h"
+#include "program/program.h"
 #include "r200_context.h"
 #include "r200_ioctl.h"
 #include "r200_tex.h"
@@ -121,7 +121,7 @@ static GLuint dstmask_table[8] =
    R200_TXC_OUTPUT_MASK_RGB
 };
 
-static void r200UpdateFSArith( GLcontext *ctx )
+static void r200UpdateFSArith( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    GLuint *afs_cmd;
@@ -322,7 +322,7 @@ static void r200UpdateFSArith( GLcontext *ctx )
    rmesa->afs_loaded = ctx->ATIFragmentShader.Current;
 }
 
-static void r200UpdateFSRouting( GLcontext *ctx ) {
+static void r200UpdateFSRouting( struct gl_context *ctx ) {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
    GLuint reg;
@@ -362,7 +362,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
 
    if (shader->NumPasses < 2) {
       for (reg = 0; reg < R200_MAX_TEXTURE_UNITS; reg++) {
-        GLbitfield targetbit = ctx->Texture.Unit[reg]._ReallyEnabled;
+         struct gl_texture_object *texObj = ctx->Texture.Unit[reg]._Current;
          R200_STATECHANGE( rmesa, tex[reg] );
         rmesa->hw.tex[reg].cmd[TEX_PP_TXMULTI_CTL] = 0;
         if (shader->SetupInst[0][reg].Opcode) {
@@ -387,10 +387,10 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
               }
               rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
            }
-           else if (targetbit == TEXTURE_3D_BIT) {
+           else if (texObj && texObj->Target == GL_TEXTURE_3D) {
               txformat_x |= R200_TEXCOORD_VOLUME;
            }
-           else if (targetbit == TEXTURE_CUBE_BIT) {
+           else if (texObj && texObj->Target == GL_TEXTURE_CUBE_MAP) {
               txformat_x |= R200_TEXCOORD_CUBIC_ENV;
            }
            else if (shader->SetupInst[0][reg].swizzle == GL_SWIZZLE_STR_ATI ||
@@ -403,7 +403,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
            rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT] = txformat;
            rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT_X] = txformat_x;
            /* enabling texturing when unit isn't correctly configured may not be safe */
-           if (targetbit)
+           if (texObj)
               rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
         }
       }
@@ -411,7 +411,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
    } else {
       /* setup 1st pass */
       for (reg = 0; reg < R200_MAX_TEXTURE_UNITS; reg++) {
-        GLbitfield targetbit = ctx->Texture.Unit[reg]._ReallyEnabled;
+        struct gl_texture_object *texObj = ctx->Texture.Unit[reg]._Current;
         R200_STATECHANGE( rmesa, tex[reg] );
         GLuint txformat_multi = 0;
         if (shader->SetupInst[0][reg].Opcode) {
@@ -428,10 +428,10 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
               }
               rmesa->hw.cst.cmd[CST_PP_CNTL_X] |= R200_PPX_TEX_0_ENABLE << reg;
            }
-           else if (targetbit == TEXTURE_3D_BIT) {
+           else if (texObj && texObj->Target == GL_TEXTURE_3D) {
               txformat_multi |= R200_PASS1_TEXCOORD_VOLUME;
            }
-           else if (targetbit == TEXTURE_CUBE_BIT) {
+           else if (texObj && texObj->Target == GL_TEXTURE_CUBE_MAP) {
               txformat_multi |= R200_PASS1_TEXCOORD_CUBIC_ENV;
            }
            else if (shader->SetupInst[0][reg].swizzle == GL_SWIZZLE_STR_ATI ||
@@ -441,7 +441,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
            else {
               txformat_multi |= R200_PASS1_TEXCOORD_PROJ;
            }
-           if (targetbit)
+           if (texObj)
               rmesa->hw.cst.cmd[CST_PP_CNTL_X] |= R200_PPX_TEX_0_ENABLE << reg;
         }
          rmesa->hw.tex[reg].cmd[TEX_PP_TXMULTI_CTL] = txformat_multi;
@@ -449,7 +449,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
 
       /* setup 2nd pass */
       for (reg=0; reg < R200_MAX_TEXTURE_UNITS; reg++) {
-        GLbitfield targetbit = ctx->Texture.Unit[reg]._ReallyEnabled;
+        struct gl_texture_object *texObj = ctx->Texture.Unit[reg]._Current;
         if (shader->SetupInst[1][reg].Opcode) {
            GLuint coord = shader->SetupInst[1][reg].src;
            GLuint txformat = rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT]
@@ -468,10 +468,10 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
               }
               rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
            }
-           else if (targetbit == TEXTURE_3D_BIT) {
+           else if (texObj && texObj->Target == GL_TEXTURE_3D) {
               txformat_x |= R200_TEXCOORD_VOLUME;
            }
-           else if (targetbit == TEXTURE_CUBE_BIT) {
+           else if (texObj && texObj->Target == GL_TEXTURE_CUBE_MAP) {
               txformat_x |= R200_TEXCOORD_CUBIC_ENV;
            }
            else if (shader->SetupInst[1][reg].swizzle == GL_SWIZZLE_STR_ATI ||
@@ -492,14 +492,14 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
            }
            rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT_X] = txformat_x;
            rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT] = txformat;
-           if (targetbit)
+           if (texObj)
               rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
         }
       }
    }
 }
 
-static void r200UpdateFSConstants( GLcontext *ctx )
+static void r200UpdateFSConstants( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
@@ -522,7 +522,7 @@ static void r200UpdateFSConstants( GLcontext *ctx )
         CLAMPED_FLOAT_TO_UBYTE(con_byte[2], ctx->ATIFragmentShader.GlobalConstants[i][2]);
         CLAMPED_FLOAT_TO_UBYTE(con_byte[3], ctx->ATIFragmentShader.GlobalConstants[i][3]);
       }
-      rmesa->hw.atf.cmd[ATF_TFACTOR_0 + i] = r200PackColor (
+      rmesa->hw.atf.cmd[ATF_TFACTOR_0 + i] = radeonPackColor (
         4, con_byte[0], con_byte[1], con_byte[2], con_byte[3] );
    }
 }
@@ -537,7 +537,7 @@ static void r200UpdateFSConstants( GLcontext *ctx )
  * stored in some DriverData object attached to the mesa atifs object, i.e. binding a
  * shader wouldn't force us to "recompile" the shader).
  */
-void r200UpdateFragmentShader( GLcontext *ctx )
+void r200UpdateFragmentShader( struct gl_context *ctx )
 {
    r200ContextPtr rmesa = R200_CONTEXT(ctx);