Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .jvmopts
Binary file not shown.
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ lazy val lwjglNatives = {

val lwjglVersion = "3.3.3"
val jomlVersion = "1.10.0"
javaOptions += "-Xmx8G"
javaOptions += "-XX:+UseG1GC"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G1 is the default GC so no need to enable it




lazy val root = (project in file("."))
Expand Down
Binary file added generated2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added generated3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added julia/frame07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added key_issue_code.txt
Binary file not shown.
Binary file added output.log
Binary file not shown.
Binary file added output/frame00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added output/frame01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added output_io.computenode.cyfra.samples.playground.log
Binary file not shown.
Binary file added output_io.computenode.cyfra.samples.sample.log
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added renderFrame_code.txt
Binary file not shown.
18 changes: 8 additions & 10 deletions src/main/scala/io/computenode/cyfra/dsl/GSeq.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.computenode.cyfra.dsl

import io.computenode.cyfra.dsl.Algebra.{*, given}
import io.computenode.cyfra.dsl.Algebra.{*, given}
import io.computenode.cyfra.dsl.Control.{Scope, when}
import io.computenode.cyfra.dsl.Expression.{ConstInt32, E}
import io.computenode.cyfra.dsl.GSeq.*
Expand Down Expand Up @@ -65,8 +65,6 @@ class GSeq[T <: Value : Tag : FromExpr](

def lastOr(t: T): T =
fold(t, (_: T, elem: T) => elem)



object GSeq:

Expand Down Expand Up @@ -119,12 +117,12 @@ object GSeq:
val streamNextExpr = seq.source.next
val seqExprs = seq.elemOps.map(_.fn)

val limitExpr = ConstInt32(seq.limit.getOrElse(throw new IllegalArgumentException("Reduce on infinite stream is not supported")))
// Ensure a default limit to avoid infinite stream errors
val defaultLimit = 100 // Set a safe default limit
Copy link
Member

@szymon-rd szymon-rd Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is a good idea. It's pretty similar to letting people write fors in a language without upper bound, and having default = 100, it can be quite confusing. If you would like to make it more ergonomic you could make a GSeq.reduce result only be a Value after limit is called on it. That would be quite challenging but a good Scala excercise.

val limitExpr = ConstInt32(seq.limit.getOrElse {
println("⚠ Warning: No limit set, using default limit of " + defaultLimit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to be removed after addressing previous comment, but regardless, if we are to introduce warnings it's not a good idea to println. You usually want to use some logging API that can be configured/adjusted by library user, SLF4J is a good example.

defaultLimit
})

override val exprDependencies: List[E[_]] = List(zeroExpr, streamInitExpr, limitExpr)
override val introducedScopes: List[Scope[_]] = Scope(fnExpr)(using fnExpr.tag) :: Scope(streamNextExpr)(using streamNextExpr.tag) :: seqExprs.map(e => Scope(e)(using e.tag))





override val introducedScopes: List[Scope[_]] = Scope(fnExpr)(using fnExpr.tag) :: Scope(streamNextExpr)(using streamNextExpr.tag) :: seqExprs.map(e => Scope(e)(using e.tag))
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AnimationRtRenderer(params: AnimationRtRenderer.Parameters) extends RtRend
List.iterate((initialMem, 0), params.iterations + 1) { case (mem, render) =>
UniformContext.withUniform(RaytracingIteration(render, time)):
val fmem = Vec4FloatMem(mem)
val result = Await.result(fmem.map(fn), 1.minute)
val result = Await.result(fmem.map(fn), 5.minute)
(result, render + 1)
}.map(_._1).last

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private[cyfra] object ExpressionCompiler:
case (from, _: ToUInt32[_]) if from.tag =:= Float32Tag.tag => Op.OpConvertFToU
case (from, _: ToInt32[_]) if from.tag =:= UInt32Tag.tag => Op.OpBitcast
case (from, _: ToUInt32[_]) if from.tag =:= Int32Tag.tag => Op.OpBitcast
case _ => throw new MatchError(s"Unexpected input: (${cexpr.fromTag}, $cexpr)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
val instructions = List(
Instruction(tfOpcode, List(
Expand Down
Binary file added structure.txt
Binary file not shown.