From 2dfb0671395c383caf360a5690756f77afef6663 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 10 Dec 2013 16:22:56 -0800 Subject: [PATCH] i965/fs: Add and use MAX_SAMPLER_MESSAGE_SIZE definition. Reviewed-by: Jordan Justen --- src/mesa/drivers/dri/i965/brw_fs.h | 2 ++ src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 3 ++- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 1a5f7f8585b..6ed16f6bc02 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -51,6 +51,8 @@ extern "C" { #include "glsl/glsl_types.h" #include "glsl/ir.h" +#define MAX_SAMPLER_MESSAGE_SIZE 11 + class bblock_t; namespace { struct acp_entry; diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp index f54a2defd44..2494b117e57 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp @@ -103,7 +103,8 @@ brw_alloc_reg_set(struct brw_context *brw, int reg_width) int class_sizes[BRW_MAX_MRF]; if (brw->gen >= 7) { - for (class_count = 0; class_count < 11; class_count++) + for (class_count = 0; class_count < MAX_SAMPLER_MESSAGE_SIZE; + class_count++) class_sizes[class_count] = class_count + 1; } else { for (class_count = 0; class_count < 4; class_count++) diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 1727ef9593a..643ba5f00ad 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1231,8 +1231,9 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate, inst->header_present = header_present; inst->regs_written = 4; - if (mlen > 11) { - fail("Message length >11 disallowed by hardware\n"); + if (mlen > MAX_SAMPLER_MESSAGE_SIZE) { + fail("Message length >" STRINGIFY(MAX_SAMPLER_MESSAGE_SIZE) + " disallowed by hardware\n"); } return inst; @@ -1424,8 +1425,9 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate, inst->regs_written = 4; virtual_grf_sizes[payload.reg] = next.reg_offset; - if (inst->mlen > 11) { - fail("Message length >11 disallowed by hardware\n"); + if (inst->mlen > MAX_SAMPLER_MESSAGE_SIZE) { + fail("Message length >" STRINGIFY(MAX_SAMPLER_MESSAGE_SIZE) + " disallowed by hardware\n"); } return inst; -- 2.30.2