Repository navigation
RedByteFX 1.2.0
Shader DSL and compilation
- A subexpression that one statement reads more than once is spelled once and reused. Layered helpers no longer grow exponentially:
fbm(domainWarp(uv))went from 3.4 MB of GLSL to a few kilobytes, and deeply shared graphs no longer run the compiler out of memory. - Generated identifiers are always valid ASCII. Cyrillic names are transliterated (
яркостьbecomesu_yarkost), and names that clash with GLSL ES 3.20 or AGSL keywords, types, or builtins get a suffix. Prefixed names (u_,a_,v_) keep their 1.1.1 spelling, andgl_,sk_, and__never appear. - A
repeat { }whose body records no shader statement now fails withProgramCode.EmptyRepeatand points tolocal(...).set(...)orkotlin.repeat, instead of silently emitting an empty loop. - Looking up a uniform by an author name shared by several uniforms throws and lists the spelled names; spelled names still resolve directly.
Exprcaches its hash, so a graph with reused subexpressions hashes in linear time.- Comparing two equal expression graphs built separately takes linear time instead of exponential.
- A function that reads a stage-only value only inside a local assignment can no longer be called from another stage: it fails with
ProgramCode.FunctionWrongStageinstead of producing a shader that fails to link. Each function is classified once, when it is defined. ShaderTarget.Agslno longer requires API 33: compiling AGSL works on any API level. Running it still needs Android 13, andAgslInstancenow carries@RequiresApi(33). NewRedByteFxPlatform.isAgslSupported()checks support without throwing.- New
FrameClockaccumulates frame time in whole nanoseconds, skips paused gaps, and caps a single step; bothbindTimehelpers use it, so time no longer drifts after hours.
GLES runtime
- Uniform setters bind their program before every write, and
drawRangemakes its own program current, soA.use(); B.set(...); A.drawRange(...)draws withA. The sharedGlTextureUnitsalso tracks the bound framebuffer, which color targets now restore correctly. - Deleting a uniform or storage block buffer no longer clears a binding point another program may be using.
glGetErrordraining stops after 16 reads, so a lost robust context cannot hang the GL thread.- Uniform and storage block updates, the native upload scratch, and
setLitModelno longer allocate on steady updates.
Compose hosts
- An exception on the GL thread (a queued write, a
runOnGlblock,onFrame, or a non-link setup error) no longer crashes the app. Rendering stops, the error is published asGlController.failure, and the newfailureOverlayparameter ofGlSurfaceandGlComputeshows it. Matrix and block arrays are validated whensetis called. - GL views keep their EGL context across pauses and start paused unless the host lifecycle is resumed.
GlFrame.secondskeeps counting across a new context without jumping. - A new
meshpassed toGlSurfaceis uploaded on the existing context instead of recreating the view. - A recorded draw that no longer fits a mesh shrunk from another thread is skipped instead of failing.
GlFrame.replace(vertices)andGlMesh.replace(vertices)check kept indices against their cached highest index instead of scanning them on every call.- A
GlControllerno longer keeps a released GL view, and itsContext, reachable until the next view attaches. GlComputelays out at least 1 dp with a transparent surface, so a zero-size host still links.GlControllerwrites allocate nothing and never hold its lock during a GL call; the AGSL modifier invalidates through one path; the scene renderer avoids per-frame allocations and per-draw state calls.- The 1.1.1 JVM signatures of
GlSurfaceandGlComputeare kept, so binaries compiled against 1.1.1 keep working. redbytefx-gl-composeexposesredbytefx-3das an API dependency, becausesetLitModeltakes aLitMesh.
Standard library
- Alpha guards in medium precision use 1/1024 instead of 1e-6, which half floats flush to zero, and
polarAngle01is defined at its center. sdfNormalsamples the scene four times (tetrahedral differences) instead of six, so the scene appears in the shader two fewer times. Normals can differ from 1.1.1 in the last bits.
Sample and checks
- The sample runs on Android 7 to 9 (the window theme had no parent below API 29) and closes the AGSL examples below Android 13 instead of crashing.
qualityChecknow also runs Android Lint and checks the public API against committedapi/*.apidumps.
Maven Central
implementation("io.github.i-redbyte:redbytefx-core:1.2.0")
implementation("io.github.i-redbyte:redbytefx-gl:1.2.0")
implementation("io.github.i-redbyte:redbytefx-gl-compose:1.2.0")
implementation("io.github.i-redbyte:redbytefx-compose:1.2.0")
implementation("io.github.i-redbyte:redbytefx-stdlib:1.2.0")
implementation("io.github.i-redbyte:redbytefx-3d:1.2.0")The attached AARs are the published binaries for manual download. Use Maven Central for Gradle projects so dependencies resolve automatically. SHA-256 hashes are in SHA256SUMS.
Full changelog: docs/changelog.md · RU