cepl icon indicating copy to clipboard operation
cepl copied to clipboard

[BUG?] Incorrect type on :ivec4 gpu/c-array

Open shelvick opened this issue 7 years ago • 3 comments

I think CEPL is doing something wrong with :ivec4's created as gpu/c-arrays, causing wonky values in my shaders. Observe:

> (type-of
   (car
    (cepl:pull-g
     (cepl:make-gpu-array
      `(,(make-array '(4) :element-type '(signed-byte 32) :initial-contents '(1 2 3 4)))
      :element-type :ivec4))))

(SIMPLE-VECTOR 4)

Shouldn't the type here be (SIMPLE-ARRAY (SIGNED-BYTE 32) (4))? The :vec4 type returns an array as you might expect:

> (type-of
   (car
    (cepl:pull-g
     (cepl:make-gpu-array
      `(,(make-array '(4) :initial-contents '(1 2 3 4)))
      :element-type :vec4))))

(SIMPLE-ARRAY SINGLE-FLOAT (4))

shelvick avatar Sep 13 '18 18:09 shelvick

Yeah that looks wonky. I'll mark this as a bug. Cheers!

cbaggers avatar Oct 10 '18 19:10 cbaggers

Thanks again for reporting this. There was indeed a bug in CEPL that affected ivecs and uvecs. Was a simple fix though.

In the next release the behavior will be:

CEPL> (type-of
	(car
	 (cepl:pull-g
	  (cepl:make-gpu-array
	   `(,(make-array '(4) :element-type '(signed-byte 32) :initial-contents '(1 2 3 4)))
	   :element-type :ivec4))))
(SIMPLE-ARRAY (SIGNED-BYTE 32) (4))

cbaggers avatar Jan 20 '19 18:01 cbaggers

The fix can be found the https://github.com/cbaggers/cepl/tree/fix/ivec-conversions branch. It will be merged in after some more testing

cbaggers avatar Jan 20 '19 18:01 cbaggers