Skip to content

Commit

Permalink
Merge pull request #8 from arhik/main
Browse files Browse the repository at this point in the history
upstream sync
  • Loading branch information
arhik authored Mar 23, 2024
2 parents 8fe7908 + e1da693 commit 4cd4ef7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8'
- 'nightly'
- '1.9'
- '1.10'
os:
- ubuntu-latest
arch:
Expand All @@ -34,10 +34,6 @@ jobs:
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
files: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ function wgslFunctionStatement(io, stmnt; indent=true, indentLevel=0)
if cond == true
wgslFunctionStatements(io, ifblock;indent=true, indentLevel=indentLevel)
end
# TODO this is incomplete
elseif @capture(stmnt, @forloop forLoop_)
@capture(forLoop, for idx_::idxType_ in range_ block__ end)
@capture(range, start_:step_:stop_)
#idxInit = @var Base.eval(:($idx::UInt32 = Meta.parse(wgslType(UInt32(r.start - 1)))))
#@infiltrate
idxExpr = :($idx::$idxType)
write(io, " "^(4*(indentLevel-1))*"for( var $(wgslType(idxExpr)) = $(start); $idx < $(stop); $(idx)++) { \n")
wgslFunctionStatements(io, block; indent=false, indentLevel=indentLevel)
write(io, " "^(4*indentLevel)*"}\n")
elseif @capture(stmnt, @escif if cond_ blocks__ end)
write(io, " "^(4*(indentLevel-1))*"if $cond {\n")
wgslFunctionStatements(io, blocks; indent=false, indentLevel=indentLevel)
Expand Down
8 changes: 4 additions & 4 deletions src/typeutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ juliaToWGSLTypes = Dict(
wgslType(a::Bool) = a;
wgslType(a::Int32) = "$(a)i";
wgslType(a::UInt32) = "$(a)u";
wgslType(a::Float16) = a;
wgslType(a::Float32) = a;
wgslType(a::Float16) = "$(a)"; #TODO refer to wgsl specs and update this
wgslType(a::Float32) = "$(a)";
wgslType(a::Int) = a;
wgslType(a::Number) = a;

Expand Down Expand Up @@ -154,9 +154,9 @@ function wgslType(expr::Union{Expr, Type{Expr}})
return "$(wgslType(eval(f)))($(xargs))"
end
elseif @capture(expr, a_::b_)
return "$a::$(wgslType(eval(b)))"
return "$a:$(wgslType(eval(b)))"
elseif @capture(expr, a_::b_ = c_)
return "$a::$(wgslType(eval(b))) = $c"
return "$a:$(wgslType(eval(b))) = $c"
elseif @capture(expr, a_.b_)
return "$a.$b"
elseif @capture(expr, ref_[b_])
Expand Down

0 comments on commit 4cd4ef7

Please sign in to comment.