anv: prepare sampler emission code for multiplanar images
New settings from the KHR_sampler_ycbcr_conversion specifications might require different sampler settings for luma and chroma planes. This change makes the sampler table emission ready to handle multiple planes. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -2545,7 +2545,7 @@ void anv_fill_buffer_surface_state(struct anv_device *device,
|
||||
uint32_t stride);
|
||||
|
||||
struct anv_sampler {
|
||||
uint32_t state[4];
|
||||
uint32_t state[3][4];
|
||||
uint32_t n_planes;
|
||||
};
|
||||
|
||||
|
@@ -1742,7 +1742,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,
|
||||
continue;
|
||||
|
||||
memcpy(state->map + (s * 16),
|
||||
sampler->state, sizeof(sampler->state));
|
||||
sampler->state[binding->plane], sizeof(sampler->state[0]));
|
||||
}
|
||||
|
||||
anv_state_flush(cmd_buffer->device, *state);
|
||||
|
@@ -166,7 +166,7 @@ VkResult genX(CreateSampler)(
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
|
||||
|
||||
sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,
|
||||
sampler = vk_zalloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!sampler)
|
||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
@@ -181,6 +181,7 @@ VkResult genX(CreateSampler)(
|
||||
bool enable_mag_filter_addr_rounding =
|
||||
pCreateInfo->magFilter != VK_FILTER_NEAREST;
|
||||
|
||||
for (unsigned p = 0; p < sampler->n_planes; p++) {
|
||||
struct GENX(SAMPLER_STATE) sampler_state = {
|
||||
.SamplerDisable = false,
|
||||
.TextureBorderColorMode = DX10OGL,
|
||||
@@ -229,7 +230,8 @@ VkResult genX(CreateSampler)(
|
||||
.TCZAddressControlMode = vk_to_gen_tex_address[pCreateInfo->addressModeW],
|
||||
};
|
||||
|
||||
GENX(SAMPLER_STATE_pack)(NULL, sampler->state, &sampler_state);
|
||||
GENX(SAMPLER_STATE_pack)(NULL, sampler->state[p], &sampler_state);
|
||||
}
|
||||
|
||||
*pSampler = anv_sampler_to_handle(sampler);
|
||||
|
||||
|
Reference in New Issue
Block a user