i965/vec4: Make with_writemask() non-static.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_wm.c
index c560af725031bcdc96475ca8e0606a6c476bb1af..3df2b7df4ce4df3a004fb71fbcae411ecbde8447 100644 (file)
@@ -140,7 +140,6 @@ bool do_wm_prog(struct brw_context *brw,
                struct brw_fragment_program *fp,
                struct brw_wm_prog_key *key)
 {
-   struct intel_context *intel = &brw->intel;
    struct brw_wm_compile *c;
    const GLuint *program;
    struct gl_shader *fs = NULL;
@@ -205,7 +204,6 @@ bool do_wm_prog(struct brw_context *brw,
 static bool
 key_debug(struct brw_context *brw, const char *name, int a, int b)
 {
-   struct intel_context *intel = &brw->intel;
    if (a != b) {
       perf_debug("  %s %d->%d\n", name, a, b);
       return true;
@@ -244,7 +242,6 @@ brw_wm_debug_recompile(struct brw_context *brw,
                        struct gl_shader_program *prog,
                        const struct brw_wm_prog_key *key)
 {
-   struct intel_context *intel = &brw->intel;
    struct brw_cache_item *c = NULL;
    const struct brw_wm_prog_key *old_key = NULL;
    bool found = false;
@@ -301,11 +298,12 @@ brw_wm_debug_recompile(struct brw_context *brw,
 void
 brw_populate_sampler_prog_key_data(struct gl_context *ctx,
                                   const struct gl_program *prog,
+                                   unsigned sampler_count,
                                   struct brw_sampler_prog_key_data *key)
 {
-   struct intel_context *intel = intel_context(ctx);
+   struct brw_context *brw = brw_context(ctx);
 
-   for (int s = 0; s < MAX_SAMPLERS; s++) {
+   for (int s = 0; s < sampler_count; s++) {
       key->swizzles[s] = SWIZZLE_NOOP;
 
       if (!(prog->SamplersUsed & (1 << s)))
@@ -326,7 +324,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
          /* Haswell handles texture swizzling as surface format overrides
           * (except for GL_ALPHA); all other platforms need MOVs in the shader.
           */
-         if (!intel->is_haswell || alpha_depth)
+         if (!brw->is_haswell || alpha_depth)
             key->swizzles[s] = brw_get_texture_swizzle(ctx, t);
 
         if (img->InternalFormat == GL_YCBCR_MESA) {
@@ -351,8 +349,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
 static void brw_wm_populate_key( struct brw_context *brw,
                                 struct brw_wm_prog_key *key )
 {
-   struct gl_context *ctx = &brw->intel.ctx;
-   struct intel_context *intel = &brw->intel;
+   struct gl_context *ctx = &brw->ctx;
    /* BRW_NEW_FRAGMENT_PROGRAM */
    const struct brw_fragment_program *fp = 
       (struct brw_fragment_program *)brw->fragment_program;
@@ -365,7 +362,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
 
    /* Build the index for table lookup
     */
-   if (intel->gen < 6) {
+   if (brw->gen < 6) {
       /* _NEW_COLOR */
       if (fp->program.UsesKill || ctx->Color.AlphaEnabled)
         lookup |= IZ_PS_KILL_ALPHATEST_BIT;
@@ -395,10 +392,10 @@ static void brw_wm_populate_key( struct brw_context *brw,
 
    /* _NEW_LINE, _NEW_POLYGON, BRW_NEW_REDUCED_PRIMITIVE */
    if (ctx->Line.SmoothFlag) {
-      if (brw->intel.reduced_primitive == GL_LINES) {
+      if (brw->reduced_primitive == GL_LINES) {
         line_aa = AA_ALWAYS;
       }
-      else if (brw->intel.reduced_primitive == GL_TRIANGLES) {
+      else if (brw->reduced_primitive == GL_TRIANGLES) {
         if (ctx->Polygon.FrontMode == GL_LINE) {
            line_aa = AA_SOMETIMES;
 
@@ -419,8 +416,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
 
    key->line_aa = line_aa;
 
-   if (intel->gen < 6)
-      key->stats_wm = brw->intel.stats_wm;
+   if (brw->gen < 6)
+      key->stats_wm = brw->stats_wm;
 
    /* _NEW_LIGHT */
    key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
@@ -429,7 +426,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
    key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
 
    /* _NEW_TEXTURE */
-   brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
+   brw_populate_sampler_prog_key_data(ctx, prog, brw->wm.sampler_count,
+                                      &key->tex);
 
    /* _NEW_BUFFERS */
    /*
@@ -468,7 +466,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
       (ctx->Multisample.SampleAlphaToCoverage || ctx->Color.AlphaEnabled);
 
    /* BRW_NEW_VUE_MAP_GEOM_OUT */
-   if (intel->gen < 6)
+   if (brw->gen < 6)
       key->input_slots_valid = brw->vue_map_geom_out.slots_valid;
 
    /* The unique fragment program ID */
@@ -479,8 +477,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
 static void
 brw_upload_wm_prog(struct brw_context *brw)
 {
-   struct intel_context *intel = &brw->intel;
-   struct gl_context *ctx = &intel->ctx;
+   struct gl_context *ctx = &brw->ctx;
    struct brw_wm_prog_key key;
    struct brw_fragment_program *fp = (struct brw_fragment_program *)
       brw->fragment_program;