freedreno: constify fd_vsc_pipe
[mesa.git] / src / gallium / drivers / freedreno / a3xx / fd3_emit.h
index d8e5991cab94a21aea49378ca7f61c6bf9843fca..7a905628dd62d68c40a86ae46143938533bfa85c 100644 (file)
@@ -1,5 +1,3 @@
-/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
-
 /*
  * Copyright (C) 2013 Rob Clark <robclark@freedesktop.org>
  *
 #include "freedreno_context.h"
 #include "fd3_format.h"
 #include "fd3_program.h"
-#include "ir3_shader.h"
+#include "ir3_gallium.h"
 
 struct fd_ringbuffer;
 
-void fd3_emit_const(struct fd_ringbuffer *ring, enum shader_t type,
-               uint32_t regid, uint32_t offset, uint32_t sizedwords,
-               const uint32_t *dwords, struct pipe_resource *prsc);
-
 void fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring,
                struct pipe_surface **psurf, int bufs);
 
@@ -51,41 +45,44 @@ struct fd3_emit {
        const struct fd_vertex_state *vtx;
        const struct fd_program_stateobj *prog;
        const struct pipe_draw_info *info;
+       bool binning_pass;
        struct ir3_shader_key key;
-       uint32_t dirty;
+       enum fd_dirty_3d_state dirty;
 
        uint32_t sprite_coord_enable;
        bool sprite_coord_mode;
        bool rasterflat;
 
        /* cached to avoid repeated lookups of same variants: */
-       const struct ir3_shader_variant *vp, *fp;
+       const struct ir3_shader_variant *vs, *fs;
 };
 
 static inline const struct ir3_shader_variant *
 fd3_emit_get_vp(struct fd3_emit *emit)
 {
-       if (!emit->vp) {
-               struct fd3_shader_stateobj *so = emit->prog->vp;
-               emit->vp = ir3_shader_variant(so->shader, emit->key, emit->debug);
+       if (!emit->vs) {
+               struct ir3_shader *shader = emit->prog->vs;
+               emit->vs = ir3_shader_variant(shader, emit->key,
+                               emit->binning_pass, emit->debug);
        }
-       return emit->vp;
+       return emit->vs;
 }
 
 static inline const struct ir3_shader_variant *
 fd3_emit_get_fp(struct fd3_emit *emit)
 {
-       if (!emit->fp) {
-               if (emit->key.binning_pass) {
+       if (!emit->fs) {
+               if (emit->binning_pass) {
                        /* use dummy stateobj to simplify binning vs non-binning: */
-                       static const struct ir3_shader_variant binning_fp = {};
-                       emit->fp = &binning_fp;
+                       static const struct ir3_shader_variant binning_fs = {};
+                       emit->fs = &binning_fs;
                } else {
-                       struct fd3_shader_stateobj *so = emit->prog->fp;
-                       emit->fp = ir3_shader_variant(so->shader, emit->key, emit->debug);
+                       struct ir3_shader *shader = emit->prog->fs;
+                       emit->fs = ir3_shader_variant(shader, emit->key,
+                                       false, emit->debug);
                }
        }
-       return emit->fp;
+       return emit->fs;
 }
 
 void fd3_emit_vertex_bufs(struct fd_ringbuffer *ring, struct fd3_emit *emit);
@@ -95,8 +92,15 @@ void fd3_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring,
 
 void fd3_emit_restore(struct fd_batch *batch, struct fd_ringbuffer *ring);
 
+void fd3_emit_init_screen(struct pipe_screen *pscreen);
 void fd3_emit_init(struct pipe_context *pctx);
 
+static inline void
+fd3_emit_ib(struct fd_ringbuffer *ring, struct fd_ringbuffer *target)
+{
+       __OUT_IB(ring, true, target);
+}
+
 static inline void
 fd3_emit_cache_flush(struct fd_batch *batch, struct fd_ringbuffer *ring)
 {