#include "brw_context.h"
#include "brw_wm.h"
#include "brw_state.h"
-#include "brw_shader.h"
#include "main/enums.h"
#include "main/formats.h"
#include "main/fbobject.h"
#include "program/program.h"
#include "intel_mipmap_tree.h"
#include "intel_image.h"
-#include "brw_nir.h"
+#include "compiler/brw_nir.h"
#include "brw_program.h"
#include "util/ralloc.h"
brw_wm_debug_recompile(struct brw_context *brw, struct gl_program *prog,
const struct brw_wm_prog_key *key)
{
- struct brw_cache_item *c = NULL;
- const struct brw_wm_prog_key *old_key = NULL;
- bool found = false;
-
perf_debug("Recompiling fragment shader for program %d\n", prog->Id);
- for (unsigned int i = 0; i < brw->cache.size; i++) {
- for (c = brw->cache.items[i]; c; c = c->next) {
- if (c->cache_id == BRW_CACHE_FS_PROG) {
- old_key = c->key;
-
- if (old_key->program_string_id == key->program_string_id)
- break;
- }
- }
- if (c)
- break;
- }
+ bool found = false;
+ const struct brw_wm_prog_key *old_key =
+ brw_find_previous_compile(&brw->cache, BRW_CACHE_FS_PROG,
+ key->program_string_id);
- if (!c) {
+ if (!old_key) {
perf_debug(" Didn't find previous compile in the shader cache for debug\n");
return;
}
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();
}
if (program == NULL) {
if (!fp->program.is_arb_asm) {
- fp->program.sh.data->LinkStatus = false;
+ fp->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&fp->program.sh.data->InfoLog, error_str);
}
brw_wm_debug_recompile(brw, &fp->program, key);
fp->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("FS compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
if (brw->gen < 6) {
/* _NEW_COLOR */
if (prog->info.fs.uses_discard || ctx->Color.AlphaEnabled) {
- lookup |= IZ_PS_KILL_ALPHATEST_BIT;
+ lookup |= BRW_WM_IZ_PS_KILL_ALPHATEST_BIT;
}
if (prog->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
- lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
+ lookup |= BRW_WM_IZ_PS_COMPUTES_DEPTH_BIT;
}
/* _NEW_DEPTH */
if (ctx->Depth.Test)
- lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
+ lookup |= BRW_WM_IZ_DEPTH_TEST_ENABLE_BIT;
if (brw_depth_writes_enabled(brw))
- lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
+ lookup |= BRW_WM_IZ_DEPTH_WRITE_ENABLE_BIT;
/* _NEW_STENCIL | _NEW_BUFFERS */
if (ctx->Stencil._Enabled) {
- lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
+ lookup |= BRW_WM_IZ_STENCIL_TEST_ENABLE_BIT;
if (ctx->Stencil.WriteMask[0] ||
ctx->Stencil.WriteMask[ctx->Stencil._BackFace])
- lookup |= IZ_STENCIL_WRITE_ENABLE_BIT;
+ lookup |= BRW_WM_IZ_STENCIL_WRITE_ENABLE_BIT;
}
key->iz_lookup = lookup;
}
- line_aa = AA_NEVER;
+ line_aa = BRW_WM_AA_NEVER;
/* _NEW_LINE, _NEW_POLYGON, BRW_NEW_REDUCED_PRIMITIVE */
if (ctx->Line.SmoothFlag) {
if (brw->reduced_primitive == GL_LINES) {
- line_aa = AA_ALWAYS;
+ line_aa = BRW_WM_AA_ALWAYS;
}
else if (brw->reduced_primitive == GL_TRIANGLES) {
if (ctx->Polygon.FrontMode == GL_LINE) {
- line_aa = AA_SOMETIMES;
+ line_aa = BRW_WM_AA_SOMETIMES;
if (ctx->Polygon.BackMode == GL_LINE ||
(ctx->Polygon.CullFlag &&
ctx->Polygon.CullFaceMode == GL_BACK))
- line_aa = AA_ALWAYS;
+ line_aa = BRW_WM_AA_ALWAYS;
}
else if (ctx->Polygon.BackMode == GL_LINE) {
- line_aa = AA_SOMETIMES;
+ line_aa = BRW_WM_AA_SOMETIMES;
if ((ctx->Polygon.CullFlag &&
ctx->Polygon.CullFaceMode == GL_FRONT))
- line_aa = AA_ALWAYS;
+ line_aa = BRW_WM_AA_ALWAYS;
}
}
}
if (brw->gen < 6) {
if (prog->info.fs.uses_discard)
- key.iz_lookup |= IZ_PS_KILL_ALPHATEST_BIT;
+ key.iz_lookup |= BRW_WM_IZ_PS_KILL_ALPHATEST_BIT;
if (outputs_written & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
- key.iz_lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
+ key.iz_lookup |= BRW_WM_IZ_PS_COMPUTES_DEPTH_BIT;
/* Just assume depth testing. */
- key.iz_lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
- key.iz_lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
+ key.iz_lookup |= BRW_WM_IZ_DEPTH_TEST_ENABLE_BIT;
+ key.iz_lookup |= BRW_WM_IZ_DEPTH_WRITE_ENABLE_BIT;
}
if (brw->gen < 6 || _mesa_bitcount_64(prog->info.inputs_read &