vk/0.210.0: Rework sampler filtering and mode enums
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 1 Dec 2015 00:21:38 +0000 (16:21 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 3 Dec 2015 21:43:51 +0000 (13:43 -0800)
include/vulkan/vulkan.h
src/vulkan/anv_dump.c
src/vulkan/anv_meta.c
src/vulkan/gen7_state.c
src/vulkan/gen8_state.c

index 79133dd7628c58a1393018f776abd43f50f39415..986b86b4f43b7a442db28ca53740ef847f94fe39 100644 (file)
@@ -647,36 +647,36 @@ typedef enum VkDynamicState {
     VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF
 } VkDynamicState;
 
-typedef enum {
-    VK_TEX_FILTER_NEAREST = 0,
-    VK_TEX_FILTER_LINEAR = 1,
-    VK_TEX_FILTER_BEGIN_RANGE = VK_TEX_FILTER_NEAREST,
-    VK_TEX_FILTER_END_RANGE = VK_TEX_FILTER_LINEAR,
-    VK_TEX_FILTER_NUM = (VK_TEX_FILTER_LINEAR - VK_TEX_FILTER_NEAREST + 1),
-    VK_TEX_FILTER_MAX_ENUM = 0x7FFFFFFF
-} VkTexFilter;
-
-typedef enum {
-    VK_TEX_MIPMAP_MODE_BASE = 0,
-    VK_TEX_MIPMAP_MODE_NEAREST = 1,
-    VK_TEX_MIPMAP_MODE_LINEAR = 2,
-    VK_TEX_MIPMAP_MODE_BEGIN_RANGE = VK_TEX_MIPMAP_MODE_BASE,
-    VK_TEX_MIPMAP_MODE_END_RANGE = VK_TEX_MIPMAP_MODE_LINEAR,
-    VK_TEX_MIPMAP_MODE_NUM = (VK_TEX_MIPMAP_MODE_LINEAR - VK_TEX_MIPMAP_MODE_BASE + 1),
-    VK_TEX_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF
-} VkTexMipmapMode;
-
-typedef enum {
-    VK_TEX_ADDRESS_MODE_WRAP = 0,
-    VK_TEX_ADDRESS_MODE_MIRROR = 1,
-    VK_TEX_ADDRESS_MODE_CLAMP = 2,
-    VK_TEX_ADDRESS_MODE_MIRROR_ONCE = 3,
-    VK_TEX_ADDRESS_MODE_CLAMP_BORDER = 4,
-    VK_TEX_ADDRESS_BEGIN_RANGE = VK_TEX_ADDRESS_MODE_WRAP,
-    VK_TEX_ADDRESS_END_RANGE = VK_TEX_ADDRESS_MODE_CLAMP_BORDER,
-    VK_TEX_ADDRESS_NUM = (VK_TEX_ADDRESS_MODE_CLAMP_BORDER - VK_TEX_ADDRESS_MODE_WRAP + 1),
-    VK_TEX_ADDRESS_MAX_ENUM = 0x7FFFFFFF
-} VkTexAddressMode;
+typedef enum VkFilter {
+    VK_FILTER_NEAREST = 0,
+    VK_FILTER_LINEAR = 1,
+    VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST,
+    VK_FILTER_END_RANGE = VK_FILTER_LINEAR,
+    VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1),
+    VK_FILTER_MAX_ENUM = 0x7FFFFFFF
+} VkFilter;
+
+typedef enum VkSamplerMipmapMode {
+    VK_SAMPLER_MIPMAP_MODE_BASE = 0,
+    VK_SAMPLER_MIPMAP_MODE_NEAREST = 1,
+    VK_SAMPLER_MIPMAP_MODE_LINEAR = 2,
+    VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_BASE,
+    VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR,
+    VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_BASE + 1),
+    VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSamplerMipmapMode;
+
+typedef enum VkSamplerAddressMode {
+    VK_SAMPLER_ADDRESS_MODE_REPEAT = 0,
+    VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1,
+    VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2,
+    VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
+    VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
+    VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT,
+    VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
+    VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
+    VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
+} VkSamplerAddressMode;
 
 typedef enum VkBorderColor {
     VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0,
@@ -1759,12 +1759,12 @@ typedef struct {
 typedef struct {
     VkStructureType                             sType;
     const void*                                 pNext;
-    VkTexFilter                                 magFilter;
-    VkTexFilter                                 minFilter;
-    VkTexMipmapMode                             mipMode;
-    VkTexAddressMode                            addressModeU;
-    VkTexAddressMode                            addressModeV;
-    VkTexAddressMode                            addressModeW;
+    VkFilter                                    magFilter;
+    VkFilter                                    minFilter;
+    VkSamplerMipmapMode                         mipmapMode;
+    VkSamplerAddressMode                        addressModeU;
+    VkSamplerAddressMode                        addressModeV;
+    VkSamplerAddressMode                        addressModeW;
     float                                       mipLodBias;
     float                                       maxAnisotropy;
     VkBool32                                    compareEnable;
@@ -2192,7 +2192,7 @@ typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint3
 typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset);
 typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions);
 typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions);
-typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkTexFilter filter);
+typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
 typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
 typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
 typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData);
@@ -2843,7 +2843,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(
     VkImageLayout                               dstImageLayout,
     uint32_t                                    regionCount,
     const VkImageBlit*                          pRegions,
-    VkTexFilter                                 filter);
+    VkFilter                                    filter);
 
 VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(
     VkCommandBuffer                             commandBuffer,
index 52b9ca17b4365fb9c71aff33ff516ec5d20456c0..6192361e491bc77cc88f45c71197ad3baa0081ab 100644 (file)
@@ -126,7 +126,7 @@ anv_dump_image_to_ppm(struct anv_device *device,
             extent.height,
             1
          },
-      }, VK_TEX_FILTER_NEAREST);
+      }, VK_FILTER_NEAREST);
 
    ANV_CALL(CmdPipelineBarrier)(cmd,
       VK_PIPELINE_STAGE_TRANSFER_BIT,
index 3b4c8890b1315af8359a32c05a0ffe40e6803bc2..3f93e1d0b447e32a9f6ac8149cba44411afc00b6 100644 (file)
@@ -449,7 +449,7 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
                struct anv_image_view *dest_iview,
                VkOffset3D dest_offset,
                VkExtent3D dest_extent,
-               VkTexFilter blit_filter)
+               VkFilter blit_filter)
 {
    struct anv_device *device = cmd_buffer->device;
    VkDescriptorPool dummy_desc_pool = (VkDescriptorPool)1;
@@ -734,7 +734,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
                   &dest_iview,
                   (VkOffset3D) { 0, 0, 0 },
                   (VkExtent3D) { width, height, 1 },
-                  VK_TEX_FILTER_NEAREST);
+                  VK_FILTER_NEAREST);
 
    anv_DestroyImage(vk_device, src_image);
    anv_DestroyImage(vk_device, dest_image);
@@ -907,7 +907,7 @@ void anv_CmdCopyImage(
                         dest_image, &dest_iview,
                         dest_offset,
                         pRegions[r].extent,
-                        VK_TEX_FILTER_NEAREST);
+                        VK_FILTER_NEAREST);
       }
    }
 
@@ -922,7 +922,7 @@ void anv_CmdBlitImage(
     VkImageLayout                               destImageLayout,
     uint32_t                                    regionCount,
     const VkImageBlit*                          pRegions,
-    VkTexFilter                                 filter)
+    VkFilter                                    filter)
 
 {
    ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
@@ -934,7 +934,7 @@ void anv_CmdBlitImage(
 
    struct anv_meta_saved_state saved_state;
 
-   anv_finishme("respect VkTexFilter");
+   anv_finishme("respect VkFilter");
 
    meta_prepare_blit(cmd_buffer, &saved_state);
 
@@ -1141,7 +1141,7 @@ void anv_CmdCopyBufferToImage(
                         &dest_iview,
                         dest_offset,
                         pRegions[r].imageExtent,
-                        VK_TEX_FILTER_NEAREST);
+                        VK_FILTER_NEAREST);
 
          /* Once we've done the blit, all of the actual information about
           * the image is embedded in the command buffer so we can just
@@ -1244,7 +1244,7 @@ void anv_CmdCopyImageToBuffer(
                         &dest_iview,
                         (VkOffset3D) { 0, 0, 0 },
                         pRegions[r].imageExtent,
-                        VK_TEX_FILTER_NEAREST);
+                        VK_FILTER_NEAREST);
 
          /* Once we've done the blit, all of the actual information about
           * the image is embedded in the command buffer so we can just
index 8fff649bfea3446377b71dc3c80f5e4dcd1d37be..a30de3487321ba44e6062ca09f02a274a568d3c0 100644 (file)
@@ -64,22 +64,22 @@ genX(fill_buffer_surface_state)(void *state, const struct anv_format *format,
 }
 
 static const uint32_t vk_to_gen_tex_filter[] = {
-   [VK_TEX_FILTER_NEAREST]                      = MAPFILTER_NEAREST,
-   [VK_TEX_FILTER_LINEAR]                       = MAPFILTER_LINEAR
+   [VK_FILTER_NEAREST]                          = MAPFILTER_NEAREST,
+   [VK_FILTER_LINEAR]                           = MAPFILTER_LINEAR
 };
 
 static const uint32_t vk_to_gen_mipmap_mode[] = {
-   [VK_TEX_MIPMAP_MODE_BASE]                    = MIPFILTER_NONE,
-   [VK_TEX_MIPMAP_MODE_NEAREST]                 = MIPFILTER_NEAREST,
-   [VK_TEX_MIPMAP_MODE_LINEAR]                  = MIPFILTER_LINEAR
+   [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_TEX_ADDRESS_MODE_WRAP]                   = TCM_WRAP,
-   [VK_TEX_ADDRESS_MODE_MIRROR]                 = TCM_MIRROR,
-   [VK_TEX_ADDRESS_MODE_CLAMP]                  = TCM_CLAMP,
-   [VK_TEX_ADDRESS_MODE_MIRROR_ONCE]            = TCM_MIRROR_ONCE,
-   [VK_TEX_ADDRESS_MODE_CLAMP_BORDER]           = TCM_CLAMP_BORDER,
+   [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[] = {
@@ -134,7 +134,7 @@ VkResult genX(CreateSampler)(
       .SamplerDisable = false,
       .TextureBorderColorMode = DX10OGL,
       .BaseMipLevel = 0.0,
-      .MipModeFilter = vk_to_gen_mipmap_mode[pCreateInfo->mipMode],
+      .MipModeFilter = vk_to_gen_mipmap_mode[pCreateInfo->mipmapMode],
       .MagModeFilter = mag_filter,
       .MinModeFilter = min_filter,
       .TextureLODBias = pCreateInfo->mipLodBias * 256,
index 3fc985d52b703c7ca9d95cf746979d3acb60f387..092e1ae78227e4bb92a5a48a20063ef9bc86ae81 100644 (file)
@@ -283,22 +283,22 @@ VkResult genX(CreateSampler)(
       return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
 
    static const uint32_t vk_to_gen_tex_filter[] = {
-      [VK_TEX_FILTER_NEAREST]                   = MAPFILTER_NEAREST,
-      [VK_TEX_FILTER_LINEAR]                    = MAPFILTER_LINEAR
+      [VK_FILTER_NEAREST]                       = MAPFILTER_NEAREST,
+      [VK_FILTER_LINEAR]                        = MAPFILTER_LINEAR
    };
 
    static const uint32_t vk_to_gen_mipmap_mode[] = {
-      [VK_TEX_MIPMAP_MODE_BASE]                 = MIPFILTER_NONE,
-      [VK_TEX_MIPMAP_MODE_NEAREST]              = MIPFILTER_NEAREST,
-      [VK_TEX_MIPMAP_MODE_LINEAR]               = MIPFILTER_LINEAR
+      [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_TEX_ADDRESS_MODE_WRAP]                = TCM_WRAP,
-      [VK_TEX_ADDRESS_MODE_MIRROR]              = TCM_MIRROR,
-      [VK_TEX_ADDRESS_MODE_CLAMP]               = TCM_CLAMP,
-      [VK_TEX_ADDRESS_MODE_MIRROR_ONCE]         = TCM_MIRROR_ONCE,
-      [VK_TEX_ADDRESS_MODE_CLAMP_BORDER]        = TCM_CLAMP_BORDER,
+      [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[] = {
@@ -329,7 +329,7 @@ VkResult genX(CreateSampler)(
 #if ANV_GEN == 8
       .BaseMipLevel = 0.0,
 #endif
-      .MipModeFilter = vk_to_gen_mipmap_mode[pCreateInfo->mipMode],
+      .MipModeFilter = vk_to_gen_mipmap_mode[pCreateInfo->mipmapMode],
       .MagModeFilter = mag_filter,
       .MinModeFilter = min_filter,
       .TextureLODBias = anv_clamp_f(pCreateInfo->mipLodBias, -16, 15.996),