From 8db397f9dedcc9ce1bfd62b1a329a924c7621201 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Mon, 4 May 2009 15:15:36 -0500 Subject: [PATCH 1/2] work around macosx-x86-64 bug where it tries to write glGetAttachedShaders param as a GLuint64 array instead of a GLuint. this should fix bunny/spheres crash --- basis/opengl/shaders/shaders.factor | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/basis/opengl/shaders/shaders.factor b/basis/opengl/shaders/shaders.factor index a77d29da2f..15fab1aae0 100755 --- a/basis/opengl/shaders/shaders.factor +++ b/basis/opengl/shaders/shaders.factor @@ -92,11 +92,16 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ; : gl-program-shaders-length ( program -- shaders-length ) GL_ATTACHED_SHADERS gl-program-get-int ; inline +! On some macosx-x86-64 graphics drivers, glGetAttachedShaders tries to treat the +! shaders parameter as a ulonglong array rather than a GLuint array as documented. +! We hack around this by allocating a buffer twice the size and sifting out the zero +! values + : gl-program-shaders ( program -- shaders ) - dup gl-program-shaders-length + dup gl-program-shaders-length 2 * 0 over - [ glGetAttachedShaders ] keep ; + [ glGetAttachedShaders ] keep [ zero? not ] filter ; : delete-gl-program-only ( program -- ) glDeleteProgram ; inline From 249601618b483cbf828fd56ca5159d2476e9c7b6 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 4 May 2009 21:27:14 -0500 Subject: [PATCH 2/2] remove >bignum in crc32 -- 2x faster on both 32 and 64bit --- core/checksums/crc32/crc32.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/checksums/crc32/crc32.factor b/core/checksums/crc32/crc32.factor index 7655ec8482..209de83763 100644 --- a/core/checksums/crc32/crc32.factor +++ b/core/checksums/crc32/crc32.factor @@ -12,12 +12,12 @@ CONSTANT: crc32-table V{ } 256 iota [ 8 [ [ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless - ] times >bignum + ] times ] map 0 crc32-table copy : (crc32) ( crc ch -- crc ) - >bignum dupd bitxor - mask-byte crc32-table nth-unsafe >bignum + dupd bitxor + mask-byte crc32-table nth-unsafe swap -8 shift bitxor ; inline SINGLETON: crc32