Commit: 1253f462386fa9df517454a58f714933718e6411
Parent: 9c671842f78678995f2a30c6a7858a8df92b47f8
Author: Randy Palamar
Date: Mon, 27 Jul 2026 18:31:51 -0700
build/meta: allow compile flags directly in Shader block declaration
Diffstat:
3 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/beamformer.meta b/beamformer.meta
@@ -271,28 +271,6 @@
[transmit_receive_orientations U16 MaxChannelCount]
}
-@Flags FilterCompileFlags
-{
- ComplexFilter
- Demodulate
-}
-
-@Flags DecodeCompileFlags
-{
- CooperativeMatrix
-}
-
-@Flags DASCompileFlags
-{
- CoherencyWeighting
-}
-
-@Flags ReshapeCompileFlags
-{
- Deinterleave
- Interleave
-}
-
@Emit
{
`read_only global u8 beamformer_data_kind_element_size[] = {`
@@ -358,7 +336,10 @@
{
@Enumeration DecodeMode
- @Flags DecodeCompileFlags
+ @Flags
+ {
+ CooperativeMatrix
+ }
@Bake
{
@@ -388,10 +369,14 @@
@Enumeration ShaderBufferSlot
@Enumeration ShaderResourceKind
- @Flags FilterCompileFlags
-
@ShaderAlias Demodulate
+ @Flags
+ {
+ ComplexFilter
+ Demodulate
+ }
+
@Bake
{
[DecimationRate decimation_rate U32]
@@ -427,10 +412,13 @@
@Enumeration ShaderBufferSlot
@Enumeration ShaderResourceKind
- @Flags DASCompileFlags
-
@Struct DASArrayParameters
+ @Flags
+ {
+ CoherencyWeighting
+ }
+
@Bake
{
[SingleFocus single_focus B32]
@@ -505,7 +493,12 @@
@Shader(reshape.glsl) Reshape
{
- @Flags ReshapeCompileFlags
+ @Flags
+ {
+ Deinterleave
+ Interleave
+ }
+
@Bake
{
[SizeX size_x U32]
diff --git a/build.c b/build.c
@@ -2701,6 +2701,12 @@ meta_pack_shader_common(MetaContext *ctx, MetaEntityID shader_id, MetaEntry *e,
result = meta_pack_table_entity(ctx, e, entry_count, e->name, shader_id);
}break;
+ case MetaEntryKind_Flags:{
+ e->name = push_str8_from_parts(ctx->arena, str8(""), ctx->entity_names.data[shader_id.value], str8("CompileFlags"));
+ result = meta_pack_table_entity(ctx, e, entry_count, e->name, shader_id);
+ goto reference;
+ }break;
+
case MetaEntryKind_PushConstants:{
e->name = push_str8_from_parts(ctx->arena, str8(""), ctx->entity_names.data[shader_id.value], str8("PushConstants"));
result = meta_pack_table_entity(ctx, e, entry_count, e->name, shader_id);
@@ -2715,7 +2721,6 @@ meta_pack_shader_common(MetaContext *ctx, MetaEntityID shader_id, MetaEntry *e,
}break;
case MetaEntryKind_Enumeration:
- case MetaEntryKind_Flags:
case MetaEntryKind_Constant:
case MetaEntryKind_Struct:
reference:
diff --git a/generated/beamformer.c b/generated/beamformer.c
@@ -124,15 +124,15 @@ typedef enum {
} BeamformerLiveImagingDirtyFlags;
typedef enum {
+ BeamformerDecodeCompileFlags_CooperativeMatrix = 1 << 0,
+} BeamformerDecodeCompileFlags;
+
+typedef enum {
BeamformerFilterCompileFlags_ComplexFilter = 1 << 0,
BeamformerFilterCompileFlags_Demodulate = 1 << 1,
} BeamformerFilterCompileFlags;
typedef enum {
- BeamformerDecodeCompileFlags_CooperativeMatrix = 1 << 0,
-} BeamformerDecodeCompileFlags;
-
-typedef enum {
BeamformerDASCompileFlags_CoherencyWeighting = 1 << 0,
} BeamformerDASCompileFlags;
@@ -835,9 +835,6 @@ read_only global str8 beamformer_shader_global_header_strings[] = {
"#define RCAOrientation_Columns 2\n"
"\n"),
str8_comp(""
- "#define CoherencyWeighting ((CompileFlags & (1 << 0)) != 0)\n"
- "\n"),
- str8_comp(""
"struct DASArrayParameters {\n"
" f32vec2 focal_vectors[MaxChannelCount];\n"
" int16_t sparse_elements[MaxChannelCount];\n"
@@ -845,6 +842,9 @@ read_only global str8 beamformer_shader_global_header_strings[] = {
"};\n"
"\n"),
str8_comp(""
+ "#define CoherencyWeighting ((CompileFlags & (1 << 0)) != 0)\n"
+ "\n"),
+ str8_comp(""
"layout(push_constant, std430) uniform PushConstants {\n"
" f32mat4 xdc_transform;\n"
" f32mat4 voxel_transform;\n"