<ixelp>
GitHub - Shirakumo/glfw: An up-to-date Common Lisp bindings library to the most recent GLFW OpenGL context management li [...]
<superchig>
But not sure about a GLAD equivalent?
alfiee has quit [Ping timeout: 244 seconds]
<|3b|>
cl-opengl already does that part i think
<superchig>
Ah neato, I'll try it
<superchig>
Thanks!
<|3b|>
the %gl: package has all of the bindings for the api, but they are direct translations of the C APIs, so you need to use CFFI and manually manage foreign memory for anything involving pointers
ym has joined #commonlisp
markb1 has quit [Ping timeout: 260 seconds]
<|3b|>
the GL: package has higher-level wrappers for the more common things, but unfortunately the parts about buffers were made when there was mostly just vertex buffers in cpu memory, so those aren't a very good abstraction these days
<|3b|>
aside from those, the stuff in GL: is usually nicer
<superchig>
Ah, very handy tips, thank you
markb1 has joined #commonlisp
<superchig>
I'm new to Common Lisp, spent most of my time so far poking at asdf / roswell / Emacs rather than much with the language proper
<|3b|>
things like being able to (gl:enable :blend :texture-2d :depth-test :multisample) or whatever in form
jonatack has quit [Ping timeout: 244 seconds]
jonatack has joined #commonlisp
rkazak has joined #commonlisp
edgar-rft_ has joined #commonlisp
edgar-rft` has quit [Ping timeout: 260 seconds]
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 244 seconds]
markb1 has quit [Ping timeout: 252 seconds]
rkazak has quit [Ping timeout: 268 seconds]
bpanthi977 has quit [Ping timeout: 260 seconds]
ym has quit [Quit: Leaving]
markb1 has joined #commonlisp
rkazak has joined #commonlisp
decweb has quit [Quit: Konversation terminated!]
bpanthi977 has joined #commonlisp
bpanthi977 has quit [Ping timeout: 260 seconds]
rkazak has quit [Ping timeout: 252 seconds]
markb1 has quit [Ping timeout: 244 seconds]
<superchig>
Awesome, I think I've gotten the hang of using the GL: package. Thanks again, 3b!
superchig has quit [Quit: Client closed]
rkazak has joined #commonlisp
bpanthi977 has joined #commonlisp
soweli_iki has quit [Remote host closed the connection]
alfiee has joined #commonlisp
superchig has joined #commonlisp
rkazak has quit [Ping timeout: 265 seconds]
alfiee has quit [Ping timeout: 244 seconds]
soweli_iki has joined #commonlisp
markb1 has joined #commonlisp
soweli_iki has quit [Changing host]
soweli_iki has joined #commonlisp
rkazak has joined #commonlisp
AmateurLisper has quit [Quit: Leaving]
superchig has quit [Quit: Client closed]
rkazak has quit [Ping timeout: 252 seconds]
nybble has quit [Ping timeout: 246 seconds]
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 252 seconds]
rkazak has joined #commonlisp
shka has joined #commonlisp
rkazak has quit [Ping timeout: 265 seconds]
bpanthi977 has quit [Ping timeout: 260 seconds]
rkazak has joined #commonlisp
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 260 seconds]
rkazak has quit [Ping timeout: 260 seconds]
geminium has joined #commonlisp
markb1 has quit [Ping timeout: 244 seconds]
istewart has quit [Quit: Konversation terminated!]
geminium has quit [Ping timeout: 272 seconds]
markb1 has joined #commonlisp
cercopith has joined #commonlisp
rtypo has joined #commonlisp
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 246 seconds]
rkazak has joined #commonlisp
markb1 has quit [Ping timeout: 272 seconds]
Equill has joined #commonlisp
rkazak has quit [Ping timeout: 246 seconds]
markb1 has joined #commonlisp
jrx has joined #commonlisp
rkazak has joined #commonlisp
markb1 has quit [Ping timeout: 244 seconds]
varjag has joined #commonlisp
pve has joined #commonlisp
alfiee has joined #commonlisp
rkazak has quit [Ping timeout: 260 seconds]
markb1 has joined #commonlisp
Devon has quit [Ping timeout: 252 seconds]
alfiee has quit [Ping timeout: 252 seconds]
veqq has quit [Ping timeout: 244 seconds]
nil78 has quit [Read error: Connection reset by peer]
nil78 has joined #commonlisp
msv has quit [Ping timeout: 268 seconds]
rkazak has joined #commonlisp
msv has joined #commonlisp
jrx has quit [Remote host closed the connection]
markb1 has quit [Ping timeout: 252 seconds]
msv has quit [Remote host closed the connection]
svm has joined #commonlisp
rkazak has quit [Ping timeout: 276 seconds]
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 246 seconds]
wacki has joined #commonlisp
markb1 has joined #commonlisp
rkazak has joined #commonlisp
wobbol has quit [Ping timeout: 244 seconds]
King_julian has joined #commonlisp
King_julian has quit [Ping timeout: 252 seconds]
varjag has quit [Ping timeout: 268 seconds]
rkazak has quit [Ping timeout: 260 seconds]
chomwitt has joined #commonlisp
wobbol has joined #commonlisp
Inline has quit [Remote host closed the connection]
wbooze has quit [Remote host closed the connection]
rkazak has joined #commonlisp
wbooze has joined #commonlisp
Inline has joined #commonlisp
varjag has joined #commonlisp
msv has joined #commonlisp
markb1 has quit [Ping timeout: 268 seconds]
alfiee has joined #commonlisp
rkazak has quit [Ping timeout: 248 seconds]
chomwitt has quit [Ping timeout: 248 seconds]
svm has quit [Ping timeout: 246 seconds]
King_julian has joined #commonlisp
alfiee has quit [Ping timeout: 246 seconds]
Equill has quit [Ping timeout: 268 seconds]
King_julian has quit [Ping timeout: 276 seconds]
markb1 has joined #commonlisp
phantomics has joined #commonlisp
phantomics_ has quit [Ping timeout: 245 seconds]
rkazak has joined #commonlisp
King_julian has joined #commonlisp
attila_lendvai has joined #commonlisp
King_julian has quit [Ping timeout: 260 seconds]
rkazak has quit [Ping timeout: 248 seconds]
alternateved has joined #commonlisp
markb1 has quit [Ping timeout: 248 seconds]
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 248 seconds]
markb1 has joined #commonlisp
King_julian has joined #commonlisp
rkazak has joined #commonlisp
varjag has quit [Ping timeout: 252 seconds]
markb1 has quit [Ping timeout: 244 seconds]
King_julian has quit [Ping timeout: 246 seconds]
rkazak has quit [Ping timeout: 244 seconds]
markb1 has joined #commonlisp
rkazak has joined #commonlisp
varjag has joined #commonlisp
alfiee has joined #commonlisp
varjag has quit [Ping timeout: 268 seconds]
alfiee has quit [Ping timeout: 260 seconds]
msv has quit [Remote host closed the connection]
svm has joined #commonlisp
markb1 has quit [Ping timeout: 248 seconds]
MyNetAz has quit [Remote host closed the connection]
dansa has joined #commonlisp
MyNetAz has joined #commonlisp
random-nick has joined #commonlisp
rkazak has quit [Ping timeout: 248 seconds]
Equill has joined #commonlisp
markb1 has joined #commonlisp
rkazak has joined #commonlisp
rkazak has quit [Ping timeout: 244 seconds]
geminium has joined #commonlisp
decweb has joined #commonlisp
geminium has quit [Ping timeout: 252 seconds]
dawids has joined #commonlisp
dawids has quit [Remote host closed the connection]
markb1 has quit [Ping timeout: 244 seconds]
josrr has joined #commonlisp
King_julian has joined #commonlisp
cage has joined #commonlisp
cage has quit [Excess Flood]
cage has joined #commonlisp
rkazak has joined #commonlisp
alfiee has joined #commonlisp
King_julian has quit [Ping timeout: 265 seconds]
markb1 has joined #commonlisp
rkazak has quit [Ping timeout: 268 seconds]
alfiee has quit [Ping timeout: 260 seconds]
rkazak has joined #commonlisp
King_julian has joined #commonlisp
markb1 has quit [Ping timeout: 252 seconds]
King_julian has quit [Ping timeout: 252 seconds]
akoana has joined #commonlisp
zwr has joined #commonlisp
markb1 has joined #commonlisp
King_julian has joined #commonlisp
rkazak has quit [Ping timeout: 248 seconds]
alfiee has joined #commonlisp
svm is now known as msv
King_julian has quit [Ping timeout: 260 seconds]
alfiee has quit [Ping timeout: 268 seconds]
pranav has quit [Remote host closed the connection]
akoana has quit [Quit: leaving]
markb1 has quit [Ping timeout: 252 seconds]
surabax has joined #commonlisp
zwr has quit [Remote host closed the connection]
rkazak has joined #commonlisp
markb1 has joined #commonlisp
rkazak has quit [Ping timeout: 252 seconds]
josrr has quit [Remote host closed the connection]
cercopith has quit [Remote host closed the connection]
alfiee has joined #commonlisp
rkazak has quit [Ping timeout: 260 seconds]
alfiee has quit [Ping timeout: 272 seconds]
svm has joined #commonlisp
msv has quit [Ping timeout: 252 seconds]
veqq has joined #commonlisp
nybble has joined #commonlisp
khinsen has joined #commonlisp
surabax has quit [Ping timeout: 272 seconds]
rkazak has joined #commonlisp
kevingal has joined #commonlisp
surabax has joined #commonlisp
surabax has quit [Changing host]
surabax has joined #commonlisp
deadmarshal_ has quit [Remote host closed the connection]
alfiee has joined #commonlisp
dansa has quit [Ping timeout: 244 seconds]
alfiee has quit [Ping timeout: 268 seconds]
rkazak has quit [Ping timeout: 260 seconds]
JuanDaugherty is now known as ColinRobinson
khinsen has left #commonlisp [#commonlisp]
apac has quit [Ping timeout: 244 seconds]
ingeniot has quit [Ping timeout: 240 seconds]
rkazak has joined #commonlisp
gpiero has joined #commonlisp
wacki has quit [Ping timeout: 260 seconds]
rkazak has quit [Ping timeout: 260 seconds]
zwr has joined #commonlisp
wacki has joined #commonlisp
ColinRobinson is now known as JuanDaugherty
deadmarshal_ has joined #commonlisp
rkazak has joined #commonlisp
alfiee has joined #commonlisp
Lord_of_Life_ has joined #commonlisp
Lord_of_Life has quit [Ping timeout: 245 seconds]
khinsen has joined #commonlisp
rkazak has quit [Ping timeout: 244 seconds]
Lord_of_Life_ is now known as Lord_of_Life
alfiee has quit [Ping timeout: 272 seconds]
Devon has joined #commonlisp
khinsen has left #commonlisp [#commonlisp]
sonny has joined #commonlisp
rkazak has joined #commonlisp
yaneko has quit [Quit: parting]
kevingal has quit [Ping timeout: 260 seconds]
veqq has quit [Quit: veqq]
geminium has joined #commonlisp
rkazak has quit [Ping timeout: 272 seconds]
veqq has joined #commonlisp
geminium has quit [Ping timeout: 252 seconds]
markb1 has quit [Ping timeout: 252 seconds]
yaneko has joined #commonlisp
markb1 has joined #commonlisp
rkazak has joined #commonlisp
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 244 seconds]
rkazak has quit [Ping timeout: 265 seconds]
markb1 has quit [Ping timeout: 252 seconds]
markb1 has joined #commonlisp
wobbol has quit [Ping timeout: 260 seconds]
Inline has quit [Quit: Leaving]
wbooze has quit [Quit: Leaving]
robin_ has joined #commonlisp
robin__ has quit [Ping timeout: 244 seconds]
rkazak has joined #commonlisp
wobbol has joined #commonlisp
troojg has joined #commonlisp
alfiee has joined #commonlisp
veqq has quit [Remote host closed the connection]
alfiee has quit [Ping timeout: 260 seconds]
apac has joined #commonlisp
<sonny>
what's the word on working with binary representations in cl?
<aeth>
Usually you make it an (unsigned-byte 8) array, which is usually aliased via DEFTYPE to octet (and always talked about as "octet" even if you don't shorten the name in code) because it's way more convenient with that name
<aeth>
Sometimes you want e.g. (unsigned-byte 32) instead
<sonny>
interesting
<aeth>
It's pretty convenient. CL has a lot of stuff for working with bits. Maybe 2-3 different ways to work with them. Probably because Lisp Machines were still a thing when Common Lisp was written.
<aeth>
And since machines are almost all 64-bit these days, you can just (unsigned-byte 32) safely and it should work on all implementations because it should be smaller than all fixnums (except perhaps ABCL, which targets the JVM)
rkazak has quit [Ping timeout: 260 seconds]
<aeth>
(unsigned-byte 64) may heap-allocate as a bignum because a fixnum is going to lose at least 2 bytes there (1 because it's signed and 1 because it needs a type tag... SBCL does the minimum on x86-64... other implementations may lose a few more bytes)
<aeth>
s/a few more bytes/a few more bits/
<sonny>
so what if I need 64 bits?
<aeth>
But 64-bit implementations will _probably_ still let you (make-array length :element-type '(unsigned-byte 64)) and _may_ optimize away the boxing even if it is above a fixnum in size.
<aeth>
SBCL does so for signed/unsigned 64-bit ints and for double-float
<aeth>
You do have to be careful about implicit return values (e.g. in SETF), though. Because if it is implicitly returned, it's going to have to allocate it
<aeth>
This bot is a 32-bit implementation. So it does _not_ have an (unsigned-byte 64) and thus upgrades it to a T (generic) array. But 64-bit implementations probably return (UNSIGNED-BYTE 64) there.
<aeth>
It will still work if it is _not_ (unsigned-byte 64) but it will be inefficient and if you rely on it for type safety with runtime errors, you'll obviously not get them
<sonny>
hmm, ok thanks
JuanDaugherty is now known as ColinRobinson
<aeth>
CL usually defaults to slow-but-still-works for things like this. So the optimized code will work well on x86-64 SBCL, but still _run_ on ixelp (if you can fit it within one IRC line).
Inline has joined #commonlisp
jonatack has quit [Ping timeout: 244 seconds]
wbooze has joined #commonlisp
<pranav>
So I should declare the type as (unsigned-byte 64) and use (return array)?
ColinRobinson has quit [Quit: praxis.meansofproduction.biz (juan@acm.org)]
<aeth>
(defun foo (a) (declare (type (simple-array (unsigned-byte 64) (3)) a)) (setf (aref a 1) (expt 2 63)) a)
<aeth>
^ This is what I mean
<aeth>
If you disassemble that in SBCL, you see it doesn't heap allocate it
toadlicker has quit [Ping timeout: 245 seconds]
<aeth>
even though (typep (expt 2 63) 'fixnum) => NIL
<aeth>
After the SETF you have to return the array itself or NIL or (values) or anything, really. Because if you don't, it will still have to allocate it to implicitly return 9223372036854775808
<aeth>
This trick is more useful for double-floats, though, because it's easier to provably (to the optimizing compiler) stay within double-floats.
<pranav>
I see. Thanks. Let me check it out.
jonatack has joined #commonlisp
<aeth>
disassemble being (disassemble #'foo)
rkazak has joined #commonlisp
pve has quit [Quit: leaving]
<aeth>
And for my particular example, where it's a constant, any 64-bit compiler with a (simple-array (unsigned-byte 64) (*)) could probably easily add this optimization, even if not all currently do that.
<pranav>
I notice that 2^63 value in the asswmbly is signed (negative)
<aeth>
probably because fixnums are signed and this particular case is so niche that they probably didn't special case the printing.
rakka has quit [Remote host closed the connection]
<pranav>
But we specified (unsigned-byte 64) which is not the same as fixnum...right?
rakka has joined #commonlisp
<aeth>
assembly usually isn't typed like that
<aeth>
an integer is an integer and you just use signed/unsigned instructions on it
itsanonmelody has joined #commonlisp
itsanonmelody has quit [Client Quit]
<aeth>
usually it doesn't show up in 64-bit Lisp stuff at all because the edge case would exist as a heap-allocated bignum (because a type tag is required for dynamic typing), but here the compiler knows the bignum doesn't need to be heap allocated
<aeth>
but it has been so long since I've _written_ x86 asm, that I may be slightly incorrect
<pranav>
I see.
itsanonmelody has joined #commonlisp
<pranav>
Thanks aeth. I've been looking for resources on writing cache friendly code using sbcl. This was helpful.
<pranav>
I also noticed petalisp uses (and fixnum unsigned-byte) at times.
<aeth>
I suppose that's a way to say unsigned-fixnum
jonatack has quit [Ping timeout: 260 seconds]
alfiee has joined #commonlisp
<aeth>
I think the more usual way to say unsigned-fixnum is (integer 0 #.most-positive-fixnum) or doing that with DEFTYPE so you don't have to use the ugly #. read-eval most of the type you need to express it
<aeth>
e.g. ,(let ((x 42)) (check-type x (integer 0 #.most-positive-fixnum)) x)
<pranav>
Reader macro could also be troublesome for cross compiling.
jonatack has joined #commonlisp
veqq has joined #commonlisp
<aeth>
right, with DEFTYPE it's quoted so you don't have to have #.
troojg has quit [Ping timeout: 260 seconds]
critbase has quit [Ping timeout: 260 seconds]
<aeth>
The problem with relying on fixnum is that it's an unpredictable size. Different implementations, and the same implementations on different architectures (even if both are 32-bit architectures or both are 64-bit architectures!), may have different fixnum sizes.
<aeth>
I would generally rather just see if I can get by with (unsigned-byte 32) and assume that 64-bit implementations will be efficient and 32-bit ones probably won't be efficient. And if that's not enough, I can do (unsigned-byte 64) and maybe a few implementations will be efficient about it
alfiee has quit [Ping timeout: 260 seconds]
rkazak has quit [Ping timeout: 268 seconds]
<aeth>
(unsigned-byte 48) would probably work, but it's probably just getting upgraded into unsigned-fixnum (I tested and it's (unsigned-byte 62) in the case of x86-64 SBCL) if it's an array...
<aeth>
But for non-array things, that's almost certainly going to be in the 64-bit fixnum range.
critbase has joined #commonlisp
<pranav>
Oh. I was just testing this with the bitfield package that can pack values that fit into an unsigned-byte.
svm is now known as msv
chomwitt has joined #commonlisp
geminium has joined #commonlisp
varjag has joined #commonlisp
itsanonmelody has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.4)]
rkazak has joined #commonlisp
alfiee has joined #commonlisp
cage has quit [Quit: rcirc on GNU Emacs 29.4]
alfiee has quit [Ping timeout: 268 seconds]
critbase has quit [Ping timeout: 260 seconds]
critbase has joined #commonlisp
jonatack has quit [Ping timeout: 244 seconds]
rkazak has quit [Ping timeout: 246 seconds]
jonatack has joined #commonlisp
soweli_iki has joined #commonlisp
soweli_iki has quit [Changing host]
soweli_iki has joined #commonlisp
Thermoriax has quit [Ping timeout: 260 seconds]
markb1 has quit [Ping timeout: 252 seconds]
zwr has quit [Remote host closed the connection]
josrr has quit [Remote host closed the connection]
markb1 has joined #commonlisp
attila_lendvai has quit [Ping timeout: 248 seconds]
wacki has quit [Remote host closed the connection]
alfiee has joined #commonlisp
alfiee has quit [Ping timeout: 252 seconds]
rkazak has joined #commonlisp
markb1 has quit [Ping timeout: 252 seconds]
markb1 has joined #commonlisp
markb1 has quit [Max SendQ exceeded]
markb1 has joined #commonlisp
josrr has joined #commonlisp
Equill has quit [Ping timeout: 246 seconds]
sonny has quit [Quit: Client closed]
alternateved has quit [Remote host closed the connection]
rkazak has quit [Ping timeout: 272 seconds]
wbooze has quit [Ping timeout: 265 seconds]
Inline has quit [Ping timeout: 265 seconds]
troojg has joined #commonlisp
rtypo has quit [Read error: Connection reset by peer]