#include "intel_batchbuffer.h"
#include "glsl/nir/nir.h"
+static void
+assign_cs_binding_table_offsets(const struct brw_device_info *devinfo,
+ const struct gl_shader_program *shader_prog,
+ const struct gl_program *prog,
+ struct brw_cs_prog_data *prog_data)
+{
+ uint32_t next_binding_table_offset = 0;
+
+ /* May not be used if the gl_NumWorkGroups variable is not accessed. */
+ prog_data->binding_table.work_groups_start = next_binding_table_offset;
+ next_binding_table_offset++;
+
+ brw_assign_common_binding_table_offsets(MESA_SHADER_COMPUTE, devinfo,
+ shader_prog, prog, &prog_data->base,
+ next_binding_table_offset);
+}
+
static bool
brw_codegen_cs_prog(struct brw_context *brw,
struct gl_shader_program *prog,
memset(&prog_data, 0, sizeof(prog_data));
+ assign_cs_binding_table_offsets(brw->intelScreen->devinfo, prog,
+ &cp->program.Base, &prog_data);
+
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
}
}
-void
-fs_visitor::assign_fs_binding_table_offsets()
-{
- assert(stage == MESA_SHADER_FRAGMENT);
- brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
- brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
- uint32_t next_binding_table_offset = 0;
-
- /* If there are no color regions, we still perform an FB write to a null
- * renderbuffer, which we place at surface index 0.
- */
- prog_data->binding_table.render_target_start = next_binding_table_offset;
- next_binding_table_offset += MAX2(key->nr_color_regions, 1);
-
- brw_assign_common_binding_table_offsets(MESA_SHADER_FRAGMENT, devinfo,
- shader_prog, prog, stage_prog_data,
- next_binding_table_offset);
-}
-
-void
-fs_visitor::assign_cs_binding_table_offsets()
-{
- assert(stage == MESA_SHADER_COMPUTE);
- brw_cs_prog_data *prog_data = (brw_cs_prog_data*) this->prog_data;
- uint32_t next_binding_table_offset = 0;
-
- /* May not be used if the gl_NumWorkGroups variable is not accessed. */
- prog_data->binding_table.work_groups_start = next_binding_table_offset;
- next_binding_table_offset++;
-
- brw_assign_common_binding_table_offsets(MESA_SHADER_COMPUTE, devinfo,
- shader_prog, prog, stage_prog_data,
- next_binding_table_offset);
-}
-
void
fs_visitor::calculate_register_pressure()
{
{
assert(stage == MESA_SHADER_VERTEX);
- brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX, devinfo,
- shader_prog, prog, stage_prog_data,
- 0);
setup_vs_payload();
if (shader_time_index >= 0)
sanity_param_count = prog->Parameters->NumParameters;
- assign_fs_binding_table_offsets();
-
if (devinfo->gen >= 6)
setup_payload_gen6();
else
sanity_param_count = prog->Parameters->NumParameters;
- assign_cs_binding_table_offsets();
-
setup_cs_payload();
if (shader_time_index >= 0)
bool run_cs();
void optimize();
void allocate_registers();
- void assign_fs_binding_table_offsets();
- void assign_cs_binding_table_offsets();
void setup_payload_gen4();
void setup_payload_gen6();
void setup_vs_payload();
#include "brw_ff_gs.h"
#include "glsl/nir/nir.h"
+static void
+assign_gs_binding_table_offsets(const struct brw_device_info *devinfo,
+ const struct gl_shader_program *shader_prog,
+ const struct gl_program *prog,
+ struct brw_gs_prog_data *prog_data)
+{
+ /* In gen6 we reserve the first BRW_MAX_SOL_BINDINGS entries for transform
+ * feedback surfaces.
+ */
+ uint32_t reserved = devinfo->gen == 6 ? BRW_MAX_SOL_BINDINGS : 0;
+
+ brw_assign_common_binding_table_offsets(MESA_SHADER_GEOMETRY, devinfo,
+ shader_prog, prog,
+ &prog_data->base.base,
+ reserved);
+}
bool
brw_codegen_gs_prog(struct brw_context *brw,
c.prog_data.invocations = gp->program.Invocations;
+ assign_gs_binding_table_offsets(brw->intelScreen->devinfo, prog,
+ &gp->program.Base, &c.prog_data);
+
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
this->first_non_payload_grf = reg;
}
-void
-vec4_visitor::assign_binding_table_offsets()
-{
- brw_assign_common_binding_table_offsets(stage, devinfo, shader_prog, prog,
- stage_prog_data, 0);
-}
-
src_reg
vec4_visitor::get_timestamp()
{
if (shader_time_index >= 0)
emit_shader_time_begin();
- assign_binding_table_offsets();
-
emit_prolog();
assert(prog->nir != NULL);
bool interleaved);
void setup_payload_interference(struct ra_graph *g, int first_payload_node,
int reg_node_count);
- virtual void assign_binding_table_offsets();
virtual void setup_payload() = 0;
virtual void emit_prolog() = 0;
virtual void emit_thread_end() = 0;
mem_ctx = ralloc_context(NULL);
+ brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX,
+ brw->intelScreen->devinfo,
+ prog, &vp->program.Base,
+ &prog_data.base.base, 0);
+
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
return BRW_PSCDEPTH_OFF;
}
+static void
+assign_fs_binding_table_offsets(const struct brw_device_info *devinfo,
+ const struct gl_shader_program *shader_prog,
+ const struct gl_program *prog,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data)
+{
+ uint32_t next_binding_table_offset = 0;
+
+ /* If there are no color regions, we still perform an FB write to a null
+ * renderbuffer, which we place at surface index 0.
+ */
+ prog_data->binding_table.render_target_start = next_binding_table_offset;
+ next_binding_table_offset += MAX2(key->nr_color_regions, 1);
+
+ brw_assign_common_binding_table_offsets(MESA_SHADER_FRAGMENT, devinfo,
+ shader_prog, prog, &prog_data->base,
+ next_binding_table_offset);
+}
+
/**
* All Mesa program -> GPU code generation goes through this function.
* Depending on the instructions used (i.e. flow control instructions)
if (!prog)
prog_data.base.use_alt_mode = true;
+ assign_fs_binding_table_offsets(brw->intelScreen->devinfo, prog,
+ &fp->program.Base, key, &prog_data);
+
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
namespace brw {
-void
-gen6_gs_visitor::assign_binding_table_offsets()
-{
- /* In gen6 we reserve the first BRW_MAX_SOL_BINDINGS entries for transform
- * feedback surfaces.
- */
- brw_assign_common_binding_table_offsets(MESA_SHADER_GEOMETRY, devinfo,
- shader_prog, prog, stage_prog_data,
- BRW_MAX_SOL_BINDINGS);
-}
-
void
gen6_gs_visitor::emit_prolog()
{
shader_time_index) {}
protected:
- virtual void assign_binding_table_offsets();
virtual void emit_prolog();
virtual void emit_thread_end();
virtual void gs_emit_vertex(int stream_id);