spirv: Handle the PixelCenterInteger execution mode.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 18 May 2016 18:06:08 +0000 (11:06 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 20 May 2016 21:44:22 +0000 (14:44 -0700)
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@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/spirv_to_nir.c
src/compiler/spirv/vtn_private.h
src/compiler/spirv/vtn_variables.c

index e60bb54106d9c4894afc8f4ec813f87bf710d52b..359fa5c583a68b8cf2058b78ba372a46ffb9d407 100644 (file)
@@ -2330,6 +2330,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;
index 3840d8c4b650f59d81b324666d3f2e355c8aa7fe..3ecffada2ba27573224647f013cea04fca6c83e1 100644 (file)
@@ -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;
index bbe1166aff079a6089989ff9038046cf93847948..0c7f0f76718188edf1c4b72047a87d197e5b5145 100644 (file)
@@ -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: