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

+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)