[Mesa-dev] [PATCH 04/16] i965/fs: Add and use MAX_SAMPLER_MESSAGE_SIZE definition.

Matt Turner mattst88 at gmail.com
Thu Dec 19 13:40:18 PST 2013


---
 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 2949c47..853cf3c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -50,6 +50,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 8567afd..5bca09e 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 f81bc8e..869b636 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1229,8 +1229,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;
@@ -1425,8 +1426,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;
-- 
1.8.3.2



More information about the mesa-dev mailing list