i965/fs: Add initial support for 16-wide dispatch on gen6.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_wm.h
index 5aade1c4e690e0fe22cfe5cbff45b2790b108573..8e5a9cdb86ca1bdee30cefcc16814a10878ea4c9 100644 (file)
@@ -33,8 +33,9 @@
 #ifndef BRW_WM_H
 #define BRW_WM_H
 
+#include <stdbool.h>
 
-#include "shader/prog_instruction.h"
+#include "program/prog_instruction.h"
 #include "brw_context.h"
 #include "brw_eu.h"
 
 #define AA_ALWAYS    2
 
 struct brw_wm_prog_key {
-   GLuint source_depth_reg:3;
-   GLuint aa_dest_stencil_reg:3;
-   GLuint dest_depth_reg:3;
-   GLuint nr_depth_regs:3;
-   GLuint computes_depth:1;    /* could be derived from program string */
-   GLuint source_depth_to_render_target:1;
+   GLuint stats_wm:1;
    GLuint flat_shade:1;
    GLuint linear_color:1;  /**< linear interpolation vs perspective interp */
-   GLuint runtime_check_aads_emit:1;
-   GLuint nr_color_regions:2;
-   
+   GLuint nr_color_regions:5;
+   GLuint render_to_fbo:1;
+   GLuint alpha_test:1;
+   GLuint clamp_fragment_color:1;
+
    GLbitfield proj_attrib_mask; /**< one bit per fragment program attribute */
    GLuint shadowtex_mask:16;
    GLuint yuvtex_mask:16;
@@ -78,6 +76,8 @@ struct brw_wm_prog_key {
 
    GLushort drawable_height;
    GLbitfield64 vp_outputs_written;
+   GLuint iz_lookup;
+   GLuint line_aa;
    GLuint program_string_id:32;
 };
 
@@ -181,7 +181,11 @@ struct brw_wm_instruction {
 #define MAX_WM_OPCODE     (MAX_OPCODE + 9)
 
 #define PROGRAM_PAYLOAD   (PROGRAM_FILE_MAX)
+#define NUM_FILES        (PROGRAM_PAYLOAD + 1)
+
 #define PAYLOAD_DEPTH     (FRAG_ATTRIB_MAX)
+#define PAYLOAD_W         (FRAG_ATTRIB_MAX + 1)
+#define PAYLOAD_FP_REG_MAX (FRAG_ATTRIB_MAX + 2)
 
 struct brw_wm_compile {
    struct brw_compile func;
@@ -197,6 +201,15 @@ struct brw_wm_compile {
       PASS2_DONE
    } state;
 
+   GLuint source_depth_reg:3;
+   GLuint source_w_reg:3;
+   GLuint aa_dest_stencil_reg:3;
+   GLuint dest_depth_reg:3;
+   GLuint nr_payload_regs:4;
+   GLuint computes_depth:1;    /* could be derived from program string */
+   GLuint source_depth_to_render_target:1;
+   GLuint runtime_check_aads_emit:1;
+
    /* Initial pass - translate fp instructions to fp instructions,
     * simplifying and adding instructions for interpolation and
     * framebuffer writes.
@@ -205,7 +218,6 @@ struct brw_wm_compile {
    GLuint nr_fp_insns;
    GLuint fp_temp;
    GLuint fp_interp_emitted;
-   GLuint fp_fragcolor_emitted;
 
    struct prog_src_register pixel_xy;
    struct prog_src_register delta_xy;
@@ -224,7 +236,7 @@ struct brw_wm_compile {
    } payload;
 
 
-   const struct brw_wm_ref *pass0_fp_reg[PROGRAM_PAYLOAD+1][256][4];
+   const struct brw_wm_ref *pass0_fp_reg[NUM_FILES][256][4];
 
    struct brw_wm_ref undef_ref;
    struct brw_wm_value undef_value;
@@ -252,7 +264,7 @@ struct brw_wm_compile {
    struct {
       GLboolean inited;
       struct brw_reg reg;
-   } wm_regs[PROGRAM_PAYLOAD+1][256][4];
+   } wm_regs[NUM_FILES][256][4];
 
    GLboolean used_grf[BRW_WM_MAX_GRF];
    GLuint first_free_grf;
@@ -299,13 +311,10 @@ void brw_wm_print_insn( struct brw_wm_compile *c,
 void brw_wm_print_program( struct brw_wm_compile *c,
                           const char *stage );
 
-void brw_wm_lookup_iz( GLuint line_aa,
-                      GLuint lookup,
-                      GLboolean ps_uses_depth,
-                      struct brw_wm_prog_key *key );
+void brw_wm_lookup_iz(struct intel_context *intel,
+                     struct brw_wm_compile *c);
 
-GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp);
-void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c);
+bool brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c);
 
 /* brw_wm_emit.c */
 void emit_alu1(struct brw_compile *p,
@@ -343,6 +352,11 @@ void emit_delta_xy(struct brw_compile *p,
                   const struct brw_reg *dst,
                   GLuint mask,
                   const struct brw_reg *arg0);
+void emit_dp2(struct brw_compile *p,
+             const struct brw_reg *dst,
+             GLuint mask,
+             const struct brw_reg *arg0,
+             const struct brw_reg *arg1);
 void emit_dp3(struct brw_compile *p,
              const struct brw_reg *dst,
              GLuint mask,
@@ -425,6 +439,10 @@ void emit_sop(struct brw_compile *p,
              GLuint cond,
              const struct brw_reg *arg0,
              const struct brw_reg *arg1);
+void emit_sign(struct brw_compile *p,
+              const struct brw_reg *dst,
+              GLuint mask,
+              const struct brw_reg *arg0);
 void emit_tex(struct brw_wm_compile *c,
              struct brw_reg *dst,
              GLuint dst_flags,
@@ -450,4 +468,13 @@ void emit_xpd(struct brw_compile *p,
              const struct brw_reg *arg0,
              const struct brw_reg *arg1);
 
+GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
+struct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name);
+
+bool brw_color_buffer_write_enabled(struct brw_context *brw);
+bool brw_render_target_supported(gl_format format);
+void brw_wm_payload_setup(struct brw_context *brw,
+                         struct brw_wm_compile *c);
+
 #endif