Give the per-object motion fragment shader's OpSelect a condition vector, as SPIR-V 1.0 needs

tools/make_mvobj_fs.py assembled OpSelect of a vec4 with a scalar bool condition, which only SPIR-V 1.4 and later
allow. The module is 1.0, so spirv-val in the Vulkan validation layer rejected it (Expected vector sizes of Result Type
and the condition to be equal: Select). The condition is now splatted into a bvec4 first; runtime/vk_mvobj_fs.h is
regenerated and passes spirv-val.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2andClaude Opus 5.5 committed 2026-11-10 14:59:31 +01:00
1 parent 1503b17f7d
commit 708e0cfe8d
2 files changed
+36 -29

No files matched your search

+30 -28
View File
@@ -1,7 +1,7 @@
// Generated by tools/make_mvobj_fs.py: the per-object motion fragment shader (vk_mvobj.c). Do not edit.
#define MVOBJ_FS_LOCATION_WORD 24 // the input Location literal, patched to the variant's
static const uint32_t mvobj_fs_spv[] = {
0x07230203, 0x00010000, 0x00000000, 0x00000034, 0x00000000, 0x00020011, 0x00000001, 0x0003000e,
0x07230203, 0x00010000, 0x00000000, 0x00000036, 0x00000000, 0x00020011, 0x00000001, 0x0003000e,
0x00000000, 0x00000001, 0x0008000f, 0x00000004, 0x00000001, 0x6e69616d, 0x00000000, 0x0000000e,
0x0000000f, 0x00000010, 0x00030010, 0x00000001, 0x00000007, 0x00040047, 0x0000000e, 0x0000001e,
0x00000000, 0x00040047, 0x0000000f, 0x0000000b, 0x0000000f, 0x00040047, 0x00000010, 0x0000001e,
@@ -9,31 +9,33 @@ static const uint32_t mvobj_fs_spv[] = {
0x00000000, 0x00040047, 0x00000011, 0x00000022, 0x00000000, 0x00040047, 0x00000011, 0x00000021,
0x00000001, 0x00020013, 0x00000002, 0x00030021, 0x00000003, 0x00000002, 0x00030016, 0x00000004,
0x00000020, 0x00040017, 0x00000005, 0x00000004, 0x00000002, 0x00040017, 0x00000006, 0x00000004,
0x00000004, 0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x00020014, 0x00000008, 0x00040020,
0x00000009, 0x00000001, 0x00000006, 0x00040020, 0x0000000a, 0x00000003, 0x00000006, 0x0003001e,
0x0000000b, 0x00000006, 0x00040020, 0x0000000c, 0x00000002, 0x0000000b, 0x00040020, 0x00000017,
0x00000002, 0x00000006, 0x0004002b, 0x00000004, 0x00000012, 0x3f000000, 0x0004002b, 0x00000004,
0x00000013, 0x00000000, 0x0004002b, 0x00000004, 0x00000014, 0x358637bd, 0x0004002b, 0x00000007,
0x00000015, 0x00000000, 0x0007002c, 0x00000006, 0x00000016, 0x00000013, 0x00000013, 0x00000013,
0x00000013, 0x0004003b, 0x00000009, 0x0000000e, 0x00000001, 0x0004003b, 0x00000009, 0x0000000f,
0x00000001, 0x0004003b, 0x0000000a, 0x00000010, 0x00000003, 0x0004003b, 0x0000000c, 0x00000011,
0x00000002, 0x00050036, 0x00000002, 0x00000001, 0x00000000, 0x00000003, 0x000200f8, 0x00000018,
0x00050041, 0x00000017, 0x00000019, 0x00000011, 0x00000015, 0x0004003d, 0x00000006, 0x0000001a,
0x00000019, 0x0004003d, 0x00000006, 0x0000001b, 0x0000000e, 0x0004003d, 0x00000006, 0x0000001c,
0x0000000f, 0x0007004f, 0x00000005, 0x0000001d, 0x0000001c, 0x0000001c, 0x00000000, 0x00000001,
0x0007004f, 0x00000005, 0x0000001e, 0x0000001a, 0x0000001a, 0x00000002, 0x00000003, 0x00050083,
0x00000005, 0x0000001f, 0x0000001d, 0x0000001e, 0x00050051, 0x00000004, 0x00000020, 0x0000001b,
0x00000000, 0x00050051, 0x00000004, 0x00000021, 0x0000001b, 0x00000001, 0x00050051, 0x00000004,
0x00000022, 0x0000001b, 0x00000003, 0x00050088, 0x00000004, 0x00000023, 0x00000020, 0x00000022,
0x00050088, 0x00000004, 0x00000024, 0x00000021, 0x00000022, 0x00050051, 0x00000004, 0x00000025,
0x0000001a, 0x00000000, 0x00050051, 0x00000004, 0x00000026, 0x0000001a, 0x00000001, 0x00050085,
0x00000004, 0x00000027, 0x00000023, 0x00000012, 0x00050081, 0x00000004, 0x00000028, 0x00000027,
0x00000012, 0x00050085, 0x00000004, 0x00000029, 0x00000028, 0x00000025, 0x00050085, 0x00000004,
0x0000002a, 0x00000024, 0x00000012, 0x00050083, 0x00000004, 0x0000002b, 0x00000012, 0x0000002a,
0x00050085, 0x00000004, 0x0000002c, 0x0000002b, 0x00000026, 0x00050051, 0x00000004, 0x0000002d,
0x0000001f, 0x00000000, 0x00050051, 0x00000004, 0x0000002e, 0x0000001f, 0x00000001, 0x00050083,
0x00000004, 0x0000002f, 0x00000029, 0x0000002d, 0x00050083, 0x00000004, 0x00000030, 0x0000002c,
0x0000002e, 0x00070050, 0x00000006, 0x00000031, 0x0000002f, 0x00000030, 0x00000013, 0x00000013,
0x000500ba, 0x00000008, 0x00000032, 0x00000022, 0x00000014, 0x000600a9, 0x00000006, 0x00000033,
0x00000032, 0x00000031, 0x00000016, 0x0003003e, 0x00000010, 0x00000033, 0x000100fd, 0x00010038
0x00000004, 0x00040015, 0x00000007, 0x00000020, 0x00000000, 0x00020014, 0x00000008, 0x00040017,
0x00000018, 0x00000008, 0x00000004, 0x00040020, 0x00000009, 0x00000001, 0x00000006, 0x00040020,
0x0000000a, 0x00000003, 0x00000006, 0x0003001e, 0x0000000b, 0x00000006, 0x00040020, 0x0000000c,
0x00000002, 0x0000000b, 0x00040020, 0x00000017, 0x00000002, 0x00000006, 0x0004002b, 0x00000004,
0x00000012, 0x3f000000, 0x0004002b, 0x00000004, 0x00000013, 0x00000000, 0x0004002b, 0x00000004,
0x00000014, 0x358637bd, 0x0004002b, 0x00000007, 0x00000015, 0x00000000, 0x0007002c, 0x00000006,
0x00000016, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x0004003b, 0x00000009, 0x0000000e,
0x00000001, 0x0004003b, 0x00000009, 0x0000000f, 0x00000001, 0x0004003b, 0x0000000a, 0x00000010,
0x00000003, 0x0004003b, 0x0000000c, 0x00000011, 0x00000002, 0x00050036, 0x00000002, 0x00000001,
0x00000000, 0x00000003, 0x000200f8, 0x00000019, 0x00050041, 0x00000017, 0x0000001a, 0x00000011,
0x00000015, 0x0004003d, 0x00000006, 0x0000001b, 0x0000001a, 0x0004003d, 0x00000006, 0x0000001c,
0x0000000e, 0x0004003d, 0x00000006, 0x0000001d, 0x0000000f, 0x0007004f, 0x00000005, 0x0000001e,
0x0000001d, 0x0000001d, 0x00000000, 0x00000001, 0x0007004f, 0x00000005, 0x0000001f, 0x0000001b,
0x0000001b, 0x00000002, 0x00000003, 0x00050083, 0x00000005, 0x00000020, 0x0000001e, 0x0000001f,
0x00050051, 0x00000004, 0x00000021, 0x0000001c, 0x00000000, 0x00050051, 0x00000004, 0x00000022,
0x0000001c, 0x00000001, 0x00050051, 0x00000004, 0x00000023, 0x0000001c, 0x00000003, 0x00050088,
0x00000004, 0x00000024, 0x00000021, 0x00000023, 0x00050088, 0x00000004, 0x00000025, 0x00000022,
0x00000023, 0x00050051, 0x00000004, 0x00000026, 0x0000001b, 0x00000000, 0x00050051, 0x00000004,
0x00000027, 0x0000001b, 0x00000001, 0x00050085, 0x00000004, 0x00000028, 0x00000024, 0x00000012,
0x00050081, 0x00000004, 0x00000029, 0x00000028, 0x00000012, 0x00050085, 0x00000004, 0x0000002a,
0x00000029, 0x00000026, 0x00050085, 0x00000004, 0x0000002b, 0x00000025, 0x00000012, 0x00050083,
0x00000004, 0x0000002c, 0x00000012, 0x0000002b, 0x00050085, 0x00000004, 0x0000002d, 0x0000002c,
0x00000027, 0x00050051, 0x00000004, 0x0000002e, 0x00000020, 0x00000000, 0x00050051, 0x00000004,
0x0000002f, 0x00000020, 0x00000001, 0x00050083, 0x00000004, 0x00000030, 0x0000002a, 0x0000002e,
0x00050083, 0x00000004, 0x00000031, 0x0000002d, 0x0000002f, 0x00070050, 0x00000006, 0x00000032,
0x00000030, 0x00000031, 0x00000013, 0x00000013, 0x000500ba, 0x00000008, 0x00000033, 0x00000023,
0x00000014, 0x00070050, 0x00000018, 0x00000034, 0x00000033, 0x00000033, 0x00000033, 0x00000033,
0x000600a9, 0x00000006, 0x00000035, 0x00000034, 0x00000032, 0x00000016, 0x0003003e, 0x00000010,
0x00000035, 0x000100fd, 0x00010038
};
+6 -1
View File
@@ -80,6 +80,7 @@ t_pin, t_pout, t_struct, t_pu, t_pf_u = a.id(), a.id(), a.id(), a.id(), a.id()
v_prev, v_frag, v_out, v_p = a.id(), a.id(), a.id(), a.id()
c_half, c_zero, c_eps, c_u0, c_vzero = a.id(), a.id(), a.id(), a.id(), a.id()
t_pv4u = a.id()
t_bv4 = a.id()
a.op('entry', OpEntryPoint, 4, main, *string('main'), v_prev, v_frag, v_out) # Fragment
a.op('exec', OpExecutionMode, main, 7) # OriginUpperLeft
a.loc_ins = a.op('dec', OpDecorate, v_prev, Location, 0)
@@ -96,6 +97,7 @@ a.op('types', OpTypeVector, t_v2, t_f, 2)
a.op('types', OpTypeVector, t_v4, t_f, 4)
a.op('types', OpTypeInt, t_u, 32, 0)
a.op('types', OpTypeBool, t_bool)
a.op('types', OpTypeVector, t_bv4, t_bool, 4)
a.op('types', OpTypePointer, t_pin, Input, t_v4)
a.op('types', OpTypePointer, t_pout, Output, t_v4)
a.op('types', OpTypeStruct, t_struct, t_v4)
@@ -149,7 +151,10 @@ a.op(F, OpFSub, t_f, mx, x3, wx)
a.op(F, OpFSub, t_f, my, y3, wy)
mv = a.id(); a.op(F, OpCompositeConstruct, t_v4, mv, mx, my, c_zero, c_zero)
ok = a.id(); a.op(F, OpFOrdGreaterThan, t_bool, ok, pw, c_eps)
res = a.id(); a.op(F, OpSelect, t_v4, res, ok, mv, c_vzero)
# SPIR-V 1.0 (the module's version): OpSelect of a vector takes a condition vector of the same size; a scalar
# condition is allowed only from 1.4 on, and spirv-val (the validation layer) rejects the module otherwise.
okv = a.id(); a.op(F, OpCompositeConstruct, t_bv4, okv, ok, ok, ok, ok)
res = a.id(); a.op(F, OpSelect, t_v4, res, okv, mv, c_vzero)
a.op(F, OpStore, v_out, res)
a.op(F, OpReturn)
a.op(F, OpFunctionEnd)