mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 04:08:25 +02:00
asahi,hk: deduplicate txf sampler settings
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30981>
This commit is contained in:
parent
1f45aa37e0
commit
1e2dcae4da
3 changed files with 18 additions and 20 deletions
|
|
@ -48,6 +48,21 @@ agx_translate_sampler_state_count(unsigned count, bool extended)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
agx_pack_txf_sampler(struct agx_sampler_packed *out)
|
||||
{
|
||||
agx_pack(out, SAMPLER, cfg) {
|
||||
/* Allow mipmapping. This is respected by txf, weirdly. */
|
||||
cfg.mip_filter = AGX_MIP_FILTER_NEAREST;
|
||||
|
||||
/* Out-of-bounds reads must return 0 */
|
||||
cfg.wrap_s = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.wrap_t = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.wrap_r = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.border_colour = AGX_BORDER_COLOUR_TRANSPARENT_BLACK;
|
||||
}
|
||||
}
|
||||
|
||||
/* Channels agree for RGBA but are weird for force 0/1 */
|
||||
|
||||
static inline enum agx_channel
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "hk_device.h"
|
||||
|
||||
#include "agx_bg_eot.h"
|
||||
#include "agx_helpers.h"
|
||||
#include "agx_opcodes.h"
|
||||
#include "agx_scratch.h"
|
||||
#include "hk_cmd_buffer.h"
|
||||
|
|
@ -58,16 +59,7 @@ hk_upload_rodata(struct hk_device *dev)
|
|||
cfg.buffer = dev->rodata.bo->va->addr + offs;
|
||||
}
|
||||
|
||||
agx_pack(map + offs, SAMPLER, cfg) {
|
||||
/* Allow mipmapping. This is respected by txf, weirdly. */
|
||||
cfg.mip_filter = AGX_MIP_FILTER_NEAREST;
|
||||
|
||||
/* Out-of-bounds reads must return 0 */
|
||||
cfg.wrap_s = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.wrap_t = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.wrap_r = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.border_colour = AGX_BORDER_COLOUR_TRANSPARENT_BLACK;
|
||||
}
|
||||
agx_pack_txf_sampler((struct agx_sampler_packed *)(map + offs));
|
||||
offs += AGX_SAMPLER_LENGTH;
|
||||
|
||||
/* The image heap is allocated on the device prior to the rodata. The heap
|
||||
|
|
|
|||
|
|
@ -2814,16 +2814,7 @@ agx_upload_samplers(struct agx_batch *batch, struct agx_compiled_shader *cs,
|
|||
agx_pool_alloc_aligned(&batch->pool, sampler_length * nr_samplers, 64);
|
||||
|
||||
/* Sampler #0 is reserved for txf */
|
||||
agx_pack(T.cpu, SAMPLER, cfg) {
|
||||
/* Allow mipmapping. This is respected by txf, weirdly. */
|
||||
cfg.mip_filter = AGX_MIP_FILTER_NEAREST;
|
||||
|
||||
/* Out-of-bounds reads must return 0 */
|
||||
cfg.wrap_s = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.wrap_t = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.wrap_r = AGX_WRAP_CLAMP_TO_BORDER;
|
||||
cfg.border_colour = AGX_BORDER_COLOUR_TRANSPARENT_BLACK;
|
||||
}
|
||||
agx_pack_txf_sampler(T.cpu);
|
||||
|
||||
/* Remaining samplers are API samplers */
|
||||
uint8_t *out_sampler = (uint8_t *)T.cpu + sampler_length;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue