From 079e8a96749e9d4dfe415dfcd676e0d5e0ec37ea Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 21 Jul 2023 14:52:41 -0500 Subject: [PATCH] anv,hasvk,iris: sampler_prog_key::swizzles is only used on crocus The field is no longer consumed by brw_complie_* and is instead handled directly by the crocus driver. Therefore, it's safe to leave it zero and not even bother setting it. This removes our reliance on the SWIZZLE_* macros in prog_instructions.h. Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_program.c | 3 +-- src/intel/compiler/brw_compiler.h | 3 +++ src/intel/vulkan/anv_pipeline.c | 15 --------------- src/intel/vulkan_hasvk/anv_pipeline.c | 9 +-------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 6a94366e777..02371230448 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -53,8 +53,7 @@ .prefix.limit_trig_input_range = screen->driconf.limit_trig_input_range #define BRW_KEY_INIT(gen, prog_id, limit_trig_input) \ .base.program_string_id = prog_id, \ - .base.limit_trig_input_range = limit_trig_input, \ - .base.tex.swizzles[0 ... BRW_MAX_SAMPLERS - 1] = 0x688 + .base.limit_trig_input_range = limit_trig_input struct iris_threaded_compile_job { struct iris_screen *screen; diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 6187dd6c881..f0fcf83fd44 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -209,6 +209,9 @@ PRAGMA_DIAGNOSTIC_ERROR(-Wpadded) struct brw_sampler_prog_key_data { /** * EXT_texture_swizzle and DEPTH_TEXTURE_MODE swizzles. + * + * This field is not consumed by the back-end compiler and is only relevant + * for the crocus OpenGL driver for Broadwell and earlier hardware. */ uint16_t swizzles[BRW_MAX_SAMPLERS]; diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 8bb767441d6..bdcb9eb10cf 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -44,9 +44,6 @@ #include "vk_render_pass.h" #include "vk_util.h" -/* Needed for SWIZZLE macros */ -#include "program/prog_instruction.h" - struct lower_set_vtx_and_prim_count_state { nir_variable *primitive_count; }; @@ -382,16 +379,6 @@ void anv_DestroyPipeline( vk_free2(&device->vk.alloc, pAllocator, pipeline); } -static void -populate_sampler_prog_key(const struct intel_device_info *devinfo, - struct brw_sampler_prog_key_data *key) -{ - for (int i = 0; i < BRW_MAX_SAMPLERS; i++) { - /* Assume color sampler, no swizzling. (Works for BDW+) */ - key->swizzles[i] = SWIZZLE_XYZW; - } -} - static void populate_base_prog_key(const struct anv_device *device, bool robust_buffer_acccess, @@ -400,8 +387,6 @@ populate_base_prog_key(const struct anv_device *device, key->robust_buffer_access = robust_buffer_acccess; key->limit_trig_input_range = device->physical->instance->limit_trig_input_range; - - populate_sampler_prog_key(device->info, &key->tex); } static void diff --git a/src/intel/vulkan_hasvk/anv_pipeline.c b/src/intel/vulkan_hasvk/anv_pipeline.c index 632721fba36..6277e8ff95a 100644 --- a/src/intel/vulkan_hasvk/anv_pipeline.c +++ b/src/intel/vulkan_hasvk/anv_pipeline.c @@ -42,9 +42,6 @@ #include "vk_render_pass.h" #include "vk_util.h" -/* Needed for SWIZZLE macros */ -#include "program/prog_instruction.h" - /* Eventually, this will become part of anv_CreateShader. Unfortunately, * we can't do that yet because we don't have the ability to copy nir. */ @@ -261,11 +258,7 @@ static void populate_sampler_prog_key(const struct intel_device_info *devinfo, struct brw_sampler_prog_key_data *key) { - /* XXX: Handle texture swizzle on HSW- */ - for (int i = 0; i < BRW_MAX_SAMPLERS; i++) { - /* Assume color sampler, no swizzling. (Works for BDW+) */ - key->swizzles[i] = SWIZZLE_XYZW; - } + /* XXX: Handle texture swizzle Pre-HSW */ } static void