[Mesa-dev] [PATCH 12/12] spirv: Handle the PixelCenterInteger execution mode.

Kenneth Graunke kenneth at whitecape.org
Wed May 18 22:00:17 UTC 2016


This isn't allowed by Vulkan, but might be useful someday for
SPIR-V in OpenGL (if that ever becomes a thing).  It's easy enough
to hook up, and as precedent, we already do so for OriginLowerLeft.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/spirv/spirv_to_nir.c  | 3 +++
 src/compiler/spirv/vtn_private.h   | 1 +
 src/compiler/spirv/vtn_variables.c | 3 +++
 3 files changed, 7 insertions(+)

Unnecessary patch.  I wrote it, so I figured I'd send it.
I'm fine with dropping it if people prefer.

diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index c92dfca..2ed140e 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -2329,6 +2329,9 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
       break;
 
    case SpvExecutionModePixelCenterInteger:
+      b->pixel_center_integer = true;
+      break;
+
    case SpvExecutionModeXfb:
       assert(!"Unhandled execution mode");
       break;
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 3840d8c..3ecffad 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -378,6 +378,7 @@ struct vtn_builder {
    const char *entry_point_name;
    struct vtn_value *entry_point;
    bool origin_upper_left;
+   bool pixel_center_integer;
 
    struct vtn_function *func;
    struct exec_list functions;
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index bbe1166..0c7f0f7 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1016,6 +1016,9 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
 
       if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition)
          nir_var->data.origin_upper_left = b->origin_upper_left;
+
+      if (builtin == SpvBuiltInFragCoord)
+         nir_var->data.pixel_center_integer = b->pixel_center_integer;
       break;
    }
    case SpvDecorationRowMajor:
-- 
2.8.2



More information about the mesa-dev mailing list