VirtualBox

Ignore:
Timestamp:
Apr 18, 2019 12:07:07 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130111
Message:

Merge first stage of the Chromium cleanup from the branch:

  • r129818 (Remove VBOX_WITH_CR_DISPLAY_LISTS and accompanying code as it was disabled since r108676 and was never brought back (see ​bugref:3456 and ​bugref:8485))
  • r129819 (HostServices/SharedOpenGL: Remove unused main entry point from upstream server process based implementation)
  • r129820 (HostServices/SharedOpenGL: Started eliminating all backends other than HGCM. They are not used and probably wouldn't work anymore anyway)
  • r129821 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crTimer* API as it is not used anywhere)
  • r129822 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill most from cr_process.h apart from two used methods)
  • r129823 (HostServices/SharedOpenGL,GuestHost/OpenGLAdditions/common/crOpenGL: Kill crList* API as it is unused)
  • r129824 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crHullInteriorBox API as it is unused)
  • r129825 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill crWarpPoint API as it is unused)
  • r129826 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill CrSa* API as it is unused and not even compiled in)
  • r129827 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Kill cr_bbox.h as it is unused)
  • r129828 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove a few crParseUrl() two uses)
  • r129829 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove last crParseURL() use)
  • r129830 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove crParseURL())
  • r129831 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove VBOX_WITH_COCOA_QT and related code when not set as it is the default for years now and we don't support anything else anymore)
  • r129832 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_logo.h)
  • r129833 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused crut_api.h and crut_clientapi.h)
  • r129834 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_dmx.h)
  • r129835 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused cr_perf.h)
  • r129836 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove cr_rand.h and friends as it is not actively used anywhere)
  • r129837 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of all the swapped versions in the packer SPU, we never change endianess from guest to host and don't need it)
  • r129838 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129839 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129840 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused pack_pica.c)
  • r129841 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove more swapper versions in the packer related code)
  • r129842 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_endianess.h and friends)
  • r129843 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused lowercase.py)
  • r129844 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_calllists.h and friends)
  • r129845 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of completely unused idpool.c, not even compiled in)
  • r129846 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused cr_debugopcodes.h and friends)
  • r129847 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the cr_mem.h API inline and get rid of the implementation in the util library)
  • r129848 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of SPUOptions and related code as it is of no use for us)
  • r129849 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of cr_environment.h and friends and convert usage to RTEnv* APIs)
  • r129850 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of unused renderspu_agl.c)
  • r129851 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Remove unused code in cr_htable.h)
  • r129853 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Introduce a state paremeter for the unpacker workers instead of reyling on global variables, work in progress)
  • r129854 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Let the caller of crUnpack set up the initial state. This allows to get rid of the global return_ptr and writeback_ptr as they get supplied in the unpacker state by the server)
  • r129855 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the cr_lastDispatch and cr_unpackDispatch as they are of no use now)
  • r129856 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Get rid of the global cr_unpackData and cr_unpackDataEnd symbols by indtroducing another hack to make it possible for certail server dispatch callbacks to access the data buffer)
  • r129857 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: build fix for release builds)
  • r129858 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Make the pointer to the unpacker state non const (is required for the access verification))
  • r129859 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: First iteration of the buffer size validation to prevent out of bound read access + added todos for places where additional checks are needed)
  • r129860 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129861 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129871 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129872 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Stop as soon as the unpacker encountered an error)
  • r129876 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129880 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Working on remaining verification todos)
  • r129882 (HostServices/SharedOpenGL,GuestHost/OpenGL,Additions/common/crOpenGL: Fixed some offsets in unpack_texture.c, 3DMark03 renders correctly again)
  • r130013 (HostServices/SharedOpenGL: Convert files to C++ so we can use C99 featuers on Windows with cl.exe)
  • r130014 (HostServices/SharedOpenGL,GuestHost/OpenGL: WIndows build fixes)
  • r130015 (HostServices/SharedOpenGL,GuestHost/OpenGL: More Windows build fixes)
  • r130036 (Config.kmk: Fix linker error on Windows by temporarily disabling the use of VBoxGuestR3DllMinW2K)
  • r130094 (src/VBox/GuestHost/OpenGL: Revert inlining the allocation/free functions in R3 completely as it doesn't work on Windows if memory is allocated and freed across different DLLs which don't share a common CRT, causes crashes in RtlValidtaeHeap())
  • r130095 (src/VBox/GuestHost/OpenGL,src/VBox/Additions/common/crOpenGL/pack: Don't use floating point specifiers in packspu_GetString() to avoid R6002 errors (couldn't fully understand why they occur suddenly after the rework but this gets rid of it))
