intel/compiler: Stop including src/mesa/main/config.h

src/mesa/main includes are for Mesa's OpenGL implementation, and the
compiler is used in Vulkan drivers and other tools.  We really only
needed one #define, which is that we offer 32 samplers.  It probably
makes more sense to have our own defined limit for that rather than
importing a project-wide value which theoretically could be adjusted,
so swap MAX_SAMPLERS for a new BRW_MAX_SAMPLERS and call it a day.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17309>
This commit is contained in:
Kenneth Graunke 2022-06-14 17:13:20 -07:00 committed by Marge Bot
parent 434bc468fe
commit a141a351de
6 changed files with 16 additions and 15 deletions

View File

@ -49,7 +49,7 @@
#define KEY_INIT_NO_ID() \
.base.subgroup_size_type = BRW_SUBGROUP_SIZE_UNIFORM, \
.base.tex.swizzles[0 ... MAX_SAMPLERS - 1] = 0x688, \
.base.tex.swizzles[0 ... BRW_MAX_SAMPLERS - 1] = 0x688, \
.base.tex.compressed_multisample_layout_mask = ~0
#define KEY_INIT() \
.base.program_string_id = ish->program_id, \
@ -60,7 +60,7 @@ static void
crocus_sanitize_tex_key(struct brw_sampler_prog_key_data *key)
{
key->gather_channel_quirk_mask = 0;
for (unsigned s = 0; s < MAX_SAMPLERS; s++) {
for (unsigned s = 0; s < BRW_MAX_SAMPLERS; s++) {
key->swizzles[s] = SWIZZLE_NOOP;
key->gfx6_gather_wa[s] = 0;
}

View File

@ -50,12 +50,12 @@
#define KEY_INIT(prefix) \
.prefix.program_string_id = ish->program_id, \
.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.subgroup_size_type = BRW_SUBGROUP_SIZE_UNIFORM, \
.base.tex.swizzles[0 ... MAX_SAMPLERS - 1] = 0x688, \
.base.tex.compressed_multisample_layout_mask = ~0, \
#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.subgroup_size_type = BRW_SUBGROUP_SIZE_UNIFORM, \
.base.tex.swizzles[0 ... BRW_MAX_SAMPLERS - 1] = 0x688, \
.base.tex.compressed_multisample_layout_mask = ~0, \
.base.tex.msaa_16 = (gen >= 9 ? ~0 : 0)
struct iris_threaded_compile_job {

View File

@ -203,7 +203,7 @@ blorp_params_init(struct blorp_params *params)
static void
blorp_init_base_prog_key(struct brw_base_prog_key *key)
{
for (int i = 0; i < MAX_SAMPLERS; i++)
for (int i = 0; i < BRW_MAX_SAMPLERS; i++)
key->tex.swizzles[i] = SWIZZLE_XYZW;
}

View File

@ -27,7 +27,6 @@
#include <stdio.h>
#include "c11/threads.h"
#include "dev/intel_device_info.h"
#include "main/config.h"
#include "util/ralloc.h"
#include "util/u_math.h"
@ -177,6 +176,8 @@ enum PACKED gfx6_gather_sampler_wa {
WA_16BIT = 4, /* if we have a 16bit format needing wa */
};
#define BRW_MAX_SAMPLERS 32
/**
* Sampler information needed by VS, WM, and GS program cache keys.
*/
@ -184,7 +185,7 @@ struct brw_sampler_prog_key_data {
/**
* EXT_texture_swizzle and DEPTH_TEXTURE_MODE swizzles.
*/
uint16_t swizzles[MAX_SAMPLERS];
uint16_t swizzles[BRW_MAX_SAMPLERS];
uint32_t gl_clamp_mask[3];
@ -208,7 +209,7 @@ struct brw_sampler_prog_key_data {
/**
* For Sandybridge, which shader w/a we need for gather quirks.
*/
enum gfx6_gather_sampler_wa gfx6_gather_wa[MAX_SAMPLERS];
enum gfx6_gather_sampler_wa gfx6_gather_wa[BRW_MAX_SAMPLERS];
/**
* Texture units that have a YUV image bound.
@ -223,7 +224,7 @@ struct brw_sampler_prog_key_data {
uint32_t bt2020_mask;
/* Scale factor for each texture. */
float scale_factors[32];
float scale_factors[BRW_MAX_SAMPLERS];
};
/** An enum representing what kind of input gl_SubgroupSize is. */

View File

@ -73,7 +73,7 @@ debug_sampler_recompile(const struct brw_compiler *c, void *log,
found |= check("ayuv image bound", ayuv_image_mask);
found |= check("xyuv image bound", xyuv_image_mask);
for (unsigned i = 0; i < MAX_SAMPLERS; i++) {
for (unsigned i = 0; i < BRW_MAX_SAMPLERS; i++) {
found |= check("EXT_texture_swizzle or DEPTH_TEXTURE_MODE", swizzles[i]);
found |= check("textureGather workarounds", gfx6_gather_wa[i]);
found |= check_float("scale factor", scale_factors[i]);

View File

@ -308,7 +308,7 @@ populate_sampler_prog_key(const struct intel_device_info *devinfo,
key->msaa_16 = ~0;
/* XXX: Handle texture swizzle on HSW- */
for (int i = 0; i < MAX_SAMPLERS; i++) {
for (int i = 0; i < BRW_MAX_SAMPLERS; i++) {
/* Assume color sampler, no swizzling. (Works for BDW+) */
key->swizzles[i] = SWIZZLE_XYZW;
}