Merge branch 'master' of git://factorcode.org/git/factor
						commit
						8486e6db82
					
				| 
						 | 
					@ -92,11 +92,16 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ;
 | 
				
			||||||
: gl-program-shaders-length ( program -- shaders-length )
 | 
					: gl-program-shaders-length ( program -- shaders-length )
 | 
				
			||||||
    GL_ATTACHED_SHADERS gl-program-get-int ; inline
 | 
					    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 )
 | 
					: gl-program-shaders ( program -- shaders )
 | 
				
			||||||
    dup gl-program-shaders-length
 | 
					    dup gl-program-shaders-length 2 *
 | 
				
			||||||
    0 <int>
 | 
					    0 <int>
 | 
				
			||||||
    over <uint-array>
 | 
					    over <uint-array>
 | 
				
			||||||
    [ glGetAttachedShaders ] keep ;
 | 
					    [ glGetAttachedShaders ] keep [ zero? not ] filter ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: delete-gl-program-only ( program -- )
 | 
					: delete-gl-program-only ( program -- )
 | 
				
			||||||
    glDeleteProgram ; inline
 | 
					    glDeleteProgram ; inline
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,12 +12,12 @@ CONSTANT: crc32-table V{ }
 | 
				
			||||||
256 iota [
 | 
					256 iota [
 | 
				
			||||||
    8 [
 | 
					    8 [
 | 
				
			||||||
        [ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless
 | 
					        [ 2/ ] [ even? ] bi [ crc32-polynomial bitxor ] unless
 | 
				
			||||||
    ] times >bignum
 | 
					    ] times
 | 
				
			||||||
] map 0 crc32-table copy
 | 
					] map 0 crc32-table copy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: (crc32) ( crc ch -- crc )
 | 
					: (crc32) ( crc ch -- crc )
 | 
				
			||||||
    >bignum dupd bitxor
 | 
					    dupd bitxor
 | 
				
			||||||
    mask-byte crc32-table nth-unsafe >bignum
 | 
					    mask-byte crc32-table nth-unsafe
 | 
				
			||||||
    swap -8 shift bitxor ; inline
 | 
					    swap -8 shift bitxor ; inline
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SINGLETON: crc32
 | 
					SINGLETON: crc32
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue