Skip to content

Commit

Permalink
More hacks!
Browse files Browse the repository at this point in the history
  • Loading branch information
christiangnrd committed Dec 10, 2024
1 parent 06daaf3 commit bea48d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/mtl/libmtl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,20 @@ struct MTLOrigin
x::NSUInteger
y::NSUInteger
z::NSUInteger
MTLOrigin(x = 0, y = 0, z = 0) = begin
#= none:1 =#
new(x, y, z)
end
MTLOrigin(x = 0, y = 0, z = 0) = new(x, y, z)
end

struct MTLSize
width::NSUInteger
height::NSUInteger
depth::NSUInteger
MTLSize(w = 1, h = 1, d = 1) = begin
#= none:1 =#
new(w, h, d)
end
MTLSize(w = 1, h = 1, d = 1) = new(w, h, d)
end

struct MTLRegion
origin::MTLOrigin
size::MTLSize
MTLRegion(origin = MTLOrigin(), size = MTLSize()) = begin
#= none:1 =#
new(origin, size)
end
MTLRegion(origin = MTLOrigin(), size = MTLSize()) = new(origin, size)
end

struct MTLSamplePosition
Expand Down
4 changes: 4 additions & 0 deletions res/wrap/wrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ function rewriter!(ctx, options)
expr = node.exprs[1]
con = options["api"][structName]["constructor"] |> Meta.parse

if con.head == :(=) && con.args[2] isa Expr && con.args[2].head == :block &&
con.args[2].args[1] isa LineNumberNode && con.args[2].args[2].head == :call
con.args[2] = con.args[2].args[2]
end
push!(expr.args[3].args, con)
end
end
Expand Down

0 comments on commit bea48d8

Please sign in to comment.