No matching definitions.

glsl/codegen

src/glsl/codegen.tur
defn

glsl-cat2

(glsl-cat2 [a : cstr b : cstr] :)

concatenate two strings.

afirst string
bsecond string

Concatenated string.

(glsl-cat2 "vec3 " "pos")  ; => "vec3 pos"

Since: v0.1.0

defn

glsl-cat3

(glsl-cat3 [a : cstr b : cstr c : cstr] :)

concatenate three strings.

afirst string
bsecond string
cthird string

Concatenated string.

(glsl-cat3 "if (" cond ") {")

Since: v0.1.0

defn

glsl-cat4

(glsl-cat4 [a : cstr b : cstr c : cstr d : cstr] :)

concatenate four strings.

a b c d -- strings to concatenate

Concatenated string.

Since: v0.1.0

defn

glsl-sprintf1

(glsl-sprintf1 [fmt : cstr a : cstr] :)

format a string with one substitution.

fmtformat string with one %s
asubstitution value

Formatted string.

(glsl-sprintf1 "return %s;" "x")  ; => "return x;"

Since: v0.1.0

defn

glsl-sprintf2

(glsl-sprintf2 [fmt : cstr a : cstr b : cstr] :)

format a string with two substitutions.

fmtformat string with two %s placeholders
a b -- substitution values

Formatted string.

(glsl-sprintf2 "%s = %s;" name value)

Since: v0.1.0

defn

glsl-sprintf3

(glsl-sprintf3 [fmt : cstr a : cstr b : cstr c : cstr] :)

format a string with three substitutions.

fmtformat string with three %s placeholders
a b c -- substitution values

Formatted string.

(glsl-sprintf3 "%s %s = %s;" type name init)

Since: v0.1.0

defn

glsl-sprintf4

(glsl-sprintf4 [fmt : cstr a : cstr b : cstr c : cstr d : cstr] :)

format a string with four substitutions.

fmtformat string with four %s placeholders
a b c d -- substitution values

Formatted string.

Since: v0.1.0

defn

glsl-int->str

(glsl-int->str [n : int] :)

convert an integer to a decimal string.

ninteger value

Decimal string representation.

(glsl-int->str 42)  ; => "42"

Since: v0.1.0

defn

glsl-join-vec

(glsl-join-vec [sep : cstr items : int] :)

join a cons list of strings with a separator.

sepseparator string
itemscons list of :cstr values (opaque :int handle)
sepseparator inserted between elements
itemsVec[cstr] of strings to concatenate

The joined string.

(glsl-join-vec ", " (vec-of "float x" "vec3 n"))
  ; => "float x, vec3 n"

Since: v0.2.0

defn

glsl-join

(glsl-join [sep : cstr items : int] :)
defn

glsl-indent

(glsl-indent [src : cstr] :)

indent every line of src by 4 spaces.

srcGLSL source fragment (may be multi-line)

Source with 4 spaces prepended to every line.

(glsl-indent "return x;")  ; => "    return x;"

Since: v0.1.0

defn

glsl-raw

(glsl-raw [src : cstr] :)

return src unchanged.

srcany string

src unchanged. Useful as a pass-through in higher-order contexts.

Since: v0.1.0

defn

glsl-stmts

(glsl-stmts [stmts : int] :)

join a cons list of statement strings with newlines.

stmtscons list of statement strings

Statements joined with "\n".

(glsl-stmts (cons "float x = 1.0;" (cons "float y = 2.0;" 0)))
  ; => "float x = 1.0;\nfloat y = 2.0;"

Since: v0.1.0

defn

compile-glsl

(compile-glsl [src : cstr] :)

return the assembled GLSL source string.

srccomplete GLSL source string

src unchanged.

(compile-glsl (glsl-vertex-shader "330 core" decls body))

Since: v0.1.0