3b / cl-opengl

cl-opengl is a set of CFFI bindings to the OpenGL, GLU and GLUT APIs.
http://common-lisp.net/project/cl-opengl/
Other
279 stars 59 forks source link

new enum-group problems #92

Closed 3b closed 11 months ago

3b commented 4 years ago

todo list:


things that need verified as either cl-opengl bugs, or problems with new enough groups in gl.xml:

:FRAMEBUFFER-EXT is not defined as a keyword for enum type #<CFFI::FOREIGN-ENUM CL-OPENGL-BINDINGS::FRAMEBUFFER-TARGET>.

:RENDERBUFFER-EXT is not defined as a keyword for enum type #<CFFI::FOREIGN-ENUM CL-OPENGL-BINDINGS::RENDERBUFFER-TARGET>.

:DEPTH-COMPONENT24 is not defined as a keyword for enum type #<CFFI::FOREIGN-ENUM CL-OPENGL-BINDINGS::INTERNAL-FORMAT>.

`:MAX-TEXTURE-MAX-ANISOTROPY-EXT is not defined as a keyword for enum type #.)

3b commented 4 years ago

:UNSIGNED-INT-24-8 is not defined as a keyword for enum type # calling glTexImage2D also check :float-32-unsigned-int-24-8-rev and others in that group

3b commented 4 years ago

from #93: in glTextureSubImage3d

:UNSIGNED-INT-8-8-8-8-REV is not defined as a keyword for enum type #<CFFI::FOREIGN-ENUM CL-OPENGL-BINDINGS::PIXEL-TYPE>.

:UNSIGNED-INT-2-10-10-10-REV is not defined as a keyword for enum type #<CFFI::FOREIGN-ENUM CL-OPENGL-BINDINGS::PIXEL-TYPE>.

also check :unsigned-int-5-9-9-9-rev

metayan commented 4 years ago

Adding error details as requested in #lispgames (hoping I understood the request correctly): When building nineveh (using SBCL 2.0.9 and 2.0.9.48, as well as CCL v1.12-32):

; processing (DEFN BUFFER-STREAMER-PUSH-FROM-RANGE ...)
; file: /cl/scm/nineveh/streams/buffer-streamer.lisp
; in: DEFN BUFFER-STREAMER-PUSH-FROM-RANGE
;     (CEPL.GPU-ARRAYS:WITH-GPU-ARRAY-RANGE-AS-POINTER (NINEVEH.STREAMS::G-PTR
;                                                       NINEVEH.STREAMS::G-ARR
;                                                       NINEVEH.STREAMS::NEW-START-POS
;                                                       NINEVEH.STREAMS::C-LEN
;                                                       :ACCESS-SET
;                                                       '(:MAP-WRITE
;                                                         :MAP-UNSYNCHRONIZED))
;       (CEPL.TYPES::%MEMCPY NINEVEH.STREAMS::G-PTR NINEVEH.STREAMS::C-PTR
;                            (*
;                             (%CEPL.TYPES:C-ARRAY-ELEMENT-BYTE-SIZE
;                              %CEPL.TYPES:C-ARRAY)
;                             NINEVEH.STREAMS::C-LEN)))
; 
; caught ERROR:
;   during macroexpansion of
;   (WITH-GPU-ARRAY-RANGE-AS-POINTER (G-PTR G-ARR NEW-START-POS ...)
;     (CEPL.TYPES::%MEMCPY G-PTR C-PTR ...)).
;   Use *BREAK-ON-SIGNALS* to intercept.
;   
;    Unknown CFFI type CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK

Expanding the macro (but not sure I'm doing this correctly, so any guidance appreciated):

  0: (CFFI::UNDEFINED-FOREIGN-TYPE-ERROR CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK :DEFAULT)
      Locals:
        NAMESPACE = :DEFAULT
        TYPE-NAME = CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK
  1: (CFFI::FIND-TYPE-PARSER CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK :DEFAULT)
      Locals:
        NAMESPACE = :DEFAULT
        SYMBOL = CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK
  2: (CFFI::PARSE-TYPE CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK)
      Locals:
        TYPE = CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK
  3: (CFFI::ENSURE-PARSED-BASE-TYPE CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK)
      Locals:
        TYPE = CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK
  4: (CFFI:FOREIGN-BITFIELD-SYMBOL-LIST CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK)
      Locals:
        BITFIELD-TYPE = CL-OPENGL-BINDINGS::MAPBUFFERUSAGEMASK
  5: (CEPL.GPU-ARRAYS::%PROCESS-WITH-GPU-ARRAY-RANGE-MACRO-ARGS :ARRAY-BUFFER (QUOTE (:MAP-WRITE :MAP-UNSYNCHRONIZED)))
      Locals:
        ACCESS-SET = '(:MAP-WRITE :MAP-UNSYNCHRONIZED)
        #:TEMP0 = :ARRAY-BUFFER
  6: ((MACRO-FUNCTION WITH-GPU-ARRAY-RANGE-AS-POINTER) (WITH-GPU-ARRAY-RANGE-AS-POINTER (G-PTR G-ARR NEW-START-POS C-LEN :ACCESS-SET (QUOTE #)) (CEPL.TYPES::%MEMCPY G-PTR C-PTR (* # C-LEN))) #<unused argum..
      Locals:
        #:EXPR = (WITH-GPU-ARRAY-RANGE-AS-POINTER (G-PTR G-ARR NEW-START-POS C-LEN :ACCESS-SET '(:MAP-WRITE :MAP-UNSYNCHRONIZED)) ..)
        CEPL.GPU-ARRAYS::GTARGET = #:GTARGET3876
        CEPL.GPU-ARRAYS::TARGET = :ARRAY-BUFFER

Noticed this comment: {TODO} make a PR to add this to cl-opengl close to the macro definition.

Possible solution

Replacing mapbufferusagemask with mapbufferaccessmask in CEPL seems to be all that's needed to solve the nineveh issue.

3b commented 11 months ago

Gave up on the new enum groups in order to get cl-opengl development moving again, so closing this.

(Didn't have enough energy to get the gl spec changes upstream, and the more specific enum types seemed to cause more problems than they helped anyway)