#include "util/ralloc.h"
#include "brw_context.h"
#include "brw_cs.h"
-#include "brw_eu.h"
#include "brw_wm.h"
-#include "brw_shader.h"
#include "intel_mipmap_tree.h"
#include "brw_state.h"
#include "intel_batchbuffer.h"
-#include "brw_nir.h"
+#include "compiler/brw_nir.h"
#include "brw_program.h"
#include "compiler/glsl/ir_uniform.h"
static void
assign_cs_binding_table_offsets(const struct gen_device_info *devinfo,
- const struct gl_shader_program *shader_prog,
const struct gl_program *prog,
struct brw_cs_prog_data *prog_data)
{
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,
+ brw_assign_common_binding_table_offsets(devinfo, prog, &prog_data->base,
next_binding_table_offset);
}
static bool
brw_codegen_cs_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
struct brw_program *cp,
struct brw_cs_prog_key *key)
{
memset(&prog_data, 0, sizeof(prog_data));
if (cp->program.info.cs.shared_size > 64 * 1024) {
- prog->data->LinkStatus = false;
+ cp->program.sh.data->LinkStatus = linking_failure;
const char *error_str =
"Compute shader used more than 64KB of shared variables";
- ralloc_strcat(&prog->data->InfoLog, error_str);
+ ralloc_strcat(&cp->program.sh.data->InfoLog, error_str);
_mesa_problem(NULL, "Failed to link compute shader: %s\n", error_str);
ralloc_free(mem_ctx);
prog_data.base.total_shared = cp->program.info.cs.shared_size;
}
- assign_cs_binding_table_offsets(devinfo, prog, &cp->program, &prog_data);
+ assign_cs_binding_table_offsets(devinfo, &cp->program, &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
prog_data.base.nr_params = param_count;
prog_data.base.nr_image_params = cp->program.info.num_images;
- brw_nir_setup_glsl_uniforms(cp->program.nir, prog, &cp->program,
- &prog_data.base, true);
+ brw_nir_setup_glsl_uniforms(cp->program.nir, &cp->program,&prog_data.base,
+ true);
if (unlikely(brw->perf_debug)) {
start_busy = (brw->batch.last_bo &&
- drm_intel_bo_busy(brw->batch.last_bo));
+ brw_bo_busy(brw->batch.last_bo));
start_time = get_time();
}
&prog_data, cp->program.nir, st_index,
&program_size, &error_str);
if (program == NULL) {
- prog->data->LinkStatus = false;
- ralloc_strcat(&prog->data->InfoLog, error_str);
+ cp->program.sh.data->LinkStatus = linking_failure;
+ ralloc_strcat(&cp->program.sh.data->InfoLog, error_str);
_mesa_problem(NULL, "Failed to compile compute shader: %s\n", error_str);
ralloc_free(mem_ctx);
}
cp->compiled_once = true;
- if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
+ if (start_busy && !brw_bo_busy(brw->batch.last_bo)) {
perf_debug("CS compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
&key, sizeof(key),
&brw->cs.base.prog_offset,
&brw->cs.base.prog_data)) {
- bool success =
- brw_codegen_cs_prog(brw,
- ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE],
- cp, &key);
+ bool success = brw_codegen_cs_prog(brw, cp, &key);
(void) success;
assert(success);
}
bool
-brw_cs_precompile(struct gl_context *ctx,
- struct gl_shader_program *shader_prog,
- struct gl_program *prog)
+brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog)
{
struct brw_context *brw = brw_context(ctx);
struct brw_cs_prog_key key;
uint32_t old_prog_offset = brw->cs.base.prog_offset;
struct brw_stage_prog_data *old_prog_data = brw->cs.base.prog_data;
- bool success = brw_codegen_cs_prog(brw, shader_prog, bcp, &key);
+ bool success = brw_codegen_cs_prog(brw, bcp, &key);
brw->cs.base.prog_offset = old_prog_offset;
brw->cs.base.prog_data = old_prog_data;