varjo icon indicating copy to clipboard operation
varjo copied to clipboard

glsl code getting interpreted as a format directive

Open Piroshky opened this issue 4 years ago • 0 comments

The glsl code emitted for lognand is return (~(A & B));. Unfortunately "~(" has semantic meaning to #'format so this causes an error when glsl-chunk-from-compiled calls glsl-line, which in turn calls format. I fixed this by changing #'glsl-line to the following:

(defun glsl-line (control-string &rest args)
  (declare (type string control-string))
  (%make-glsl-line :string-part (if args (apply #'format nil control-string args) control-string)))

All I did was wrap the format call in an if statement that checks if there are args to pass to format. If there isn't then format isn't needed anyways. I didn't make this a pull request as it seems like a bit of a bodge and doesn't address the underlying issue. But I figure'd I'd document it in case someone needs it short term.

Piroshky avatar May 12 '21 19:05 Piroshky