freedreno/a4xx: better workaround for astc+srgb
[mesa.git] / src / gallium / drivers / freedreno / ir3 / ir3_shader.c
index d79e05b9fe52aac72e3e1c99b4381e88eae5d581..435a565e61ec1b8e9019084cc07dfcbb8bb94cad 100644 (file)
@@ -223,6 +223,7 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
                        key.vsaturate_s = 0;
                        key.vsaturate_t = 0;
                        key.vsaturate_r = 0;
+                       key.vastc_srgb = 0;
                }
                break;
        case SHADER_VERTEX:
@@ -233,6 +234,7 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
                        key.fsaturate_s = 0;
                        key.fsaturate_t = 0;
                        key.fsaturate_r = 0;
+                       key.fastc_srgb = 0;
                }
                break;
        }
@@ -266,14 +268,13 @@ ir3_shader_destroy(struct ir3_shader *shader)
 }
 
 struct ir3_shader *
-ir3_shader_create(struct pipe_context *pctx,
+ir3_shader_create(struct ir3_compiler *compiler,
                const struct pipe_shader_state *cso,
                enum shader_t type)
 {
        struct ir3_shader *shader = CALLOC_STRUCT(ir3_shader);
-       shader->compiler = fd_context(pctx)->screen->compiler;
+       shader->compiler = compiler;
        shader->id = ++shader->compiler->shader_count;
-       shader->pctx = pctx;
        shader->type = type;
        if (fd_mesa_debug & FD_DBG_DISASM) {
                DBG("dump tgsi: type=%d", shader->type);
@@ -463,7 +464,7 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin)
 #include "freedreno_resource.h"
 
 static void
-emit_user_consts(struct fd_context *ctx, struct ir3_shader_variant *v,
+emit_user_consts(struct fd_context *ctx, const struct ir3_shader_variant *v,
                struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
 {
        const unsigned index = 0;     /* user consts are index 0 */
@@ -501,7 +502,7 @@ emit_user_consts(struct fd_context *ctx, struct ir3_shader_variant *v,
 }
 
 static void
-emit_ubos(struct fd_context *ctx, struct ir3_shader_variant *v,
+emit_ubos(struct fd_context *ctx, const struct ir3_shader_variant *v,
                struct fd_ringbuffer *ring, struct fd_constbuf_stateobj *constbuf)
 {
        uint32_t offset = v->first_driver_param + IR3_UBOS_OFF;
@@ -530,7 +531,7 @@ emit_ubos(struct fd_context *ctx, struct ir3_shader_variant *v,
 }
 
 static void
-emit_immediates(struct fd_context *ctx, struct ir3_shader_variant *v,
+emit_immediates(struct fd_context *ctx, const struct ir3_shader_variant *v,
                struct fd_ringbuffer *ring)
 {
        int size = v->immediates_count;
@@ -554,7 +555,7 @@ emit_immediates(struct fd_context *ctx, struct ir3_shader_variant *v,
 
 /* emit stream-out buffers: */
 static void
-emit_tfbos(struct fd_context *ctx, struct ir3_shader_variant *v,
+emit_tfbos(struct fd_context *ctx, const struct ir3_shader_variant *v,
                struct fd_ringbuffer *ring)
 {
        /* streamout addresses after driver-params: */
@@ -585,7 +586,7 @@ emit_tfbos(struct fd_context *ctx, struct ir3_shader_variant *v,
 }
 
 static uint32_t
-max_tf_vtx(struct fd_context *ctx, struct ir3_shader_variant *v)
+max_tf_vtx(struct fd_context *ctx, const struct ir3_shader_variant *v)
 {
        struct fd_streamout_stateobj *so = &ctx->streamout;
        struct pipe_stream_output_info *info = &v->shader->stream_output;
@@ -630,7 +631,7 @@ max_tf_vtx(struct fd_context *ctx, struct ir3_shader_variant *v)
 }
 
 void
-ir3_emit_consts(struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
+ir3_emit_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
                struct fd_context *ctx, const struct pipe_draw_info *info, uint32_t dirty)
 {
        if (dirty & (FD_DIRTY_PROG | FD_DIRTY_CONSTBUF)) {