summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/wgl
Commit message (Collapse)AuthorAgeFilesLines
* st/wgl: make own_mutex() non-staticBrian Paul2016-06-302-4/+7
| | | | Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* st/wgl: remove unneeded inline qualifiersBrian Paul2016-06-302-4/+4
| | | | | | No effect on size of the .o files (optimized build). Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: add a stw_device::initialized fieldBrian Paul2016-06-303-24/+35
| | | | | | | | Set when the stw_dev object's initialization is completed. We test for this in the window callback function to avoid potential crashes on start-up in multi-threaded applications. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: refactor framebuffer locking codeBrian Paul2016-06-304-51/+68
| | | | | | | | | | | | Split the old stw_framebuffer_reference() function into two new functions: stw_framebuffer_reference_locked() which increments the refcount and stw_framebuffer_release_locked() which decrements the refcount and destroys the buffer when the count hits zero. Original patch by Jose. Modified by Brian (clean-ups, lock assertion checks, etc). Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: rename curctx to old_ctx in stw_make_current()José Fonseca2016-06-301-8/+8
| | | | Reviewed-by: Brian Paul <brianp@vmware.com>
* st/wgl: release the pbuffer DC at the end of wglBindTexImageARB()Brian Paul2016-06-301-1/+6
| | | | | | | | | | | Otherwise we were leaking DC GDI objects and if wglBindTexImageARB() was called enough we'd eventually hit the GDI limit of 10,000 objects. Things started failing at that point. v2: also release DC if we return early, per Charmaine. Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* scons: whitespace cleanupGiuseppe Bilotta2016-05-251-1/+1
| | | | | | | | | | This text transformation was done automatically via the following shell command: $ find -name SCons\* -exec sed -i s/\\s\\+$// '{}' \; Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* Treewide: Remove Elements() macroJan Vesely2016-05-171-5/+5
| | | | | Signed-off-by: Jan Vesely <jano.vesely@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* st/wgl: add new stw_ext_rendertexture.c fileBrian Paul2015-12-031-0/+252
| | | | | | This should have been included in the previous commit. Signed-off-by: Brian Paul <brianp@vmware.com>
* st/wgl: add support for WGL_ARB_render_textureBrian Paul2015-12-039-10/+118
| | | | | | | | | | | There are a few legacy OpenGL apps on Windows which need this extension. We basically use glCopyTex[Sub]Image to implement wglBindTexImageARB (see the implementation notes for details). v2: refactor code to use st_copy_framebuffer_to_texture() helper function. Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: add a comment about recursive locking in stw_make_current()Brian Paul2015-11-121-0/+4
| | | | | Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: add a lock assertion in stw_framebuffer_from_hwnd_locked()Brian Paul2015-11-121-0/+1
| | | | | Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: add some mutex checking codeJosé Fonseca2015-11-121-0/+26
| | | | | | | | | | | This would have caught the locking bug that was fixed in the earlier "st/wgl: fix locking issue in stw_st_framebuffer_present_locked()" patch. v2: minor coding style changes by Brian. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: rename stw_framebuffer_release() to stw_framebuffer_unlock()Brian Paul2015-11-125-19/+19
| | | | | | | To match the new stw_framebuffer_lock() function. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: reimplement stw_framebuffer::mutex with CRITICAL_SECTIONBrian Paul2015-11-124-29/+32
| | | | | | | | v2: update comments on the stw_framebuffer::mutex field regarding locking order. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: include u_debug.hBrian Paul2015-11-123-0/+6
| | | | | | | | To get declaration for debug_printf() directly instead of getting it indirectly through os_thread.h Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: reimplement stw_device::fb_mutex with CRITICAL_SECTIONBrian Paul2015-11-123-15/+29
| | | | | Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: re-implement stw_device::ctx_mutex with CRITICAL_SECTIONBrian Paul2015-11-123-19/+34
| | | | | | | | | This is Windows-only code so we can use the native Win32 functions for critical sections. This will also allow us to (cleanly) add some mutex check/debug code in subsequent patches. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: clarify code in stw_framebuffer_from_hwnd_locked()Brian Paul2015-11-111-2/+2
| | | | | | | | | Just a minor code change to make it obvious that NULL is returned when we don't find the given HWND. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: improve some function commentsBrian Paul2015-11-111-6/+30
| | | | | | | | | In particular, explain when stw_framebuffer objects are locked/unlocked/etc. Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: whitespace/formatting fixesBrian Paul2015-11-113-63/+48
|
* st/wgl: fix locking issue in stw_st_framebuffer_present_locked()Brian Paul2015-11-111-0/+3
| | | | | | | | | | | | | When stw_st_framebuffer_present_locked() is called, the stw_framebuffer's mutex will already be locked. Normally, the stw_framebuffer_present_locked() function calls stw_framebuffer_release() to unlock the mutex when it's done. But if for some reason the 'resource' pointer in stw_st_framebuffer_present_locked() is null, we'd return without unlocking the stw_framebuffer. This fixes that to avoid potential deadlocks. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: add null pointer check for HUD textureBrian Paul2015-11-091-1/+3
| | | | | | Fixes crash when using HUD with Nobel Clinician Viewer. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* st/wgl: fix double-present on swapbuffers bugBrian Paul2015-11-093-20/+12
| | | | | | | | | | | | | | | | | | The stw_st_framebuffer_present_locked() function was getting called twice per SwapBuffers. First, when st_context_iface::flush() was called from DrvSwapBuffers() because the ST_FLUSH_FRONT flag was given. Second, by stw_st_swap_framebuffer_locked() which does the actual SwapBuffers. Two code changes: 1. Pass ST_FLUSH_END_OF_FRAME, instead of ST_FLUSH_FRONT. 2. Move the implementation of stw_flush_current_locked() into DrvSwapBuffers() since it's not called anywhere else. Not much change in perf for benchmarks like Lightsmark, but some simple Mesa demos are measurably faster. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: reorder pixel formats to put MSAA formats lastBrian Paul2015-11-091-29/+32
| | | | | | | | | | | | | And put 8-bit/channel formats before 5/6/5 formats. The ChoosePixelFormat() function seems to be finicky about format selection. Putting the MSAA formats after the non-MSAA formats means most apps get a low-numbered format. Now we generally get the same pixel format regardless of whether using vgpu9 or 10. VMware bug 1455030 Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: Don't rely on GDI to bookkeep pixelformat for us.José Fonseca2015-11-092-7/+6
| | | | | | | This allows to use apitrace's retracediff script on Windows to retrace and compare two builds of a Mesa based opengl32.dll/ICD side-by-side. See also https://github.com/apitrace/apitrace/commit/e4a4f15f5b92e0abbd24d7d053da25f8278c9f64
* gallium: replace INLINE with inlineIlia Mirkin2015-07-214-6/+6
| | | | | | | | | | | | | | | | Generated by running: git grep -l INLINE src/gallium/ | xargs sed -i 's/\bINLINE\b/inline/g' git grep -l INLINE src/mesa/state_tracker/ | xargs sed -i 's/\bINLINE\b/inline/g' git checkout src/gallium/state_trackers/clover/Doxyfile and manual edits to src/gallium/include/pipe/p_compiler.h src/gallium/README.portability to remove mentions of the inline define. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Acked-by: Marek Olšák <marek.olsak@amd.com>
* st/wgl: add stw_nopfuncs.h to the sources listsEmil Velikov2015-06-241-0/+1
| | | | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* st/wgl: fix WGL_SWAP_METHOD_ARB queryBrian Paul2015-06-191-1/+6
| | | | | | | | | | There are three possible return values (not two): WGL_SWAP_COPY_ARB, WGL_SWAP_EXCHANGE_EXT and WGL_SWAP_UNDEFINED_ARB. VMware bug 1431184 Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* stw: use new stw_get_nop_function() function to avoid Viewperf 12 crashesBrian Paul2015-06-191-3/+20
| | | | | | | Also, print a warning if we do return NULL from wglGetProcAddress() to help spot this sort of problem in the future. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* stw: add some no-op functions for GL_EXT_dsa, GL_NV_half_floatBrian Paul2015-06-193-0/+476
| | | | | | | | | | | | | | | | | | Viewperf 12 calls wglGetProcAddress() to get pointers to some unsupported DSA and half-float functions. We return NULL but Viewperf doesn't check for null before trying to jump through the pointer. That causes a crash. This patch adds no-op functions to call instead (used by the next patch). This avoids the crash but the rendering is incorrect. Some DSA functions are being added to Mesa at this time so we may be able to remove some of these no-ops in the future. More no-op functions may be added as needed. VMware PR1383421 Reviewed-by: José Fonseca <jfonseca@vmware.com>
* st/wgl: Don't return core profile for 3.1 contexts.Jose Fonseca2015-06-191-7/+6
| | | | | | | | | | | | | | | | | | | WGL_CONTEXT_PROFILE_MASK_ARB doesn't apply to desktop OpenGL versions less than 3.2 -- applications can't specify whether they want a core or a compat 3.1 context -- instead they are supposed the check whether the returned context advertises GL_ARB_compatibility extension. Mesa doesn't support compatability contexts for version higher than 3.1, so we used to return core profile context, but this makes several Windows applications unhappy, because they just assume they got a compatability context without checking. So it seems safer to on Windows to never return core profile for 3.1, ie, just fail the context creation. VMware PR1365920. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/wgl: set PIPE_BIND_SAMPLER_VIEW for window color buffersBrian Paul2015-06-191-0/+1
| | | | | | | To allow sampling from the surface for things like glCopyPixels or glCopyTexSubImage. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: add support for multisample pixel formatsBrian Paul2015-06-191-9/+20
| | | | | | | | | Create pixel formats with 0, 4, 8 and 16 samples per pixel. Add a SVGA_FORCE_MSAA env var to force creating all pixel formats with a particular sample count. This is useful for testing Mesa/GLUT/ etc. programs which don't ordinarily use multisample. Reviewed-by: Matthew McClure <mcclurem@vmware.com>
* st/wgl: respect sample count when creating framebuffer surfacesBrian Paul2015-06-191-0/+1
| | | | | | Use the visual/pixel format's sample count instead of zero. Reviewed-by: Matthew McClure <mcclurem@vmware.com>
* st/wgl: fix WGL_SAMPLE_BUFFERS_ARB queryBrian Paul2015-06-191-1/+1
| | | | | | | Only report 1 for WGL_SAMPLE_BUFFERS_ARB if the number of samples per pixel > 1. Reviewed-by: Matthew McClure <mcclurem@vmware.com>
* Fix a few typosZoë Blade2015-04-271-1/+1
| | | | Reviewed-by: Francisco Jerez <currojerez@riseup.net>
* st/wgl: Couple of fixes to opengl32.dll's wglCreateContext/wglDeleteContext ↵Jose Fonseca2015-04-153-9/+66
| | | | | | | | | | | | | | | dispatch. - Use GetModuleHandle instead of LoadLibrary to avoid incrementing the opengl32.dll reference count (otherwise the opengl32.dll will linger in memory forever.) - Ensure we use our fake wglCreateContext/wglDeleteContext when using Mesa as a drop-in replacement for opengl32.dll Untested. Just noticed by accident. Reviewed-by: Brian Paul <brianp@vmware.com>
* st/wgl: Ignore ulVersion in DrvValidateVersion.José Fonseca2015-01-081-2/+10
| | | | | | | | | | | We never used ulVersion for proper version checks. Most 3rd party drivers use version 1, but recently NVIDIA OpenGL driver started using a different version number, so the handy trick of renaming Mesa's ICDs as nvoglv32.dll on Windows machines with NVIDIA hardware for quick testing of Mesa software renderers stopped working. Reviewed-by: Brian Paul <brianp@vmware.com>
* Don't cast the return value of malloc/reallocMatt Turner2014-12-081-1/+1
| | | | | | | See commit 2b7a972e for the Coccinelle script. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* st/wgl: Don't export wglGetExtensionsStringARB.José Fonseca2014-11-261-1/+0
| | | | | | | | | It's not exported by the official opengl32.dll neither. Applications are supposed to get it via wglGetProcAddress(), not GetProcAddress(). Cc: "10.4" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
* st/wgl: Implement WGL_EXT_create_context_es/es2_profile.José Fonseca2014-11-143-63/+78
| | | | | | | | Derived from st/glx's GLX_EXT_create_context_es/es2_profile implementation. Tested with an OpenGL ES 2.0 ApiTrace. Reviewed-by: Brian Paul <brianp@vmware.com>
* wgl: stw_pixelformat_get_info: correct type for index variableAlon Levy2014-10-231-1/+1
| | | | | Signed-off-by: Alon Levy <alevy@redhat.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* st/wgl: add WINAPI qualifiers on wgl function typedefsBrian Paul2014-10-031-2/+2
| | | | | | | | Fixes a release build segfault when wglCreateContextAttribsARB() calls the wglCreateContext() function. Cc: "10.3" <mesa-stable@lists.freedesktop.org> Reviewed-by: Matthew McClure <mcclurem@vmware.com>
* st/wgl: Clamp wglChoosePixelFormatARB's output nNumFormats to nMaxFormats.José Fonseca2014-07-291-2/+4
| | | | | | | | | | | | | | While running https://github.com/nvMcJohn/apitest with apitrace I noticed that Mesa was producing bogus results: wglChoosePixelFormatARB(hdc, piAttribIList = {...}, pfAttribFList = &0, nMaxFormats = 1, piFormats = {19, 65576, 37, 198656, 131075, 0, 402653184, 0, 0, 0, 0, -573575710}, nNumFormats = &12) = TRUE However https://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt states <nNumFormats> returns the number of matching formats. The returned value is guaranteed to be no larger than <nMaxFormats>. Cc: "10.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
* wgl: Disable CRT message boxes when Windows system error messages boxes are ↵José Fonseca2014-06-041-0/+2
| | | | | | | | | | disabled. At least on MSVC we statically link against the CRT, so we must disable the CRT message boxes if we want unattended testing. The messages are convenient when running manually, so let them be if the system error message boxes are not disabled.
* st/wgl: use _debug_printf() instead of fprintf()Brian Paul2014-05-301-7/+3
| | | | | | | | This should print output both for debug and release builds. Suggested by Jose. Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: formatting fixes in stw_framebuffer.cBrian Paul2014-05-301-82/+70
| | | | | | And remove some unneeded #includes and INLINE qualifiers. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: make stw_lookup_context_locked() an inline functionBrian Paul2014-05-302-15/+9
| | | | Reviewed-by: Charmaine Lee <charmainel@vmware.com>
* st/wgl: fix implementation of wglCreateContextAttribsARB()Brian Paul2014-05-303-22/+136
| | | | | | | | | | | | | | | | | | | | wglCreateContextAttribsARB() didn't work previously since it returned a context ID that wasn't allocated by OPENGL32.DLL. So if that context ID was later passed to wglMakeCurrent(), etc. it was rejected. Now when wglCreateContextAttribsARB() is called we actually call wglCreateContext() in order to get a valid context ID. Then we replace the context data which was created with new context data which reflects the arguments passed to wglCreateContextAttribsARB(). If there were a DrvCreateContextAttribs() function in the ICD this work-around wouldn't be necessary. Reviewed-by: Charmaine Lee <charmainel@vmware.com> Conflicts: src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c src/gallium/state_trackers/wgl/stw_getprocaddress.c