gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.
[mesa.git] / src / gallium / drivers / nvc0 / nvc0_program.h
index f6fea29780ba221df944b66486a9d0c4b79432ad..9c184d1f1d5215536325294fb1aeb05d17396d6c 100644 (file)
@@ -3,9 +3,16 @@
 #define __NVC0_PROGRAM_H__
 
 #include "pipe/p_state.h"
-#include "tgsi/tgsi_scan.h"
 
-#define NVC0_CAP_MAX_PROGRAM_TEMPS 64
+#define NVC0_CAP_MAX_PROGRAM_TEMPS 128
+
+
+struct nvc0_transform_feedback_state {
+   uint32_t stride[4];
+   uint8_t varying_count[4];
+   uint8_t varying_index[4][128];
+};
+
 
 #define NVC0_SHADER_HEADER_SIZE (20 * 4)
 
@@ -14,79 +21,48 @@ struct nvc0_program {
 
    ubyte type;
    boolean translated;
-   ubyte max_gpr;
+   boolean need_tls;
+   uint8_t num_gprs;
 
    uint32_t *code;
+   uint32_t *immd_data;
    unsigned code_base;
    unsigned code_size;
-   unsigned parm_size;
-
-   uint32_t hdr[20]; /* TODO: move this into code to save space */
+   unsigned immd_base;
+   unsigned immd_size; /* size of immediate array data */
+   unsigned parm_size; /* size of non-bindable uniforms (c0[]) */
 
+   uint32_t hdr[20];
    uint32_t flags[2];
 
    struct {
-      uint8_t edgeflag;
-      uint8_t num_ucps;
-      uint8_t out_pos[PIPE_MAX_SHADER_OUTPUTS];
+      uint32_t clip_mode; /* clip/cull selection */
+      uint8_t clip_enable; /* mask of defined clip planes */
+      uint8_t num_ucps; /* also set to max if ClipDistance is used */
+      uint8_t edgeflag; /* attribute index of edgeflag input */
+      boolean need_vertex_id;
    } vp;
    struct {
       uint8_t early_z;
       uint8_t in_pos[PIPE_MAX_SHADER_INPUTS];
    } fp;
+   struct {
+      uint32_t tess_mode; /* ~0 if defined by the other stage */
+      uint32_t input_patch_size;
+   } tp;
+   struct {
+      uint32_t lmem_size; /* local memory (TGSI PRIVATE resource) size */
+      uint32_t smem_size; /* shared memory (TGSI LOCAL resource) size */
+      void *syms;
+      unsigned num_syms;
+   } cp;
+   uint8_t num_barriers;
 
    void *relocs;
-   unsigned num_relocs;
-
-   struct nouveau_resource *res;
-};
 
-/* first 2 bits are written into the program header, for each input */
-#define NVC0_INTERP_FLAT          (1 << 0)
-#define NVC0_INTERP_PERSPECTIVE   (2 << 0)
-#define NVC0_INTERP_LINEAR        (3 << 0)
-#define NVC0_INTERP_CENTROID      (1 << 2)
-
-/* analyze TGSI and see which TEMP[] are used as subroutine inputs/outputs */
-struct nvc0_subroutine {
-   unsigned id;
-   unsigned first_insn;
-   uint32_t argv[NVC0_CAP_MAX_PROGRAM_TEMPS][4];
-   uint32_t retv[NVC0_CAP_MAX_PROGRAM_TEMPS][4];
-};
+   struct nvc0_transform_feedback_state *tfb;
 
-struct nvc0_translation_info {
-   struct nvc0_program *prog;
-   struct tgsi_full_instruction *insns;
-   unsigned num_insns;
-   ubyte input_file;
-   ubyte output_file;
-   ubyte fp_depth_output;
-   uint16_t input_loc[PIPE_MAX_SHADER_INPUTS][4];
-   uint16_t output_loc[PIPE_MAX_SHADER_OUTPUTS][4];
-   uint16_t sysval_loc[TGSI_SEMANTIC_COUNT];
-   boolean sysval_in[TGSI_SEMANTIC_COUNT];
-   int input_access[PIPE_MAX_SHADER_INPUTS][4];
-   int output_access[PIPE_MAX_SHADER_OUTPUTS][4];
-   ubyte interp_mode[PIPE_MAX_SHADER_INPUTS];
-   boolean indirect_inputs;
-   boolean indirect_outputs;
-   boolean require_stores;
-   boolean global_stores;
-   uint32_t *immd32;
-   ubyte *immd32_ty;
-   unsigned immd32_nr;
-   unsigned temp128_nr;
-   ubyte edgeflag_out;
-   struct nvc0_subroutine *subr;
-   unsigned num_subrs;
-   boolean append_ucp;
-   struct tgsi_shader_info scan;
+   struct nouveau_heap *mem;
 };
 
-int nvc0_generate_code(struct nvc0_translation_info *);
-
-void nvc0_relocate_program(struct nvc0_program *,
-                           uint32_t code_base, uint32_t data_base);
-
 #endif