d92de00cc1
This is a fairly fundamental change on how IDs are handled. It serves many purposes: - Improve performance. We only need to iterate over IDs which are relevant at any one time. - Makes sure we iterate through IDs in SPIR-V module declaration order rather than ID space. IDs don't have to be monotonically increasing, which was an assumption SPIRV-Cross used to have. It has apparently never been a problem until now. - Support LUTs of structs. We do this by interleaving declaration of constants and struct types in SPIR-V module order. To support this, the ParsedIR interface needed to change slightly. Before setting any ID with variant_set<T> we let ParsedIR know that an ID with a specific type has been added. The surface for change should be minimal. ParsedIR will maintain a per-type list of IDs which the cross-compiler will need to consider for later. Instead of looping over ir.ids[] (which can be extremely large), we loop over types now, using: ir.for_each_typed_id<SPIRVariable>([&](uint32_t id, SPIRVariable &var) { handle_variable(var); }); Now we make sure that we're never looking at irrelevant types.
38 lines
1018 B
GLSL
38 lines
1018 B
GLSL
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
constant int _7_tmp [[function_constant(201)]];
|
|
constant int _7 = is_function_constant_defined(_7_tmp) ? _7_tmp : -10;
|
|
constant int _20 = (_7 + 2);
|
|
constant uint _8_tmp [[function_constant(202)]];
|
|
constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 100u;
|
|
constant uint _25 = (_8 % 5u);
|
|
constant int4 _30 = int4(20, 30, _20, _20);
|
|
constant int2 _32 = int2(_30.y, _30.x);
|
|
constant int _33 = _30.y;
|
|
constant float _9_tmp [[function_constant(200)]];
|
|
constant float _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 3.141590118408203125;
|
|
|
|
struct main0_out
|
|
{
|
|
int m_4 [[user(locn0)]];
|
|
float4 gl_Position [[position]];
|
|
};
|
|
|
|
vertex main0_out main0()
|
|
{
|
|
main0_out out = {};
|
|
float4 pos = float4(0.0);
|
|
pos.y += float(_20);
|
|
pos.z += float(_25);
|
|
pos += float4(_30);
|
|
float2 _56 = pos.xy + float2(_32);
|
|
pos = float4(_56.x, _56.y, pos.z, pos.w);
|
|
out.gl_Position = pos;
|
|
out.m_4 = _33;
|
|
return out;
|
|
}
|
|
|