mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
asahi: Add XML for custom border colours
These use extended sampler descriptors. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20570>
This commit is contained in:
parent
3a819bd22e
commit
10eaa4a2ec
3 changed files with 62 additions and 5 deletions
36
src/asahi/lib/agx_helpers.h
Normal file
36
src/asahi/lib/agx_helpers.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2023 Alyssa Rosenzweig
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef __AGX_HELPERS_H
|
||||
#define __AGX_HELPERS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "agx_pack.h"
|
||||
|
||||
static inline enum agx_sampler_states
|
||||
agx_translate_sampler_state_count(unsigned count, bool extended)
|
||||
{
|
||||
assert(count <= 16 && "max 16 sampler state registers supported");
|
||||
|
||||
if (count == 0) {
|
||||
return AGX_SAMPLER_STATES_0;
|
||||
} else if (extended) {
|
||||
if (count <= 8)
|
||||
return AGX_SAMPLER_STATES_8_EXTENDED;
|
||||
else
|
||||
return AGX_SAMPLER_STATES_16_EXTENDED;
|
||||
} else {
|
||||
if (count <= 4)
|
||||
return AGX_SAMPLER_STATES_4_COMPACT;
|
||||
else if (count <= 8)
|
||||
return AGX_SAMPLER_STATES_8_COMPACT;
|
||||
else if (count <= 12)
|
||||
return AGX_SAMPLER_STATES_12_COMPACT;
|
||||
else
|
||||
return AGX_SAMPLER_STATES_16_COMPACT;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -289,6 +289,7 @@
|
|||
<value name="Transparent black" value="0"/>
|
||||
<value name="Opaque black" value="1"/>
|
||||
<value name="Opaque white" value="2"/>
|
||||
<value name="Custom" value="3"/>
|
||||
</enum>
|
||||
|
||||
<struct name="Sampler" size="8">
|
||||
|
|
@ -308,6 +309,13 @@
|
|||
<field name="Seamful cube maps" size="1" start="57" type="bool"/>
|
||||
</struct>
|
||||
|
||||
<struct name="Border" size="16">
|
||||
<field name="Channel 0" size="32" start="0:0" type="hex"/>
|
||||
<field name="Channel 1" size="32" start="1:0" type="hex"/>
|
||||
<field name="Channel 2" size="32" start="2:0" type="hex"/>
|
||||
<field name="Channel 3" size="32" start="3:0" type="hex"/>
|
||||
</struct>
|
||||
|
||||
<!--- Pointed to from the command buffer -->
|
||||
<struct name="Scissor" size="16">
|
||||
<field name="Max X" size="16" start="0:0" type="uint"/>
|
||||
|
|
@ -519,11 +527,21 @@
|
|||
<field name="Depth bias" size="16" start="16" type="uint"/>
|
||||
</struct>
|
||||
|
||||
<enum name="Sampler states">
|
||||
<value name="0" value="0"/>
|
||||
<value name="4 compact" value="1"/>
|
||||
<value name="8 compact" value="2"/>
|
||||
<value name="12 compact" value="3"/>
|
||||
<value name="16 compact" value="4"/>
|
||||
<value name="8 extended" value="6"/>
|
||||
<value name="16 extended" value="7"/>
|
||||
</enum>
|
||||
|
||||
<struct name="Fragment shader" size="16">
|
||||
<field name="Unknown 0" size="1" start="0" type="hex" default="0"/>
|
||||
<field name="Uniform register count" size="3" start="1" type="uint" modifier="groups(64)"/>
|
||||
<field name="Texture state register count" size="5" start="4" type="uint" modifier="groups(8)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="uint" modifier="groups(4)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="Sampler states"/>
|
||||
<field name="Preshader register count" size="4" start="12" type="uint" modifier="groups(16)"/>
|
||||
<field name="CF binding count" size="7" start="16" type="uint"/>
|
||||
<field name="Unknown 1:0" size="2" start="1:0" type="hex"/>
|
||||
|
|
@ -677,7 +695,7 @@
|
|||
<field name="Unknown 0" size="1" start="0" type="hex" default="0"/>
|
||||
<field name="Uniform register count" size="3" start="1" type="uint" modifier="groups(64)"/>
|
||||
<field name="Texture state register count" size="5" start="4" type="uint" modifier="groups(8)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="uint" modifier="groups(4)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="Sampler states"/>
|
||||
<field name="Preshader register count" size="4" start="12" type="uint" modifier="groups(16)"/>
|
||||
</struct>
|
||||
|
||||
|
|
@ -770,7 +788,7 @@
|
|||
<struct name="Launch" size="36">
|
||||
<field name="Uniform register count" size="3" start="1" type="uint" modifier="groups(64)"/>
|
||||
<field name="Texture state register count" size="5" start="4" type="uint" modifier="groups(8)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="uint" modifier="groups(4)"/>
|
||||
<field name="Sampler state register count" size="3" start="9" type="Sampler states"/>
|
||||
<field name="Preshader register count" size="4" start="12" type="uint" modifier="groups(16)"/>
|
||||
<field name="Block Type" size="3" start="29" type="CDM Block Type" default="Compute Kernel"/>
|
||||
<field name="Pipeline" size="32" start="1:0" type="address"/>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdio.h>
|
||||
#include "asahi/compiler/agx_compile.h"
|
||||
#include "asahi/lib/agx_formats.h"
|
||||
#include "asahi/lib/agx_helpers.h"
|
||||
#include "asahi/lib/agx_pack.h"
|
||||
#include "asahi/lib/agx_ppp.h"
|
||||
#include "asahi/lib/agx_usc.h"
|
||||
|
|
@ -1890,7 +1891,8 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines,
|
|||
cfg.uniform_register_count = ctx->vs->info.push_count;
|
||||
cfg.preshader_register_count = ctx->vs->info.nr_preamble_gprs;
|
||||
cfg.texture_state_register_count = tex_count;
|
||||
cfg.sampler_state_register_count = tex_count;
|
||||
cfg.sampler_state_register_count =
|
||||
agx_translate_sampler_state_count(tex_count, false);
|
||||
}
|
||||
out += AGX_VDM_STATE_VERTEX_SHADER_WORD_0_LENGTH;
|
||||
|
||||
|
|
@ -2071,7 +2073,8 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines,
|
|||
cfg.uniform_register_count = ctx->fs->info.push_count;
|
||||
cfg.preshader_register_count = ctx->fs->info.nr_preamble_gprs;
|
||||
cfg.texture_state_register_count = frag_tex_count;
|
||||
cfg.sampler_state_register_count = frag_tex_count;
|
||||
cfg.sampler_state_register_count =
|
||||
agx_translate_sampler_state_count(frag_tex_count, false);
|
||||
cfg.cf_binding_count = ctx->fs->info.varyings.fs.nr_bindings;
|
||||
cfg.cf_bindings = batch->varyings;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue