struct brw_program {
struct gl_program program;
GLuint id;
+
+ bool compiled_once;
};
};
-struct brw_shader {
- struct gl_linked_shader base;
-
- bool compiled_once;
-};
-
/**
* Bitmask indicating which fragment shader inputs represent varyings (and
* hence have to be delivered to the fragment shader by the SF/SBE stage).
bool start_busy = false;
double start_time = 0;
- struct brw_shader *cs =
- (struct brw_shader *) prog->_LinkedShaders[MESA_SHADER_COMPUTE];
- assert (cs);
-
memset(&prog_data, 0, sizeof(prog_data));
if (prog->Comp.SharedSize > 64 * 1024) {
return false;
}
- if (unlikely(brw->perf_debug) && cs) {
- if (cs->compiled_once) {
+ if (unlikely(brw->perf_debug)) {
+ if (cp->compiled_once) {
_mesa_problem(&brw->ctx, "CS programs shouldn't need recompiles");
}
- cs->compiled_once = true;
+ cp->compiled_once = true;
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("CS compile took %.03f ms and stalled the GPU\n",
* padding around uniform values below vec4 size, so the worst case is that
* every uniform is a float which gets padded to the size of a vec4.
*/
- struct gl_linked_shader *gs = prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
- struct brw_shader *bgs = (struct brw_shader *) gs;
int param_count = gp->program.nir->num_uniforms / 4;
prog_data.base.base.param =
char *error_str;
const unsigned *program =
brw_compile_gs(brw->screen->compiler, brw, mem_ctx, key,
- &prog_data, gs->Program->nir, prog,
+ &prog_data, gp->program.nir, prog,
st_index, &program_size, &error_str);
if (program == NULL) {
ralloc_strcat(&prog->data->InfoLog, error_str);
}
if (unlikely(brw->perf_debug)) {
- if (bgs->compiled_once) {
+ if (gp->compiled_once) {
brw_gs_debug_recompile(brw, prog, key);
}
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("GS compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
- bgs->compiled_once = true;
+ gp->compiled_once = true;
}
/* Scratch space is used for register spilling */
extern "C" struct gl_linked_shader *
brw_new_shader(gl_shader_stage stage)
{
- struct brw_shader *shader;
-
- shader = rzalloc(NULL, struct brw_shader);
+ struct gl_linked_shader *shader = rzalloc(NULL, struct gl_linked_shader);
if (shader) {
- shader->base.Stage = stage;
+ shader->Stage = stage;
}
- return &shader->base;
+ return shader;
}
static void
}
if (unlikely(brw->perf_debug)) {
- struct gl_linked_shader *tcs = shader_prog ?
- shader_prog->_LinkedShaders[MESA_SHADER_TESS_CTRL] : NULL;
- struct brw_shader *btcs = (struct brw_shader *) tcs;
- if (btcs) {
- if (btcs->compiled_once) {
+ if (tcp) {
+ if (tcp->compiled_once) {
brw_tcs_debug_recompile(brw, shader_prog, key);
}
- btcs->compiled_once = true;
+ tcp->compiled_once = true;
}
+
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("TCS compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
if (unlikely(brw->perf_debug)) {
- struct gl_linked_shader *tes =
- shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL];
- struct brw_shader *btes = (struct brw_shader *) tes;
- if (btes->compiled_once) {
+ if (tep->compiled_once) {
brw_tes_debug_recompile(brw, shader_prog, key);
}
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("TES compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
- btes->compiled_once = true;
+ tep->compiled_once = true;
}
/* Scratch space is used for register spilling */
struct brw_vs_prog_data prog_data;
struct brw_stage_prog_data *stage_prog_data = &prog_data.base.base;
void *mem_ctx;
- struct brw_shader *vs = NULL;
bool start_busy = false;
double start_time = 0;
- if (prog)
- vs = (struct brw_shader *) prog->_LinkedShaders[MESA_SHADER_VERTEX];
-
memset(&prog_data, 0, sizeof(prog_data));
/* Use ALT floating point mode for ARB programs so that 0^0 == 1. */
return false;
}
- if (unlikely(brw->perf_debug) && vs) {
- if (vs->compiled_once) {
+ if (unlikely(brw->perf_debug)) {
+ if (vp->compiled_once) {
brw_vs_debug_recompile(brw, prog, key);
}
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("VS compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
- vs->compiled_once = true;
+ vp->compiled_once = true;
}
/* Scratch space is used for register spilling */
void *mem_ctx = ralloc_context(NULL);
struct brw_wm_prog_data prog_data;
const GLuint *program;
- struct brw_shader *fs = NULL;
GLuint program_size;
bool start_busy = false;
double start_time = 0;
- if (prog)
- fs = (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
-
memset(&prog_data, 0, sizeof(prog_data));
/* Use ALT floating point mode for ARB programs so that 0^0 == 1. */
return false;
}
- if (unlikely(brw->perf_debug) && fs) {
- if (fs->compiled_once)
+ if (unlikely(brw->perf_debug)) {
+ if (fp->compiled_once)
brw_wm_debug_recompile(brw, prog, key);
- fs->compiled_once = true;
+ fp->compiled_once = true;
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("FS compile took %.03f ms and stalled the GPU\n",