Location:
trunk
Files:
45 added
49 deleted
18 edited
8 moved

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:mergeinfo
      •  

        old new  
        99/branches/VBox-5.1:112367,115992,116543,116550,116568,116573
        1010/branches/VBox-5.2:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124260,124263,124271,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812
         11/branches/aeichner/vbox-chromium-cleanup:129816,129818-129851,129853-129861,129871-129872,129876,129880,129882,130013-130015,130036,130094-130095
        1112/branches/andy/draganddrop:90781-91268
        1213/branches/andy/guestctrl20:78916,78930
  • trunk/src/VBox

    • Property svn:mergeinfo
      •  

        old new  
        99/branches/VBox-5.1/src/VBox:112367,116543,116550,116568,116573
        1010/branches/VBox-5.2/src/VBox:119536,120083,120099,120213,120221,120239,123597-123598,123600-123601,123755,124263,124273,124277-124279,124284-124286,124288-124290,125768,125779-125780,125812,127158-127159,127162-127167,127180
         11/branches/aeichner/vbox-chromium-cleanup/src/VBox:129818-129851,129853-129861,129871-129872,129876,129880,129882,130013-130015,130094-130095
        1112/branches/andy/draganddrop/src/VBox:90781-91268
        1213/branches/andy/guestctrl20/src/VBox:78916,78930
  • trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk

    r78086 r78190  
    2929        $(VBOX_PATH_CROGL_GENFILES)/
    3030endif
    31 
    32 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    33  LIBRARIES += VBoxOGLcrdlm
    34  DLLS      += VBoxOGLexpandospu
    35 endif # VBOX_WITH_CR_DISPLAY_LISTS
    3631
    3732ifeq ($(KBUILD_TARGET),darwin)
     
    9792VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI
    9893endif
    99 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    100 VBoxSharedCrOpenGL_LIBS += $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB)
    101 endif
    10294
    10395#
     
    116108        $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
    117109
    118 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    119 VBoxOGLcrserverlib_INTERMEDIATES += $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h
    120 endif
    121 
    122110VBoxOGLcrserverlib_SOURCES := \
    123         crserverlib/server_main.c \
    124         crserverlib/server_boundsinfo.c \
    125         crserverlib/server_bufferobject.c \
    126         crserverlib/server_clear.c \
    127         crserverlib/server_clip.c \
    128         crserverlib/server_config.c \
    129         crserverlib/server_context.c \
    130         crserverlib/server_gentextures.c \
    131         crserverlib/server_getmap.c \
    132         crserverlib/server_getstring.c \
    133         crserverlib/server_getpointer.c \
    134         crserverlib/server_getpixelmap.c \
    135         crserverlib/server_getteximage.c \
    136         crserverlib/server_lists.c \
    137         crserverlib/server_misc.c \
    138         crserverlib/server_occlude.c \
    139         crserverlib/server_papi.c \
    140         crserverlib/server_projmatrix.c \
    141         crserverlib/server_readpixels.c \
    142         crserverlib/server_stream.c \
    143         crserverlib/server_viewport.c \
    144         crserverlib/server_window.c \
    145         crserverlib/server_winpos.c \
    146         crserverlib/server_writeback.c \
    147         crserverlib/server_getshaders.c \
    148         crserverlib/server_framebuffer.c \
    149         crserverlib/server_glsl.c \
     111        crserverlib/server_main.cpp \
     112        crserverlib/server_boundsinfo.cpp \
     113        crserverlib/server_bufferobject.cpp \
     114        crserverlib/server_clear.cpp \
     115        crserverlib/server_clip.cpp \
     116        crserverlib/server_config.cpp \
     117        crserverlib/server_context.cpp \
     118        crserverlib/server_gentextures.cpp \
     119        crserverlib/server_getmap.cpp \
     120        crserverlib/server_getstring.cpp \
     121        crserverlib/server_getpointer.cpp \
     122        crserverlib/server_getpixelmap.cpp \
     123        crserverlib/server_getteximage.cpp \
     124        crserverlib/server_lists.cpp \
     125        crserverlib/server_misc.cpp \
     126        crserverlib/server_occlude.cpp \
     127        crserverlib/server_papi.cpp \
     128        crserverlib/server_projmatrix.cpp \
     129        crserverlib/server_readpixels.cpp \
     130        crserverlib/server_stream.cpp \
     131        crserverlib/server_viewport.cpp \
     132        crserverlib/server_window.cpp \
     133        crserverlib/server_winpos.cpp \
     134        crserverlib/server_writeback.cpp \
     135        crserverlib/server_getshaders.cpp \
     136        crserverlib/server_framebuffer.cpp \
     137        crserverlib/server_glsl.cpp \
    150138        crserverlib/server_muralfbo.cpp \
    151         crserverlib/server_texture.c \
     139        crserverlib/server_texture.cpp \
    152140        crserverlib/presenter/server_presenter.cpp \
    153141        crserverlib/presenter/display_base.cpp \
     
    158146        crserverlib/presenter/display_vrdp.cpp \
    159147        crserverlib/server_rpw.cpp \
    160         $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
    161         $(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
    162         $(VBOX_PATH_CROGL_GENFILES)/server_get.c \
    163         $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c
     148        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp \
     149        $(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp \
     150        $(VBOX_PATH_CROGL_GENFILES)/server_get.cpp \
     151        $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp
    164152VBoxOGLcrserverlib_CLEAN = \
    165         $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
    166         $(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
    167         $(VBOX_PATH_CROGL_GENFILES)/server_get.c \
    168         $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c \
     153        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp \
     154        $(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp \
     155        $(VBOX_PATH_CROGL_GENFILES)/server_get.cpp \
     156        $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp \
    169157        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h
    170 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    171 VBoxOGLcrserverlib_DEFS += VBOX_WITH_CR_DISPLAY_LISTS
    172 endif
    173158ifdef VBOXCR_LOGFPS
    174159VBoxOGLcrserverlib_DEFS += VBOXCR_LOGFPS
     
    192177        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    193178
    194 $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_dispatch.py server_special) $(VBOX_CROGL_API_FILES) $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/state_tracker/state_special | $$(dir $$@)
    195         $(call MSG_GENERATE,python,$@,$<)
    196         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    197 
    198 $(VBOX_PATH_CROGL_GENFILES)/server_retval.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_retval.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    199         $(call MSG_GENERATE,python,$@,$<)
    200         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    201 
    202 $(VBOX_PATH_CROGL_GENFILES)/server_get.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_get.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    203         $(call MSG_GENERATE,python,$@,$<)
    204         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    205 
    206 $(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_simpleget.py get_sizes.py) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     179$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_dispatch.py server_special) $(VBOX_CROGL_API_FILES) $(PATH_ROOT)/src/VBox/GuestHost/OpenGL/state_tracker/state_special | $$(dir $$@)
     180        $(call MSG_GENERATE,python,$@,$<)
     181        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     182
     183$(VBOX_PATH_CROGL_GENFILES)/server_retval.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_retval.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     184        $(call MSG_GENERATE,python,$@,$<)
     185        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     186
     187$(VBOX_PATH_CROGL_GENFILES)/server_get.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_get.py server_special) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
     188        $(call MSG_GENERATE,python,$@,$<)
     189        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     190
     191$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.cpp: $(addprefix $(PATH_SUB_CURRENT)/crserverlib/, server_simpleget.py get_sizes.py) $(VBOX_CROGL_API_FILES) | $$(dir $$@)
    207192        $(call MSG_GENERATE,python,$@,$<)
    208193        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
     
    223208        $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h
    224209VBoxOGLcrunpacker_SOURCES  = \
    225         unpacker/unpack_arrays.c \
    226         unpacker/unpack_bounds.c \
    227         unpacker/unpack_bufferobject.c \
    228         unpacker/unpack_calllists.c \
    229         unpacker/unpack_clipplane.c \
    230         unpacker/unpack_context.c \
    231         unpacker/unpack_drawpixels.c \
    232         unpacker/unpack_fence.c \
    233         unpacker/unpack_fog.c \
    234         unpacker/unpack_lights.c \
    235         unpacker/unpack_map.c \
    236         unpacker/unpack_materials.c \
    237         unpacker/unpack_matrices.c \
    238         unpacker/unpack_misc.c \
    239         unpacker/unpack_pixelmap.c \
    240         unpacker/unpack_point.c \
    241         unpacker/unpack_program.c \
    242         unpacker/unpack_readpixels.c \
    243         unpacker/unpack_regcombiner.c \
    244         unpacker/unpack_stipple.c \
    245         unpacker/unpack_texture.c \
    246         unpacker/unpack_writeback.c \
    247         unpacker/unpack_visibleregion.c \
    248         unpacker/unpack_shaders.c \
    249         unpacker/unpack_framebuffer.c \
     210        unpacker/unpack_arrays.cpp \
     211        unpacker/unpack_bounds.cpp \
     212        unpacker/unpack_bufferobject.cpp \
     213        unpacker/unpack_calllists.cpp \
     214        unpacker/unpack_clipplane.cpp \
     215        unpacker/unpack_context.cpp \
     216        unpacker/unpack_drawpixels.cpp \
     217        unpacker/unpack_fence.cpp \
     218        unpacker/unpack_fog.cpp \
     219        unpacker/unpack_lights.cpp \
     220        unpacker/unpack_map.cpp \
     221        unpacker/unpack_materials.cpp \
     222        unpacker/unpack_matrices.cpp \
     223        unpacker/unpack_misc.cpp \
     224        unpacker/unpack_pixelmap.cpp \
     225        unpacker/unpack_point.cpp \
     226        unpacker/unpack_program.cpp \
     227        unpacker/unpack_readpixels.cpp \
     228        unpacker/unpack_regcombiner.cpp \
     229        unpacker/unpack_stipple.cpp \
     230        unpacker/unpack_texture.cpp \
     231        unpacker/unpack_writeback.cpp \
     232        unpacker/unpack_visibleregion.cpp \
     233        unpacker/unpack_shaders.cpp \
     234        unpacker/unpack_framebuffer.cpp \
    250235        $(VBOX_PATH_CROGL_GENFILES)/unpack.cpp
    251236VBoxOGLcrunpacker_CLEAN = \
     
    270255        $(call MSG_GENERATE,python,$@,$<)
    271256        $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
    272 
    273 
    274 ifdef VBOX_WITH_CR_DISPLAY_LISTS
    275 #
    276 # VBoxOGLcrdlm
    277 #
    278 
    279 VBoxOGLcrdlm_TEMPLATE       = VBOXCROGLR3HOSTLIB
    280 VBoxOGLcrdlm_INCS           = \
    281         dlm
    282 VBoxOGLcrdlm_INTERMEDIATES  = \
    283         $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
    284         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
    285 
    286 VBoxOGLcrdlm_SOURCES  = \
    287         dlm/dlm.c \
    288         dlm/dlm_arrays.c \
    289         dlm/dlm_state.c \
    290         dlm/dlm_checklist.c \
    291         dlm/dlm_error.c \
    292         dlm/dlm_lists.c \
    293         dlm/dlm_pointers.c \
    294         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c
    295 
    296 VBoxOGLcrdlm_CLEAN = \
    297         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c \
    298         $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
    299         $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
    300 #
    301 # Generate files for VBoxOGLcrdlm.
    302 #
    303 $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h: \
    304                 $(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_header.py) \
    305                 $(VBOX_CROGL_API_FILES) \
    306                 | $$(dir $$@)
    307         $(call MSG_GENERATE,python,$@,$<)
    308         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< header $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
    309 
    310 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h: \
    311                 $(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
    312                 $(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
    313                 $(VBOX_CROGL_API_FILES) \
    314                 | $$(dir $$@)
    315         $(call MSG_GENERATE,python,$@,$<)
    316         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< headers $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
    317 
    318 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c: \
    319                 $(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
    320                 $(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h \
    321                 $(VBOX_CROGL_API_FILES) \
    322                 | $$(dir $$@)
    323         $(call MSG_GENERATE,python,$@,$<)
    324         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< source $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
    325 
    326 
    327 #
    328 # VBoxOGLexpandospu
    329 #
    330 VBoxOGLexpandospu_TEMPLATE       = VBOXCROGLR3HOSTDLL
    331 VBoxOGLexpandospu_INCS           = \
    332         expando
    333 VBoxOGLexpandospu_SOURCES  = \
    334         expando/expandospu.c \
    335         expando/expandospu_config.c \
    336         expando/expandospu_init.c \
    337         $(VBOX_PATH_CROGL_GENFILES)/expando.c
    338 VBoxOGLexpandospu_CLEAN = \
    339         $(VBOX_PATH_CROGL_GENFILES)/expando.c
    340 VBoxOGLexpandospu_CLEAN = \
    341         $(VBOX_PATH_CROGL_GENFILES)/expando.c
    342 VBoxOGLexpandospu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLexpandospu.dylib
    343 VBoxOGLexpandospu_LIBS = \
    344         $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB) \
    345         $(PATH_STAGE_LIB)/VBoxOGLhostcrstate$(VBOX_SUFF_LIB) \
    346         $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
    347         $(VBOX_LIB_OGL_HOSTCRUTIL) \
    348         $(LIB_RUNTIME) \
    349         $(LIB_VMM)
    350 #
    351 # Generate files for VBoxOGLexpandospu.
    352 #
    353 $(VBOX_PATH_CROGL_GENFILES)/expando.c: \
    354                 $(addprefix $(PATH_SUB_CURRENT)/expando/, expando.py expando_special) \
    355                 $(VBOX_CROGL_API_FILES) \
    356                 | $$(dir $$@)
    357         $(call MSG_GENERATE,python,$@,$<)
    358         $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) > $@
    359 endif
    360257
    361258
  • trunk/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp

    r76553 r78190  
    2626#include <ApplicationServices/ApplicationServices.h>
    2727#include <OpenGL/gl.h>
    28 #ifdef VBOX_WITH_COCOA_QT
    29 # include <OpenGL/glu.h>
    30 #endif
     28#include <OpenGL/glu.h>
    3129
    3230#include <iprt/env.h>
     
    143141            GLboolean isSupported = GL_TRUE;
    144142
    145 #ifdef VBOX_WITH_COCOA_QT
    146143            /*
    147144             * In the Cocoa port we depend on the GL_EXT_framebuffer_object &
     
    160157            else
    161158                LogRel(("OpenGL Info: 3D test found that GL_EXT_framebuffer_object extension not supported.\n"));
    162 #endif /* VBOX_WITH_COCOA_QT */
    163159
    164160            CGLDestroyContext(pCglContext);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h

    r76553 r78190  
    2424#include "cr_error.h"
    2525#include "cr_net.h"
    26 #include "cr_rand.h"
    2726#include "server_dispatch.h"
    2827#include "server.h"
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r71607 r78190  
    9292} CRServerProgram;
    9393
    94 void crServerSetVBoxConfiguration();
    9594void crServerSetVBoxConfigurationHGCM();
    9695void crServerInitDispatch(void);
     
    107106void crServerSetOutputBounds( const CRMuralInfo *mural, int extNum );
    108107void crServerComputeViewportBounds( const CRViewportState *v, CRMuralInfo *mural );
    109 
    110 GLboolean crServerInitializeBucketing(CRMuralInfo *mural);
    111108
    112109void crComputeOverlapGeom(double *quads, int nquad, CRPoly ***res);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch.py

    r78116 r78190  
    110110        print('\t{')
    111111        print('\t\tcr_server.head_spu->dispatch_table.%s(%s);' % (func_name, apiutil.MakeCallStringForDispatcher(params) ))
    112         print("\t\tcr_server.current.c.%s.%s%s = cr_unpackData;" % (name,type,array))
     112        print("\t\tcr_server.current.c.%s.%s%s = cr_server.pUnpackerState->pbUnpackData;" % (name,type,array))
    113113        print('\t}')
    114114        print('}\n')
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getpixelmap.cpp

    r78189 r78190  
    7070        pbo_offset = (GLfloat*) ((uintptr_t) *((GLint*)values));
    7171
    72         cr_server.head_spu->dispatch_table.GetPixelMapfv( map, pbo_offset );
     72        cr_server.head_spu->dispatch_table.GetPixelMapfv( map, (GLfloat *)pbo_offset );
    7373    }
    7474    else
     
    9797        pbo_offset = (GLuint*) ((uintptr_t) *((GLint*)values));
    9898
    99         cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, pbo_offset );
     99        cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, (GLuint *)pbo_offset );
    100100    }
    101101    else
     
    124124        pbo_offset = (GLushort*) ((uintptr_t) *((GLint*)values));
    125125
    126         cr_server.head_spu->dispatch_table.GetPixelMapusv( map, pbo_offset );
     126        cr_server.head_spu->dispatch_table.GetPixelMapusv( map, (GLushort *)pbo_offset );
    127127    }
    128128    else
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_papi.cpp

    r78189 r78190  
    1212
    1313#define DEBUG_BARRIERS 1
     14#ifdef DEBUG_BARRIERS
     15# include <stdio.h>
     16#endif
    1417
    1518void SERVER_DISPATCH_APIENTRY crServerDispatchBarrierCreateCR( GLuint name, GLuint count )
     
    165168        }
    166169
    167         sema = crHashtableSearch(cr_server.semaphores, name);
     170        sema = (CRServerSemaphore *)crHashtableSearch(cr_server.semaphores, name);
    168171        if (sema)
    169172                return; /* already created */
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_retval.py

    r74890 r78190  
    3030        if (cr_server.bIsInLoadingState)
    3131            return;
    32 
    33         if (cr_server.curClient->conn->type == CR_FILE)
    34         {
    35             return;
    36         }
    3732
    3833        if (payload_len >= INT32_MAX - sizeof( *rb ))
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.c

    r69390 r78190  
    55 */
    66
    7 #include "cr_environment.h"
    87#include "cr_string.h"
    98#include "cr_error.h"
    109#include "cr_mem.h"
    1110#include "cr_spu.h"
    12 #include "cr_environment.h"
    1311#include "renderspu.h"
    1412#include "cr_extstring.h"
     
    1614#include <iprt/asm.h>
    1715
     16#include <stdio.h> /*sprintf*/
     17
    1818uint32_t renderspuContextRelease(ContextInfo *context);
    1919uint32_t renderspuContextRetain(ContextInfo *context);
     
    2626    out.header.type = CR_MESSAGE_OOB;
    2727
    28     if (render_spu.is_swap_master)
    29     {
    30         int a;
    31 
    32         for (a = 0; a < render_spu.num_swap_clients; a++)
    33         {
    34             crNetGetMessage( render_spu.swap_conns[a], &in );
    35             crNetFree( render_spu.swap_conns[a], in);
    36         }
    37 
    38         for (a = 0; a < render_spu.num_swap_clients; a++)
    39             crNetSend( render_spu.swap_conns[a], NULL, &out, sizeof(CRMessage));
    40     }
    41     else
    42     {
    43         crNetSend( render_spu.swap_conns[0], NULL, &out, sizeof(CRMessage));
    44 
    45         crNetGetMessage( render_spu.swap_conns[0], &in );
    46         crNetFree( render_spu.swap_conns[0], in);
    47     }
     28    crNetSend( render_spu.swap_conns[0], NULL, &out, sizeof(CRMessage));
     29
     30    crNetGetMessage( render_spu.swap_conns[0], &in );
     31    crNetFree( render_spu.swap_conns[0], in);
    4832}
    4933
     
    13611345        DrawCursor( render_spu.cursorX, render_spu.cursorY );
    13621346
    1363     if (render_spu.swap_master_url)
    1364         DoSync();
    1365 
    13661347    renderspu_SystemSwapBuffers( w, flags );
    13671348}
     
    15701551                switch (render_spu.server->clients[client_num]->conn->type)
    15711552                {
    1572                     case CR_TCPIP:
    1573                         crDebug("Render SPU: AcceptClient from %s on %d",
    1574                             render_spu.server->clients[client_num]->conn->hostname, render_spu.gather_port);
    1575                         render_spu.gather_conns[client_num] =
    1576                                 crNetAcceptClient("tcpip", NULL, port, 1024*1024,  1);
    1577                         break;
    1578 
    1579                     case CR_GM:
    1580                         render_spu.gather_conns[client_num] =
    1581                                 crNetAcceptClient("gm", NULL, port, 1024*1024,  1);
    1582                         break;
    1583 
    15841553                    default:
    15851554                        crError("Render SPU: Unknown Network Type to Open Gather Connection");
     
    16001569                if (render_spu.gather_conns[client_num])
    16011570                {
    1602                     crDebug("Render SPU: success! from %s", render_spu.gather_conns[client_num]->hostname);
     1571                    crDebug("Render SPU: success!");
    16031572                }
    16041573            }
     
    16291598         * in SwapBuffers above] is not necessary -- karl
    16301599         */
    1631 
    1632         if (render_spu.swap_master_url)
    1633             DoSync();
    1634 
    16351600        for (client_num=0; client_num< render_spu.server->numClients; client_num++)
    16361601            crNetSend(render_spu.gather_conns[client_num], NULL, &pingback,
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h

    r70851 r78190  
    1414#define snprintf _snprintf
    1515#elif defined(DARWIN)
    16 # ifndef VBOX_WITH_COCOA_QT
    17 #  include <AGL/AGL.h>
    18 # else
    19 #  include "renderspu_cocoa_helper.h"
    20 # endif
     16# include "renderspu_cocoa_helper.h"
    2117#define RENDER_APIENTRY
    2218#else
     
    4743#define MAX_VISUALS 32
    4844
    49 #ifdef RT_OS_DARWIN
    50 # ifndef VBOX_WITH_COCOA_QT
    51 enum
    52 {
    53     /* Event classes */
    54     kEventClassVBox         = 'vbox',
    55     /* Event kinds */
    56     kEventVBoxShowWindow    = 'swin',
    57     kEventVBoxHideWindow    = 'hwin',
    58     kEventVBoxMoveWindow    = 'mwin',
    59     kEventVBoxResizeWindow  = 'rwin',
    60     kEventVBoxDisposeWindow = 'dwin',
    61     kEventVBoxUpdateDock    = 'udck',
    62     kEventVBoxUpdateContext = 'uctx',
    63     kEventVBoxBoundsChanged = 'bchg'
    64 };
    65 pascal OSStatus windowEvtHndlr(EventHandlerCallRef myHandler, EventRef event, void* userData);
    66 # endif
    67 #endif /* RT_OS_DARWIN */
    68 
    6945/**
    7046 * Visual info
     
    7652//    HDC device_context;
    7753#elif defined(DARWIN)
    78 # ifndef VBOX_WITH_COCOA_QT
    79     WindowRef window;
    80 # endif
    8154#elif defined(GLX)
    8255    Display *dpy;
     
    12194    HRGN hRgn;
    12295#elif defined(DARWIN)
    123 # ifndef VBOX_WITH_COCOA_QT
    124     WindowRef window;
    125     WindowRef nativeWindow; /**< for render_to_app_window */
    126     WindowRef appWindow;
    127     EventHandlerUPP event_handler;
    128     GLint bufferName;
    129     AGLContext dummyContext;
    130     RgnHandle hVisibleRegion;
    131     /* unsigned long context_ptr; */
    132 # else
    13396    NativeNSViewRef window;
    13497    NativeNSViewRef nativeWindow; /**< for render_to_app_window */
    13598    NativeNSOpenGLContextRef *currentCtx;
    136 # endif
    13799#elif defined(GLX)
    138100    Window window;
     
    163125    HGLRC hRC;
    164126#elif defined(DARWIN)
    165 # ifndef VBOX_WITH_COCOA_QT
    166     AGLContext context;
    167 # else
    168127    NativeNSOpenGLContextRef context;
    169 # endif
    170128#elif defined(GLX)
    171129    GLXContext context;
     
    288246    CRHashTable *barrierHash;
    289247
    290     int is_swap_master, num_swap_clients;
    291     int swap_mtu;
    292     char *swap_master_url;
     248    int num_swap_clients;
    293249    CRConnection **swap_conns;
    294250
     
    329285
    330286#ifdef RT_OS_DARWIN
    331 # ifdef VBOX_WITH_COCOA_QT
    332287    PFNDELETE_OBJECT pfnDeleteObject;
    333288    PFNGET_ATTACHED_OBJECTS pfnGetAttachedObjects;
     
    338293
    339294    CR_GLSL_CACHE GlobalShaders;
    340 # else
    341     RgnHandle hRootVisibleRegion;
    342     RTSEMFASTMUTEX syncMutex;
    343     EventHandlerUPP hParentEventHandler;
    344     WindowGroupRef pParentGroup;
    345     WindowGroupRef pMasterGroup;
    346     GLint currentBufferName;
    347     uint64_t uiDockUpdateTS;
    348     bool fInit;
    349 # endif
    350295#endif /* RT_OS_DARWIN */
    351296    /* If TRUE, render should tell window server to prevent artificial content
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_config.c

    r70852 r78190  
    1010#include "cr_mem.h"
    1111#include "cr_error.h"
    12 #include "cr_environment.h"
    13 #include "cr_url.h"
    1412
    15 
    16 static void set_window_geometry( RenderSPU *render_spu, const char *response )
    17 {
    18     int x, y, w, h;
    19     CRASSERT(response[0] == '[');
    20     sscanf( response, "[ %d, %d, %d, %d ]", &x, &y, &w, &h );
    21     render_spu->defaultX = (int) x;
    22     render_spu->defaultY = (int) y;
    23     render_spu->defaultWidth = (unsigned int) w;
    24     render_spu->defaultHeight = (unsigned int) h;
    25 }
    26 
    27 static void set_default_visual( RenderSPU *render_spu, const char *response )
    28 {
    29     if (crStrlen(response) > 0) {
    30         if (crStrstr(response, "rgb"))
    31                 render_spu->default_visual |= CR_RGB_BIT;
    32         if (crStrstr(response, "alpha"))
    33                 render_spu->default_visual |= CR_ALPHA_BIT;
    34         if (crStrstr(response, "z") || crStrstr(response, "depth"))
    35                 render_spu->default_visual |= CR_DEPTH_BIT;
    36         if (crStrstr(response, "stencil"))
    37                 render_spu->default_visual |= CR_STENCIL_BIT;
    38         if (crStrstr(response, "accum"))
    39                 render_spu->default_visual |= CR_ACCUM_BIT;
    40         if (crStrstr(response, "stereo"))
    41                 render_spu->default_visual |= CR_STEREO_BIT;
    42         if (crStrstr(response, "multisample"))
    43                 render_spu->default_visual |= CR_MULTISAMPLE_BIT;
    44         if (crStrstr(response, "double"))
    45                 render_spu->default_visual |= CR_DOUBLE_BIT;
    46         if (crStrstr(response, "pbuffer"))
    47                 render_spu->default_visual |= CR_PBUFFER_BIT;
    48     }
    49 }
    50 
    51 static void set_display_string( RenderSPU *render_spu, const char *response )
    52 {
    53     if (!crStrcmp(response, "DEFAULT")) {
    54         const char *display = crGetenv("DISPLAY");
    55         if (display)
    56             crStrncpy(render_spu->display_string,
    57                                 display,
    58                                 sizeof(render_spu->display_string));
    59         else
    60             crStrcpy(render_spu->display_string, ""); /* empty string */
    61     }
    62     else {
    63         crStrncpy(render_spu->display_string,
    64                             response,
    65                             sizeof(render_spu->display_string));
    66     }
    67 }
    68 
    69 static void set_fullscreen( RenderSPU *render_spu, const char *response )
    70 {
    71     sscanf( response, "%d", &(render_spu->fullscreen) );
    72 }
    73 
    74 static void set_on_top( RenderSPU *render_spu, const char *response )
    75 {
    76     sscanf( response, "%d", &(render_spu->ontop) );
    77 }
    78 
    79 static void set_system_gl_path( RenderSPU *render_spu, const char *response )
    80 {
    81     if (crStrlen(response) > 0)
    82         crSetenv( "CR_SYSTEM_GL_PATH", response );
    83 }
    84 
    85 static void set_title( RenderSPU *render_spu, const char *response )
    86 {
    87     crFree( render_spu->window_title );
    88     render_spu->window_title = crStrdup( response );
    89 }
    90 
    91 #if defined(GLX)
    92 static void set_try_direct( RenderSPU *render_spu, const char *response )
    93 {
    94     sscanf( response, "%d", &(render_spu->try_direct) );
    95 }
    96 
    97 static void set_force_direct( RenderSPU *render_spu, const char *response )
    98 {
    99     sscanf( response, "%d", &(render_spu->force_direct) );
    100 }
    101 #endif /* GLX */
    102 
    103 static void render_to_app_window( RenderSPU *render_spu, const char *response )
    104 {
    105     sscanf( response, "%d", &(render_spu->render_to_app_window) );
    106 }
    107 
    108 static void render_to_crut_window( RenderSPU *render_spu, const char *response )
    109 {
    110     sscanf( response, "%d", &(render_spu->render_to_crut_window) );
    111 }
    112 
    113 static void resizable( RenderSPU *render_spu, const char *response )
    114 {
    115     sscanf( response, "%d", &(render_spu->resizable) );
    116 }
    117 
    118 static void set_borderless( RenderSPU *render_spu, const char *response )
    119 {
    120     sscanf( response, "%d", &(render_spu->borderless) );
    121 }
    122 
    123 static void set_cursor( RenderSPU *render_spu, const char *response )
    124 {
    125     sscanf( response, "%d", &(render_spu->drawCursor) );
    126 }
    127 
    128 static void gather_url( RenderSPU *render_spu, const char *response )
    129 {
    130     char protocol[4096], hostname[4096];
    131     unsigned short port;
    132    
    133     if (!crParseURL(response, protocol, hostname, &port, 0))
    134     {
    135         crError( "Malformed URL: \"%s\"", response );
    136     }
    137 
    138     render_spu->gather_port = port;
    139 }
    140 
    141 static void gather_userbuf( RenderSPU *render_spu, const char *response )
    142 {
    143     sscanf( response, "%d", &(render_spu->gather_userbuf_size) );
    144 }
    145 
    146 static void set_lut8( RenderSPU *render_spu, const char *response )
    147 {
    148     int a; 
    149     char **lut;
    150    
    151     if (!response[0]) return;
    152 
    153     lut = crStrSplit(response, ",");
    154     if (!lut) return;
    155 
    156     for (a=0; a<256; a++)
    157     {
    158         render_spu->lut8[0][a]  = crStrToInt(lut[a]);
    159         render_spu->lut8[1][a]  = crStrToInt(lut[256+a]);
    160         render_spu->lut8[2][a]  = crStrToInt(lut[512+a]);
    161     }
    162 
    163     crFreeStrings(lut);
    164 
    165     render_spu->use_lut8 = 1;
    166 }
    167 
    168 static void set_master_url ( RenderSPU *render_spu, char *response )
    169 {
    170     if (response[0])
    171         render_spu->swap_master_url = crStrdup( response );
    172     else
    173         render_spu->swap_master_url = NULL;
    174 }
    175 
    176 static void set_is_master ( RenderSPU *render_spu, char *response )
    177 {
    178     render_spu->is_swap_master = crStrToInt( response );
    179 }
    180 
    181 static void set_num_clients ( RenderSPU *render_spu, char *response )
    182 {
    183     render_spu->num_swap_clients = crStrToInt( response );
    184 }
    185 
    186 static void set_use_osmesa ( RenderSPU *render_spu, char *response )
    187 {
    188     int val = crStrToInt( response );
    189 #ifdef USE_OSMESA
    190     render_spu->use_osmesa = val;
    191 #else
    192     if (val != 0)
    193         crError( "renderspu with Conf(use_osmesa, 1) but not compiled with -DUSE_OSMESA");
    194 #endif
    195 }
    196 
    197 static void set_nv_swap_group( RenderSPU *render_spu, char *response )
    198 {
    199     render_spu->nvSwapGroup = crStrToInt( response );
    200     if (render_spu->nvSwapGroup < 0)
    201         render_spu->nvSwapGroup = 0;
    202 }
    203 
    204 static void set_ignore_papi( RenderSPU *render_spu, char *response )
    205 {
    206     render_spu->ignore_papi = crStrToInt( response );
    207 }
    208 
    209 static void set_ignore_window_moves( RenderSPU *render_spu, char *response )
    210 {
    211     render_spu->ignore_window_moves = crStrToInt( response );
    212 }
    213 
    214 static void set_pbuffer_size( RenderSPU *render_spu, const char *response )
    215 {
    216     CRASSERT(response[0] == '[');
    217     sscanf( response, "[ %d, %d ]",
    218                     &render_spu->pbufferWidth, &render_spu->pbufferHeight);
    219 }
    220 
    221 static void set_use_glxchoosevisual( RenderSPU *render_spu, char *response )
    222 {
    223     render_spu->use_glxchoosevisual = crStrToInt( response );
    224 }
    225 
    226 static void set_draw_bbox( RenderSPU *render_spu, char *response )
    227 {
    228     render_spu->draw_bbox = crStrToInt( response );
    229 }
    230 
    231 
    232 
    233 /* option, type, nr, default, min, max, title, callback
    234  */
    235 SPUOptions renderSPUOptions[] = {
    236     { "title", CR_STRING, 1, "Chromium Render SPU", NULL, NULL,
    237         "Window Title", (SPUOptionCB)set_title },
    238 
    239     { "window_geometry", CR_INT, 4, "[0, 0, 256, 256]", "[0, 0, 1, 1]", NULL,
    240         "Default Window Geometry (x,y,w,h)", (SPUOptionCB)set_window_geometry },
    241 
    242     { "fullscreen", CR_BOOL, 1, "0", NULL, NULL,
    243         "Full-screen Window", (SPUOptionCB)set_fullscreen },
    244 
    245     { "resizable", CR_BOOL, 1, "0", NULL, NULL,
    246         "Resizable Window", (SPUOptionCB)resizable },
    247 
    248     { "on_top", CR_BOOL, 1, "0", NULL, NULL,
    249         "Display on Top", (SPUOptionCB)set_on_top },
    250 
    251     { "borderless", CR_BOOL, 1, "0", NULL, NULL,
    252         "Borderless Window", (SPUOptionCB) set_borderless },
    253 
    254     { "default_visual", CR_STRING, 1, "rgb, double, depth", NULL, NULL,
    255         "Default GL Visual", (SPUOptionCB) set_default_visual },
    256 
    257 #if defined(GLX)
    258     { "try_direct", CR_BOOL, 1, "1", NULL, NULL,
    259         "Try Direct Rendering", (SPUOptionCB)set_try_direct  },
    260 
    261     { "force_direct", CR_BOOL, 1, "0", NULL, NULL,
    262         "Force Direct Rendering", (SPUOptionCB)set_force_direct },
    263 #endif
    264 
    265     { "render_to_app_window", CR_BOOL, 1, "0", NULL, NULL,
    266         "Render to Application window", (SPUOptionCB)render_to_app_window },
    267 
    268     { "render_to_crut_window", CR_BOOL, 1, "0", NULL, NULL,
    269         "Render to CRUT window", (SPUOptionCB)render_to_crut_window },
    270 
    271     { "show_cursor", CR_BOOL, 1, "0", NULL, NULL,
    272         "Show Software Cursor", (SPUOptionCB) set_cursor },
    273 
    274     { "system_gl_path", CR_STRING, 1, "", NULL, NULL,
    275         "System GL Path", (SPUOptionCB)set_system_gl_path },
    276 
    277     { "display_string", CR_STRING, 1, "DEFAULT", NULL, NULL,
    278         "X Display String", (SPUOptionCB)set_display_string },
    279 
    280     { "gather_url", CR_STRING, 1, "", NULL, NULL,
    281         "Gatherer URL", (SPUOptionCB)gather_url},
    282 
    283     { "gather_userbuf_size", CR_INT, 1, "0", NULL, NULL,
    284         "Size of Buffer to Allocate for Gathering", (SPUOptionCB)gather_userbuf},
    285 
    286     { "lut8", CR_STRING, 1, "", NULL, NULL,
    287         "8 bit RGB LUT", (SPUOptionCB)set_lut8},
    288 
    289     { "swap_master_url", CR_STRING, 1, "", NULL, NULL,
    290         "The URL to the master swapper", (SPUOptionCB)set_master_url },
    291 
    292     { "is_swap_master", CR_BOOL, 1, "0", NULL, NULL,
    293         "Is this the swap master", (SPUOptionCB)set_is_master },
    294 
    295     { "num_swap_clients", CR_INT, 1, "1", NULL, NULL,
    296         "How many swaps to wait on", (SPUOptionCB)set_num_clients },
    297 
    298     { "use_osmesa", CR_BOOL, 1, "0", NULL, NULL,
    299         "Use offscreen rendering with Mesa", (SPUOptionCB)set_use_osmesa },
    300      
    301     { "nv_swap_group", CR_INT, 1, "0", NULL, NULL,
    302         "NVIDIA Swap Group Number", (SPUOptionCB) set_nv_swap_group },
    303 
    304     { "ignore_papi", CR_BOOL, 1, "0", NULL, NULL,
    305         "Ignore Barrier and Semaphore calls", (SPUOptionCB) set_ignore_papi },
    306 
    307     { "ignore_window_moves", CR_BOOL, 1, "0", NULL, NULL,
    308         "Ignore crWindowPosition calls", (SPUOptionCB) set_ignore_window_moves },
    309 
    310     { "pbuffer_size", CR_INT, 2, "[0, 0]", "[0, 0]", NULL,
    311         "Maximum PBuffer Size", (SPUOptionCB) set_pbuffer_size },
    312 
    313     { "use_glxchoosevisual", CR_BOOL, 1, "1", NULL, NULL,
    314         "Use glXChooseVisual", (SPUOptionCB) set_use_glxchoosevisual },
    315 
    316     { "draw_bbox", CR_BOOL, 1, "0", NULL, NULL,
    317         "Draw Bounding Boxes", (SPUOptionCB) set_draw_bbox },
    318     { NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
    319 };
     13#include <iprt/env.h>
    32014
    32115
    32216void renderspuSetVBoxConfiguration( RenderSPU *render_spu )
    32317{
     18    const char *display = NULL;
    32419    int a;
    32520
     
    33227    render_spu->use_lut8 = 0;
    33328
    334     set_title(render_spu, "Chromium Render SPU");
    335     set_window_geometry(render_spu, "[0, 0, 0, 0]");
    336     set_fullscreen(render_spu, "0");
    337     resizable(render_spu, "0");
    338     set_on_top(render_spu, "1");
    339     set_borderless(render_spu, "1");
    340     set_default_visual(render_spu, "rgb, double, depth");
     29    crFree( render_spu->window_title );
     30    render_spu->window_title = crStrdup("Chromium Render SPU");
     31    render_spu->defaultX = 0;
     32    render_spu->defaultY = 0;
     33    render_spu->defaultWidth = 0;
     34    render_spu->defaultHeight = 0;
     35    render_spu->fullscreen = 0;
     36    render_spu->resizable = 0;
     37    render_spu->ontop = 1;
     38    render_spu->borderless = 1;
     39    render_spu->default_visual = CR_RGB_BIT | CR_DOUBLE_BIT | CR_DEPTH_BIT;
    34140#if defined(GLX)
    342     set_try_direct(render_spu, "1");
    343     set_force_direct(render_spu, "0");
     41    render_spu->try_direct = 1;
     42    render_spu->force_direct = 0;
    34443#endif
    345     render_to_app_window(render_spu, "0");
    346     render_to_crut_window(render_spu, "0");
    347     set_cursor(render_spu, "0");
    348     set_system_gl_path(render_spu, "");
    349     set_display_string(render_spu, "DEFAULT");
    350     gather_url(render_spu, "");
    351     gather_userbuf(render_spu, "0");
    352     set_lut8(render_spu, "");
    353     set_master_url(render_spu, "");
    354     set_is_master(render_spu, "0");
    355     set_num_clients(render_spu, "1");
    356     set_use_osmesa(render_spu, "0");
    357     set_nv_swap_group(render_spu, "0");
    358     set_ignore_papi(render_spu, "0");
    359     set_ignore_window_moves(render_spu, "0");
    360     set_pbuffer_size(render_spu, "[0, 0]");
    361     set_use_glxchoosevisual(render_spu, "1");
    362     set_draw_bbox(render_spu, "0");
     44    render_spu->render_to_app_window = 0;
     45    render_spu->render_to_crut_window = 0;
     46    render_spu->drawCursor = 0;
     47    render_spu->gather_userbuf_size = 0;
     48    render_spu->use_lut8 = 0;
     49    render_spu->num_swap_clients = 1;
     50    render_spu->nvSwapGroup = 0;
     51    render_spu->ignore_papi = 0;
     52    render_spu->ignore_window_moves = 0;
     53    render_spu->pbufferWidth = 0;
     54    render_spu->pbufferHeight = 0;
     55    render_spu->use_glxchoosevisual = 1;
     56    render_spu->draw_bbox = 0;
    36357
    364     render_spu->swap_mtu = 1024 * 500;
     58    display = RTEnvGet("DISPLAY");
     59    if (display)
     60        crStrncpy(render_spu->display_string, display, sizeof(render_spu->display_string));
     61    else
     62        crStrcpy(render_spu->display_string, ""); /* empty string */
    36563
    36664    /* Some initialization that doesn't really have anything to do
     
    37674    /* Config of "render force present main thread" (currently implemented by glx and wgl). */
    37775    {
    378         const char *forcePresent = crGetenv("CR_RENDER_FORCE_PRESENT_MAIN_THREAD");
     76        const char *forcePresent = RTEnvGet("CR_RENDER_FORCE_PRESENT_MAIN_THREAD");
    37977        if (forcePresent)
    38078            render_spu->force_present_main_thread = crStrToInt(forcePresent) ? 1 : 0;
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c

    r70851 r78190  
    44 * See the file LICENSE.txt for information on redistributing this software.
    55 */
    6 #if 00 /*TEMPORARY*/
    7 #include <unistd.h>
    8 #include "cr_rand.h"
    9 #endif
    10 
    116#include <GL/glx.h>
    127#include <X11/Xlib.h>
     
    1813#include <stdio.h>
    1914
    20 #include "cr_environment.h"
    2115#include "cr_error.h"
    2216#include "cr_string.h"
     
    2418#include "cr_process.h"
    2519#include "renderspu.h"
    26 
    2720
    2821/*
     
    948941    flags = CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
    949942
    950     /*
    951      * We pass the VNC's desktop windowID via an environment variable.
    952      * If we don't find one, we're not on a 3D-capable vncviewer, or
    953      * if we do find one, then create the renderspu subwindow as a
    954      * child of the vncviewer's desktop window.
    955      *
    956      * This is purely for the replicateSPU.
    957      *
    958      * NOTE: This is crufty, and will do for now. FIXME.
    959      */
    960     vncWin = crStrToInt( crGetenv("CRVNCWINDOW") );
    961     if (vncWin)
    962         parent = (Window) vncWin;
    963     else
    964         parent = RootWindow(dpy, visual->visual->screen);
    965 
     943    parent = RootWindow(dpy, visual->visual->screen);
    966944    if (render_spu_parent_window_id>0)
    967945    {
     
    19891967    CRASSERT(w);
    19901968
    1991 #if 00 /*TEMPORARY - FOR TESTING SWAP LOCK*/
    1992     if (1) {
    1993         /* random delay */
    1994         int k = crRandInt(1000 * 100, 750*1000);
    1995         static int first = 1;
    1996         if (first) {
    1997              crRandAutoSeed();
    1998              first = 0;
    1999         }
    2000         usleep(k);
    2001     }
    2002 #endif
    2003 
    20041969    /* render_to_app_window:
    20051970     * w->nativeWindow will only be non-zero if the
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c

    r69390 r78190  
    99#include "cr_error.h"
    1010#include "cr_string.h"
    11 #include "cr_url.h"
    12 #include "cr_environment.h"
    1311#include "renderspu.h"
    1412#include <stdio.h>
     13
     14#include <iprt/env.h>
    1515
    1616#ifdef RT_OS_DARWIN
     
    3232CRtsd _RenderTSD;
    3333#endif
    34 
    35 static void swapsyncConnect(void)
    36 {
    37     char hostname[4096], protocol[4096];
    38     unsigned short port;
    39 
    40     crNetInit(NULL, NULL);
    41 
    42     if (!crParseURL( render_spu.swap_master_url, protocol, hostname,
    43                     &port, 9876))
    44         crError( "Bad URL: %s", render_spu.swap_master_url );
    45 
    46     if (render_spu.is_swap_master)
    47     {
    48         int a;
    49 
    50         render_spu.swap_conns = (CRConnection **)crAlloc(
    51                         render_spu.num_swap_clients*sizeof(CRConnection *));
    52         for (a=0; a<render_spu.num_swap_clients; a++)
    53         {
    54             render_spu.swap_conns[a] = crNetAcceptClient( protocol, hostname, port,
    55                                                         render_spu.swap_mtu, 1);
    56         }
    57     }
    58     else
    59     {
    60         render_spu.swap_conns = (CRConnection **)crAlloc(sizeof(CRConnection *));
    61 
    62         render_spu.swap_conns[0] = crNetConnectToServer(render_spu.swap_master_url,
    63                                     port, render_spu.swap_mtu, 1);
    64         if (!render_spu.swap_conns[0])
    65             crError("Failed connection");
    66     }
    67 }
    6834
    6935#ifdef RT_OS_WINDOWS
     
    195161    renderspuSetVBoxConfiguration(&render_spu);
    196162
    197     if (render_spu.swap_master_url)
    198         swapsyncConnect();
    199 
    200 
    201163    /* Get our special functions. */
    202164    numSpecial = renderspuCreateFunctions( _cr_render_table );
     
    234196    render_spu.dummyWindowTable = crAllocHashtable();
    235197
    236     pcpwSetting = crGetenv("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT");
     198    pcpwSetting = RTEnvGet("CR_RENDER_ENABLE_SINGLE_PRESENT_CONTEXT");
    237199    if (pcpwSetting)
    238200    {
     
    271233    }
    272234#endif
    273 
    274 #ifdef DARWIN
    275 # ifdef VBOX_WITH_COCOA_QT
    276 # else /* VBOX_WITH_COCOA_QT */
    277     render_spu.hRootVisibleRegion = 0;
    278     render_spu.currentBufferName = 1;
    279     render_spu.uiDockUpdateTS = 0;
    280     /* Create a mutex for synchronizing events from the main Qt thread & this
    281        thread */
    282     RTSemFastMutexCreate(&render_spu.syncMutex);
    283     /* Create our window groups */
    284     CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &render_spu.pMasterGroup);
    285     CreateWindowGroup(kWindowGroupAttrMoveTogether | kWindowGroupAttrLayerTogether | kWindowGroupAttrSharedActivation | kWindowGroupAttrHideOnCollapse | kWindowGroupAttrFixedLevel, &render_spu.pParentGroup);
    286     /* Make the correct z-layering */
    287     SendWindowGroupBehind (render_spu.pParentGroup, render_spu.pMasterGroup);
    288     /* and set the gParentGroup as parent for gMasterGroup. */
    289     SetWindowGroupParent (render_spu.pMasterGroup, render_spu.pParentGroup);
    290     /* Install the event handlers */
    291     EventTypeSpec eventList[] =
    292     {
    293         {kEventClassVBox, kEventVBoxUpdateContext}, /* Update the context after show/size/move events */
    294         {kEventClassVBox, kEventVBoxBoundsChanged}  /* Clip/Pos the OpenGL windows when the main window is changed in pos/size */
    295     };
    296     /* We need to process events from our main window */
    297     render_spu.hParentEventHandler = NewEventHandlerUPP(windowEvtHndlr);
    298     InstallApplicationEventHandler (render_spu.hParentEventHandler,
    299                                     GetEventTypeCount(eventList), eventList,
    300                                     NULL, NULL);
    301     render_spu.fInit = true;
    302 # endif /* VBOX_WITH_COCOA_QT */
    303 #endif /* DARWIN */
    304235
    305236    rc = renderspuDefaultCtxInit();
     
    536467    renderspuCleanupBase(true);
    537468
    538 #ifdef RT_OS_DARWIN
    539 # ifndef VBOX_WITH_COCOA_QT
    540     render_spu.fInit = false;
    541     DisposeEventHandlerUPP(render_spu.hParentEventHandler);
    542     ReleaseWindowGroup(render_spu.pMasterGroup);
    543     ReleaseWindowGroup(render_spu.pParentGroup);
    544     if (render_spu.hRootVisibleRegion)
    545     {
    546         DisposeRgn(render_spu.hRootVisibleRegion);
    547         render_spu.hRootVisibleRegion = 0;
    548     }
    549     render_spu.currentBufferName = 1;
    550     render_spu.uiDockUpdateTS = 0;
    551     RTSemFastMutexDestroy(render_spu.syncMutex);
    552 # else /* VBOX_WITH_COCOA_QT */
    553 # endif /* VBOX_WITH_COCOA_QT */
    554 #endif /* RT_OS_DARWIN */
    555 
    556469#ifdef RT_OS_WINDOWS
    557470    if (render_spu.dwWinThreadId)
     
    600513
    601514
    602 extern SPUOptions renderSPUOptions[];
    603 
    604515int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
    605516         SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
    606          SPUOptionsPtr *options, int *flags )
     517         int *flags )
    607518{
    608519    *name = "render";
     
    611522    *self = renderSPUSelfDispatch;
    612523    *cleanup = renderSPUCleanup;
    613     *options = renderSPUOptions;
    614524    *flags = (SPU_NO_PACKER|SPU_IS_TERMINAL|SPU_MAX_SERVERS_ZERO);
    615525
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c

    r70871 r78190  
    1313#include <memory.h>
    1414
    15 #include "cr_environment.h"
    1615#include "cr_error.h"
    1716#include "cr_string.h"
     
    1918#include "cr_mem.h"
    2019
     20#include <iprt/env.h>
    2121
    2222/* IAT patcher stuff */
     
    664664     */
    665665#ifdef VBOX_CR_SERVER_FORCE_WGL
    666     if (crGetenv( "CR_WGL_DO_NOT_USE_GDI" ) != NULL)
     666    if (RTEnvGet( "CR_WGL_DO_NOT_USE_GDI" ) != NULL)
    667667    {
    668668        pixelformat = render_spu.ws.wglChoosePixelFormat( hdc, ppfd );
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.def

    r69390 r78190  
    55EXPORTS
    66crUnpack
    7 crUnpackPush
    8 crUnpackPop
    97crUnpackSetReturnPointer
    108crUnpackSetWritebackPointer
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py

    r78116 r78190  
    2727DECLEXPORT(const unsigned char *) cr_unpackData = NULL;
    2828DECLEXPORT(const unsigned char *) cr_unpackDataEnd = NULL;
    29 SPUDispatchTable cr_unpackDispatch;
    30 
    31 static void crUnpackExtend(void);
    32 static void crUnpackExtendDbg(void);
     29
     30static void crUnpackExtend(PCrUnpackerState pState);
     31static void crUnpackExtendDbg(PCrUnpackerState pState);
    3332
    3433#if 0 //def DEBUG_misha
     
    7271    argument out of the buffer's operand area."""
    7372    if arg_type == "GLdouble" or arg_type == "GLclampd":
    74         retval = "READ_DOUBLE(%d)" % offset
    75     else:
    76         retval = "READ_DATA(%d, %s)" % (offset, arg_type)
     73        retval = "READ_DOUBLE(pState, %d)" % offset
     74    else:
     75        retval = "READ_DATA(pState, %d, %s)" % (offset, arg_type)
    7776    return retval
    7877
     
    8382    arg_len = apiutil.PacketLength( params )
    8483    if (return_type != 'void'):
    85         print('\tSET_RETURN_PTR(%d);' % (arg_len + 8)) # extended opcode plus packet length
     84        print('\tSET_RETURN_PTR(pState, %d);' % (arg_len + 8)) # extended opcode plus packet length
    8685    else:
    8786        paramList = [ ('foo', 'void *', 0) ]
    88         print('\tSET_RETURN_PTR(%d);' % (arg_len + 8 - apiutil.PacketLength(paramList)))
    89 
    90 
    91 def FindWritebackPointer( return_type, params ):
    92     """Emit a SET_WRITEBACK_PTR call."""
     87        print('\tSET_RETURN_PTR(pState, %d);' % (arg_len + 8 - apiutil.PacketLength(paramList)))
     88
     89
     90def getWritebackPointerOffset(return_type, params):
     91    """Returns the offset of the writeback pointer"""
    9392    arg_len = apiutil.PacketLength( params )
    9493    if return_type != 'void':
     
    9695        arg_len += apiutil.PacketLength( paramList )
    9796
    98     print('\tSET_WRITEBACK_PTR(%d);' % (arg_len + 8)) # extended opcode plus packet length
     97    return arg_len + 8 # extended opcode plus packet length
     98
     99def FindWritebackPointer( return_type, params ):
     100    """Emit a SET_WRITEBACK_PTR call."""
     101    print('\tSET_WRITEBACK_PTR(pState, %d);' % getWritebackPointerOffset(return_type, params))
    99102
    100103
     
    122125    else:
    123126        print("\t", end="")
    124     print("cr_unpackDispatch.%s(%s);" % (func_name, apiutil.MakeCallStringForDispatcher(params)))
     127    print("pState->pDispatchTbl->%s(%s);" % (func_name, apiutil.MakeCallStringForDispatcher(params)))
    125128
    126129
     
    134137    if arg_type == "GLdouble" or arg_type == "GLclampd":
    135138        print("#ifdef CR_UNALIGNED_ACCESS_OKAY")
    136         print("\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType))
     139        print("\tpState->pDispatchTbl->%s((%s) pState->pbUnpackData);" % (vec_func, vecType))
    137140        print("#else")
    138141        for index in range(0, vecSize):
    139             print("\tGLdouble v" + repr(index) + " = READ_DOUBLE(" + repr(index * 8) + ");")
     142            print("\tGLdouble v" + repr(index) + " = READ_DOUBLE(pState, " + repr(index * 8) + ");")
    140143        if return_type != "void":
    141             print("\t(void) cr_unpackDispatch.%s(" % func_name, end="")
     144            print("\t(void) pState->pDispatchTbl->%s(" % func_name, end="")
    142145        else:
    143             print("\tcr_unpackDispatch.%s(" % func_name, end="")
     146            print("\tpState->pDispatchTbl->%s(" % func_name, end="")
    144147        for index in range(0, vecSize):
    145148            print("v" + repr(index), end="")
     
    149152        print("#endif")
    150153    else:
    151         print("\tcr_unpackDispatch.%s((%s) cr_unpackData);" % (vec_func, vecType))
     154        print("\tpState->pDispatchTbl->%s((%s) pState->pbUnpackData);" % (vec_func, vecType))
    152155
    153156
     
    166169    params = apiutil.Parameters(func_name)
    167170    return_type = apiutil.ReturnType(func_name)
    168    
    169     print("static void crUnpack%s(void)" % func_name)
     171
     172    packet_length = apiutil.PacketLength( params )
     173    print("static void crUnpack%s(PCrUnpackerState pState)" % func_name)
    170174    print("{")
    171 
    172     # Verify that the provided buffer length is what we expect.
    173     packet_length = apiutil.PacketLength( params )
    174     if packet_length > 0:
    175         print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
    176         print("\t{");
    177         print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
    178         print("\t\treturn;");
    179         print("\t}");
     175    if ("get" in apiutil.Properties(func_name)):
     176        print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % getWritebackPointerOffset(return_type, params));
     177    elif packet_length != 0:
     178        print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % packet_length);
    180179
    181180    vector_func = apiutil.VectorFunction(func_name)
     
    185184        MakeNormalCall( return_type, func_name, params )
    186185    if packet_length == 0:
    187         print("\tINCR_DATA_PTR_NO_ARGS( );")
    188     else:
    189         print("\tINCR_DATA_PTR(%d);" % packet_length)
     186        print("\tINCR_DATA_PTR_NO_ARGS(pState);")
     187    else:
     188        print("\tINCR_DATA_PTR(pState, %d);" % packet_length)
    190189    print("}\n")
    191190
     
    195194#
    196195print("""
    197 typedef struct __dispatchNode {
    198     const unsigned char *unpackData;
    199     struct __dispatchNode *next;
    200 } DispatchNode;
    201 
    202 static DispatchNode *unpackStack = NULL;
    203 
    204 static SPUDispatchTable *cr_lastDispatch = NULL;
    205 
    206 void crUnpackPush(void)
    207 {
    208     DispatchNode *node = (DispatchNode*)crAlloc( sizeof( *node ) );
    209     node->next = unpackStack;
    210     unpackStack = node;
    211     node->unpackData = cr_unpackData;
    212 }
    213 
    214 void crUnpackPop(void)
    215 {
    216     DispatchNode *node = unpackStack;
    217 
    218     if (!node)
    219     {
    220         crError( "crUnpackPop called with an empty stack!" );
    221     }
    222     unpackStack = node->next;
    223     cr_unpackData = node->unpackData;
    224     crFree( node );
    225 }
    226 
    227196CR_UNPACK_BUFFER_TYPE crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes)
    228197{
     
    249218}
    250219
    251 void crUnpack( const void *data, const void *data_end, const void *opcodes,
    252         unsigned int num_opcodes, SPUDispatchTable *table )
     220void crUnpack(PCrUnpackerState pState)
    253221{
    254222    unsigned int i;
    255     const unsigned char *unpack_opcodes;
    256     if (table != cr_lastDispatch)
    257     {
    258         crSPUCopyDispatchTable( &cr_unpackDispatch, table );
    259         cr_lastDispatch = table;
    260     }
    261 
    262     unpack_opcodes = (const unsigned char *)opcodes;
    263     cr_unpackData = (const unsigned char *)data;
    264     cr_unpackDataEnd = (const unsigned char *)data_end;
    265223
    266224#if defined(CR_UNPACK_DEBUG_OPCODES) || defined(CR_UNPACK_DEBUG_LAST_OPCODES)
    267     crDebug("crUnpack: %d opcodes", num_opcodes);
    268 #endif
    269 
    270     for (i = 0; i < num_opcodes; i++)
     225    crDebug("crUnpack: %d opcodes", pState->cOpcodes);
     226#endif
     227
     228    for (i = 0; i < pState->cOpcodes && RT_SUCCESS(pState->rcUnpack); i++)
    271229    {
    272230   
    273         CRDBGPTR_CHECKZ(writeback_ptr);
    274         CRDBGPTR_CHECKZ(return_ptr);
     231        CRDBGPTR_CHECKZ(pState->pWritebackPtr);
     232        CRDBGPTR_CHECKZ(pState->pReturnPtr);
    275233   
    276         /*crDebug(\"Unpacking opcode \%d\", *unpack_opcodes);*/
     234        /*crDebug(\"Unpacking opcode \%d\", *pState->pbOpcodes);*/
    277235#ifdef CR_UNPACK_DEBUG_PREV_OPCODES
    278         g_VBoxDbgCrPrevOpcode = *unpack_opcodes;
    279 #endif
    280         switch( *unpack_opcodes )
     236        g_VBoxDbgCrPrevOpcode = *pState->pbOpcodes;
     237#endif
     238        switch( *pState->pbOpcodes )
    281239        {""")
    282240
     
    295253                crDebug("Unpack: %s");
    296254#endif """ % apiutil.OpcodeName(func_name))
    297         print('\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name)
     255        print('\t\t\t\tcrUnpack%s(pState); \n\t\t\t\tbreak;' % func_name)
    298256
    299257print("""       
    300258            case CR_EXTEND_OPCODE:
    301259                #ifdef CR_UNPACK_DEBUG_OPCODES
    302                     crUnpackExtendDbg();
     260                    crUnpackExtendDbg(pState);
    303261                #else
    304262                # ifdef CR_UNPACK_DEBUG_LAST_OPCODES
    305                     if (i==(num_opcodes-1)) crUnpackExtendDbg();
     263                    if (i==(num_opcodes-1)) crUnpackExtendDbg(pState);
    306264                    else
    307265                # endif
    308                     crUnpackExtend();
     266                    crUnpackExtend(pState);
    309267                #endif
    310268                break;
     
    313271            case CR_CMDBLOCKFLUSH_OPCODE:
    314272            case CR_NOP_OPCODE:
    315                 INCR_DATA_PTR_NO_ARGS( );
     273                INCR_DATA_PTR_NO_ARGS(pState);
    316274                break;
    317275            default:
    318                 crError( "Unknown opcode: %d", *unpack_opcodes );
     276                crError( "Unknown opcode: %d", *pState->pbOpcodes );
    319277                break;
    320278        }
    321        
    322         CRDBGPTR_CHECKZ(writeback_ptr);
    323         CRDBGPTR_CHECKZ(return_ptr);
    324        
    325         unpack_opcodes--;
     279
     280        CRDBGPTR_CHECKZ(pState->pWritebackPtr);
     281        CRDBGPTR_CHECKZ(pState->pReturnPtr);
     282        pState->pbOpcodes--;
    326283    }
    327284}""")
     
    336293            return_type = apiutil.ReturnType(func_name)
    337294            params = apiutil.Parameters(func_name)
    338             print('static void crUnpackExtend%s(void)' % func_name)
     295            print('static void crUnpackExtend%s(PCrUnpackerState pState)' % func_name)
    339296            print('{')
    340 
    341             # Verify that the provided buffer length is what we expect.
    342             packet_length = apiutil.PacketLength( params )
    343             if packet_length > 0:
    344                 print("\tif(!DATA_POINTER_CHECK(%d))" % packet_length);
    345                 print("\t{");
    346                 print("\t\tcrError(\"crUnpack%s: parameters out of range\");" % func_name);
    347                 print("\t\treturn;");
    348                 print("\t}");
    349 
     297            if ("get" in apiutil.Properties(func_name)):
     298                print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % (8 + getWritebackPointerOffset(return_type, params)));
     299            else:
     300                print("\tCHECK_BUFFER_SIZE_STATIC(pState, %s);" % (8 + apiutil.PacketLength( params )));
    350301            MakeNormalCall( return_type, func_name, params, 8 )
    351302            print('}\n')
    352303
    353 print('static void crUnpackExtend(void)')
     304print('static void crUnpackExtend(PCrUnpackerState pState)')
    354305print('{')
     306print('\tCHECK_BUFFER_SIZE_STATIC_LAST(pState, 4, GLenum);');
    355307print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' ))
    356308print('')
     
    371323        print('\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name ))
    372324#        print('\t\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name )))
    373         print('\t\t\tcrUnpackExtend%s( );' % func_name)
     325        print('\t\t\tcrUnpackExtend%s(pState);' % func_name)
    374326        print('\t\t\tbreak;')
    375327
     
    378330            break;
    379331    }
    380     INCR_VAR_PTR();
     332    INCR_VAR_PTR(pState);
    381333}""")
    382334
    383 print('static void crUnpackExtendDbg(void)')
     335print('static void crUnpackExtendDbg(PCrUnpackerState pState)')
    384336print('{')
     337print('\tCHECK_BUFFER_SIZE_STATIC_LAST(pState, 4, GLenum);');
    385338print('\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' ))
    386339print('')
     
    402355        if not apiutil.ExtendedOpcodeName(func_name) in nodebug_extopcodes:
    403356            print('\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name ))
    404         print('\t\t\tcrUnpackExtend%s( );' % func_name)
     357        print('\t\t\tcrUnpackExtend%s(pState);' % func_name)
    405358        print('\t\t\tbreak;')
    406359
     
    409362            break;
    410363    }
    411     INCR_VAR_PTR();
     364    INCR_VAR_PTR(pState);
    412365}""")
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_arrays.cpp

    r78189 r78190  
    2020 */
    2121
    22 void crUnpackExtendVertexPointer(void)
    23 {
    24     GLint size = READ_DATA( 8, GLint );
    25     GLenum type = READ_DATA( 12, GLenum );
    26     GLsizei stride = READ_DATA( 16, GLsizei );
    27     GLintptrARB pointer = (GLintptrARB) READ_DATA( 20, GLuint );
    28     cr_unpackDispatch.VertexPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    29 }
    30 
    31 void crUnpackExtendTexCoordPointer(void)
    32 {
    33     GLint size = READ_DATA( 8, GLint );
    34     GLenum type = READ_DATA( 12, GLenum );
    35     GLsizei stride = READ_DATA( 16, GLsizei );
    36     GLintptrARB pointer = READ_DATA( 20, GLuint );
    37     cr_unpackDispatch.TexCoordPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    38 }
    39 
    40 void crUnpackExtendNormalPointer(void)
    41 {
    42     GLenum type = READ_DATA( 8, GLenum );
    43     GLsizei stride = READ_DATA( 12, GLsizei );
    44     GLintptrARB pointer = READ_DATA( 16, GLuint );
    45     cr_unpackDispatch.NormalPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
    46 }
    47 
    48 void crUnpackExtendIndexPointer(void)
    49 {
    50     GLenum type = READ_DATA( 8, GLenum );
    51     GLsizei stride = READ_DATA( 12, GLsizei );
    52     GLintptrARB pointer = READ_DATA( 16, GLuint );
    53     cr_unpackDispatch.IndexPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
    54 }
    55 
    56 void crUnpackExtendEdgeFlagPointer(void)
    57 {
    58     GLsizei stride = READ_DATA( 8, GLsizei );
    59     GLintptrARB pointer = READ_DATA( 12, GLuint );
    60     cr_unpackDispatch.EdgeFlagPointer( stride, (void *) pointer, false /*fRealPtr*/ );
    61 }
    62 
    63 void crUnpackExtendColorPointer(void)
    64 {
    65     GLint size = READ_DATA( 8, GLint );
    66     GLenum type = READ_DATA( 12, GLenum );
    67     GLsizei stride = READ_DATA( 16, GLsizei );
    68     GLintptrARB pointer = READ_DATA( 20, GLuint );
    69     cr_unpackDispatch.ColorPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    70 }
    71 
    72 void crUnpackExtendFogCoordPointerEXT(void)
    73 {
    74     GLenum type = READ_DATA( 8, GLenum );
    75     GLsizei stride = READ_DATA( 12, GLsizei );
    76     GLintptrARB pointer = READ_DATA( 16, GLuint );
    77     cr_unpackDispatch.FogCoordPointerEXT( type, stride, (void *) pointer, false /*fRealPtr*/ );
    78 }
    79 
    80 void crUnpackExtendSecondaryColorPointerEXT(void)
    81 {
    82     GLint size = READ_DATA( 8, GLint );
    83     GLenum type = READ_DATA( 12, GLenum );
    84     GLsizei stride = READ_DATA( 16, GLsizei );
    85     GLintptrARB pointer = READ_DATA( 20, GLuint );
    86     cr_unpackDispatch.SecondaryColorPointerEXT( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    87 }
    88 
    89 void crUnpackExtendVertexAttribPointerARB(void)
    90 {
    91     GLuint index = READ_DATA( 8, GLuint);
    92     GLint size = READ_DATA( 12, GLint );
    93     GLenum type = READ_DATA( 16, GLenum );
    94     GLboolean normalized = READ_DATA( 20, GLboolean );
    95     GLsizei stride = READ_DATA( 24, GLsizei );
    96     GLintptrARB pointer = READ_DATA( 28, GLuint );
    97     cr_unpackDispatch.VertexAttribPointerARB( index, size, type, normalized, stride, (void *) pointer, false /*fRealPtr*/ );
    98 }
    99 
    100 void crUnpackExtendVertexAttribPointerNV(void)
    101 {
    102     GLuint index = READ_DATA( 8, GLuint);
    103     GLint size = READ_DATA( 12, GLint );
    104     GLenum type = READ_DATA( 16, GLenum );
    105     GLsizei stride = READ_DATA( 20, GLsizei );
    106     GLintptrARB pointer = READ_DATA( 24, GLuint );
    107     cr_unpackDispatch.VertexAttribPointerNV( index, size, type, stride, (void *) pointer, false /*fRealPtr*/ );
    108 }
    109 
    110 void crUnpackExtendInterleavedArrays(void)
    111 {
    112     GLenum format = READ_DATA( 8, GLenum );
    113     GLsizei stride = READ_DATA( 12, GLsizei );
    114     GLintptrARB pointer = READ_DATA( 16, GLuint );
    115     cr_unpackDispatch.InterleavedArrays( format, stride, (void *) pointer, false /*fRealPtr*/ );
    116 }
    117 
    118 void crUnpackExtendDrawElements(void)
    119 {
    120     GLenum mode         = READ_DATA( 8, GLenum );
    121     GLsizei count       = READ_DATA( 12, GLsizei );
    122     GLenum type         = READ_DATA( 16, GLenum );
    123     GLintptrARB indices = READ_DATA( 20, GLuint );
     22void crUnpackExtendVertexPointer(PCrUnpackerState pState)
     23{
     24    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     25
     26    GLint size = READ_DATA(pState, 8, GLint );
     27    GLenum type = READ_DATA(pState, 12, GLenum );
     28    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     29    GLintptrARB pointer = (GLintptrARB) READ_DATA(pState, 20, GLuint );
     30    pState->pDispatchTbl->VertexPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     31}
     32
     33void crUnpackExtendTexCoordPointer(PCrUnpackerState pState)
     34{
     35    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     36
     37    GLint size = READ_DATA(pState, 8, GLint );
     38    GLenum type = READ_DATA(pState, 12, GLenum );
     39    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     40    GLintptrARB pointer = READ_DATA(pState, 20, GLuint );
     41    pState->pDispatchTbl->TexCoordPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     42}
     43
     44void crUnpackExtendNormalPointer(PCrUnpackerState pState)
     45{
     46    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     47
     48    GLenum type = READ_DATA(pState, 8, GLenum );
     49    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     50    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     51    pState->pDispatchTbl->NormalPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
     52}
     53
     54void crUnpackExtendIndexPointer(PCrUnpackerState pState)
     55{
     56    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     57
     58    GLenum type = READ_DATA(pState, 8, GLenum );
     59    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     60    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     61    pState->pDispatchTbl->IndexPointer( type, stride, (void *) pointer, false /*fRealPtr*/ );
     62}
     63
     64void crUnpackExtendEdgeFlagPointer(PCrUnpackerState pState)
     65{
     66    CHECK_BUFFER_SIZE_STATIC(pState, 12 + sizeof(GLuint) );
     67
     68    GLsizei stride = READ_DATA(pState, 8, GLsizei );
     69    GLintptrARB pointer = READ_DATA(pState, 12, GLuint );
     70    pState->pDispatchTbl->EdgeFlagPointer( stride, (void *) pointer, false /*fRealPtr*/ );
     71}
     72
     73void crUnpackExtendColorPointer(PCrUnpackerState pState)
     74{
     75    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     76
     77    GLint size = READ_DATA(pState, 8, GLint );
     78    GLenum type = READ_DATA(pState, 12, GLenum );
     79    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     80    GLintptrARB pointer = READ_DATA(pState, 20, GLuint );
     81    pState->pDispatchTbl->ColorPointer( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     82}
     83
     84void crUnpackExtendFogCoordPointerEXT(PCrUnpackerState pState)
     85{
     86    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     87
     88    GLenum type = READ_DATA(pState, 8, GLenum );
     89    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     90    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     91    pState->pDispatchTbl->FogCoordPointerEXT( type, stride, (void *) pointer, false /*fRealPtr*/ );
     92}
     93
     94void crUnpackExtendSecondaryColorPointerEXT(PCrUnpackerState pState)
     95{
     96    CHECK_BUFFER_SIZE_STATIC(pState, 20 + sizeof(GLuint) );
     97
     98    GLint size = READ_DATA(pState, 8, GLint );
     99    GLenum type = READ_DATA(pState, 12, GLenum );
     100    GLsizei stride = READ_DATA(pState, 16, GLsizei );
     101    GLintptrARB pointer = READ_DATA(pState, 20, GLuint );
     102    pState->pDispatchTbl->SecondaryColorPointerEXT( size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     103}
     104
     105void crUnpackExtendVertexAttribPointerARB(PCrUnpackerState pState)
     106{
     107    CHECK_BUFFER_SIZE_STATIC(pState, 28 + sizeof(GLuint) );
     108
     109    GLuint index = READ_DATA(pState, 8, GLuint);
     110    GLint size = READ_DATA(pState, 12, GLint );
     111    GLenum type = READ_DATA(pState, 16, GLenum );
     112    GLboolean normalized = READ_DATA(pState, 20, GLboolean );
     113    GLsizei stride = READ_DATA(pState, 24, GLsizei );
     114    GLintptrARB pointer = READ_DATA(pState, 28, GLuint );
     115    pState->pDispatchTbl->VertexAttribPointerARB( index, size, type, normalized, stride, (void *) pointer, false /*fRealPtr*/ );
     116}
     117
     118void crUnpackExtendVertexAttribPointerNV(PCrUnpackerState pState)
     119{
     120    CHECK_BUFFER_SIZE_STATIC(pState, 24 + sizeof(GLuint) );
     121
     122    GLuint index = READ_DATA(pState, 8, GLuint);
     123    GLint size = READ_DATA(pState, 12, GLint );
     124    GLenum type = READ_DATA(pState, 16, GLenum );
     125    GLsizei stride = READ_DATA(pState, 20, GLsizei );
     126    GLintptrARB pointer = READ_DATA(pState, 24, GLuint );
     127    pState->pDispatchTbl->VertexAttribPointerNV( index, size, type, stride, (void *) pointer, false /*fRealPtr*/ );
     128}
     129
     130void crUnpackExtendInterleavedArrays(PCrUnpackerState pState)
     131{
     132    CHECK_BUFFER_SIZE_STATIC(pState, 16 + sizeof(GLuint) );
     133
     134    GLenum format = READ_DATA(pState, 8, GLenum );
     135    GLsizei stride = READ_DATA(pState, 12, GLsizei );
     136    GLintptrARB pointer = READ_DATA(pState, 16, GLuint );
     137    pState->pDispatchTbl->InterleavedArrays( format, stride, (void *) pointer, false /*fRealPtr*/ );
     138}
     139
     140void crUnpackExtendDrawElements(PCrUnpackerState pState)
     141{
     142#ifdef CR_ARB_vertex_buffer_object
     143    CHECK_BUFFER_SIZE_STATIC(pState, 28);
     144#else
     145    CHECK_BUFFER_SIZE_STATIC(pState, 24);
     146#endif
     147
     148    GLenum mode         = READ_DATA(pState, 8, GLenum );
     149    GLsizei count       = READ_DATA(pState, 12, GLsizei );
     150    GLenum type         = READ_DATA(pState, 16, GLenum );
     151    GLintptrARB indices = READ_DATA(pState, 20, GLuint );
    124152    void * indexptr;
     153
     154    size_t cbElem = 0;
     155    switch (type)
     156    {
     157        case GL_UNSIGNED_BYTE:
     158            cbElem = sizeof(GLubyte);
     159            break;
     160        case GL_UNSIGNED_SHORT:
     161            cbElem = sizeof(GLubyte);
     162            break;
     163        case GL_UNSIGNED_INT:
     164            cbElem = sizeof(GLubyte);
     165            break;
     166        default:
     167            crError("crUnpackExtendDrawElements: Invalid type (%#x) passed!\n", type);
     168            pState->rcUnpack = VERR_INVALID_PARAMETER;
     169            return;
     170    }
     171
    125172#ifdef CR_ARB_vertex_buffer_object
    126     GLboolean hasidxdata = READ_DATA(24, GLint);
    127     indexptr = hasidxdata ? DATA_POINTER(28, void) : (void*)indices;
     173    GLboolean hasidxdata = READ_DATA(pState, 24, GLint);
     174    indexptr = hasidxdata ? DATA_POINTER(pState, 28, void) : (void*)indices;
     175    if (hasidxdata)
     176        CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    128177#else
    129     indexptr = DATA_POINTER(24, void);
     178    indexptr = DATA_POINTER(pState, 24, void);
     179    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    130180#endif
    131     cr_unpackDispatch.DrawElements(mode, count, type, indexptr);
    132 }
    133 
    134 void crUnpackExtendDrawRangeElements(void)
    135 {
    136     GLenum mode         = READ_DATA( 8, GLenum );
    137     GLuint start        = READ_DATA( 12, GLuint );
    138     GLuint end          = READ_DATA( 16, GLuint );
    139     GLsizei count       = READ_DATA( 20, GLsizei );
    140     GLenum type         = READ_DATA( 24, GLenum );
    141     GLintptrARB indices = READ_DATA( 28, GLuint );
     181    pState->pDispatchTbl->DrawElements(mode, count, type, indexptr);
     182}
     183
     184void crUnpackExtendDrawRangeElements(PCrUnpackerState pState)
     185{
     186#ifdef CR_ARB_vertex_buffer_object
     187    CHECK_BUFFER_SIZE_STATIC(pState, 36);
     188#else
     189    CHECK_BUFFER_SIZE_STATIC(pState, 32);
     190#endif
     191
     192    GLenum mode         = READ_DATA(pState, 8, GLenum );
     193    GLuint start        = READ_DATA(pState, 12, GLuint );
     194    GLuint end          = READ_DATA(pState, 16, GLuint );
     195    GLsizei count       = READ_DATA(pState, 20, GLsizei );
     196    GLenum type         = READ_DATA(pState, 24, GLenum );
     197    GLintptrARB indices = READ_DATA(pState, 28, GLuint );
    142198    void * indexptr;
     199
     200    size_t cbElem = 0;
     201    switch (type)
     202    {
     203        case GL_UNSIGNED_BYTE:
     204            cbElem = sizeof(GLubyte);
     205            break;
     206        case GL_UNSIGNED_SHORT:
     207            cbElem = sizeof(GLubyte);
     208            break;
     209        case GL_UNSIGNED_INT:
     210            cbElem = sizeof(GLubyte);
     211            break;
     212        default:
     213            crError("crUnpackExtendDrawElements: Invalid type (%#x) passed!\n", type);
     214            pState->rcUnpack = VERR_INVALID_PARAMETER;
     215            return;
     216    }
    143217#ifdef CR_ARB_vertex_buffer_object
    144     GLboolean hasidxdata = READ_DATA(32, GLint);
    145     indexptr = hasidxdata ? DATA_POINTER(36, void) : (void*)indices;
     218    GLboolean hasidxdata = READ_DATA(pState, 32, GLint);
     219    indexptr = hasidxdata ? DATA_POINTER(pState, 36, void) : (void*)indices;
     220    if (hasidxdata)
     221        CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    146222#else
    147     indexptr = DATA_POINTER(32, void);
     223    indexptr = DATA_POINTER(pState, 32, void);
     224    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, indexptr, count, cbElem);
    148225#endif
    149     cr_unpackDispatch.DrawRangeElements(mode, start, end, count, type, indexptr);
    150 }
    151 
    152 void crUnpackMultiDrawArraysEXT(void)
    153 {
     226
     227    pState->pDispatchTbl->DrawRangeElements(mode, start, end, count, type, indexptr);
     228}
     229
     230void crUnpackMultiDrawArraysEXT(PCrUnpackerState pState)
     231{
     232    RT_NOREF(pState);
    154233    crError( "Can't decode MultiDrawArraysEXT" );
    155234}
    156235
    157 void crUnpackMultiDrawElementsEXT(void)
    158 {
     236void crUnpackMultiDrawElementsEXT(PCrUnpackerState pState)
     237{
     238    RT_NOREF(pState);
    159239    crError( "Can't decode MultiDrawElementsEXT" );
    160240}
    161241
    162 static void crUnpackSetClientPointerByIndex(int index, GLint size,
     242static void crUnpackSetClientPointerByIndex(PCrUnpackerState pState, int index, GLint size,
    163243                                            GLenum type, GLboolean normalized,
    164244                                            GLsizei stride, const GLvoid *pointer, CRClientState *c, int fRealPtr)
     
    171251        {
    172252            case 0:
    173                 cr_unpackDispatch.VertexPointer(size, type, stride, pointer, fRealPtr);
     253                pState->pDispatchTbl->VertexPointer(size, type, stride, pointer, fRealPtr);
    174254                break;
    175255            case 1:
    176                 cr_unpackDispatch.ColorPointer(size, type, stride, pointer, fRealPtr);
     256                pState->pDispatchTbl->ColorPointer(size, type, stride, pointer, fRealPtr);
    177257                break;
    178258            case 2:
    179                 cr_unpackDispatch.FogCoordPointerEXT(type, stride, pointer, fRealPtr);
     259                pState->pDispatchTbl->FogCoordPointerEXT(type, stride, pointer, fRealPtr);
    180260                break;
    181261            case 3:
    182                 cr_unpackDispatch.SecondaryColorPointerEXT(size, type, stride, pointer, fRealPtr);
     262                pState->pDispatchTbl->SecondaryColorPointerEXT(size, type, stride, pointer, fRealPtr);
    183263                break;
    184264            case 4:
    185                 cr_unpackDispatch.EdgeFlagPointer(stride, pointer, fRealPtr);
     265                pState->pDispatchTbl->EdgeFlagPointer(stride, pointer, fRealPtr);
    186266                break;
    187267            case 5:
    188                 cr_unpackDispatch.IndexPointer(type, stride, pointer, fRealPtr);
     268                pState->pDispatchTbl->IndexPointer(type, stride, pointer, fRealPtr);
    189269                break;
    190270            case 6:
    191                 cr_unpackDispatch.NormalPointer(type, stride, pointer, fRealPtr);
     271                pState->pDispatchTbl->NormalPointer(type, stride, pointer, fRealPtr);
    192272                break;
    193273        }
     
    198278        if ((index-7)!=curTexUnit)
    199279        {
    200             cr_unpackDispatch.ClientActiveTextureARB(GL_TEXTURE0_ARB+index-7);
    201         }
    202         cr_unpackDispatch.TexCoordPointer(size, type, stride, pointer, fRealPtr);
     280            pState->pDispatchTbl->ClientActiveTextureARB(GL_TEXTURE0_ARB+index-7);
     281        }
     282        pState->pDispatchTbl->TexCoordPointer(size, type, stride, pointer, fRealPtr);
    203283        if ((index-7)!=curTexUnit)
    204284        {
    205             cr_unpackDispatch.ClientActiveTextureARB(GL_TEXTURE0_ARB+curTexUnit);
     285            pState->pDispatchTbl->ClientActiveTextureARB(GL_TEXTURE0_ARB+curTexUnit);
    206286        }
    207287    }
    208288    else
    209289    {
    210         cr_unpackDispatch.VertexAttribPointerARB(index-7-CR_MAX_TEXTURE_UNITS,
     290        pState->pDispatchTbl->VertexAttribPointerARB(index-7-CR_MAX_TEXTURE_UNITS,
    211291                                                 size, type, normalized, stride, pointer, fRealPtr);
    212292    }
    213293}
    214294
    215 void crUnpackExtendLockArraysEXT(void)
    216 {
    217     GLint first    = READ_DATA(sizeof(int) + 4, GLint);
    218     GLint count    = READ_DATA(sizeof(int) + 8, GLint);
    219     int numenabled = READ_DATA(sizeof(int) + 12, int);
     295void crUnpackExtendLockArraysEXT(PCrUnpackerState pState)
     296{
     297    CHECK_BUFFER_SIZE_STATIC(pState, sizeof(int) + 12 + sizeof(int));
     298
     299    GLint first    = READ_DATA(pState, sizeof(int) + 4, GLint);
     300    GLint count    = READ_DATA(pState, sizeof(int) + 8, GLint);
     301    int numenabled = READ_DATA(pState, sizeof(int) + 12, int);
    220302
    221303    CRContext *g = crStateGetCurrent();
     
    223305    CRClientPointer *cp;
    224306    int i, index, offset;
    225     unsigned char *data;
    226    
     307    uint8_t *data;
     308
    227309    if (first < 0 || count <= 0 || first >= INT32_MAX - count)
    228310    {
     
    243325    for (i = 0; i < numenabled; ++i)
    244326    {
    245         index = READ_DATA(offset, int);
     327        CHECK_BUFFER_SIZE_STATIC_LAST(pState, offset, int);
     328        index = READ_DATA(pState, offset, int);
    246329        offset += sizeof(int);
    247330
     
    258341            }
    259342
    260             data = crAlloc((first + count) * cp->bytesPerIndex);
     343            data = (uint8_t *)crAlloc((first + count) * cp->bytesPerIndex);
    261344
    262345            if (data)
    263346            {
    264                 crMemcpy(data + first * cp->bytesPerIndex, DATA_POINTER(offset, GLvoid), count * cp->bytesPerIndex);
     347                crMemcpy(data + first * cp->bytesPerIndex, DATA_POINTER(pState, offset, GLvoid), count * cp->bytesPerIndex);
    265348                /*crDebug("crUnpackExtendLockArraysEXT: old cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
    266349                        index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
    267                 crUnpackSetClientPointerByIndex(index, cp->size, cp->type, cp->normalized, 0, data, c, 1 /*fRealPtr*/);
     350                crUnpackSetClientPointerByIndex(pState, index, cp->size, cp->type, cp->normalized, 0, data, c, 1);
    268351                /*crDebug("crUnpackExtendLockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
    269352                        index, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
     
    284367    }
    285368
    286     cr_unpackDispatch.LockArraysEXT(first, count);
    287 }
    288 
    289 void crUnpackExtendUnlockArraysEXT(void)
     369    pState->pDispatchTbl->LockArraysEXT(first, count);
     370}
     371
     372void crUnpackExtendUnlockArraysEXT(PCrUnpackerState pState)
    290373{
    291374    int i;
     
    296379    /*crDebug("crUnpackExtendUnlockArraysEXT");*/
    297380
    298     cr_unpackDispatch.UnlockArraysEXT();
     381    pState->pDispatchTbl->UnlockArraysEXT();
    299382
    300383    for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i)
     
    309392            cp->prevPtr = NULL;
    310393            cp->fPrevRealPtr = 0;
    311             crUnpackSetClientPointerByIndex(i, cp->size, cp->type, cp->normalized, cp->prevStride, prevPtr, c, fPrevRealPtr);
     394
     395            crUnpackSetClientPointerByIndex(pState, i, cp->size, cp->type, cp->normalized, cp->prevStride, prevPtr, c, fPrevRealPtr);
    312396            /*crDebug("crUnpackExtendUnlockArraysEXT: new cp(%i): en/l=%i(%i) p=%p size=%i type=0x%x n=%i str=%i pp=%p pstr=%i",
    313397                    i, cp->enabled, cp->locked, cp->p, cp->size, cp->type, cp->normalized, cp->stride, cp->prevPtr, cp->prevStride);*/
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_extend.py

    r78086 r78190  
    1818#define UNPACK_EXTEND_H 1
    1919
     20#include "cr_unpack.h"
     21
    2022#ifdef __cplusplus
    2123extern "C" {
     
    3032for func_name in apiutil.AllSpecials( "unpacker" ):
    3133        if "extpack" in apiutil.ChromiumProps(func_name):
    32                 print('extern void crUnpackExtend%s(void);' % func_name)
     34                print('extern void crUnpackExtend%s(PCrUnpackerState pState);' % func_name)
    3335        else:
    34                 print('extern void crUnpack%s(void);' % func_name)
     36                print('extern void crUnpack%s(PCrUnpackerState pState);' % func_name)
    3537
    3638print("""
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_header.py

    r69390 r78190  
    2222print("""#ifndef CR_UNPACKFUNCTIONS_H
    2323#define CR_UNPACKFUNCTIONS_H
     24
     25#include "cr_unpack.h"
    2426""")
    2527
    2628for func_name in sorted(gl_mapping.keys()):
    2729        ( return_type, arg_names, arg_types ) = gl_mapping[func_name]
    28         print('void crUnpack%s();' %( func_name ))
    29 print('void crUnpackExtend();')
     30        print('void crUnpack%s(PCrUnpackerState pState);' %( func_name ))
     31print('void crUnpackExtend(PCrUnpackerState pState);')
    3032print('\n#endif /* CR_UNPACKFUNCTIONS_H */')
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_misc.cpp

    r78189 r78190  
    77#include "unpacker.h"
    88
    9 void crUnpackExtendChromiumParametervCR( void  )
     9void crUnpackExtendChromiumParametervCR(PCrUnpackerState pState)
    1010{
    11     GLenum target = READ_DATA( 8, GLenum );
    12     GLenum type = READ_DATA( 12, GLenum );
    13     GLsizei count = READ_DATA( 16, GLsizei );
    14     GLvoid *values = DATA_POINTER( 20, GLvoid );
     11    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei);
    1512
    16     cr_unpackDispatch.ChromiumParametervCR(target, type, count, values);
     13    GLenum target = READ_DATA(pState, 8, GLenum );
     14    GLenum type = READ_DATA(pState, 12, GLenum );
     15    GLsizei count = READ_DATA(pState, 16, GLsizei );
     16    GLvoid *values = DATA_POINTER(pState, 20, GLvoid );
    1717
     18    size_t cbValue = 0;
     19    switch (type)
     20    {
     21        case GL_BYTE:
     22        case GL_UNSIGNED_BYTE:
     23            cbValue = sizeof(GLbyte);
     24            break;
     25        case GL_SHORT:
     26        case GL_UNSIGNED_SHORT:
     27            cbValue = sizeof(GLshort);
     28            break;
     29        case GL_INT:
     30        case GL_UNSIGNED_INT:
     31            cbValue = sizeof(GLint);
     32            break;
     33        case GL_FLOAT:
     34            cbValue = sizeof(GLfloat);
     35            break;
     36        case GL_DOUBLE:
     37            cbValue = sizeof(GLdouble);
     38            break;
     39        default:
     40            crError("crUnpackExtendChromiumParametervCR: Invalid type (%#x) passed!\n", type);
     41            pState->rcUnpack = VERR_INVALID_PARAMETER;
     42            return;
     43    }
    1844
    19     /*
    20     INCR_VAR_PTR();
    21     */
     45    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_SZ_LAST(pState, values, count, cbValue);
     46    pState->pDispatchTbl->ChromiumParametervCR(target, type, count, values);
    2247}
    2348
    24 void crUnpackExtendDeleteQueriesARB(void)
     49void crUnpackExtendDeleteQueriesARB(PCrUnpackerState pState)
    2550{
    26     GLsizei n = READ_DATA( 8, GLsizei );
    27     const GLuint *ids = DATA_POINTER(12, GLuint);
     51    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei);
    2852
    29     if (n <= 0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(12 + n * sizeof(GLuint)))
     53    GLsizei n = READ_DATA(pState, 8, GLsizei );
     54    const GLuint *ids = DATA_POINTER(pState, 12, GLuint);
     55
     56    if (n <= 0 || n >= INT32_MAX / sizeof(GLint) / 4 || !DATA_POINTER_CHECK(pState, 12 + n * sizeof(GLuint)))
    3057    {
    3158        crError("crUnpackExtendDeleteQueriesARB: parameter 'n' is out of range");
     
    3360    }
    3461
    35     cr_unpackDispatch.DeleteQueriesARB(n, ids);
     62
     63    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, ids, n, GLuint);
     64    pState->pDispatchTbl->DeleteQueriesARB(n, ids);
    3665}
    3766
    38 void crUnpackExtendGetPolygonStipple(void)
     67void crUnpackExtendGetPolygonStipple(PCrUnpackerState pState)
    3968{
    40     GLubyte *mask;
     69    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, CRNetworkPointer);
    4170
    42     SET_RETURN_PTR( 8 );
    43     SET_WRITEBACK_PTR( 16 );
    44     mask = DATA_POINTER(8, GLubyte);
     71    SET_RETURN_PTR(pState, 8 );
     72    SET_WRITEBACK_PTR(pState, 16 );
     73    GLubyte *mask = DATA_POINTER(pState, 8, GLubyte);
    4574
    46     cr_unpackDispatch.GetPolygonStipple( mask );
     75    /*
     76     * This method will write to the set writeback buffer and not to the mask argument, the mask argument is only used
     77     * for GL_PIXEL_PACK_BUFFER_ARB contexts where it denotes an offset (GLint) which was already enclosed in the
     78     * buffer verification.
     79     */
     80    pState->pDispatchTbl->GetPolygonStipple( mask );
    4781}
    4882
    49 void crUnpackExtendGetPixelMapfv(void)
     83void crUnpackExtendGetPixelMapfv(PCrUnpackerState pState)
    5084{
    51     GLenum map = READ_DATA( 8, GLenum );
    52     GLfloat *values;
     85    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
    5386
    54     SET_RETURN_PTR( 12 );
    55     SET_WRITEBACK_PTR( 20 );
    56     values = DATA_POINTER(12, GLfloat);
     87    GLenum map = READ_DATA(pState, 8, GLenum );
    5788
    58     cr_unpackDispatch.GetPixelMapfv( map, values );
     89    SET_RETURN_PTR(pState, 12 );
     90    SET_WRITEBACK_PTR(pState, 20 );
     91    GLfloat *values = DATA_POINTER(pState, 12, GLfloat);
     92
     93    /* see crUnpackExtendGetPolygonStipple() for verification notes. */
     94    pState->pDispatchTbl->GetPixelMapfv( map, values );
    5995}
    6096
    61 void crUnpackExtendGetPixelMapuiv(void)
     97void crUnpackExtendGetPixelMapuiv(PCrUnpackerState pState)
    6298{
    63     GLenum map = READ_DATA( 8, GLenum );
     99    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
     100
     101    GLenum map = READ_DATA(pState, 8, GLenum );
    64102    GLuint *values;
    65103
    66     SET_RETURN_PTR( 12 );
    67     SET_WRITEBACK_PTR( 20 );
    68     values = DATA_POINTER(12, GLuint);
     104    SET_RETURN_PTR(pState, 12 );
     105    SET_WRITEBACK_PTR(pState, 20 );
     106    values = DATA_POINTER(pState, 12, GLuint);
    69107
    70     cr_unpackDispatch.GetPixelMapuiv( map, values );
     108    /* see crUnpackExtendGetPolygonStipple() for verification notes. */
     109    pState->pDispatchTbl->GetPixelMapuiv( map, values );
    71110}
    72111
    73 void crUnpackExtendGetPixelMapusv(void)
     112void crUnpackExtendGetPixelMapusv(PCrUnpackerState pState)
    74113{
    75     GLenum map = READ_DATA( 8, GLenum );
     114    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 20, CRNetworkPointer);
     115
     116    GLenum map = READ_DATA(pState, 8, GLenum );
    76117    GLushort *values;
    77118
    78     SET_RETURN_PTR( 12 );
    79     SET_WRITEBACK_PTR( 20 );
    80     values = DATA_POINTER(12, GLushort);
     119    SET_RETURN_PTR(pState, 12 );
     120    SET_WRITEBACK_PTR(pState, 20 );
     121    values = DATA_POINTER(pState, 12, GLushort);
    81122
    82     cr_unpackDispatch.GetPixelMapusv( map, values );
     123    /* see crUnpackExtendGetPolygonStipple() for verification notes. */
     124    pState->pDispatchTbl->GetPixelMapusv( map, values );
    83125}
    84126
    85 void crUnpackExtendVBoxTexPresent(void)
     127void crUnpackExtendVBoxTexPresent(PCrUnpackerState pState)
    86128{
    87     GLuint texture = READ_DATA( 8, GLuint );
    88     GLuint cfg = READ_DATA( 12, GLuint );
    89     GLint xPos = READ_DATA( 16, GLint );
    90     GLint yPos = READ_DATA( 20, GLint );
    91     GLint cRects = READ_DATA( 24, GLint );
    92     GLint *pRects = (GLint *)DATA_POINTER( 28, GLvoid );
     129    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, GLint);
    93130
    94     if (cRects <= 0 || cRects >= INT32_MAX / sizeof(GLint) / 8 || !DATA_POINTER_CHECK(28 + 4 * cRects * sizeof(GLint)))
     131    GLuint texture = READ_DATA(pState, 8, GLuint );
     132    GLuint cfg = READ_DATA(pState, 12, GLuint );
     133    GLint xPos = READ_DATA(pState, 16, GLint );
     134    GLint yPos = READ_DATA(pState, 20, GLint );
     135    GLint cRects = READ_DATA(pState, 24, GLint );
     136    GLint *pRects = (GLint *)DATA_POINTER(pState, 28, GLvoid );
     137
     138    if (cRects <= 0 || cRects >= INT32_MAX / sizeof(GLint) / 8 || !DATA_POINTER_CHECK(pState, 28 + 4 * cRects * sizeof(GLint)))
    95139    {
    96140        crError("crUnpackExtendVBoxTexPresent: parameter 'cRects' is out of range");
     
    98142    }
    99143
    100     cr_unpackDispatch.VBoxTexPresent( texture, cfg, xPos, yPos, cRects, pRects );
     144    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pRects, cRects * 4, GLint); /* Each rect as 4 points. */
     145    pState->pDispatchTbl->VBoxTexPresent( texture, cfg, xPos, yPos, cRects, pRects );
    101146}
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_shaders.cpp

    r78189 r78190  
    2323#include "cr_version.h"
    2424
    25 void crUnpackExtendBindAttribLocation(void)
    26 {
    27     GLuint program   = READ_DATA(8, GLuint);
    28     GLuint index     = READ_DATA(12, GLuint);
    29     const char *name = DATA_POINTER(16, const char);
    30 
    31     cr_unpackDispatch.BindAttribLocation(program, index, name);
    32 }
    33 
    34 void crUnpackExtendShaderSource(void)
    35 {
     25void crUnpackExtendBindAttribLocation(PCrUnpackerState pState)
     26{
     27    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLuint);
     28
     29    GLuint program   = READ_DATA(pState, 8, GLuint);
     30    GLuint index     = READ_DATA(pState, 12, GLuint);
     31    const char *name = DATA_POINTER(pState, 16, const char);
     32
     33    CHECK_STRING_FROM_PTR_UPDATE_NO_SZ(pState, name);
     34    pState->pDispatchTbl->BindAttribLocation(program, index, name);
     35}
     36
     37void crUnpackExtendShaderSource(PCrUnpackerState pState)
     38{
     39    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLsizei);
     40
    3641    GLint *length = NULL;
    37     GLuint shader = READ_DATA(8, GLuint);
    38     GLsizei count = READ_DATA(12, GLsizei);
    39     GLint hasNonLocalLen = READ_DATA(16, GLsizei);
    40     GLint *pLocalLength = DATA_POINTER(20, GLint);
     42    GLuint shader = READ_DATA(pState, 8, GLuint);
     43    GLsizei count = READ_DATA(pState, 12, GLsizei);
     44    GLint hasNonLocalLen = READ_DATA(pState, 16, GLsizei);
     45    GLint *pLocalLength = DATA_POINTER(pState, 20, GLint);
    4146    char **ppStrings = NULL;
    4247    GLsizei i, j, jUpTo;
     
    4853        return;
    4954    }
    50 
     55    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, pLocalLength, count, GLint);
     56
     57    /** @todo More verification required here. */
    5158    pos = 20 + count * sizeof(*pLocalLength);
    5259
    53     if (!DATA_POINTER_CHECK(pos))
     60    if (!DATA_POINTER_CHECK(pState, pos))
    5461    {
    5562        crError("crUnpackExtendShaderSource: pos %d is out of range", pos);
     
    5966    if (hasNonLocalLen > 0)
    6067    {
    61         length = DATA_POINTER(pos, GLint);
     68        length = DATA_POINTER(pState, pos, GLint);
    6269        pos += count * sizeof(*length);
    6370    }
    6471
    65     if (!DATA_POINTER_CHECK(pos))
     72    pos_check = pos;
     73
     74    if (!DATA_POINTER_CHECK(pState, pos_check))
    6675    {
    6776        crError("crUnpackExtendShaderSource: pos %d is out of range", pos);
     
    7382    for (i = 0; i < count; ++i)
    7483    {
    75         if (pLocalLength[i] <= 0 || pos_check >= INT32_MAX - pLocalLength[i])
     84        if (pLocalLength[i] <= 0 || pos_check >= INT32_MAX - pLocalLength[i] || !DATA_POINTER_CHECK(pState, pos_check))
    7685        {
    7786            crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check);
     
    8190        pos_check += pLocalLength[i];
    8291
    83         if (!DATA_POINTER_CHECK(pos_check))
     92        if (!DATA_POINTER_CHECK(pState, pos_check))
    8493        {
    8594            crError("crUnpackExtendShaderSource: pos %d is out of range", pos_check);
     
    8897    }
    8998
    90     ppStrings = crAlloc(count * sizeof(char*));
     99    ppStrings = (char **)crAlloc(count * sizeof(char*));
    91100    if (!ppStrings) return;
    92101
    93102    for (i = 0; i < count; ++i)
    94103    {
    95         ppStrings[i] = DATA_POINTER(pos, char);
     104        CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, pos); /** @todo Free ppStrings on error. */
     105        ppStrings[i] = DATA_POINTER(pState, pos, char);
    96106        pos += pLocalLength[i];
    97107        if (!length)
     
    114124    }
    115125
    116 //    cr_unpackDispatch.ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
    117     cr_unpackDispatch.ShaderSource(shader, 1, (const char**)ppStrings, 0);
     126//    pState->pDispatchTbl->ShaderSource(shader, count, ppStrings, length ? length : pLocalLength);
     127    pState->pDispatchTbl->ShaderSource(shader, 1, (const char**)ppStrings, 0);
    118128
    119129    crFree(ppStrings);
    120130}
    121131
    122 void crUnpackExtendUniform1fv(void)
    123 {
    124     GLint location = READ_DATA(8, GLint);
    125     GLsizei count = READ_DATA(12, GLsizei);
    126     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    127     cr_unpackDispatch.Uniform1fv(location, count, value);
    128 }
    129 
    130 void crUnpackExtendUniform1iv(void)
    131 {
    132     GLint location = READ_DATA(8, GLint);
    133     GLsizei count = READ_DATA(12, GLsizei);
    134     const GLint *value = DATA_POINTER(16, const GLint);
    135     cr_unpackDispatch.Uniform1iv(location, count, value);
    136 }
    137 
    138 void crUnpackExtendUniform2fv(void)
    139 {
    140     GLint location = READ_DATA(8, GLint);
    141     GLsizei count = READ_DATA(12, GLsizei);
    142     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    143     cr_unpackDispatch.Uniform2fv(location, count, value);
    144 }
    145 
    146 void crUnpackExtendUniform2iv(void)
    147 {
    148     GLint location = READ_DATA(8, GLint);
    149     GLsizei count = READ_DATA(12, GLsizei);
    150     const GLint *value = DATA_POINTER(16, const GLint);
    151     cr_unpackDispatch.Uniform2iv(location, count, value);
    152 }
    153 
    154 void crUnpackExtendUniform3fv(void)
    155 {
    156     GLint location = READ_DATA(8, GLint);
    157     GLsizei count = READ_DATA(12, GLsizei);
    158     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    159     cr_unpackDispatch.Uniform3fv(location, count, value);
    160 }
    161 
    162 void crUnpackExtendUniform3iv(void)
    163 {
    164     GLint location = READ_DATA(8, GLint);
    165     GLsizei count = READ_DATA(12, GLsizei);
    166     const GLint *value = DATA_POINTER(16, const GLint);
    167     cr_unpackDispatch.Uniform3iv(location, count, value);
    168 }
    169 
    170 void crUnpackExtendUniform4fv(void)
    171 {
    172     GLint location = READ_DATA(8, GLint);
    173     GLsizei count = READ_DATA(12, GLsizei);
    174     const GLfloat *value = DATA_POINTER(16, const GLfloat);
    175     cr_unpackDispatch.Uniform4fv(location, count, value);
    176 }
    177 
    178 void crUnpackExtendUniform4iv(void)
    179 {
    180     GLint location = READ_DATA(8, GLint);
    181     GLsizei count = READ_DATA(12, GLsizei);
    182     const GLint *value = DATA_POINTER(16, const GLint);
    183     cr_unpackDispatch.Uniform4iv(location, count, value);
    184 }
    185 
    186 void crUnpackExtendUniformMatrix2fv(void)
    187 {
    188     GLint location = READ_DATA(8, GLint);
    189     GLsizei count = READ_DATA(12, GLsizei);
    190     GLboolean transpose = READ_DATA(16, GLboolean);
    191     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    192     cr_unpackDispatch.UniformMatrix2fv(location, count, transpose, value);
    193 }
    194 
    195 void crUnpackExtendUniformMatrix3fv(void)
    196 {
    197     GLint location = READ_DATA(8, GLint);
    198     GLsizei count = READ_DATA(12, GLsizei);
    199     GLboolean transpose = READ_DATA(16, GLboolean);
    200     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    201     cr_unpackDispatch.UniformMatrix3fv(location, count, transpose, value);
    202 }
    203 
    204 void crUnpackExtendUniformMatrix4fv(void)
    205 {
    206     GLint location = READ_DATA(8, GLint);
    207     GLsizei count = READ_DATA(12, GLsizei);
    208     GLboolean transpose = READ_DATA(16, GLboolean);
    209     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    210     cr_unpackDispatch.UniformMatrix4fv(location, count, transpose, value);
    211 }
    212 
    213 void crUnpackExtendUniformMatrix2x3fv(void)
    214 {
    215     GLint location = READ_DATA(8, GLint);
    216     GLsizei count = READ_DATA(12, GLsizei);
    217     GLboolean transpose = READ_DATA(16, GLboolean);
    218     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    219     cr_unpackDispatch.UniformMatrix2x3fv(location, count, transpose, value);
    220 }
    221 
    222 void crUnpackExtendUniformMatrix3x2fv(void)
    223 {
    224     GLint location = READ_DATA(8, GLint);
    225     GLsizei count = READ_DATA(12, GLsizei);
    226     GLboolean transpose = READ_DATA(16, GLboolean);
    227     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    228     cr_unpackDispatch.UniformMatrix3x2fv(location, count, transpose, value);
    229 }
    230 
    231 void crUnpackExtendUniformMatrix2x4fv(void)
    232 {
    233     GLint location = READ_DATA(8, GLint);
    234     GLsizei count = READ_DATA(12, GLsizei);
    235     GLboolean transpose = READ_DATA(16, GLboolean);
    236     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    237     cr_unpackDispatch.UniformMatrix2x4fv(location, count, transpose, value);
    238 }
    239 
    240 void crUnpackExtendUniformMatrix4x2fv(void)
    241 {
    242     GLint location = READ_DATA(8, GLint);
    243     GLsizei count = READ_DATA(12, GLsizei);
    244     GLboolean transpose = READ_DATA(16, GLboolean);
    245     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    246     cr_unpackDispatch.UniformMatrix4x2fv(location, count, transpose, value);
    247 }
    248 
    249 void crUnpackExtendUniformMatrix3x4fv(void)
    250 {
    251     GLint location = READ_DATA(8, GLint);
    252     GLsizei count = READ_DATA(12, GLsizei);
    253     GLboolean transpose = READ_DATA(16, GLboolean);
    254     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    255     cr_unpackDispatch.UniformMatrix3x4fv(location, count, transpose, value);
    256 }
    257 
    258 void crUnpackExtendUniformMatrix4x3fv(void)
    259 {
    260     GLint location = READ_DATA(8, GLint);
    261     GLsizei count = READ_DATA(12, GLsizei);
    262     GLboolean transpose = READ_DATA(16, GLboolean);
    263     const GLfloat *value = DATA_POINTER(16+sizeof(GLboolean), const GLfloat);
    264     cr_unpackDispatch.UniformMatrix4x3fv(location, count, transpose, value);
    265 }
    266 
    267 void crUnpackExtendDrawBuffers(void)
    268 {
    269     GLsizei n = READ_DATA(8, GLsizei);
    270     const GLenum *bufs = DATA_POINTER(8+sizeof(GLsizei), const GLenum);
    271     cr_unpackDispatch.DrawBuffers(n, bufs);
    272 }
    273 
    274 void crUnpackExtendGetActiveAttrib(void)
    275 {
    276     GLuint program = READ_DATA(8, GLuint);
    277     GLuint index = READ_DATA(12, GLuint);
    278     GLsizei bufSize = READ_DATA(16, GLsizei);
    279     SET_RETURN_PTR(20);
    280     SET_WRITEBACK_PTR(28);
    281     cr_unpackDispatch.GetActiveAttrib(program, index, bufSize, NULL, NULL, NULL, NULL);
    282 }
    283 
    284 void crUnpackExtendGetActiveUniform(void)
    285 {
    286     GLuint program = READ_DATA(8, GLuint);
    287     GLuint index = READ_DATA(12, GLuint);
    288     GLsizei bufSize = READ_DATA(16, GLsizei);
    289     SET_RETURN_PTR(20);
    290     SET_WRITEBACK_PTR(28);
    291     cr_unpackDispatch.GetActiveUniform(program, index, bufSize, NULL, NULL, NULL, NULL);
    292 }
    293 
    294 void crUnpackExtendGetAttachedShaders(void)
    295 {
    296     GLuint program = READ_DATA(8, GLuint);
    297     GLsizei maxCount = READ_DATA(12, GLsizei);
    298     SET_RETURN_PTR(16);
    299     SET_WRITEBACK_PTR(24);
    300     cr_unpackDispatch.GetAttachedShaders(program, maxCount, NULL, NULL);
    301 }
    302 
    303 void crUnpackExtendGetAttachedObjectsARB(void)
    304 {
    305         VBoxGLhandleARB containerObj = READ_DATA(8, VBoxGLhandleARB);
    306         GLsizei maxCount = READ_DATA(12, GLsizei);
    307         SET_RETURN_PTR(16);
    308         SET_WRITEBACK_PTR(24);
    309         cr_unpackDispatch.GetAttachedObjectsARB(containerObj, maxCount, NULL, NULL);
    310 }
    311 
    312 void crUnpackExtendGetInfoLogARB(void)
    313 {
    314         VBoxGLhandleARB obj = READ_DATA(8, VBoxGLhandleARB);
    315         GLsizei maxLength = READ_DATA(12, GLsizei);
    316         SET_RETURN_PTR(16);
    317         SET_WRITEBACK_PTR(24);
    318         cr_unpackDispatch.GetInfoLogARB(obj, maxLength, NULL, NULL);
    319 }
    320 
    321 void crUnpackExtendGetProgramInfoLog(void)
    322 {
    323     GLuint program = READ_DATA(8, GLuint);
    324     GLsizei bufSize = READ_DATA(12, GLsizei);
    325     SET_RETURN_PTR(16);
    326     SET_WRITEBACK_PTR(24);
    327     cr_unpackDispatch.GetProgramInfoLog(program, bufSize, NULL, NULL);
    328 }
    329 
    330 void crUnpackExtendGetShaderInfoLog(void)
    331 {
    332     GLuint shader = READ_DATA(8, GLuint);
    333     GLsizei bufSize = READ_DATA(12, GLsizei);
    334     SET_RETURN_PTR(16);
    335     SET_WRITEBACK_PTR(24);
    336     cr_unpackDispatch.GetShaderInfoLog(shader, bufSize, NULL, NULL);
    337 }
    338 
    339 void crUnpackExtendGetShaderSource(void)
    340 {
    341     GLuint shader = READ_DATA(8, GLuint);
    342     GLsizei bufSize = READ_DATA(12, GLsizei);
    343     SET_RETURN_PTR(16);
    344     SET_WRITEBACK_PTR(24);
    345     cr_unpackDispatch.GetShaderSource(shader, bufSize, NULL, NULL);
    346 }
    347 
    348 void crUnpackExtendGetAttribLocation(void)
    349 {
    350     int packet_length = READ_DATA(0, int);
    351     GLuint program = READ_DATA(8, GLuint);
    352     const char *name = DATA_POINTER(12, const char);
    353 
    354     if (!DATA_POINTER_CHECK(packet_length))
    355     {
    356         crError("crUnpackExtendGetAttribLocation: packet_length is out of range");
     132void crUnpackExtendUniform1fv(PCrUnpackerState pState)
     133{
     134    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     135
     136    GLint location = READ_DATA(pState, 8, GLint);
     137    GLsizei count = READ_DATA(pState, 12, GLsizei);
     138    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     139
     140    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count, GLfloat);
     141    pState->pDispatchTbl->Uniform1fv(location, count, value);
     142}
     143
     144void crUnpackExtendUniform1iv(PCrUnpackerState pState)
     145{
     146    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     147
     148    GLint location = READ_DATA(pState, 8, GLint);
     149    GLsizei count = READ_DATA(pState, 12, GLsizei);
     150    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     151
     152    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count, GLint);
     153    pState->pDispatchTbl->Uniform1iv(location, count, value);
     154}
     155
     156void crUnpackExtendUniform2fv(PCrUnpackerState pState)
     157{
     158    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     159
     160    GLint location = READ_DATA(pState, 8, GLint);
     161    GLsizei count = READ_DATA(pState, 12, GLsizei);
     162    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     163
     164    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2, GLfloat);
     165    pState->pDispatchTbl->Uniform2fv(location, count, value);
     166}
     167
     168void crUnpackExtendUniform2iv(PCrUnpackerState pState)
     169{
     170    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     171
     172    GLint location = READ_DATA(pState, 8, GLint);
     173    GLsizei count = READ_DATA(pState, 12, GLsizei);
     174    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     175
     176    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2, GLint);
     177    pState->pDispatchTbl->Uniform2iv(location, count, value);
     178}
     179
     180void crUnpackExtendUniform3fv(PCrUnpackerState pState)
     181{
     182    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     183
     184    GLint location = READ_DATA(pState, 8, GLint);
     185    GLsizei count = READ_DATA(pState, 12, GLsizei);
     186    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     187
     188    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3, GLfloat);
     189    pState->pDispatchTbl->Uniform3fv(location, count, value);
     190}
     191
     192void crUnpackExtendUniform3iv(PCrUnpackerState pState)
     193{
     194    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     195
     196    GLint location = READ_DATA(pState, 8, GLint);
     197    GLsizei count = READ_DATA(pState, 12, GLsizei);
     198    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     199
     200    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3, GLint);
     201    pState->pDispatchTbl->Uniform3iv(location, count, value);
     202}
     203
     204void crUnpackExtendUniform4fv(PCrUnpackerState pState)
     205{
     206    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     207
     208    GLint location = READ_DATA(pState, 8, GLint);
     209    GLsizei count = READ_DATA(pState, 12, GLsizei);
     210    const GLfloat *value = DATA_POINTER(pState, 16, const GLfloat);
     211
     212    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4, GLfloat);
     213    pState->pDispatchTbl->Uniform4fv(location, count, value);
     214}
     215
     216void crUnpackExtendUniform4iv(PCrUnpackerState pState)
     217{
     218    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 12, GLsizei);
     219
     220    GLint location = READ_DATA(pState, 8, GLint);
     221    GLsizei count = READ_DATA(pState, 12, GLsizei);
     222    const GLint *value = DATA_POINTER(pState, 16, const GLint);
     223
     224    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4, GLint);
     225    pState->pDispatchTbl->Uniform4iv(location, count, value);
     226}
     227
     228void crUnpackExtendUniformMatrix2fv(PCrUnpackerState pState)
     229{
     230    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     231
     232    GLint location = READ_DATA(pState, 8, GLint);
     233    GLsizei count = READ_DATA(pState, 12, GLsizei);
     234    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     235    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     236
     237    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 2, GLfloat);
     238    pState->pDispatchTbl->UniformMatrix2fv(location, count, transpose, value);
     239}
     240
     241void crUnpackExtendUniformMatrix3fv(PCrUnpackerState pState)
     242{
     243    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     244
     245    GLint location = READ_DATA(pState, 8, GLint);
     246    GLsizei count = READ_DATA(pState, 12, GLsizei);
     247    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     248    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     249
     250    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 3, GLfloat);
     251    pState->pDispatchTbl->UniformMatrix3fv(location, count, transpose, value);
     252}
     253
     254void crUnpackExtendUniformMatrix4fv(PCrUnpackerState pState)
     255{
     256    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     257
     258    GLint location = READ_DATA(pState, 8, GLint);
     259    GLsizei count = READ_DATA(pState, 12, GLsizei);
     260    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     261    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     262
     263    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 4, GLfloat);
     264    pState->pDispatchTbl->UniformMatrix4fv(location, count, transpose, value);
     265}
     266
     267void crUnpackExtendUniformMatrix2x3fv(PCrUnpackerState pState)
     268{
     269    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     270
     271    GLint location = READ_DATA(pState, 8, GLint);
     272    GLsizei count = READ_DATA(pState, 12, GLsizei);
     273    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     274    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     275
     276    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 3, GLfloat);
     277    pState->pDispatchTbl->UniformMatrix2x3fv(location, count, transpose, value);
     278}
     279
     280void crUnpackExtendUniformMatrix3x2fv(PCrUnpackerState pState)
     281{
     282    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     283
     284    GLint location = READ_DATA(pState, 8, GLint);
     285    GLsizei count = READ_DATA(pState, 12, GLsizei);
     286    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     287    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     288
     289    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 2, GLfloat);
     290    pState->pDispatchTbl->UniformMatrix3x2fv(location, count, transpose, value);
     291}
     292
     293void crUnpackExtendUniformMatrix2x4fv(PCrUnpackerState pState)
     294{
     295    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     296
     297    GLint location = READ_DATA(pState, 8, GLint);
     298    GLsizei count = READ_DATA(pState, 12, GLsizei);
     299    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     300    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     301
     302    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 2 * 4, GLfloat);
     303    pState->pDispatchTbl->UniformMatrix2x4fv(location, count, transpose, value);
     304}
     305
     306void crUnpackExtendUniformMatrix4x2fv(PCrUnpackerState pState)
     307{
     308    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     309
     310    GLint location = READ_DATA(pState, 8, GLint);
     311    GLsizei count = READ_DATA(pState, 12, GLsizei);
     312    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     313    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     314
     315    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 2, GLfloat);
     316    pState->pDispatchTbl->UniformMatrix4x2fv(location, count, transpose, value);
     317}
     318
     319void crUnpackExtendUniformMatrix3x4fv(PCrUnpackerState pState)
     320{
     321    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     322
     323    GLint location = READ_DATA(pState, 8, GLint);
     324    GLsizei count = READ_DATA(pState, 12, GLsizei);
     325    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     326    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     327
     328    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 3 * 4, GLfloat);
     329    pState->pDispatchTbl->UniformMatrix3x4fv(location, count, transpose, value);
     330}
     331
     332void crUnpackExtendUniformMatrix4x3fv(PCrUnpackerState pState)
     333{
     334    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 16, GLboolean);
     335
     336    GLint location = READ_DATA(pState, 8, GLint);
     337    GLsizei count = READ_DATA(pState, 12, GLsizei);
     338    GLboolean transpose = READ_DATA(pState, 16, GLboolean);
     339    const GLfloat *value = DATA_POINTER(pState, 16+sizeof(GLboolean), const GLfloat);
     340
     341    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, value, count * 4 * 3, GLfloat);
     342    pState->pDispatchTbl->UniformMatrix4x3fv(location, count, transpose, value);
     343}
     344
     345void crUnpackExtendDrawBuffers(PCrUnpackerState pState)
     346{
     347    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLsizei);
     348
     349    GLsizei n = READ_DATA(pState, 8, GLsizei);
     350    const GLenum *bufs = DATA_POINTER(pState, 8+sizeof(GLsizei), const GLenum);
     351
     352    CHECK_ARRAY_SIZE_FROM_PTR_UPDATE_LAST(pState, bufs, n, GLenum);
     353    pState->pDispatchTbl->DrawBuffers(n, bufs);
     354}
     355
     356void crUnpackExtendGetActiveAttrib(PCrUnpackerState pState)
     357{
     358    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 28, CRNetworkPointer);
     359
     360    GLuint program = READ_DATA(pState, 8, GLuint);
     361    GLuint index = READ_DATA(pState, 12, GLuint);
     362    GLsizei bufSize = READ_DATA(pState, 16, GLsizei);
     363    SET_RETURN_PTR(pState, 20);
     364    SET_WRITEBACK_PTR(pState, 28);
     365    pState->pDispatchTbl->GetActiveAttrib(program, index, bufSize, NULL, NULL, NULL, NULL);
     366}
     367
     368void crUnpackExtendGetActiveUniform(PCrUnpackerState pState)
     369{
     370    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 28, CRNetworkPointer);
     371
     372    GLuint program = READ_DATA(pState, 8, GLuint);
     373    GLuint index = READ_DATA(pState, 12, GLuint);
     374    GLsizei bufSize = READ_DATA(pState, 16, GLsizei);
     375    SET_RETURN_PTR(pState, 20);
     376    SET_WRITEBACK_PTR(pState, 28);
     377    pState->pDispatchTbl->GetActiveUniform(program, index, bufSize, NULL, NULL, NULL, NULL);
     378}
     379
     380void crUnpackExtendGetAttachedShaders(PCrUnpackerState pState)
     381{
     382    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     383
     384    GLuint program = READ_DATA(pState, 8, GLuint);
     385    GLsizei maxCount = READ_DATA(pState, 12, GLsizei);
     386    SET_RETURN_PTR(pState, 16);
     387    SET_WRITEBACK_PTR(pState, 24);
     388    pState->pDispatchTbl->GetAttachedShaders(program, maxCount, NULL, NULL);
     389}
     390
     391void crUnpackExtendGetAttachedObjectsARB(PCrUnpackerState pState)
     392{
     393    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     394
     395    VBoxGLhandleARB containerObj = READ_DATA(pState, 8, VBoxGLhandleARB);
     396    GLsizei maxCount = READ_DATA(pState, 12, GLsizei);
     397    SET_RETURN_PTR(pState, 16);
     398    SET_WRITEBACK_PTR(pState, 24);
     399    pState->pDispatchTbl->GetAttachedObjectsARB(containerObj, maxCount, NULL, NULL);
     400}
     401
     402void crUnpackExtendGetInfoLogARB(PCrUnpackerState pState)
     403{
     404    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     405
     406    VBoxGLhandleARB obj = READ_DATA(pState, 8, VBoxGLhandleARB);
     407    GLsizei maxLength = READ_DATA(pState, 12, GLsizei);
     408    SET_RETURN_PTR(pState, 16);
     409    SET_WRITEBACK_PTR(pState, 24);
     410    pState->pDispatchTbl->GetInfoLogARB(obj, maxLength, NULL, NULL);
     411}
     412
     413void crUnpackExtendGetProgramInfoLog(PCrUnpackerState pState)
     414{
     415    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     416
     417    GLuint program = READ_DATA(pState, 8, GLuint);
     418    GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
     419    SET_RETURN_PTR(pState, 16);
     420    SET_WRITEBACK_PTR(pState, 24);
     421    pState->pDispatchTbl->GetProgramInfoLog(program, bufSize, NULL, NULL);
     422}
     423
     424void crUnpackExtendGetShaderInfoLog(PCrUnpackerState pState)
     425{
     426    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     427
     428    GLuint shader = READ_DATA(pState, 8, GLuint);
     429    GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
     430    SET_RETURN_PTR(pState, 16);
     431    SET_WRITEBACK_PTR(pState, 24);
     432    pState->pDispatchTbl->GetShaderInfoLog(shader, bufSize, NULL, NULL);
     433}
     434
     435void crUnpackExtendGetShaderSource(PCrUnpackerState pState)
     436{
     437    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     438
     439    GLuint shader = READ_DATA(pState, 8, GLuint);
     440    GLsizei bufSize = READ_DATA(pState, 12, GLsizei);
     441    SET_RETURN_PTR(pState, 16);
     442    SET_WRITEBACK_PTR(pState, 24);
     443    pState->pDispatchTbl->GetShaderSource(shader, bufSize, NULL, NULL);
     444}
     445
     446void crUnpackExtendGetAttribLocation(PCrUnpackerState pState)
     447{
     448    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLuint);
     449
     450    int packet_length = READ_DATA(pState, 0, int);
     451    GLuint program = READ_DATA(pState, 8, GLuint);
     452    const char *name = DATA_POINTER(pState, 12, const char);
     453
     454    size_t cchStr = CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(pState, name);
     455    if (RT_UNLIKELY(cchStr == SIZE_MAX || packet_length != cchStr + 2 * sizeof(CRNetworkPointer)))
     456    {
     457        crError("crUnpackExtendGetAttribLocation: packet_length is corrupt");
    357458        return;
    358459    }
    359460
    360     SET_RETURN_PTR(packet_length-16);
    361     SET_WRITEBACK_PTR(packet_length-8);
    362     cr_unpackDispatch.GetAttribLocation(program, name);
    363 }
    364 
    365 void crUnpackExtendGetUniformLocation(void)
    366 {
    367     int packet_length = READ_DATA(0, int);
    368     GLuint program = READ_DATA(8, GLuint);
    369     const char *name = DATA_POINTER(12, const char);
    370 
    371     if (!DATA_POINTER_CHECK(packet_length))
    372     {
    373         crError("crUnpackExtendGetUniformLocation: packet_length is out of range");
     461    CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, packet_length);
     462    SET_RETURN_PTR(pState, packet_length-16);
     463    SET_WRITEBACK_PTR(pState, packet_length-8);
     464    pState->pDispatchTbl->GetAttribLocation(program, name);
     465}
     466
     467void crUnpackExtendGetUniformLocation(PCrUnpackerState pState)
     468{
     469    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 8, GLuint);
     470
     471    int packet_length = READ_DATA(pState, 0, int);
     472    GLuint program = READ_DATA(pState, 8, GLuint);
     473    const char *name = DATA_POINTER(pState, 12, const char);
     474
     475    size_t cchStr = CHECK_STRING_FROM_PTR_UPDATE_NO_RETURN(pState, name);
     476    if (RT_UNLIKELY(cchStr == SIZE_MAX || packet_length != cchStr + 2 * sizeof(CRNetworkPointer)))
     477    {
     478        crError("crUnpackExtendGetUniformLocation: packet_length is corrupt");
    374479        return;
    375480    }
    376481
    377     SET_RETURN_PTR(packet_length-16);
    378     SET_WRITEBACK_PTR(packet_length-8);
    379     cr_unpackDispatch.GetUniformLocation(program, name);
    380 }
    381 
    382 void crUnpackExtendGetUniformsLocations(void)
    383 {
    384         GLuint program = READ_DATA(8, GLuint);
    385         GLsizei maxcbData = READ_DATA(12, GLsizei);
    386         SET_RETURN_PTR(16);
    387         SET_WRITEBACK_PTR(24);
    388         cr_unpackDispatch.GetUniformsLocations(program, maxcbData, NULL, NULL);
    389 }
    390 
    391 void crUnpackExtendGetAttribsLocations(void)
    392 {
    393     GLuint program = READ_DATA(8, GLuint);
    394     GLsizei maxcbData = READ_DATA(12, GLsizei);
    395     SET_RETURN_PTR(16);
    396     SET_WRITEBACK_PTR(24);
    397     cr_unpackDispatch.GetAttribsLocations(program, maxcbData, NULL, NULL);
    398 }
     482    CHECK_BUFFER_SIZE_STATIC_UPDATE(pState, packet_length);
     483    SET_RETURN_PTR(pState, packet_length-16);
     484    SET_WRITEBACK_PTR(pState, packet_length-8);
     485    pState->pDispatchTbl->GetUniformLocation(program, name);
     486}
     487
     488void crUnpackExtendGetUniformsLocations(PCrUnpackerState pState)
     489{
     490    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     491
     492    GLuint program = READ_DATA(pState, 8, GLuint);
     493    GLsizei maxcbData = READ_DATA(pState, 12, GLsizei);
     494    SET_RETURN_PTR(pState, 16);
     495    SET_WRITEBACK_PTR(pState, 24);
     496    pState->pDispatchTbl->GetUniformsLocations(program, maxcbData, NULL, NULL);
     497}
     498
     499void crUnpackExtendGetAttribsLocations(PCrUnpackerState pState)
     500{
     501    CHECK_BUFFER_SIZE_STATIC_LAST(pState, 24, CRNetworkPointer);
     502
     503    GLuint program = READ_DATA(pState, 8, GLuint);
     504    GLsizei maxcbData = READ_DATA(pState, 12, GLsizei);
     505    SET_RETURN_PTR(pState, 16);
     506    SET_WRITEBACK_PTR(pState, 24);
     507    pState->pDispatchTbl->GetAttribsLocations(program, maxcbData, NULL, NULL);
     508}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette