[Mesa-dev] [PATCH 2/7] anv: sampler: store border color & wrapping modes on Gen7.5
Lionel Landwerlin
llandwerlin at gmail.com
Mon Nov 21 17:47:35 UTC 2016
---
src/intel/vulkan/anv_private.h | 4 +++-
src/intel/vulkan/genX_state.c | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 7d7380a..8231f6b 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1688,7 +1688,9 @@ void anv_buffer_view_fill_image_param(struct anv_device *device,
struct brw_image_param *param);
struct anv_sampler {
- uint32_t state[4];
+ uint32_t state[4];
+ uint32_t color[4];
+ uint32_t wrapping;
};
struct anv_framebuffer {
diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 4122395..5249706 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -166,6 +166,27 @@ VkResult genX(CreateSampler)(
uint32_t border_color_offset = device->border_colors.offset +
pCreateInfo->borderColor * 64;
+#if GEN_IS_HASWELL
+ if (pCreateInfo->borderColor == VK_BORDER_COLOR_INT_TRANSPARENT_BLACK ||
+ pCreateInfo->borderColor == VK_BORDER_COLOR_INT_OPAQUE_BLACK ||
+ pCreateInfo->borderColor == VK_BORDER_COLOR_INT_OPAQUE_WHITE) {
+ sampler->wrapping =
+ (pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER ?
+ 0x1 : 0) |
+ (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER ?
+ 0x2 : 0) |
+ (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER ?
+ 0x4 : 0);
+
+ static const uint32_t border_colors[][4] = {
+ [VK_BORDER_COLOR_INT_TRANSPARENT_BLACK] = { 0, 0, 0, 0 },
+ [VK_BORDER_COLOR_INT_OPAQUE_BLACK] = { 0, 0, 0, 1 },
+ [VK_BORDER_COLOR_INT_OPAQUE_WHITE] = { 1, 1, 1, 1 }
+ };
+ memcpy(sampler->color, border_colors[pCreateInfo->borderColor],
+ sizeof(sampler->color));
+ }
+#endif
bool enable_min_filter_addr_rounding =
pCreateInfo->minFilter != VK_FILTER_NEAREST;
--
2.10.2
More information about the mesa-dev
mailing list