gallium/radeon: merge USER_SHADER and INTERNAL_SHADER priority flags
[mesa.git] / src / gallium / drivers / radeonsi / si_shader.h
index 3b7b3e155b37bd466a3aab6a9861f66fe099d879..fc1b22d7383b8caf453655dec963503261201016 100644 (file)
@@ -96,6 +96,7 @@ enum {
        SI_SGPR_VERTEX_BUFFERS_HI,
        SI_SGPR_BASE_VERTEX,
        SI_SGPR_START_INSTANCE,
+       SI_SGPR_DRAWID,
        SI_ES_NUM_USER_SGPR,
 
        /* hw VS only */
@@ -142,10 +143,11 @@ enum {
        SI_PARAM_VERTEX_BUFFERS = SI_NUM_RESOURCE_PARAMS,
        SI_PARAM_BASE_VERTEX,
        SI_PARAM_START_INSTANCE,
+       SI_PARAM_DRAWID,
        /* [0] = clamp vertex color, VS as VS only */
        SI_PARAM_VS_STATE_BITS,
        /* same value as TCS_IN_LAYOUT, VS as LS only */
-       SI_PARAM_LS_OUT_LAYOUT = SI_PARAM_START_INSTANCE + 1,
+       SI_PARAM_LS_OUT_LAYOUT = SI_PARAM_DRAWID + 1,
        /* the other VS parameters are assigned dynamically */
 
        /* Layout of TCS outputs in the offchip buffer
@@ -233,6 +235,15 @@ struct si_shader;
  * binaries for one TGSI program. This can be shared by multiple contexts.
  */
 struct si_shader_selector {
+       struct si_screen        *screen;
+       struct util_queue_fence ready;
+
+       /* Should only be used by si_init_shader_selector_async
+        * if thread_index == -1 (non-threaded). */
+       LLVMTargetMachineRef    tm;
+       struct pipe_debug_callback debug;
+       bool                    is_debug_context;
+
        pipe_mutex              mutex;
        struct si_shader        *first_variant; /* immutable after the first variant */
        struct si_shader        *last_variant; /* mutable */
@@ -311,7 +322,7 @@ struct si_tcs_epilog_bits {
 /* Common PS bits between the shader key and the prolog key. */
 struct si_ps_prolog_bits {
        unsigned        color_two_side:1;
-       /* TODO: add a flatshade bit that skips interpolation for colors */
+       unsigned        flatshade_colors:1;
        unsigned        poly_stipple:1;
        unsigned        force_persp_sample_interp:1;
        unsigned        force_linear_sample_interp:1;
@@ -389,6 +400,8 @@ union si_shader_key {
 struct si_shader_config {
        unsigned                        num_sgprs;
        unsigned                        num_vgprs;
+       unsigned                        spilled_sgprs;
+       unsigned                        spilled_vgprs;
        unsigned                        lds_size;
        unsigned                        spi_ps_input_ena;
        unsigned                        spi_ps_input_addr;
@@ -428,6 +441,12 @@ struct si_shader {
        struct radeon_shader_binary     binary;
        struct si_shader_config         config;
        struct si_shader_info           info;
+
+       /* Shader key + LLVM IR + disassembly + statistics.
+        * Generated for debug contexts only.
+        */
+       char                            *shader_log;
+       size_t                          shader_log_size;
 };
 
 struct si_shader_part {
@@ -478,7 +497,6 @@ int si_compile_tgsi_shader(struct si_screen *sscreen,
 int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
                     struct si_shader *shader,
                     struct pipe_debug_callback *debug);
-void si_dump_shader_key(unsigned shader, union si_shader_key *key, FILE *f);
 int si_compile_llvm(struct si_screen *sscreen,
                    struct radeon_shader_binary *binary,
                    struct si_shader_config *conf,