Commit f3e91e78 authored by Lionel Landwerlin's avatar Lionel Landwerlin

anv: add nir lowering pass for ycbcr textures

This pass implements all the implicit conversions required by the
VK_KHR_sampler_ycbcr_conversion specification.

It also inserts plane sources onto sampling instructions that we then
let the pipeline layout pass deal with, when mapping things correctly
to descriptors.

v2: Add new file to meson build (Lionel)
    Use nir_frcp() rather than (1.0f / x) (Jason)
    Reuse nir_tex_instr_dest_size() rather than handwritten one (Jason)
    Return progress (Jason)
    Account for array of samplers (Jason)
Signed-off-by: Lionel Landwerlin's avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
parent 3492d560
......@@ -219,6 +219,7 @@ VULKAN_FILES := \
vulkan/anv_nir_lower_input_attachments.c \
vulkan/anv_nir_lower_multiview.c \
vulkan/anv_nir_lower_push_constants.c \
vulkan/anv_nir_lower_ycbcr_textures.c \
vulkan/anv_pass.c \
vulkan/anv_pipeline.c \
vulkan/anv_pipeline_cache.c \
......
......@@ -37,6 +37,9 @@ void anv_nir_lower_push_constants(nir_shader *shader);
bool anv_nir_lower_multiview(nir_shader *shader, uint32_t view_mask);
bool anv_nir_lower_ycbcr_textures(nir_shader *shader,
struct anv_pipeline *pipeline);
void anv_nir_apply_pipeline_layout(struct anv_pipeline *pipeline,
nir_shader *shader,
struct brw_stage_prog_data *prog_data,
......
This diff is collapsed.
......@@ -376,6 +376,8 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
if (nir == NULL)
return NULL;
NIR_PASS_V(nir, anv_nir_lower_ycbcr_textures, pipeline);
NIR_PASS_V(nir, anv_nir_lower_push_constants);
if (stage != MESA_SHADER_COMPUTE)
......
......@@ -2544,9 +2544,21 @@ void anv_fill_buffer_surface_state(struct anv_device *device,
uint32_t offset, uint32_t range,
uint32_t stride);
struct anv_ycbcr_conversion {
const struct anv_format * format;
VkSamplerYcbcrModelConversionKHR ycbcr_model;
VkSamplerYcbcrRangeKHR ycbcr_range;
VkComponentSwizzle mapping[4];
VkChromaLocationKHR chroma_offsets[2];
VkFilter chroma_filter;
bool chroma_reconstruction;
};
struct anv_sampler {
uint32_t state[3][4];
uint32_t n_planes;
uint32_t state[3][4];
uint32_t n_planes;
struct anv_ycbcr_conversion *conversion;
};
struct anv_framebuffer {
......
......@@ -101,6 +101,7 @@ libanv_files = files(
'anv_nir_lower_input_attachments.c',
'anv_nir_lower_multiview.c',
'anv_nir_lower_push_constants.c',
'anv_nir_lower_ycbcr_textures.c',
'anv_pass.c',
'anv_pipeline.c',
'anv_pipeline_cache.c',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment