anv/state: Pull sampler vk-to-gen maps into genX_state_util.h
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 7 Jan 2016 03:33:46 +0000 (19:33 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 7 Jan 2016 03:53:45 +0000 (19:53 -0800)
src/vulkan/gen7_state.c
src/vulkan/gen8_state.c
src/vulkan/genX_state_util.h

index a7940ca9e2f58d1c40b6a208d36d53bd73f5ebf0..257cb35aca901746a9195e0901a1a19dc8bb55bf 100644 (file)
@@ -65,36 +65,6 @@ genX(fill_buffer_surface_state)(void *state, enum isl_format format,
    GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &surface_state);
 }
 
-static const uint32_t vk_to_gen_tex_filter[] = {
-   [VK_FILTER_NEAREST]                          = MAPFILTER_NEAREST,
-   [VK_FILTER_LINEAR]                           = MAPFILTER_LINEAR
-};
-
-static const uint32_t vk_to_gen_mipmap_mode[] = {
-   [VK_SAMPLER_MIPMAP_MODE_BASE]                = MIPFILTER_NONE,
-   [VK_SAMPLER_MIPMAP_MODE_NEAREST]             = MIPFILTER_NEAREST,
-   [VK_SAMPLER_MIPMAP_MODE_LINEAR]              = MIPFILTER_LINEAR
-};
-
-static const uint32_t vk_to_gen_tex_address[] = {
-   [VK_SAMPLER_ADDRESS_MODE_REPEAT]             = TCM_WRAP,
-   [VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT]    = TCM_MIRROR,
-   [VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE]      = TCM_CLAMP,
-   [VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE] = TCM_MIRROR_ONCE,
-   [VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER]    = TCM_CLAMP_BORDER,
-};
-
-static const uint32_t vk_to_gen_compare_op[] = {
-   [VK_COMPARE_OP_NEVER]                        = PREFILTEROPNEVER,
-   [VK_COMPARE_OP_LESS]                         = PREFILTEROPLESS,
-   [VK_COMPARE_OP_EQUAL]                        = PREFILTEROPEQUAL,
-   [VK_COMPARE_OP_LESS_OR_EQUAL]                = PREFILTEROPLEQUAL,
-   [VK_COMPARE_OP_GREATER]                      = PREFILTEROPGREATER,
-   [VK_COMPARE_OP_NOT_EQUAL]                    = PREFILTEROPNOTEQUAL,
-   [VK_COMPARE_OP_GREATER_OR_EQUAL]             = PREFILTEROPGEQUAL,
-   [VK_COMPARE_OP_ALWAYS]                       = PREFILTEROPALWAYS,
-};
-
 static struct anv_state
 alloc_surface_state(struct anv_device *device,
                     struct anv_cmd_buffer *cmd_buffer)
index 14076d3f6c4d5889f03ba7201ca60f9356678d7a..34be6677915285d113e9ffb60ce1d599e5539b7d 100644 (file)
@@ -350,36 +350,6 @@ VkResult genX(CreateSampler)(
    if (!sampler)
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
-   static const uint32_t vk_to_gen_tex_filter[] = {
-      [VK_FILTER_NEAREST]                       = MAPFILTER_NEAREST,
-      [VK_FILTER_LINEAR]                        = MAPFILTER_LINEAR
-   };
-
-   static const uint32_t vk_to_gen_mipmap_mode[] = {
-      [VK_SAMPLER_MIPMAP_MODE_BASE]             = MIPFILTER_NONE,
-      [VK_SAMPLER_MIPMAP_MODE_NEAREST]          = MIPFILTER_NEAREST,
-      [VK_SAMPLER_MIPMAP_MODE_LINEAR]           = MIPFILTER_LINEAR
-   };
-
-   static const uint32_t vk_to_gen_tex_address[] = {
-      [VK_SAMPLER_ADDRESS_MODE_REPEAT]          = TCM_WRAP,
-      [VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT] = TCM_MIRROR,
-      [VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE]   = TCM_CLAMP,
-      [VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE] = TCM_MIRROR_ONCE,
-      [VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER] = TCM_CLAMP_BORDER,
-   };
-
-   static const uint32_t vk_to_gen_compare_op[] = {
-      [VK_COMPARE_OP_NEVER]                     = PREFILTEROPNEVER,
-      [VK_COMPARE_OP_LESS]                      = PREFILTEROPLESS,
-      [VK_COMPARE_OP_EQUAL]                     = PREFILTEROPEQUAL,
-      [VK_COMPARE_OP_LESS_OR_EQUAL]             = PREFILTEROPLEQUAL,
-      [VK_COMPARE_OP_GREATER]                   = PREFILTEROPGREATER,
-      [VK_COMPARE_OP_NOT_EQUAL]                 = PREFILTEROPNOTEQUAL,
-      [VK_COMPARE_OP_GREATER_OR_EQUAL]          = PREFILTEROPGEQUAL,
-      [VK_COMPARE_OP_ALWAYS]                    = PREFILTEROPALWAYS,
-   };
-
    if (pCreateInfo->maxAnisotropy > 1) {
       mag_filter = MAPFILTER_ANISOTROPIC;
       min_filter = MAPFILTER_ANISOTROPIC;
index cedfabda1f3dc94bc0f2b340c23e5c599ebffb6b..0741d766edd95996758bd1daa0a6a26d55169ae6 100644 (file)
@@ -65,3 +65,33 @@ vk_to_gen_swizzle(VkComponentSwizzle swizzle, VkComponentSwizzle component)
       return vk_to_gen_swizzle_map[swizzle];
 }
 #endif
+
+static const uint32_t vk_to_gen_tex_filter[] = {
+   [VK_FILTER_NEAREST]                       = MAPFILTER_NEAREST,
+   [VK_FILTER_LINEAR]                        = MAPFILTER_LINEAR
+};
+
+static const uint32_t vk_to_gen_mipmap_mode[] = {
+   [VK_SAMPLER_MIPMAP_MODE_BASE]             = MIPFILTER_NONE,
+   [VK_SAMPLER_MIPMAP_MODE_NEAREST]          = MIPFILTER_NEAREST,
+   [VK_SAMPLER_MIPMAP_MODE_LINEAR]           = MIPFILTER_LINEAR
+};
+
+static const uint32_t vk_to_gen_tex_address[] = {
+   [VK_SAMPLER_ADDRESS_MODE_REPEAT]          = TCM_WRAP,
+   [VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT] = TCM_MIRROR,
+   [VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE]   = TCM_CLAMP,
+   [VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE] = TCM_MIRROR_ONCE,
+   [VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER] = TCM_CLAMP_BORDER,
+};
+
+static const uint32_t vk_to_gen_compare_op[] = {
+   [VK_COMPARE_OP_NEVER]                     = PREFILTEROPNEVER,
+   [VK_COMPARE_OP_LESS]                      = PREFILTEROPLESS,
+   [VK_COMPARE_OP_EQUAL]                     = PREFILTEROPEQUAL,
+   [VK_COMPARE_OP_LESS_OR_EQUAL]             = PREFILTEROPLEQUAL,
+   [VK_COMPARE_OP_GREATER]                   = PREFILTEROPGREATER,
+   [VK_COMPARE_OP_NOT_EQUAL]                 = PREFILTEROPNOTEQUAL,
+   [VK_COMPARE_OP_GREATER_OR_EQUAL]          = PREFILTEROPGEQUAL,
+   [VK_COMPARE_OP_ALWAYS]                    = PREFILTEROPALWAYS,
+};