@@ -125,9 +125,9 @@ pub const Decl = struct {
125
125
/// - For `invocation_global`, this is the result-id of the associated InvocationGlobal instruction.
126
126
result_id : Id ,
127
127
/// The offset of the first dependency of this decl in the `decl_deps` array.
128
- begin_dep : u32 ,
128
+ begin_dep : usize = 0 ,
129
129
/// The past-end offset of the dependencies of this decl in the `decl_deps` array.
130
- end_dep : u32 ,
130
+ end_dep : usize = 0 ,
131
131
};
132
132
133
133
/// This models a kernel entry point.
@@ -258,7 +258,6 @@ pub fn resolveNav(module: *Module, ip: *InternPool, nav_index: InternPool.Nav.In
258
258
.generic = > .invocation_global ,
259
259
else = > .global ,
260
260
};
261
-
262
261
entry .value_ptr .* = try module .allocDecl (kind );
263
262
}
264
263
@@ -782,15 +781,15 @@ pub fn builtin(
782
781
const gop = try module .cache .builtins .getOrPut (module .gpa , .{ spirv_builtin , storage_class });
783
782
if (! gop .found_existing ) {
784
783
const decl_index = try module .allocDecl (.global );
785
- const result_id = module .declPtr (decl_index ).result_id ;
784
+ const decl = module .declPtr (decl_index );
785
+
786
786
gop .value_ptr .* = decl_index ;
787
787
try module .sections .globals .emit (module .gpa , .OpVariable , .{
788
788
.id_result_type = result_ty_id ,
789
- .id_result = result_id ,
789
+ .id_result = decl . result_id ,
790
790
.storage_class = storage_class ,
791
791
});
792
- try module .decorate (result_id , .{ .built_in = .{ .built_in = spirv_builtin } });
793
- try module .declareDeclDeps (decl_index , &.{});
792
+ try module .decorate (decl .result_id , .{ .built_in = .{ .built_in = spirv_builtin } });
794
793
}
795
794
return gop .value_ptr .* ;
796
795
}
@@ -847,8 +846,6 @@ pub fn allocDecl(module: *Module, kind: Decl.Kind) !Decl.Index {
847
846
try module .decls .append (module .gpa , .{
848
847
.kind = kind ,
849
848
.result_id = module .allocId (),
850
- .begin_dep = undefined ,
851
- .end_dep = undefined ,
852
849
});
853
850
854
851
return @as (Decl .Index , @enumFromInt (@as (u32 , @intCast (module .decls .items .len - 1 ))));
@@ -858,17 +855,6 @@ pub fn declPtr(module: *Module, index: Decl.Index) *Decl {
858
855
return & module .decls .items [@intFromEnum (index )];
859
856
}
860
857
861
- /// Declare ALL dependencies for a decl.
862
- pub fn declareDeclDeps (module : * Module , decl_index : Decl.Index , deps : []const Decl.Index ) ! void {
863
- const begin_dep : u32 = @intCast (module .decl_deps .items .len );
864
- try module .decl_deps .appendSlice (module .gpa , deps );
865
- const end_dep : u32 = @intCast (module .decl_deps .items .len );
866
-
867
- const decl = module .declPtr (decl_index );
868
- decl .begin_dep = begin_dep ;
869
- decl .end_dep = end_dep ;
870
- }
871
-
872
858
/// Declare a SPIR-V function as an entry point. This causes an extra wrapper
873
859
/// function to be generated, which is then exported as the real entry point. The purpose of this
874
860
/// wrapper is to allocate and initialize the structure holding the instance globals.
0 commit comments