From e10ddf87b8d46aa5be671a458b84bafabb166028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 28 Feb 2013 18:21:10 +0000 Subject: [PATCH] [DIRECTX] - sync ddraw, d3d8, d3d9, wined3d and corresponding headers wine WINE 1.5.24 [PSDK/DDRAW.H] - Add IDirectDraw3 interface - Correct LPDDENUMCALLBACK(EX){A/W} typedef svn path=/trunk/; revision=58379 --- reactos/dll/directx/wine/d3d8/buffer.c | 10 +- reactos/dll/directx/wine/d3d8/d3d8_main.c | 9 +- reactos/dll/directx/wine/d3d8/d3d8_private.h | 30 +- reactos/dll/directx/wine/d3d8/device.c | 585 +- reactos/dll/directx/wine/d3d8/directx.c | 23 +- reactos/dll/directx/wine/d3d8/shader.c | 5 +- reactos/dll/directx/wine/d3d8/surface.c | 18 +- reactos/dll/directx/wine/d3d8/swapchain.c | 24 +- reactos/dll/directx/wine/d3d8/texture.c | 10 +- .../dll/directx/wine/d3d8/vertexdeclaration.c | 2 +- reactos/dll/directx/wine/d3d8/volume.c | 4 +- reactos/dll/directx/wine/d3d9/buffer.c | 2 +- reactos/dll/directx/wine/d3d9/d3d9_main.c | 10 +- reactos/dll/directx/wine/d3d9/d3d9_private.h | 33 +- reactos/dll/directx/wine/d3d9/device.c | 558 +- reactos/dll/directx/wine/d3d9/directx.c | 10 +- reactos/dll/directx/wine/d3d9/query.c | 2 +- reactos/dll/directx/wine/d3d9/shader.c | 2 +- reactos/dll/directx/wine/d3d9/stateblock.c | 12 +- reactos/dll/directx/wine/d3d9/surface.c | 12 +- reactos/dll/directx/wine/d3d9/swapchain.c | 27 +- reactos/dll/directx/wine/d3d9/texture.c | 2 +- .../dll/directx/wine/d3d9/vertexdeclaration.c | 5 +- reactos/dll/directx/wine/d3d9/volume.c | 2 +- reactos/dll/directx/wine/ddraw/clipper.c | 4 +- reactos/dll/directx/wine/ddraw/ddraw.c | 598 +- .../dll/directx/wine/ddraw/ddraw_private.h | 66 +- reactos/dll/directx/wine/ddraw/device.c | 764 +-- .../dll/directx/wine/ddraw/executebuffer.c | 66 +- reactos/dll/directx/wine/ddraw/light.c | 78 +- reactos/dll/directx/wine/ddraw/main.c | 134 +- reactos/dll/directx/wine/ddraw/material.c | 6 +- reactos/dll/directx/wine/ddraw/palette.c | 4 +- reactos/dll/directx/wine/ddraw/surface.c | 104 +- reactos/dll/directx/wine/ddraw/utils.c | 9 +- reactos/dll/directx/wine/ddraw/vertexbuffer.c | 69 +- reactos/dll/directx/wine/ddraw/viewport.c | 40 +- .../dll/directx/wine/wined3d/CMakeLists.txt | 1 + .../directx/wine/wined3d/arb_program_shader.c | 914 +-- .../wine/wined3d/ati_fragment_shader.c | 56 +- reactos/dll/directx/wine/wined3d/buffer.c | 52 +- reactos/dll/directx/wine/wined3d/context.c | 170 +- reactos/dll/directx/wine/wined3d/device.c | 1639 +++--- reactos/dll/directx/wine/wined3d/directx.c | 1539 ++--- reactos/dll/directx/wine/wined3d/drawprim.c | 648 +-- reactos/dll/directx/wine/wined3d/gl_compat.c | 6 +- .../dll/directx/wine/wined3d/glsl_shader.c | 3563 ++++++++---- .../wine/wined3d/nvidia_texture_shader.c | 50 +- reactos/dll/directx/wine/wined3d/palette.c | 13 +- reactos/dll/directx/wine/wined3d/query.c | 32 +- reactos/dll/directx/wine/wined3d/resource.c | 4 +- reactos/dll/directx/wine/wined3d/sampler.c | 76 + reactos/dll/directx/wine/wined3d/shader.c | 936 +-- reactos/dll/directx/wine/wined3d/shader_sm1.c | 199 +- reactos/dll/directx/wine/wined3d/shader_sm4.c | 762 ++- reactos/dll/directx/wine/wined3d/state.c | 169 +- reactos/dll/directx/wine/wined3d/stateblock.c | 103 +- reactos/dll/directx/wine/wined3d/surface.c | 167 +- reactos/dll/directx/wine/wined3d/swapchain.c | 99 +- reactos/dll/directx/wine/wined3d/texture.c | 31 +- reactos/dll/directx/wine/wined3d/utils.c | 395 +- .../directx/wine/wined3d/vertexdeclaration.c | 7 +- reactos/dll/directx/wine/wined3d/view.c | 7 +- reactos/dll/directx/wine/wined3d/volume.c | 7 +- reactos/dll/directx/wine/wined3d/wined3d.spec | 58 +- reactos/dll/directx/wine/wined3d/wined3d_gl.h | 2283 +------- .../dll/directx/wine/wined3d/wined3d_main.c | 44 +- .../directx/wine/wined3d/wined3d_private.h | 351 +- reactos/include/psdk/ddraw.h | 97 +- reactos/include/reactos/wine/wgl.h | 5081 +++++++++++++++++ reactos/include/reactos/wine/wgl_driver.h | 364 +- reactos/include/reactos/wine/wined3d.h | 157 +- 72 files changed, 13668 insertions(+), 9751 deletions(-) create mode 100644 reactos/dll/directx/wine/wined3d/sampler.c create mode 100644 reactos/include/reactos/wine/wgl.h diff --git a/reactos/dll/directx/wine/d3d8/buffer.c b/reactos/dll/directx/wine/d3d8/buffer.c index 2a54efbc5bf..775595af2d7 100644 --- a/reactos/dll/directx/wine/d3d8/buffer.c +++ b/reactos/dll/directx/wine/d3d8/buffer.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -34,7 +34,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_QueryInterface(IDirect3DVertexBuffer8 *i || IsEqualGUID(riid, &IID_IDirect3DResource8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DVertexBuffer8_AddRef(iface); *object = iface; return S_OK; } @@ -302,7 +302,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device * } buffer->parent_device = &device->IDirect3DDevice8_iface; - IUnknown_AddRef(buffer->parent_device); + IDirect3DDevice8_AddRef(buffer->parent_device); return D3D_OK; } @@ -329,7 +329,7 @@ static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *ifa || IsEqualGUID(riid, &IID_IDirect3DResource8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DIndexBuffer8_AddRef(iface); *object = iface; return S_OK; } @@ -596,7 +596,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de } buffer->parent_device = &device->IDirect3DDevice8_iface; - IUnknown_AddRef(buffer->parent_device); + IDirect3DDevice8_AddRef(buffer->parent_device); return D3D_OK; } diff --git a/reactos/dll/directx/wine/d3d8/d3d8_main.c b/reactos/dll/directx/wine/d3d8/d3d8_main.c index f3b162565f5..d03bcba34c9 100644 --- a/reactos/dll/directx/wine/d3d8/d3d8_main.c +++ b/reactos/dll/directx/wine/d3d8/d3d8_main.c @@ -19,10 +19,10 @@ * */ -#include -#include +#include "config.h" +#include "initguid.h" #include "d3d8_private.h" -//#include "wine/debug.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -42,10 +42,7 @@ IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version) TRACE("sdk_version %#x.\n", sdk_version); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) - { - ERR("Failed to allocate d3d8 object memory.\n"); return NULL; - } if (!d3d8_init(object)) { diff --git a/reactos/dll/directx/wine/d3d8/d3d8_private.h b/reactos/dll/directx/wine/d3d8/d3d8_private.h index 2f16b0f3af1..fc79fe1fa7e 100644 --- a/reactos/dll/directx/wine/d3d8/d3d8_private.h +++ b/reactos/dll/directx/wine/d3d8/d3d8_private.h @@ -23,22 +23,18 @@ #ifndef __WINE_D3D8_PRIVATE_H #define __WINE_D3D8_PRIVATE_H -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include #include #define NONAMELESSUNION #define NONAMELESSSTRUCT #define COBJMACROS -#include -#include -#include -#include -#include -#include +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "wine/debug.h" +#include "d3d8.h" +#include "wine/wined3d.h" /* CreateVertexShader can return > 0xFFFF */ #define VS_HIGHESTFIXEDFXF 0xF0000000 @@ -162,6 +158,14 @@ struct d3d8_device struct FvfToDecl *decls; UINT numConvertedDecls, declArraySize; + /* User data draws */ + struct wined3d_buffer *vertex_buffer; + UINT vertex_buffer_size; + UINT vertex_buffer_pos; + struct wined3d_buffer *index_buffer; + UINT index_buffer_size; + UINT index_buffer_pos; + /* Avoids recursion with nested ReleaseRef to 0 */ BOOL inDestruction; BOOL lost; @@ -207,9 +211,9 @@ struct d3d8_surface IUnknown *forwardReference; }; -HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, - UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, - DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; +HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, UINT width, UINT height, + D3DFORMAT format, BOOL lockable, BOOL discard, DWORD usage, D3DPOOL pool, + D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN; struct d3d8_vertexbuffer diff --git a/reactos/dll/directx/wine/d3d8/device.c b/reactos/dll/directx/wine/d3d8/device.c index 4b5956f8a8c..a94d3bd646d 100644 --- a/reactos/dll/directx/wine/d3d8/device.c +++ b/reactos/dll/directx/wine/d3d8/device.c @@ -19,18 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" -//#include -//#include +#include +#include #define NONAMELESSUNION #define NONAMELESSSTRUCT -//#include "windef.h" -//#include "winbase.h" -//#include "winuser.h" -//#include "wingdi.h" -//#include "wine/debug.h" +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "wine/debug.h" #include "d3d8_private.h" @@ -307,7 +307,7 @@ static HRESULT WINAPI d3d8_device_QueryInterface(IDirect3DDevice8 *iface, REFIID if (IsEqualGUID(riid, &IID_IDirect3DDevice8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DDevice8_AddRef(iface); *out = iface; return S_OK; } @@ -357,6 +357,11 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface) } HeapFree(GetProcessHeap(), 0, device->decls); + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + wined3d_device_uninit_3d(device->wined3d_device); wined3d_device_release_focus_window(device->wined3d_device); wined3d_device_decref(device->wined3d_device); @@ -479,16 +484,15 @@ static HRESULT WINAPI d3d8_device_GetCreationParameters(IDirect3DDevice8 *iface, D3DDEVICE_CREATION_PARAMETERS *parameters) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, parameters %p.\n", iface, parameters); wined3d_mutex_lock(); - hr = wined3d_device_get_creation_parameters(device->wined3d_device, + wined3d_device_get_creation_parameters(device->wined3d_device, (struct wined3d_device_creation_parameters *)parameters); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_SetCursorProperties(IDirect3DDevice8 *iface, @@ -546,13 +550,12 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_swapchain_desc desc; struct d3d8_swapchain *object; - HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", iface, present_parameters, swapchain); wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters); - if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, &object))) + if (SUCCEEDED(d3d8_swapchain_create(device, &desc, &object))) *swapchain = &object->IDirect3DSwapChain8_iface; present_parameters_from_wined3d_swapchain_desc(present_parameters, &desc); @@ -597,10 +600,25 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, TRACE("iface %p, present_parameters %p.\n", iface, present_parameters); wined3d_mutex_lock(); - wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); - if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback))) + + if (device->vertex_buffer) { - hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); + wined3d_buffer_decref(device->vertex_buffer); + device->vertex_buffer = NULL; + device->vertex_buffer_size = 0; + } + if (device->index_buffer) + { + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = NULL; + device->index_buffer_size = 0; + } + + wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); + if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, + NULL, reset_enum_callback, TRUE))) + { + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); device->lost = FALSE; } else @@ -648,7 +666,6 @@ static HRESULT WINAPI d3d8_device_GetBackBuffer(IDirect3DDevice8 *iface, surface_impl = wined3d_surface_get_parent(wined3d_surface); *backbuffer = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*backbuffer); - wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); @@ -706,10 +723,7 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate texture memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = texture_init(object, device, width, height, levels, usage, format, pool); if (FAILED(hr)) @@ -738,10 +752,7 @@ static HRESULT WINAPI d3d8_device_CreateVolumeTexture(IDirect3DDevice8 *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate volume texture memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = volumetexture_init(object, device, width, height, depth, levels, usage, format, pool); if (FAILED(hr)) @@ -769,10 +780,7 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate cube texture memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = cubetexture_init(object, device, edge_length, levels, usage, format, pool); if (FAILED(hr)) @@ -800,10 +808,7 @@ static HRESULT WINAPI d3d8_device_CreateVertexBuffer(IDirect3DDevice8 *iface, UI object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate buffer memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = vertexbuffer_init(object, device, size, usage, fvf, pool); if (FAILED(hr)) @@ -831,10 +836,7 @@ static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UIN object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate buffer memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = indexbuffer_init(object, device, size, usage, format, pool); if (FAILED(hr)) @@ -850,17 +852,16 @@ static HRESULT WINAPI d3d8_device_CreateIndexBuffer(IDirect3DDevice8 *iface, UIN return D3D_OK; } -static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width, - UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, - IDirect3DSurface8 **surface, UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, - DWORD multisample_quality) +static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width, UINT height, + D3DFORMAT format, BOOL lockable, BOOL discard, IDirect3DSurface8 **surface, UINT usage, + D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) { struct d3d8_surface *object; HRESULT hr; - TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n" + TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, surface %p,\n" "\tusage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n", - device, width, height, format, lockable, discard, level, surface, + device, width, height, format, lockable, discard, surface, usage, pool, multisample_type, multisample_quality); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) @@ -869,9 +870,8 @@ static HRESULT d3d8_device_CreateSurface(struct d3d8_device *device, UINT width, return D3DERR_OUTOFVIDEOMEMORY; } - hr = surface_init(object, device, width, height, format, lockable, discard, level, usage, - pool, multisample_type, multisample_quality); - if (FAILED(hr)) + if (FAILED(hr = surface_init(object, device, width, height, format, lockable, + discard, usage, pool, multisample_type, multisample_quality))) { WARN("Failed to initialize surface, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); @@ -889,16 +889,12 @@ static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UI IDirect3DSurface8 **surface) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n", iface, width, height, format, multisample_type, lockable, surface); - hr = d3d8_device_CreateSurface(device, width, height, format, lockable, - FALSE, 0, surface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, - multisample_type, 0); - - return hr; + return d3d8_device_create_surface(device, width, height, format, lockable, FALSE, + surface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, multisample_type, 0); } static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *iface, @@ -906,16 +902,13 @@ static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *if IDirect3DSurface8 **surface) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n", iface, width, height, format, multisample_type, surface); /* TODO: Verify that Discard is false */ - hr = d3d8_device_CreateSurface(device, width, height, format, TRUE, FALSE, - 0, surface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, multisample_type, 0); - - return hr; + return d3d8_device_create_surface(device, width, height, format, TRUE, FALSE, + surface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, multisample_type, 0); } /* IDirect3DDevice8Impl::CreateImageSurface returns surface with pool type SYSTEMMEM */ @@ -923,15 +916,12 @@ static HRESULT WINAPI d3d8_device_CreateImageSurface(IDirect3DDevice8 *iface, UI UINT height, D3DFORMAT format, IDirect3DSurface8 **surface) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n", iface, width, height, format, surface); - hr = d3d8_device_CreateSurface(device, width, height, format, TRUE, FALSE, - 0, surface, 0, D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0); - - return hr; + return d3d8_device_create_surface(device, width, height, format, TRUE, FALSE, + surface, 0, D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0); } static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface, @@ -1085,7 +1075,7 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target); struct d3d8_surface *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil); struct wined3d_surface *original_ds = NULL; - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil); @@ -1100,14 +1090,12 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, /* If no render target is passed in check the size against the current RT */ if (!render_target) { - hr = wined3d_device_get_render_target(device->wined3d_device, 0, &original_rt); - if (FAILED(hr) || !original_rt) + if (!(original_rt = wined3d_device_get_render_target(device->wined3d_device, 0))) { wined3d_mutex_unlock(); - return hr; + return D3DERR_NOTFOUND; } wined3d_resource = wined3d_surface_get_resource(original_rt); - wined3d_surface_decref(original_rt); } else wined3d_resource = wined3d_surface_get_resource(rt_impl->wined3d_surface); @@ -1124,19 +1112,14 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface, } } - hr = wined3d_device_get_depth_stencil(device->wined3d_device, &original_ds); - if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND) + original_ds = wined3d_device_get_depth_stencil(device->wined3d_device); + wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL); + if (render_target) { - hr = wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL); - if (SUCCEEDED(hr) && render_target) - { - hr = wined3d_device_set_render_target(device->wined3d_device, 0, rt_impl->wined3d_surface, TRUE); - if (FAILED(hr)) - wined3d_device_set_depth_stencil(device->wined3d_device, original_ds); - } + hr = wined3d_device_set_render_target(device->wined3d_device, 0, rt_impl->wined3d_surface, TRUE); + if (FAILED(hr)) + wined3d_device_set_depth_stencil(device->wined3d_device, original_ds); } - if (original_ds) - wined3d_surface_decref(original_ds); wined3d_mutex_unlock(); @@ -1156,18 +1139,18 @@ static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDire return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_render_target(device->wined3d_device, 0, &wined3d_surface); - if (SUCCEEDED(hr) && wined3d_surface) + if ((wined3d_surface = wined3d_device_get_render_target(device->wined3d_device, 0))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *render_target = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*render_target); - wined3d_surface_decref(wined3d_surface); + hr = D3D_OK; } else { - ERR("Failed to get wined3d render target, hr %#x.\n", hr); + ERR("Failed to get wined3d render target.\n"); *render_target = NULL; + hr = D3DERR_NOTFOUND; } wined3d_mutex_unlock(); @@ -1179,7 +1162,7 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_surface *wined3d_surface; struct d3d8_surface *surface_impl; - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil); @@ -1187,18 +1170,15 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_depth_stencil(device->wined3d_device, &wined3d_surface); - if (SUCCEEDED(hr)) + if ((wined3d_surface = wined3d_device_get_depth_stencil(device->wined3d_device))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *depth_stencil = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*depth_stencil); - wined3d_surface_decref(wined3d_surface); } else { - if (hr != WINED3DERR_NOTFOUND) - ERR("Failed to get wined3d depth stencil, hr %#x.\n", hr); + hr = WINED3DERR_NOTFOUND; *depth_stencil = NULL; } wined3d_mutex_unlock(); @@ -1261,108 +1241,101 @@ static HRESULT WINAPI d3d8_device_SetTransform(IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_set_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); + wined3d_device_set_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetTransform(IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, D3DMATRIX *matrix) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_get_transform(device->wined3d_device, state, (struct wined3d_matrix *)matrix); + wined3d_device_get_transform(device->wined3d_device, state, (struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_multiply_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); + wined3d_device_multiply_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, viewport); /* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */ wined3d_mutex_lock(); - hr = wined3d_device_set_viewport(device->wined3d_device, (const struct wined3d_viewport *)viewport); + wined3d_device_set_viewport(device->wined3d_device, (const struct wined3d_viewport *)viewport); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPORT8 *viewport) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, viewport); /* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */ wined3d_mutex_lock(); - hr = wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); + wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_SetMaterial(IDirect3DDevice8 *iface, const D3DMATERIAL8 *material) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, material %p.\n", iface, material); /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_set_material(device->wined3d_device, (const struct wined3d_material *)material); + wined3d_device_set_material(device->wined3d_device, (const struct wined3d_material *)material); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetMaterial(IDirect3DDevice8 *iface, D3DMATERIAL8 *material) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, material %p.\n", iface, material); /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material); + wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_SetLight(IDirect3DDevice8 *iface, DWORD index, const D3DLIGHT8 *light) @@ -1455,7 +1428,6 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD value) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, state %#x, value %#x.\n", iface, state, value); @@ -1463,22 +1435,21 @@ static HRESULT WINAPI d3d8_device_SetRenderState(IDirect3DDevice8 *iface, switch (state) { case D3DRS_ZBIAS: - hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); break; default: - hr = wined3d_device_set_render_state(device->wined3d_device, state, value); + wined3d_device_set_render_state(device->wined3d_device, state, value); } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface, D3DRENDERSTATETYPE state, DWORD *value) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; TRACE("iface %p, state %#x, value %p.\n", iface, state, value); @@ -1486,15 +1457,15 @@ static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface, switch (state) { case D3DRS_ZBIAS: - hr = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); + *value = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS); break; default: - hr = wined3d_device_get_render_state(device->wined3d_device, state, value); + *value = wined3d_device_get_render_state(device->wined3d_device, state); } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface) @@ -1553,7 +1524,6 @@ static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_stateblock *stateblock; - HRESULT hr; TRACE("iface %p, token %#x.\n", iface, token); @@ -1568,17 +1538,16 @@ static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD wined3d_mutex_unlock(); return D3DERR_INVALIDCALL; } - hr = wined3d_stateblock_apply(stateblock); + wined3d_stateblock_apply(stateblock); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_CaptureStateBlock(IDirect3DDevice8 *iface, DWORD token) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_stateblock *stateblock; - HRESULT hr; TRACE("iface %p, token %#x.\n", iface, token); @@ -1590,10 +1559,10 @@ static HRESULT WINAPI d3d8_device_CaptureStateBlock(IDirect3DDevice8 *iface, DWO wined3d_mutex_unlock(); return D3DERR_INVALIDCALL; } - hr = wined3d_stateblock_capture(stateblock); + wined3d_stateblock_capture(stateblock); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_DeleteStateBlock(IDirect3DDevice8 *iface, DWORD token) @@ -1700,7 +1669,6 @@ static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stag struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_texture *wined3d_texture; struct d3d8_texture *texture_impl; - HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); @@ -1708,21 +1676,11 @@ static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stag return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_texture(device->wined3d_device, stage, &wined3d_texture); - if (FAILED(hr)) - { - WARN("Failed to get texture for stage %u, hr %#x.\n", stage, hr); - wined3d_mutex_unlock(); - *texture = NULL; - return hr; - } - - if (wined3d_texture) + if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage))) { texture_impl = wined3d_texture_get_parent(wined3d_texture); *texture = &texture_impl->IDirect3DBaseTexture8_iface; IDirect3DBaseTexture8_AddRef(*texture); - wined3d_texture_decref(wined3d_texture); } else { @@ -1794,7 +1752,6 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface, { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); const struct tss_lookup *l; - HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value); @@ -1808,12 +1765,12 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface, wined3d_mutex_lock(); if (l->sampler_state) - hr = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state, value); + *value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state); else - hr = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state, value); + *value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface, @@ -1821,7 +1778,6 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface, { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); const struct tss_lookup *l; - HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, type, value); @@ -1835,12 +1791,12 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface, wined3d_mutex_lock(); if (l->sampler_state) - hr = wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value); + wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value); else - hr = wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value); + wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD *pass_count) @@ -1868,12 +1824,12 @@ static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface, static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface, UINT palette_idx, const PALETTEENTRY *entries) { - FIXME("iface %p, palette_idx %u, entries %p unimplemented\n", iface, palette_idx, entries); + WARN("iface %p, palette_idx %u, entries %p unimplemented\n", iface, palette_idx, entries); /* GPUs stopped supporting palettized textures with the Shader Model 1 generation. Wined3d * does not have a d3d8/9-style palette API */ - return D3DERR_INVALIDCALL; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetPaletteEntries(IDirect3DDevice8 *iface, @@ -1886,9 +1842,9 @@ static HRESULT WINAPI d3d8_device_GetPaletteEntries(IDirect3DDevice8 *iface, static HRESULT WINAPI d3d8_device_SetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT palette_idx) { - FIXME("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx); + WARN("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx); - return D3DERR_INVALIDCALL; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetCurrentTexturePalette(IDirect3DDevice8 *iface, UINT *palette_idx) @@ -1935,46 +1891,214 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface, return hr; } +static void STDMETHODCALLTYPE d3d8_null_wined3d_object_destroyed(void *parent) {} + +static const struct wined3d_parent_ops d3d8_null_wined3d_parent_ops = +{ + d3d8_null_wined3d_object_destroyed, +}; + +/* The caller is responsible for wined3d locking */ +static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->vertex_buffer_size < min_size || !device->vertex_buffer) + { + UINT size = max(device->vertex_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing vertex buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_vb(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d8_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_vb failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + + device->vertex_buffer = buffer; + device->vertex_buffer_size = size; + device->vertex_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); HRESULT hr; + UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT size = vtx_count * stride; + UINT vb_pos, align; + BYTE *buffer_data; TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", iface, primitive_type, primitive_count, data, stride); - wined3d_mutex_lock(); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), - data, stride); - wined3d_mutex_unlock(); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + hr = d3d8_device_prepare_vertex_buffer(device, size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % stride; + if (align) align = stride - align; + if (vb_pos + size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, data, size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); + hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); + +done: + wined3d_mutex_unlock(); return hr; } +/* The caller is responsible for wined3d locking */ +static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->index_buffer_size < min_size || !device->index_buffer) + { + UINT size = max(device->index_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing index buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_ib(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d8_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_ib failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + + device->index_buffer = buffer; + device->index_buffer_size = size; + device->index_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface, - D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT index_count, + D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT primitive_count, const void *index_data, D3DFORMAT index_format, const void *vertex_data, UINT vertex_stride) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); HRESULT hr; + BYTE *buffer_data; - TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" + UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4; + UINT idx_size = idx_count * idx_fmt_size; + UINT ib_pos; + + UINT vtx_size = vertex_count * vertex_stride; + UINT vb_pos, align; + + TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u,\n" "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", - iface, primitive_type, min_vertex_idx, index_count, primitive_count, + iface, primitive_type, min_vertex_idx, vertex_count, primitive_count, index_data, index_format, vertex_data, vertex_stride); - wined3d_mutex_lock(); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), index_data, - wined3dformat_from_d3dformat(index_format), vertex_data, vertex_stride); - wined3d_mutex_unlock(); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + + hr = d3d8_device_prepare_vertex_buffer(device, vtx_size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % vertex_stride; + if (align) align = vertex_stride - align; + if (vb_pos + vtx_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, vertex_data, vtx_size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + vtx_size; + + hr = d3d8_device_prepare_index_buffer(device, idx_size); + if (FAILED(hr)) + goto done; + + ib_pos = device->index_buffer_pos; + align = ib_pos % idx_fmt_size; + if (align) align = idx_fmt_size - align; + if (ib_pos + idx_size + align > device->index_buffer_size) + ib_pos = 0; + else + ib_pos += align; + + hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &buffer_data, + ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, index_data, idx_size); + wined3d_buffer_unmap(device->index_buffer); + device->index_buffer_pos = ib_pos + idx_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, + wined3dformat_from_d3dformat(index_format)); + wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride); + + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); + + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); + wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + wined3d_device_set_base_vertex_index(device->wined3d_device, 0); + +done: + wined3d_mutex_unlock(); return hr; } @@ -2011,7 +2135,6 @@ static HRESULT WINAPI d3d8_device_CreateVertexShader(IDirect3DDevice8 *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Failed to allocate vertex shader memory.\n"); *shader = 0; return E_OUTOFMEMORY; } @@ -2077,10 +2200,7 @@ static struct d3d8_vertex_declaration *d3d8_device_get_fvf_declaration(struct d3 TRACE("not found. Creating and inserting at position %d.\n", low); if (!(d3d8_declaration = HeapAlloc(GetProcessHeap(), 0, sizeof(*d3d8_declaration)))) - { - ERR("Memory allocation failed.\n"); return NULL; - } if (FAILED(hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, device, fvf))) { @@ -2119,7 +2239,6 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_vertex_shader *shader_impl; - HRESULT hr; TRACE("iface %p, shader %#x.\n", iface, shader); @@ -2147,15 +2266,12 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD return D3DERR_INVALIDCALL; } - hr = wined3d_device_set_vertex_declaration(device->wined3d_device, + wined3d_device_set_vertex_declaration(device->wined3d_device, shader_impl->vertex_declaration->wined3d_vertex_declaration); - if (SUCCEEDED(hr)) - hr = wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader); + wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader); wined3d_mutex_unlock(); - TRACE("Returning hr %#x\n", hr); - - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD *shader) @@ -2163,40 +2279,30 @@ static HRESULT WINAPI d3d8_device_GetVertexShader(IDirect3DDevice8 *iface, DWORD struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_vertex_declaration *wined3d_declaration; struct d3d8_vertex_declaration *d3d8_declaration; - HRESULT hr; TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - if (FAILED(hr = wined3d_device_get_vertex_declaration(device->wined3d_device, &wined3d_declaration))) + if ((wined3d_declaration = wined3d_device_get_vertex_declaration(device->wined3d_device))) { - wined3d_mutex_unlock(); - WARN("Failed to get wined3d vertex declaration, hr %#x.\n", hr); - return hr; + d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration); + *shader = d3d8_declaration->shader_handle; } - - if (!wined3d_declaration) + else { - wined3d_mutex_unlock(); *shader = 0; - return D3D_OK; } - - d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration); - wined3d_vertex_declaration_decref(wined3d_declaration); wined3d_mutex_unlock(); - *shader = d3d8_declaration->shader_handle; TRACE("Returning %#x.\n", *shader); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DWORD shader) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_vertex_shader *shader_impl; - struct wined3d_shader *cur; TRACE("iface %p, shader %#x.\n", iface, shader); @@ -2209,12 +2315,9 @@ static HRESULT WINAPI d3d8_device_DeleteVertexShader(IDirect3DDevice8 *iface, DW return D3DERR_INVALIDCALL; } - if ((cur = wined3d_device_get_vertex_shader(device->wined3d_device))) - { - if (cur == shader_impl->wined3d_shader) - IDirect3DDevice8_SetVertexShader(iface, 0); - wined3d_shader_decref(cur); - } + if (shader_impl->wined3d_shader + && wined3d_device_get_vertex_shader(device->wined3d_device) == shader_impl->wined3d_shader) + IDirect3DDevice8_SetVertexShader(iface, 0); wined3d_mutex_unlock(); @@ -2344,7 +2447,6 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface, { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_indexbuffer *ib = unsafe_impl_from_IDirect3DIndexBuffer8(buffer); - HRESULT hr; TRACE("iface %p, buffer %p, base_vertex_idx %u.\n", iface, buffer, base_vertex_idx); @@ -2356,21 +2458,21 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface, */ wined3d_mutex_lock(); wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx); - hr = wined3d_device_set_index_buffer(device->wined3d_device, + wined3d_device_set_index_buffer(device->wined3d_device, ib ? ib->wined3d_buffer : NULL, ib ? ib->format : WINED3DFMT_UNKNOWN); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 **buffer, UINT *base_vertex_index) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - struct wined3d_buffer *wined3d_buffer = NULL; + enum wined3d_format_id wined3d_format; + struct wined3d_buffer *wined3d_buffer; struct d3d8_indexbuffer *buffer_impl; - HRESULT hr; TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, buffer, base_vertex_index); @@ -2380,23 +2482,19 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface, /* The case from UINT to INT is safe because d3d8 will never set negative values */ wined3d_mutex_lock(); *base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device); - hr = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_buffer); - if (SUCCEEDED(hr) && wined3d_buffer) + if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format))) { buffer_impl = wined3d_buffer_get_parent(wined3d_buffer); *buffer = &buffer_impl->IDirect3DIndexBuffer8_iface; IDirect3DIndexBuffer8_AddRef(*buffer); - wined3d_buffer_decref(wined3d_buffer); } else { - if (FAILED(hr)) - ERR("Failed to get wined3d index buffer, hr %#x.\n", hr); *buffer = NULL; } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface, @@ -2415,10 +2513,7 @@ static HRESULT WINAPI d3d8_device_CreatePixelShader(IDirect3DDevice8 *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate pixel shader memmory.\n"); return E_OUTOFMEMORY; - } wined3d_mutex_lock(); handle = d3d8_allocate_handle(&device->handle_table, object, D3D8_HANDLE_PS); @@ -2454,7 +2549,6 @@ static HRESULT WINAPI d3d8_device_SetPixelShader(IDirect3DDevice8 *iface, DWORD { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_pixel_shader *shader_impl; - HRESULT hr; TRACE("iface %p, shader %#x.\n", iface, shader); @@ -2462,9 +2556,9 @@ static HRESULT WINAPI d3d8_device_SetPixelShader(IDirect3DDevice8 *iface, DWORD if (!shader) { - hr = wined3d_device_set_pixel_shader(device->wined3d_device, NULL); + wined3d_device_set_pixel_shader(device->wined3d_device, NULL); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } if (!(shader_impl = d3d8_get_object(&device->handle_table, shader - (VS_HIGHESTFIXEDFXF + 1), D3D8_HANDLE_PS))) @@ -2475,10 +2569,10 @@ static HRESULT WINAPI d3d8_device_SetPixelShader(IDirect3DDevice8 *iface, DWORD } TRACE("Setting shader %p.\n", shader_impl); - hr = wined3d_device_set_pixel_shader(device->wined3d_device, shader_impl->wined3d_shader); + wined3d_device_set_pixel_shader(device->wined3d_device, shader_impl->wined3d_shader); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_GetPixelShader(IDirect3DDevice8 *iface, DWORD *shader) @@ -2496,7 +2590,6 @@ static HRESULT WINAPI d3d8_device_GetPixelShader(IDirect3DDevice8 *iface, DWORD { struct d3d8_pixel_shader *d3d8_shader; d3d8_shader = wined3d_shader_get_parent(object); - wined3d_shader_decref(object); *shader = d3d8_shader->handle; } else @@ -2514,7 +2607,6 @@ static HRESULT WINAPI d3d8_device_DeletePixelShader(IDirect3DDevice8 *iface, DWO { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_pixel_shader *shader_impl; - struct wined3d_shader *cur; TRACE("iface %p, shader %#x.\n", iface, shader); @@ -2527,12 +2619,8 @@ static HRESULT WINAPI d3d8_device_DeletePixelShader(IDirect3DDevice8 *iface, DWO return D3DERR_INVALIDCALL; } - if ((cur = wined3d_device_get_pixel_shader(device->wined3d_device))) - { - if (cur == shader_impl->wined3d_shader) - IDirect3DDevice8_SetPixelShader(iface, 0); - wined3d_shader_decref(cur); - } + if (wined3d_device_get_pixel_shader(device->wined3d_device) == shader_impl->wined3d_shader) + IDirect3DDevice8_SetPixelShader(iface, 0); wined3d_mutex_unlock(); @@ -2601,49 +2689,23 @@ static HRESULT WINAPI d3d8_device_GetPixelShaderFunction(IDirect3DDevice8 *iface static HRESULT WINAPI d3d8_device_DrawRectPatch(IDirect3DDevice8 *iface, UINT handle, const float *segment_count, const D3DRECTPATCH_INFO *patch_info) { - struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; - - TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", + FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n", iface, handle, segment_count, patch_info); - - wined3d_mutex_lock(); - hr = wined3d_device_draw_rect_patch(device->wined3d_device, handle, - segment_count, (const struct wined3d_rect_patch_info *)patch_info); - wined3d_mutex_unlock(); - - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_DrawTriPatch(IDirect3DDevice8 *iface, UINT handle, const float *segment_count, const D3DTRIPATCH_INFO *patch_info) { - struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; - - TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", + FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n", iface, handle, segment_count, patch_info); - - wined3d_mutex_lock(); - hr = wined3d_device_draw_tri_patch(device->wined3d_device, handle, - segment_count, (const struct wined3d_tri_patch_info *)patch_info); - wined3d_mutex_unlock(); - - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_device_DeletePatch(IDirect3DDevice8 *iface, UINT handle) { - struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; - - TRACE("iface %p, handle %#x.\n", iface, handle); - - wined3d_mutex_lock(); - hr = wined3d_device_delete_patch(device->wined3d_device, handle); - wined3d_mutex_unlock(); - - return hr; + FIXME("iface %p, handle %#x unimplemented.\n", iface, handle); + return D3DERR_INVALIDCALL; } static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface, @@ -2817,7 +2879,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent, void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, - enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface) + enum wined3d_pool pool, UINT sub_resource_idx, struct wined3d_surface **surface) { struct d3d8_device *device = device_from_device_parent(device_parent); struct d3d8_surface *d3d_surface; @@ -2825,17 +2887,15 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_ HRESULT hr; TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n" - "\tpool %#x, level %u, face %u, surface %p.\n", - device_parent, container_parent, width, height, format, usage, pool, level, face, surface); + "\tpool %#x, sub_resource_idx %u, surface %p.\n", + device_parent, container_parent, width, height, format, usage, pool, sub_resource_idx, surface); if (pool == WINED3D_POOL_DEFAULT && !(usage & WINED3DUSAGE_DYNAMIC)) lockable = FALSE; - hr = d3d8_device_CreateSurface(device, width, height, - d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level, - (IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */); - if (FAILED(hr)) + if (FAILED(hr = d3d8_device_create_surface(device, width, height, d3dformat_from_wined3dformat(format), + lockable, FALSE, (IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0))) { WARN("Failed to create surface, hr %#x.\n", hr); return hr; @@ -2845,7 +2905,7 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_ wined3d_surface_incref(*surface); d3d_surface->container = container_parent; - IUnknown_Release(d3d_surface->parent_device); + IDirect3DDevice8_Release(d3d_surface->parent_device); d3d_surface->parent_device = NULL; IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface); @@ -2867,8 +2927,8 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic device_parent, container_parent, width, height, format_id, usage, multisample_type, multisample_quality, surface); - if (FAILED(hr = d3d8_device_CreateSurface(device, width, height, d3dformat_from_wined3dformat(format_id), - TRUE, FALSE, 0, (IDirect3DSurface8 **)&d3d_surface, usage, D3DPOOL_DEFAULT, multisample_type, + if (FAILED(hr = d3d8_device_create_surface(device, width, height, d3dformat_from_wined3dformat(format_id), + TRUE, FALSE, (IDirect3DSurface8 **)&d3d_surface, usage, D3DPOOL_DEFAULT, multisample_type, multisample_quality))) { WARN("Failed to create surface, hr %#x.\n", hr); @@ -3046,13 +3106,8 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine return hr; } - hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_POINTSIZE_MIN, 0); wined3d_mutex_unlock(); - if (FAILED(hr)) - { - ERR("Failed to set minimum pointsize, hr %#x.\n", hr); - goto err; - } present_parameters_from_wined3d_swapchain_desc(parameters, &swapchain_desc); diff --git a/reactos/dll/directx/wine/d3d8/directx.c b/reactos/dll/directx/wine/d3d8/directx.c index afe52330e26..61d187d0de7 100644 --- a/reactos/dll/directx/wine/d3d8/directx.c +++ b/reactos/dll/directx/wine/d3d8/directx.c @@ -20,18 +20,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" -//#include +#include #define NONAMELESSUNION #define NONAMELESSSTRUCT -//#include "windef.h" -//#include "winbase.h" -//#include "wingdi.h" -//#include "winuser.h" -//#include "wine/debug.h" -//#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/debug.h" +#include "wine/unicode.h" #include "d3d8_private.h" @@ -49,7 +49,7 @@ static HRESULT WINAPI d3d8_QueryInterface(IDirect3D8 *iface, REFIID riid, void * if (IsEqualGUID(riid, &IID_IDirect3D8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3D8_AddRef(iface); *out = iface; return S_OK; } @@ -254,7 +254,7 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3 wined3d_mutex_lock(); hr = wined3d_check_device_format(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format), - usage, wined3d_rtype, wined3dformat_from_d3dformat(format), WINED3D_SURFACE_TYPE_OPENGL); + usage, wined3d_rtype, wined3dformat_from_d3dformat(format)); wined3d_mutex_unlock(); return hr; @@ -364,10 +364,7 @@ static HRESULT WINAPI d3d8_CreateDevice(IDirect3D8 *iface, UINT adapter, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate device memory.\n"); return E_OUTOFMEMORY; - } hr = device_init(object, d3d8, d3d8->wined3d, adapter, device_type, focus_window, flags, parameters); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/d3d8/shader.c b/reactos/dll/directx/wine/d3d8/shader.c index b82655ba4cb..f7096bb3834 100644 --- a/reactos/dll/directx/wine/d3d8/shader.c +++ b/reactos/dll/directx/wine/d3d8/shader.c @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -61,10 +61,7 @@ static HRESULT d3d8_vertexshader_create_vertexdeclaration(struct d3d8_device *de object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Memory allocation failed.\n"); return E_OUTOFMEMORY; - } hr = d3d8_vertex_declaration_init(object, device, declaration, shader_handle); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/d3d8/surface.c b/reactos/dll/directx/wine/d3d8/surface.c index ba78426b00f..39c19a753c8 100644 --- a/reactos/dll/directx/wine/d3d8/surface.c +++ b/reactos/dll/directx/wine/d3d8/surface.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -36,7 +36,7 @@ static HRESULT WINAPI d3d8_surface_QueryInterface(IDirect3DSurface8 *iface, REFI || IsEqualGUID(riid, &IID_IDirect3DResource8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DSurface8_AddRef(iface); *out = iface; return S_OK; } @@ -69,7 +69,7 @@ static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface) if (ref == 1) { if (surface->parent_device) - IUnknown_AddRef(surface->parent_device); + IDirect3DDevice8_AddRef(surface->parent_device); wined3d_mutex_lock(); wined3d_surface_incref(surface->wined3d_surface); wined3d_mutex_unlock(); @@ -325,9 +325,9 @@ static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, }; -HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, - UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, - DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) +HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, UINT width, UINT height, + D3DFORMAT format, BOOL lockable, BOOL discard, DWORD usage, D3DPOOL pool, + D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) { DWORD flags = 0; HRESULT hr; @@ -349,8 +349,8 @@ HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, wined3d_mutex_lock(); hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format), - level, usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality, - WINED3D_SURFACE_TYPE_OPENGL, flags, surface, &d3d8_surface_wined3d_parent_ops, &surface->wined3d_surface); + usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality, + flags, surface, &d3d8_surface_wined3d_parent_ops, &surface->wined3d_surface); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -359,7 +359,7 @@ HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, } surface->parent_device = &device->IDirect3DDevice8_iface; - IUnknown_AddRef(surface->parent_device); + IDirect3DDevice8_AddRef(surface->parent_device); return D3D_OK; } diff --git a/reactos/dll/directx/wine/d3d8/swapchain.c b/reactos/dll/directx/wine/d3d8/swapchain.c index 40565f01bd2..e9f49760acb 100644 --- a/reactos/dll/directx/wine/d3d8/swapchain.c +++ b/reactos/dll/directx/wine/d3d8/swapchain.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -35,7 +35,7 @@ static HRESULT WINAPI d3d8_swapchain_QueryInterface(IDirect3DSwapChain8 *iface, if (IsEqualGUID(riid, &IID_IDirect3DSwapChain8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DSwapChain8_AddRef(iface); *out = iface; return S_OK; } @@ -110,20 +110,22 @@ static HRESULT WINAPI d3d8_swapchain_GetBackBuffer(IDirect3DSwapChain8 *iface, struct d3d8_swapchain *swapchain = impl_from_IDirect3DSwapChain8(iface); struct wined3d_surface *wined3d_surface = NULL; struct d3d8_surface *surface_impl; - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, backbuffer_idx, backbuffer_type, backbuffer); wined3d_mutex_lock(); - hr = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, - backbuffer_idx, (enum wined3d_backbuffer_type)backbuffer_type, &wined3d_surface); - if (SUCCEEDED(hr) && wined3d_surface) + if ((wined3d_surface = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, + backbuffer_idx, (enum wined3d_backbuffer_type)backbuffer_type))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *backbuffer = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*backbuffer); - wined3d_surface_decref(wined3d_surface); + } + else + { + hr = D3DERR_INVALIDCALL; } wined3d_mutex_unlock(); @@ -158,9 +160,8 @@ static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_devi swapchain->IDirect3DSwapChain8_iface.lpVtbl = &d3d8_swapchain_vtbl; wined3d_mutex_lock(); - hr = wined3d_swapchain_create(device->wined3d_device, desc, - WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d8_swapchain_wined3d_parent_ops, - &swapchain->wined3d_swapchain); + hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, + &d3d8_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain); wined3d_mutex_unlock(); if (FAILED(hr)) @@ -182,10 +183,7 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha HRESULT hr; if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) - { - ERR("Failed to allocate swapchain memory.\n"); return E_OUTOFMEMORY; - } if (FAILED(hr = swapchain_init(object, device, desc))) { diff --git a/reactos/dll/directx/wine/d3d8/texture.c b/reactos/dll/directx/wine/d3d8/texture.c index 22e03909c53..f139d4ef735 100644 --- a/reactos/dll/directx/wine/d3d8/texture.c +++ b/reactos/dll/directx/wine/d3d8/texture.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -45,7 +45,7 @@ static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, R || IsEqualGUID(riid, &IID_IDirect3DResource8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DTexture8_AddRef(iface); *out = iface; return S_OK; } @@ -413,7 +413,7 @@ static HRESULT WINAPI d3d8_texture_cube_QueryInterface(IDirect3DCubeTexture8 *if || IsEqualGUID(riid, &IID_IDirect3DResource8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DCubeTexture8_AddRef(iface); *out = iface; return S_OK; } @@ -433,7 +433,7 @@ static ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface) if (ref == 1) { - IUnknown_AddRef(texture->parent_device); + IDirect3DDevice8_AddRef(texture->parent_device); wined3d_mutex_lock(); wined3d_texture_incref(texture->wined3d_texture); wined3d_mutex_unlock(); @@ -806,7 +806,7 @@ static HRESULT WINAPI d3d8_texture_3d_QueryInterface(IDirect3DVolumeTexture8 *if || IsEqualGUID(riid, &IID_IDirect3DResource8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DVolumeTexture8_AddRef(iface); *out = iface; return S_OK; } diff --git a/reactos/dll/directx/wine/d3d8/vertexdeclaration.c b/reactos/dll/directx/wine/d3d8/vertexdeclaration.c index a0a88005028..2277be4b26f 100644 --- a/reactos/dll/directx/wine/d3d8/vertexdeclaration.c +++ b/reactos/dll/directx/wine/d3d8/vertexdeclaration.c @@ -21,7 +21,7 @@ /* IDirect3DVertexDeclaration8 is internal to our implementation. * It's not visible in the API. */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); diff --git a/reactos/dll/directx/wine/d3d8/volume.c b/reactos/dll/directx/wine/d3d8/volume.c index c63c0895ed4..ecd4bb1e506 100644 --- a/reactos/dll/directx/wine/d3d8/volume.c +++ b/reactos/dll/directx/wine/d3d8/volume.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d8_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d8); @@ -35,7 +35,7 @@ static HRESULT WINAPI d3d8_volume_QueryInterface(IDirect3DVolume8 *iface, REFIID if (IsEqualGUID(riid, &IID_IDirect3DVolume8) || IsEqualGUID(riid, &IID_IUnknown)) { - IUnknown_AddRef(iface); + IDirect3DVolume8_AddRef(iface); *out = iface; return S_OK; } diff --git a/reactos/dll/directx/wine/d3d9/buffer.c b/reactos/dll/directx/wine/d3d9/buffer.c index 0711f9e626e..d543b2709b6 100644 --- a/reactos/dll/directx/wine/d3d9/buffer.c +++ b/reactos/dll/directx/wine/d3d9/buffer.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); diff --git a/reactos/dll/directx/wine/d3d9/d3d9_main.c b/reactos/dll/directx/wine/d3d9/d3d9_main.c index e6b0ed07071..ad2e330b9ac 100644 --- a/reactos/dll/directx/wine/d3d9/d3d9_main.c +++ b/reactos/dll/directx/wine/d3d9/d3d9_main.c @@ -21,8 +21,8 @@ * */ -#include -#include +#include "config.h" +#include "initguid.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -40,10 +40,7 @@ IDirect3D9 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT sdk_version) TRACE("sdk_version %#x.\n", sdk_version); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) - { - ERR("Failed to allocate d3d9 object memory.\n"); return NULL; - } if (!d3d9_init(object, FALSE)) { @@ -64,10 +61,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex(UINT sdk_version, IDirect3D9E TRACE("sdk_version %#x, d3d9ex %p.\n", sdk_version, d3d9ex); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) - { - ERR("Failed to allocate d3d9 object memory.\n"); return E_OUTOFMEMORY; - } if (!d3d9_init(object, TRUE)) { diff --git a/reactos/dll/directx/wine/d3d9/d3d9_private.h b/reactos/dll/directx/wine/d3d9/d3d9_private.h index f8055386d39..26d990a2c42 100644 --- a/reactos/dll/directx/wine/d3d9/d3d9_private.h +++ b/reactos/dll/directx/wine/d3d9/d3d9_private.h @@ -23,25 +23,21 @@ #ifndef __WINE_D3D9_PRIVATE_H #define __WINE_D3D9_PRIVATE_H -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include #include #define NONAMELESSUNION #define NONAMELESSSTRUCT #define COBJMACROS -#include -#include -#include -//#include "winuser.h" -#include -//#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/debug.h" +#include "wine/unicode.h" -#include -#include +#include "d3d9.h" +#include "wine/wined3d.h" extern HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN; D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN; @@ -154,6 +150,13 @@ struct d3d9_device struct fvf_declaration *fvf_decls; UINT fvf_decl_count, fvf_decl_size; + struct wined3d_buffer *vertex_buffer; + UINT vertex_buffer_size; + UINT vertex_buffer_pos; + struct wined3d_buffer *index_buffer; + UINT index_buffer_size; + UINT index_buffer_pos; + BOOL in_destruction; BOOL not_reset; BOOL in_scene; @@ -197,9 +200,9 @@ struct d3d9_surface BOOL getdc_supported; }; -HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, - UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, - DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; +HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, UINT width, UINT height, + D3DFORMAT format, BOOL lockable, BOOL discard, DWORD usage, D3DPOOL pool, + D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) DECLSPEC_HIDDEN; struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN; struct d3d9_vertexbuffer diff --git a/reactos/dll/directx/wine/d3d9/device.c b/reactos/dll/directx/wine/d3d9/device.c index f3c531469e5..7b5379092ac 100644 --- a/reactos/dll/directx/wine/d3d9/device.c +++ b/reactos/dll/directx/wine/d3d9/device.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -297,6 +297,11 @@ static ULONG WINAPI DECLSPEC_HOTPATCH d3d9_device_Release(IDirect3DDevice9Ex *if } HeapFree(GetProcessHeap(), 0, device->fvf_decls); + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + wined3d_device_uninit_3d(device->wined3d_device); wined3d_device_release_focus_window(device->wined3d_device); wined3d_device_decref(device->wined3d_device); @@ -422,16 +427,15 @@ static HRESULT WINAPI d3d9_device_GetCreationParameters(IDirect3DDevice9Ex *ifac D3DDEVICE_CREATION_PARAMETERS *parameters) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, parameters %p.\n", iface, parameters); wined3d_mutex_lock(); - hr = wined3d_device_get_creation_parameters(device->wined3d_device, + wined3d_device_get_creation_parameters(device->wined3d_device, (struct wined3d_device_creation_parameters *)parameters); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetCursorProperties(IDirect3DDevice9Ex *iface, @@ -506,24 +510,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_GetSwapChain(IDirect3DDevice UINT swapchain_idx, IDirect3DSwapChain9 **swapchain) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - struct wined3d_swapchain *wined3d_swapchain = NULL; + struct wined3d_swapchain *wined3d_swapchain; struct d3d9_swapchain *swapchain_impl; HRESULT hr; TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", iface, swapchain_idx, swapchain); wined3d_mutex_lock(); - hr = wined3d_device_get_swapchain(device->wined3d_device, swapchain_idx, &wined3d_swapchain); - if (SUCCEEDED(hr) && wined3d_swapchain) + if ((wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, swapchain_idx))) { swapchain_impl = wined3d_swapchain_get_parent(wined3d_swapchain); *swapchain = &swapchain_impl->IDirect3DSwapChain9_iface; IDirect3DSwapChain9_AddRef(*swapchain); - wined3d_swapchain_decref(wined3d_swapchain); + hr = D3D_OK; } else { *swapchain = NULL; + hr = D3DERR_INVALIDCALL; } wined3d_mutex_unlock(); @@ -582,9 +586,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Reset(IDirect3DDevice9Ex *if TRACE("iface %p, present_parameters %p.\n", iface, present_parameters); wined3d_mutex_lock(); + + if (device->vertex_buffer) + { + wined3d_buffer_decref(device->vertex_buffer); + device->vertex_buffer = NULL; + device->vertex_buffer_size = 0; + } + if (device->index_buffer) + { + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = NULL; + device->index_buffer_size = 0; + } + wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); - hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback); - if (FAILED(hr)) + hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, + NULL, reset_enum_callback, !device->d3d_parent->extended); + if (FAILED(hr) && !device->d3d_parent->extended) device->not_reset = TRUE; else device->not_reset = FALSE; @@ -629,7 +648,6 @@ static HRESULT WINAPI d3d9_device_GetBackBuffer(IDirect3DDevice9Ex *iface, UINT surface_impl = wined3d_surface_get_parent(wined3d_surface); *backbuffer = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*backbuffer); - wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); @@ -716,10 +734,7 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate texture memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = texture_init(object, device, width, height, levels, usage, format, pool); if (FAILED(hr)) @@ -763,10 +778,7 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate volume texture memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = volumetexture_init(object, device, width, height, depth, levels, usage, format, pool); if (FAILED(hr)) @@ -798,10 +810,7 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate cube texture memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = cubetexture_init(object, device, edge_length, levels, usage, format, pool); if (FAILED(hr)) @@ -833,10 +842,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate buffer memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = vertexbuffer_init(object, device, size, usage, fvf, pool); if (FAILED(hr)) @@ -868,10 +874,7 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate buffer memory.\n"); return D3DERR_OUTOFVIDEOMEMORY; - } hr = indexbuffer_init(object, device, size, usage, format, pool); if (FAILED(hr)) @@ -888,15 +891,15 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U } static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width, UINT height, - D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, IDirect3DSurface9 **surface, - UINT usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) + D3DFORMAT format, BOOL lockable, BOOL discard, IDirect3DSurface9 **surface, UINT usage, + D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) { struct d3d9_surface *object; HRESULT hr; - TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p.\n" + TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, surface %p.\n" "usage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n", - device, width, height, format, lockable, discard, level, surface, usage, pool, + device, width, height, format, lockable, discard, surface, usage, pool, multisample_type, multisample_quality); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) @@ -905,9 +908,8 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width return D3DERR_OUTOFVIDEOMEMORY; } - hr = surface_init(object, device, width, height, format, lockable, discard, - level, usage, pool, multisample_type, multisample_quality); - if (FAILED(hr)) + if (FAILED(hr = surface_init(object, device, width, height, format, lockable, + discard, usage, pool, multisample_type, multisample_quality))) { WARN("Failed to initialize surface, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); @@ -925,7 +927,6 @@ static HRESULT WINAPI d3d9_device_CreateRenderTarget(IDirect3DDevice9Ex *iface, BOOL lockable, IDirect3DSurface9 **surface, HANDLE *shared_handle) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, multisample_quality %u.\n" "lockable %#x, surface %p, shared_handle %p.\n", @@ -935,10 +936,8 @@ static HRESULT WINAPI d3d9_device_CreateRenderTarget(IDirect3DDevice9Ex *iface, if (shared_handle) FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle); - hr = d3d9_device_create_surface(device, width, height, format, lockable, FALSE, 0, surface, + return d3d9_device_create_surface(device, width, height, format, lockable, FALSE, surface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, multisample_type, multisample_quality); - - return hr; } static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex *iface, UINT width, UINT height, @@ -946,7 +945,6 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex * BOOL discard, IDirect3DSurface9 **surface, HANDLE *shared_handle) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, multisample_quality %u.\n" "discard %#x, surface %p, shared_handle %p.\n", @@ -956,10 +954,8 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex * if (shared_handle) FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle); - hr = d3d9_device_create_surface(device, width, height, format, TRUE, discard, 0, surface, + return d3d9_device_create_surface(device, width, height, format, TRUE, discard, surface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, multisample_type, multisample_quality); - - return hr; } @@ -1160,7 +1156,7 @@ static HRESULT WINAPI d3d9_device_CreateOffscreenPlainSurface(IDirect3DDevice9Ex * regardless of the pool they're created in. Should we set dynamic usage * here? */ return d3d9_device_create_surface(device, width, height, format, TRUE, - FALSE, 0, surface, 0, pool, D3DMULTISAMPLE_NONE, 0); + FALSE, surface, 0, pool, D3DMULTISAMPLE_NONE, 0); } static HRESULT WINAPI d3d9_device_SetRenderTarget(IDirect3DDevice9Ex *iface, DWORD idx, IDirect3DSurface9 *surface) @@ -1190,7 +1186,7 @@ static HRESULT WINAPI d3d9_device_GetRenderTarget(IDirect3DDevice9Ex *iface, DWO struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_surface *wined3d_surface; struct d3d9_surface *surface_impl; - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, idx %u, surface %p.\n", iface, idx, surface); @@ -1204,18 +1200,15 @@ static HRESULT WINAPI d3d9_device_GetRenderTarget(IDirect3DDevice9Ex *iface, DWO } wined3d_mutex_lock(); - hr = wined3d_device_get_render_target(device->wined3d_device, idx, &wined3d_surface); - if (SUCCEEDED(hr)) + if ((wined3d_surface = wined3d_device_get_render_target(device->wined3d_device, idx))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *surface = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*surface); - wined3d_surface_decref(wined3d_surface); } else { - if (hr != WINED3DERR_NOTFOUND) - WARN("Failed to get render target %u, hr %#x.\n", idx, hr); + hr = WINED3DERR_NOTFOUND; *surface = NULL; } wined3d_mutex_unlock(); @@ -1227,15 +1220,14 @@ static HRESULT WINAPI d3d9_device_SetDepthStencilSurface(IDirect3DDevice9Ex *ifa { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_surface *ds_impl = unsafe_impl_from_IDirect3DSurface9(depth_stencil); - HRESULT hr; TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil); wined3d_mutex_lock(); - hr = wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL); + wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetDepthStencilSurface(IDirect3DDevice9Ex *iface, IDirect3DSurface9 **depth_stencil) @@ -1243,7 +1235,7 @@ static HRESULT WINAPI d3d9_device_GetDepthStencilSurface(IDirect3DDevice9Ex *ifa struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_surface *wined3d_surface; struct d3d9_surface *surface_impl; - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil); @@ -1251,18 +1243,15 @@ static HRESULT WINAPI d3d9_device_GetDepthStencilSurface(IDirect3DDevice9Ex *ifa return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_depth_stencil(device->wined3d_device, &wined3d_surface); - if (SUCCEEDED(hr)) + if ((wined3d_surface = wined3d_device_get_depth_stencil(device->wined3d_device))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *depth_stencil = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*depth_stencil); - wined3d_surface_decref(wined3d_surface); } else { - if (hr != WINED3DERR_NOTFOUND) - WARN("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr); + hr = WINED3DERR_NOTFOUND; *depth_stencil = NULL; } wined3d_mutex_unlock(); @@ -1327,108 +1316,101 @@ static HRESULT WINAPI d3d9_device_SetTransform(IDirect3DDevice9Ex *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_set_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); + wined3d_device_set_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetTransform(IDirect3DDevice9Ex *iface, D3DTRANSFORMSTATETYPE state, D3DMATRIX *matrix) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_get_transform(device->wined3d_device, state, (struct wined3d_matrix *)matrix); + wined3d_device_get_transform(device->wined3d_device, state, (struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_MultiplyTransform(IDirect3DDevice9Ex *iface, D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_multiply_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); + wined3d_device_multiply_transform(device->wined3d_device, state, (const struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetViewport(IDirect3DDevice9Ex *iface, const D3DVIEWPORT9 *viewport) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, viewport); /* Note: D3DVIEWPORT9 is compatible with struct wined3d_viewport. */ wined3d_mutex_lock(); - hr = wined3d_device_set_viewport(device->wined3d_device, (const struct wined3d_viewport *)viewport); + wined3d_device_set_viewport(device->wined3d_device, (const struct wined3d_viewport *)viewport); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetViewport(IDirect3DDevice9Ex *iface, D3DVIEWPORT9 *viewport) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, viewport); /* Note: D3DVIEWPORT9 is compatible with struct wined3d_viewport. */ wined3d_mutex_lock(); - hr = wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); + wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetMaterial(IDirect3DDevice9Ex *iface, const D3DMATERIAL9 *material) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, material %p.\n", iface, material); /* Note: D3DMATERIAL9 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_set_material(device->wined3d_device, (const struct wined3d_material *)material); + wined3d_device_set_material(device->wined3d_device, (const struct wined3d_material *)material); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetMaterial(IDirect3DDevice9Ex *iface, D3DMATERIAL9 *material) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, material %p.\n", iface, material); /* Note: D3DMATERIAL9 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material); + wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetLight(IDirect3DDevice9Ex *iface, DWORD index, const D3DLIGHT9 *light) @@ -1521,30 +1503,28 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevi D3DRENDERSTATETYPE state, DWORD value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, state %#x, value %#x.\n", iface, state, value); wined3d_mutex_lock(); - hr = wined3d_device_set_render_state(device->wined3d_device, state, value); + wined3d_device_set_render_state(device->wined3d_device, state, value); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetRenderState(IDirect3DDevice9Ex *iface, D3DRENDERSTATETYPE state, DWORD *value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, state %#x, value %p.\n", iface, state, value); wined3d_mutex_lock(); - hr = wined3d_device_get_render_state(device->wined3d_device, state, value); + *value = wined3d_device_get_render_state(device->wined3d_device, state); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface, @@ -1564,10 +1544,7 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate stateblock memory.\n"); return E_OUTOFMEMORY; - } hr = stateblock_init(object, device, type, NULL); if (FAILED(hr)) @@ -1618,7 +1595,6 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Failed to allocate stateblock memory.\n"); wined3d_mutex_lock(); wined3d_stateblock_decref(wined3d_stateblock); wined3d_mutex_unlock(); @@ -1675,7 +1651,6 @@ static HRESULT WINAPI d3d9_device_GetTexture(IDirect3DDevice9Ex *iface, DWORD st struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_texture *wined3d_texture = NULL; struct d3d9_texture *texture_impl; - HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); @@ -1683,23 +1658,19 @@ static HRESULT WINAPI d3d9_device_GetTexture(IDirect3DDevice9Ex *iface, DWORD st return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_texture(device->wined3d_device, stage, &wined3d_texture); - if (SUCCEEDED(hr) && wined3d_texture) + if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage))) { texture_impl = wined3d_texture_get_parent(wined3d_texture); *texture = &texture_impl->IDirect3DBaseTexture9_iface; IDirect3DBaseTexture9_AddRef(*texture); - wined3d_texture_decref(wined3d_texture); } else { - if (FAILED(hr)) - WARN("Call to get texture (%u) failed (%p).\n", stage, wined3d_texture); *texture = NULL; } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetTexture(IDirect3DDevice9Ex *iface, DWORD stage, IDirect3DBaseTexture9 *texture) @@ -1761,7 +1732,6 @@ static HRESULT WINAPI d3d9_device_GetTextureStageState(IDirect3DDevice9Ex *iface DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD *value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, state, value); @@ -1772,17 +1742,16 @@ static HRESULT WINAPI d3d9_device_GetTextureStageState(IDirect3DDevice9Ex *iface } wined3d_mutex_lock(); - hr = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, tss_lookup[state], value); + *value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, tss_lookup[state]); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetTextureStageState(IDirect3DDevice9Ex *iface, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, state, value); @@ -1793,40 +1762,38 @@ static HRESULT WINAPI d3d9_device_SetTextureStageState(IDirect3DDevice9Ex *iface } wined3d_mutex_lock(); - hr = wined3d_device_set_texture_stage_state(device->wined3d_device, stage, tss_lookup[state], value); + wined3d_device_set_texture_stage_state(device->wined3d_device, stage, tss_lookup[state], value); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetSamplerState(IDirect3DDevice9Ex *iface, DWORD sampler, D3DSAMPLERSTATETYPE state, DWORD *value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, sampler %u, state %#x, value %p.\n", iface, sampler, state, value); wined3d_mutex_lock(); - hr = wined3d_device_get_sampler_state(device->wined3d_device, sampler, state, value); + *value = wined3d_device_get_sampler_state(device->wined3d_device, sampler, state); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetSamplerState(IDirect3DDevice9Ex *iface, DWORD sampler, D3DSAMPLERSTATETYPE state, DWORD value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, sampler %u, state %#x, value %#x.\n", iface, sampler, state, value); wined3d_mutex_lock(); - hr = wined3d_device_set_sampler_state(device->wined3d_device, sampler, state, value); + wined3d_device_set_sampler_state(device->wined3d_device, sampler, state, value); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_ValidateDevice(IDirect3DDevice9Ex *iface, DWORD *pass_count) @@ -1846,9 +1813,14 @@ static HRESULT WINAPI d3d9_device_ValidateDevice(IDirect3DDevice9Ex *iface, DWOR static HRESULT WINAPI d3d9_device_SetPaletteEntries(IDirect3DDevice9Ex *iface, UINT palette_idx, const PALETTEENTRY *entries) { - FIXME("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, palette_idx, entries); + WARN("iface %p, palette_idx %u, entries %p unimplemented.\n", iface, palette_idx, entries); - return D3DERR_INVALIDCALL; + /* The d3d9 palette API is non-functional on Windows. Getters and setters are implemented, + * and some drivers allow the creation of P8 surfaces. These surfaces can be copied to + * other P8 surfaces with StretchRect, but cannot be converted to (A)RGB. + * + * Some older(dx7) cards may have support for P8 textures, but games cannot rely on this. */ + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetPaletteEntries(IDirect3DDevice9Ex *iface, @@ -1861,9 +1833,9 @@ static HRESULT WINAPI d3d9_device_GetPaletteEntries(IDirect3DDevice9Ex *iface, static HRESULT WINAPI d3d9_device_SetCurrentTexturePalette(IDirect3DDevice9Ex *iface, UINT palette_idx) { - FIXME("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx); + WARN("iface %p, palette_idx %u unimplemented.\n", iface, palette_idx); - return D3DERR_INVALIDCALL; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetCurrentTexturePalette(IDirect3DDevice9Ex *iface, UINT *palette_idx) @@ -1876,43 +1848,40 @@ static HRESULT WINAPI d3d9_device_GetCurrentTexturePalette(IDirect3DDevice9Ex *i static HRESULT WINAPI d3d9_device_SetScissorRect(IDirect3DDevice9Ex *iface, const RECT *rect) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, rect %p.\n", iface, rect); wined3d_mutex_lock(); - hr = wined3d_device_set_scissor_rect(device->wined3d_device, rect); + wined3d_device_set_scissor_rect(device->wined3d_device, rect); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetScissorRect(IDirect3DDevice9Ex *iface, RECT *rect) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, rect %p.\n", iface, rect); wined3d_mutex_lock(); - hr = wined3d_device_get_scissor_rect(device->wined3d_device, rect); + wined3d_device_get_scissor_rect(device->wined3d_device, rect); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_SetSoftwareVertexProcessing(IDirect3DDevice9Ex *iface, BOOL software) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; TRACE("iface %p, software %#x.\n", iface, software); wined3d_mutex_lock(); - hr = wined3d_device_set_software_vertex_processing(device->wined3d_device, software); + wined3d_device_set_software_vertex_processing(device->wined3d_device, software); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static BOOL WINAPI d3d9_device_GetSoftwareVertexProcessing(IDirect3DDevice9Ex *iface) @@ -1997,45 +1966,214 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface return hr; } +static void STDMETHODCALLTYPE d3d9_null_wined3d_object_destroyed(void *parent) {} + +static const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops = +{ + d3d9_null_wined3d_object_destroyed, +}; + +/* The caller is responsible for wined3d locking */ +static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->vertex_buffer_size < min_size || !device->vertex_buffer) + { + UINT size = max(device->vertex_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing vertex buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_vb(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d9_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_vb failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + + device->vertex_buffer = buffer; + device->vertex_buffer_size = size; + device->vertex_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d9_device_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE primitive_type, UINT primitive_count, const void *data, UINT stride) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; + UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT size = vtx_count * stride; + UINT vb_pos, align; + BYTE *buffer_data; TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", iface, primitive_type, primitive_count, data, stride); - wined3d_mutex_lock(); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), - data, stride); - wined3d_mutex_unlock(); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + + hr = d3d9_device_prepare_vertex_buffer(device, size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % stride; + if (align) align = stride - align; + if (vb_pos + size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, data, size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); + hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count); + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); + +done: + wined3d_mutex_unlock(); return hr; } +/* The caller is responsible for wined3d locking */ +static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->index_buffer_size < min_size || !device->index_buffer) + { + UINT size = max(device->index_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing index buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_ib(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &d3d9_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_ib failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + + device->index_buffer = buffer; + device->index_buffer_size = size; + device->index_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *iface, - D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT index_count, + D3DPRIMITIVETYPE primitive_type, UINT min_vertex_idx, UINT vertex_count, UINT primitive_count, const void *index_data, D3DFORMAT index_format, const void *vertex_data, UINT vertex_stride) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; + BYTE *buffer_data; - TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" + UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count); + UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4; + UINT idx_size = idx_count * idx_fmt_size; + UINT ib_pos; + + UINT vtx_size = vertex_count * vertex_stride; + UINT vb_pos, align; + + TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u,\n" "index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n", - iface, primitive_type, min_vertex_idx, index_count, primitive_count, + iface, primitive_type, min_vertex_idx, vertex_count, primitive_count, index_data, index_format, vertex_data, vertex_stride); - wined3d_mutex_lock(); - wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device, - vertex_count_from_primitive_count(primitive_type, primitive_count), index_data, - wined3dformat_from_d3dformat(index_format), vertex_data, vertex_stride); - wined3d_mutex_unlock(); + if (!primitive_count) + { + WARN("primitive_count is 0, returning D3D_OK\n"); + return D3D_OK; + } + wined3d_mutex_lock(); + + hr = d3d9_device_prepare_vertex_buffer(device, vtx_size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % vertex_stride; + if (align) align = vertex_stride - align; + if (vb_pos + vtx_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &buffer_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, vertex_data, vtx_size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + vtx_size; + + hr = d3d9_device_prepare_index_buffer(device, idx_size); + if (FAILED(hr)) + goto done; + + ib_pos = device->index_buffer_pos; + align = ib_pos % idx_fmt_size; + if (align) align = idx_fmt_size - align; + if (ib_pos + idx_size + align > device->index_buffer_size) + ib_pos = 0; + else + ib_pos += align; + + hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &buffer_data, + ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(buffer_data, index_data, idx_size); + wined3d_buffer_unmap(device->index_buffer); + device->index_buffer_pos = ib_pos + idx_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, + wined3dformat_from_d3dformat(index_format)); + wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride); + + wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count); + + wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0); + wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + wined3d_device_set_base_vertex_index(device->wined3d_device, 0); + +done: + wined3d_mutex_unlock(); return hr; } @@ -2086,38 +2224,34 @@ static HRESULT WINAPI d3d9_device_SetVertexDeclaration(IDirect3DDevice9Ex *iface { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_vertex_declaration *decl_impl = unsafe_impl_from_IDirect3DVertexDeclaration9(declaration); - HRESULT hr; TRACE("iface %p, declaration %p.\n", iface, declaration); wined3d_mutex_lock(); - hr = wined3d_device_set_vertex_declaration(device->wined3d_device, + wined3d_device_set_vertex_declaration(device->wined3d_device, decl_impl ? decl_impl->wined3d_declaration : NULL); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetVertexDeclaration(IDirect3DDevice9Ex *iface, IDirect3DVertexDeclaration9 **declaration) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - struct wined3d_vertex_declaration *wined3d_declaration = NULL; + struct wined3d_vertex_declaration *wined3d_declaration; struct d3d9_vertex_declaration *declaration_impl; - HRESULT hr; TRACE("iface %p, declaration %p.\n", iface, declaration); if (!declaration) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_vertex_declaration(device->wined3d_device, &wined3d_declaration); - if (SUCCEEDED(hr) && wined3d_declaration) + if ((wined3d_declaration = wined3d_device_get_vertex_declaration(device->wined3d_device))) { declaration_impl = wined3d_vertex_declaration_get_parent(wined3d_declaration); *declaration = &declaration_impl->IDirect3DVertexDeclaration9_iface; IDirect3DVertexDeclaration9_AddRef(*declaration); - wined3d_vertex_declaration_decref(wined3d_declaration); } else { @@ -2126,7 +2260,7 @@ static HRESULT WINAPI d3d9_device_GetVertexDeclaration(IDirect3DDevice9Ex *iface wined3d_mutex_unlock(); TRACE("Returning %p.\n", *declaration); - return hr; + return D3D_OK; } static struct wined3d_vertex_declaration *device_get_fvf_declaration(struct d3d9_device *device, DWORD fvf) @@ -2201,7 +2335,6 @@ static HRESULT WINAPI d3d9_device_SetFVF(IDirect3DDevice9Ex *iface, DWORD fvf) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_vertex_declaration *decl; - HRESULT hr; TRACE("iface %p, fvf %#x.\n", iface, fvf); @@ -2219,12 +2352,10 @@ static HRESULT WINAPI d3d9_device_SetFVF(IDirect3DDevice9Ex *iface, DWORD fvf) return D3DERR_DRIVERINTERNALERROR; } - hr = wined3d_device_set_vertex_declaration(device->wined3d_device, decl); - if (FAILED(hr)) - ERR("Failed to set vertex declaration.\n"); + wined3d_device_set_vertex_declaration(device->wined3d_device, decl); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf) @@ -2232,24 +2363,14 @@ static HRESULT WINAPI d3d9_device_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf) struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_vertex_declaration *wined3d_declaration; struct d3d9_vertex_declaration *d3d9_declaration; - HRESULT hr; TRACE("iface %p, fvf %p.\n", iface, fvf); wined3d_mutex_lock(); - if (FAILED(hr = wined3d_device_get_vertex_declaration(device->wined3d_device, &wined3d_declaration))) - { - wined3d_mutex_unlock(); - WARN("Failed to get vertex declaration, hr %#x.\n", hr); - *fvf = 0; - return hr; - } - - if (wined3d_declaration) + if ((wined3d_declaration = wined3d_device_get_vertex_declaration(device->wined3d_device))) { d3d9_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration); *fvf = d3d9_declaration->fvf; - wined3d_vertex_declaration_decref(wined3d_declaration); } else { @@ -2259,7 +2380,7 @@ static HRESULT WINAPI d3d9_device_GetFVF(IDirect3DDevice9Ex *iface, DWORD *fvf) TRACE("Returning FVF %#x.\n", *fvf); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface, @@ -2273,10 +2394,7 @@ static HRESULT WINAPI d3d9_device_CreateVertexShader(IDirect3DDevice9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate vertex shader memory.\n"); return E_OUTOFMEMORY; - } hr = vertexshader_init(object, device, byte_code); if (FAILED(hr)) @@ -2296,16 +2414,15 @@ static HRESULT WINAPI d3d9_device_SetVertexShader(IDirect3DDevice9Ex *iface, IDi { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_vertexshader *shader_obj = unsafe_impl_from_IDirect3DVertexShader9(shader); - HRESULT hr; TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - hr = wined3d_device_set_vertex_shader(device->wined3d_device, + wined3d_device_set_vertex_shader(device->wined3d_device, shader_obj ? shader_obj->wined3d_shader : NULL); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 **shader) @@ -2317,13 +2434,11 @@ static HRESULT WINAPI d3d9_device_GetVertexShader(IDirect3DDevice9Ex *iface, IDi TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device); - if (wined3d_shader) + if ((wined3d_shader = wined3d_device_get_vertex_shader(device->wined3d_device))) { shader_impl = wined3d_shader_get_parent(wined3d_shader); *shader = &shader_impl->IDirect3DVertexShader9_iface; IDirect3DVertexShader9_AddRef(*shader); - wined3d_shader_decref(wined3d_shader); } else { @@ -2524,25 +2639,24 @@ static HRESULT WINAPI d3d9_device_SetIndices(IDirect3DDevice9Ex *iface, IDirect3 { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_indexbuffer *ib = unsafe_impl_from_IDirect3DIndexBuffer9(buffer); - HRESULT hr; TRACE("iface %p, buffer %p.\n", iface, buffer); wined3d_mutex_lock(); - hr = wined3d_device_set_index_buffer(device->wined3d_device, + wined3d_device_set_index_buffer(device->wined3d_device, ib ? ib->wined3d_buffer : NULL, ib ? ib->format : WINED3DFMT_UNKNOWN); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **buffer) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - struct wined3d_buffer *retIndexData = NULL; + enum wined3d_format_id wined3d_format; + struct wined3d_buffer *wined3d_buffer; struct d3d9_indexbuffer *buffer_impl; - HRESULT hr; TRACE("iface %p, buffer %p.\n", iface, buffer); @@ -2550,23 +2664,19 @@ static HRESULT WINAPI d3d9_device_GetIndices(IDirect3DDevice9Ex *iface, IDirect3 return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = wined3d_device_get_index_buffer(device->wined3d_device, &retIndexData); - if (SUCCEEDED(hr) && retIndexData) + if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format))) { - buffer_impl = wined3d_buffer_get_parent(retIndexData); + buffer_impl = wined3d_buffer_get_parent(wined3d_buffer); *buffer = &buffer_impl->IDirect3DIndexBuffer9_iface; IDirect3DIndexBuffer9_AddRef(*buffer); - wined3d_buffer_decref(retIndexData); } else { - if (FAILED(hr)) - FIXME("Call to GetIndices failed\n"); *buffer = NULL; } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_CreatePixelShader(IDirect3DDevice9Ex *iface, @@ -2603,16 +2713,15 @@ static HRESULT WINAPI d3d9_device_SetPixelShader(IDirect3DDevice9Ex *iface, IDir { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct d3d9_pixelshader *shader_obj = unsafe_impl_from_IDirect3DPixelShader9(shader); - HRESULT hr; TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - hr = wined3d_device_set_pixel_shader(device->wined3d_device, + wined3d_device_set_pixel_shader(device->wined3d_device, shader_obj ? shader_obj->wined3d_shader : NULL); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_GetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 **shader) @@ -2626,13 +2735,11 @@ static HRESULT WINAPI d3d9_device_GetPixelShader(IDirect3DDevice9Ex *iface, IDir if (!shader) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - wined3d_shader = wined3d_device_get_pixel_shader(device->wined3d_device); - if (wined3d_shader) + if ((wined3d_shader = wined3d_device_get_pixel_shader(device->wined3d_device))) { shader_impl = wined3d_shader_get_parent(wined3d_shader); *shader = &shader_impl->IDirect3DPixelShader9_iface; IDirect3DPixelShader9_AddRef(*shader); - wined3d_shader_decref(wined3d_shader); } else { @@ -2738,49 +2845,23 @@ static HRESULT WINAPI d3d9_device_GetPixelShaderConstantB(IDirect3DDevice9Ex *if static HRESULT WINAPI d3d9_device_DrawRectPatch(IDirect3DDevice9Ex *iface, UINT handle, const float *segment_count, const D3DRECTPATCH_INFO *patch_info) { - struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; - - TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", + FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n", iface, handle, segment_count, patch_info); - - wined3d_mutex_lock(); - hr = wined3d_device_draw_rect_patch(device->wined3d_device, handle, - segment_count, (const struct wined3d_rect_patch_info *)patch_info); - wined3d_mutex_unlock(); - - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_DrawTriPatch(IDirect3DDevice9Ex *iface, UINT handle, const float *segment_count, const D3DTRIPATCH_INFO *patch_info) { - struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; - - TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", + FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n", iface, handle, segment_count, patch_info); - - wined3d_mutex_lock(); - hr = wined3d_device_draw_tri_patch(device->wined3d_device, handle, - segment_count, (const struct wined3d_tri_patch_info *)patch_info); - wined3d_mutex_unlock(); - - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_device_DeletePatch(IDirect3DDevice9Ex *iface, UINT handle) { - struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; - - TRACE("iface %p, handle %#x.\n", iface, handle); - - wined3d_mutex_lock(); - hr = wined3d_device_delete_patch(device->wined3d_device, handle); - wined3d_mutex_unlock(); - - return hr; + FIXME("iface %p, handle %#x unimplemented.\n", iface, handle); + return D3DERR_INVALIDCALL; } static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUERYTYPE type, IDirect3DQuery9 **query) @@ -2793,10 +2874,7 @@ static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUER object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate query memory.\n"); return E_OUTOFMEMORY; - } hr = query_init(object, device, type); if (FAILED(hr)) @@ -2971,13 +3049,23 @@ static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, } wined3d_mutex_lock(); + + if (device->vertex_buffer) + { + wined3d_buffer_decref(device->vertex_buffer); + device->vertex_buffer = NULL; + device->vertex_buffer_size = 0; + } + if (device->index_buffer) + { + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = NULL; + device->index_buffer_size = 0; + } + wined3d_swapchain_desc_from_present_parameters(&swapchain_desc, present_parameters); hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, - mode ? &wined3d_mode : NULL, reset_enum_callback); - if (FAILED(hr)) - device->not_reset = TRUE; - else - device->not_reset = FALSE; + mode ? &wined3d_mode : NULL, reset_enum_callback, FALSE); wined3d_mutex_unlock(); return hr; @@ -3172,7 +3260,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent, void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, - enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface) + enum wined3d_pool pool, UINT sub_resource_idx, struct wined3d_surface **surface) { struct d3d9_device *device = device_from_device_parent(device_parent); struct d3d9_surface *d3d_surface; @@ -3180,16 +3268,14 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_ HRESULT hr; TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n" - "\tpool %#x, level %u, face %u, surface %p.\n", - device_parent, container_parent, width, height, format, usage, pool, level, face, surface); + "\tpool %#x, sub_resource_idx %u, surface %p.\n", + device_parent, container_parent, width, height, format, usage, pool, sub_resource_idx, surface); if (pool == WINED3D_POOL_DEFAULT && !(usage & D3DUSAGE_DYNAMIC)) lockable = FALSE; - hr = d3d9_device_create_surface(device, width, height, - d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level, - (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */); - if (FAILED(hr)) + if (FAILED(hr = d3d9_device_create_surface(device, width, height, d3dformat_from_wined3dformat(format), + lockable, FALSE, (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0))) { WARN("Failed to create surface, hr %#x.\n", hr); return hr; @@ -3222,7 +3308,7 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic multisample_type, multisample_quality, surface); if (FAILED(hr = d3d9_device_create_surface(device, width, height, d3dformat_from_wined3dformat(format_id), - TRUE, FALSE, 0, (IDirect3DSurface9 **)&d3d_surface, usage, D3DPOOL_DEFAULT, multisample_type, + TRUE, FALSE, (IDirect3DSurface9 **)&d3d_surface, usage, D3DPOOL_DEFAULT, multisample_type, multisample_quality))) { WARN("Failed to create surface, hr %#x.\n", hr); diff --git a/reactos/dll/directx/wine/d3d9/directx.c b/reactos/dll/directx/wine/d3d9/directx.c index e887cdd80e6..a335375dba0 100644 --- a/reactos/dll/directx/wine/d3d9/directx.c +++ b/reactos/dll/directx/wine/d3d9/directx.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -264,7 +264,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter, wined3d_mutex_lock(); hr = wined3d_check_device_format(d3d9->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format), - usage, wined3d_rtype, wined3dformat_from_d3dformat(format), WINED3D_SURFACE_TYPE_OPENGL); + usage, wined3d_rtype, wined3dformat_from_d3dformat(format)); wined3d_mutex_unlock(); return hr; @@ -456,10 +456,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate device memory.\n"); return E_OUTOFMEMORY; - } hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, NULL); if (FAILED(hr)) @@ -567,10 +564,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDeviceEx(IDirect3D9Ex *iface, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate device memory.\n"); return E_OUTOFMEMORY; - } hr = device_init(object, d3d9, d3d9->wined3d, adapter, device_type, focus_window, flags, parameters, mode); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/d3d9/query.c b/reactos/dll/directx/wine/d3d9/query.c index 7e01a69a4cb..d3634133601 100644 --- a/reactos/dll/directx/wine/d3d9/query.c +++ b/reactos/dll/directx/wine/d3d9/query.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); diff --git a/reactos/dll/directx/wine/d3d9/shader.c b/reactos/dll/directx/wine/d3d9/shader.c index 4e7abed9450..e65f485b2e3 100644 --- a/reactos/dll/directx/wine/d3d9/shader.c +++ b/reactos/dll/directx/wine/d3d9/shader.c @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); diff --git a/reactos/dll/directx/wine/d3d9/stateblock.c b/reactos/dll/directx/wine/d3d9/stateblock.c index 6062364b523..5eea835e060 100644 --- a/reactos/dll/directx/wine/d3d9/stateblock.c +++ b/reactos/dll/directx/wine/d3d9/stateblock.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -95,29 +95,27 @@ static HRESULT WINAPI d3d9_stateblock_GetDevice(IDirect3DStateBlock9 *iface, IDi static HRESULT WINAPI d3d9_stateblock_Capture(IDirect3DStateBlock9 *iface) { struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface); - HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = wined3d_stateblock_capture(stateblock->wined3d_stateblock); + wined3d_stateblock_capture(stateblock->wined3d_stateblock); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface) { struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface); - HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = wined3d_stateblock_apply(stateblock->wined3d_stateblock); + wined3d_stateblock_apply(stateblock->wined3d_stateblock); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } diff --git a/reactos/dll/directx/wine/d3d9/surface.c b/reactos/dll/directx/wine/d3d9/surface.c index 9d44d84972a..33173bc659d 100644 --- a/reactos/dll/directx/wine/d3d9/surface.c +++ b/reactos/dll/directx/wine/d3d9/surface.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -390,9 +390,9 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = surface_wined3d_object_destroyed, }; -HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, - UINT width, UINT height, D3DFORMAT format, BOOL lockable, BOOL discard, UINT level, - DWORD usage, D3DPOOL pool, D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) +HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, UINT width, UINT height, + D3DFORMAT format, BOOL lockable, BOOL discard, DWORD usage, D3DPOOL pool, + D3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality) { DWORD flags = 0; HRESULT hr; @@ -430,8 +430,8 @@ HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, wined3d_mutex_lock(); hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format), - level, usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality, - WINED3D_SURFACE_TYPE_OPENGL, flags, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface); + usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality, + flags, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface); wined3d_mutex_unlock(); if (FAILED(hr)) { diff --git a/reactos/dll/directx/wine/d3d9/swapchain.c b/reactos/dll/directx/wine/d3d9/swapchain.c index d06dc81e79d..81773361043 100644 --- a/reactos/dll/directx/wine/d3d9/swapchain.c +++ b/reactos/dll/directx/wine/d3d9/swapchain.c @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -131,20 +131,22 @@ static HRESULT WINAPI d3d9_swapchain_GetBackBuffer(IDirect3DSwapChain9 *iface, struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9(iface); struct wined3d_surface *wined3d_surface = NULL; struct d3d9_surface *surface_impl; - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, backbuffer_idx, backbuffer_type, backbuffer); wined3d_mutex_lock(); - hr = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, - backbuffer_idx, (enum wined3d_backbuffer_type)backbuffer_type, &wined3d_surface); - if (SUCCEEDED(hr) && wined3d_surface) + if ((wined3d_surface = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, + backbuffer_idx, (enum wined3d_backbuffer_type)backbuffer_type))) { surface_impl = wined3d_surface_get_parent(wined3d_surface); *backbuffer = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*backbuffer); - wined3d_surface_decref(wined3d_surface); + } + else + { + hr = D3DERR_INVALIDCALL; } wined3d_mutex_unlock(); @@ -208,16 +210,15 @@ static HRESULT WINAPI d3d9_swapchain_GetPresentParameters(IDirect3DSwapChain9 *i { struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9(iface); struct wined3d_swapchain_desc desc; - HRESULT hr; TRACE("iface %p, parameters %p.\n", iface, parameters); wined3d_mutex_lock(); - hr = wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &desc); + wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &desc); wined3d_mutex_unlock(); present_parameters_from_wined3d_swapchain_desc(parameters, &desc); - return hr; + return D3D_OK; } @@ -254,9 +255,8 @@ static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_devi swapchain->IDirect3DSwapChain9_iface.lpVtbl = &d3d9_swapchain_vtbl; wined3d_mutex_lock(); - hr = wined3d_swapchain_create(device->wined3d_device, desc, - WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops, - &swapchain->wined3d_swapchain); + hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain, + &d3d9_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain); wined3d_mutex_unlock(); if (FAILED(hr)) @@ -278,10 +278,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha HRESULT hr; if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) - { - ERR("Failed to allocate swapchain memory.\n"); return E_OUTOFMEMORY; - } if (FAILED(hr = swapchain_init(object, device, desc))) { diff --git a/reactos/dll/directx/wine/d3d9/texture.c b/reactos/dll/directx/wine/d3d9/texture.c index de795b845b8..87395c00b2c 100644 --- a/reactos/dll/directx/wine/d3d9/texture.c +++ b/reactos/dll/directx/wine/d3d9/texture.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); diff --git a/reactos/dll/directx/wine/d3d9/vertexdeclaration.c b/reactos/dll/directx/wine/d3d9/vertexdeclaration.c index d57d3b96129..502b7d372be 100644 --- a/reactos/dll/directx/wine/d3d9/vertexdeclaration.c +++ b/reactos/dll/directx/wine/d3d9/vertexdeclaration.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); @@ -419,10 +419,7 @@ HRESULT d3d9_vertex_declaration_create(struct d3d9_device *device, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate vertex declaration memory.\n"); return E_OUTOFMEMORY; - } hr = vertexdeclaration_init(object, device, elements); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/d3d9/volume.c b/reactos/dll/directx/wine/d3d9/volume.c index 6511820c778..ba5dc0566bc 100644 --- a/reactos/dll/directx/wine/d3d9/volume.c +++ b/reactos/dll/directx/wine/d3d9/volume.c @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "config.h" #include "d3d9_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d9); diff --git a/reactos/dll/directx/wine/ddraw/clipper.c b/reactos/dll/directx/wine/ddraw/clipper.c index 7703fd0c495..db9c3838285 100644 --- a/reactos/dll/directx/wine/ddraw/clipper.c +++ b/reactos/dll/directx/wine/ddraw/clipper.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" diff --git a/reactos/dll/directx/wine/ddraw/ddraw.c b/reactos/dll/directx/wine/ddraw/ddraw.c index 9fd1c6bcd88..d41096b6a2e 100644 --- a/reactos/dll/directx/wine/ddraw/ddraw.c +++ b/reactos/dll/directx/wine/ddraw/ddraw.c @@ -20,13 +20,17 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" WINE_DEFAULT_DEBUG_CHANNEL(ddraw); +static struct wined3d_display_mode original_mode; +static const struct ddraw *exclusive_ddraw; +static BOOL restore_mode; + /* Device identifier. Don't relay it to WineD3D */ static const DDDEVICEIDENTIFIER2 deviceidentifier = { @@ -115,134 +119,78 @@ static inline struct ddraw *impl_from_IDirect3D7(IDirect3D7 *iface) return CONTAINING_RECORD(iface, struct ddraw, IDirect3D7_iface); } -/***************************************************************************** - * IUnknown Methods - *****************************************************************************/ - -/***************************************************************************** - * IDirectDraw7::QueryInterface - * - * Queries different interfaces of the DirectDraw object. It can return - * IDirectDraw interfaces in version 1, 2, 4 and 7, and IDirect3D interfaces - * in version 1, 2, 3 and 7. An IDirect3DDevice can be created with this - * method. - * The returned interface is AddRef()-ed before it's returned - * - * Used for version 1, 2, 4 and 7 - * - * Params: - * refiid: Interface ID asked for - * obj: Used to return the interface pointer - * - * Returns: - * S_OK if an interface was found - * E_NOINTERFACE if the requested interface wasn't found - * - *****************************************************************************/ -static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, void **obj) +static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID riid, void **out) { - struct ddraw *This = impl_from_IDirectDraw7(iface); + struct ddraw *ddraw = impl_from_IDirectDraw7(iface); - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(refiid), obj); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - /* Can change surface impl type */ - wined3d_mutex_lock(); - - /* According to COM docs, if the QueryInterface fails, obj should be set to NULL */ - *obj = NULL; - - if(!refiid) + if (!riid) { - wined3d_mutex_unlock(); + *out = NULL; return DDERR_INVALIDPARAMS; } - /* Check DirectDraw Interfaces */ - if ( IsEqualGUID( &IID_IUnknown, refiid ) || - IsEqualGUID( &IID_IDirectDraw7, refiid ) ) + /* The refcount unit test revealed that an IDirect3D7 interface can only + * be queried from a DirectDraw object that was created as an IDirectDraw7 + * interface. The older interfaces can query any IDirect3D version except + * 7, because they are all initially created as IDirectDraw. This isn't + * really crucial behavior, and messy to implement with the common + * creation function, so it has been left out here. */ + if (IsEqualGUID(&IID_IDirectDraw7, riid) + || IsEqualGUID(&IID_IUnknown, riid)) { - *obj = &This->IDirectDraw7_iface; - TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj); + *out = &ddraw->IDirectDraw7_iface; + TRACE("Returning IDirectDraw7 interface %p.\n", *out); } - else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) + else if (IsEqualGUID(&IID_IDirectDraw4, riid)) { - *obj = &This->IDirectDraw4_iface; - TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj); + *out = &ddraw->IDirectDraw4_iface; + TRACE("Returning IDirectDraw4 interface %p.\n", *out); } - else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) ) + else if (IsEqualGUID(&IID_IDirectDraw2, riid)) { - /* This Interface exists in ddrawex.dll, it is implemented in a wrapper */ - WARN("IDirectDraw3 is not valid in ddraw.dll\n"); - *obj = NULL; - wined3d_mutex_unlock(); - return E_NOINTERFACE; + *out = &ddraw->IDirectDraw2_iface; + TRACE("Returning IDirectDraw2 interface %p.\n", *out); } - else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) + else if (IsEqualGUID(&IID_IDirectDraw, riid)) { - *obj = &This->IDirectDraw2_iface; - TRACE("(%p) Returning IDirectDraw2 interface at %p\n", This, *obj); + *out = &ddraw->IDirectDraw_iface; + TRACE("Returning IDirectDraw interface %p.\n", *out); } - else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) + else if (IsEqualGUID(&IID_IDirect3D7, riid)) { - *obj = &This->IDirectDraw_iface; - TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj); + ddraw->d3dversion = 7; + *out = &ddraw->IDirect3D7_iface; + TRACE("Returning Direct3D7 interface %p.\n", *out); } - - /* Direct3D - * The refcount unit test revealed that an IDirect3D7 interface can only be queried - * from a DirectDraw object that was created as an IDirectDraw7 interface. No idea - * who had this idea and why. The older interfaces can query and IDirect3D version - * because they are all created as IDirectDraw(1). This isn't really crucial behavior, - * and messy to implement with the common creation function, so it has been left out here. - */ - else if ( IsEqualGUID( &IID_IDirect3D , refiid ) || - IsEqualGUID( &IID_IDirect3D2 , refiid ) || - IsEqualGUID( &IID_IDirect3D3 , refiid ) || - IsEqualGUID( &IID_IDirect3D7 , refiid ) ) + else if (IsEqualGUID(&IID_IDirect3D3, riid)) { - /* Check the surface implementation */ - if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL) - { - WARN("The app requests a Direct3D interface, but non-opengl surfaces where set in winecfg\n"); - /* Do not abort here, only reject 3D Device creation */ - } - - if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) - { - This->d3dversion = 1; - *obj = &This->IDirect3D_iface; - TRACE(" returning Direct3D interface at %p.\n", *obj); - } - else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) - { - This->d3dversion = 2; - *obj = &This->IDirect3D2_iface; - TRACE(" returning Direct3D2 interface at %p.\n", *obj); - } - else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) - { - This->d3dversion = 3; - *obj = &This->IDirect3D3_iface; - TRACE(" returning Direct3D3 interface at %p.\n", *obj); - } - else if(IsEqualGUID( &IID_IDirect3D7 , refiid )) - { - This->d3dversion = 7; - *obj = &This->IDirect3D7_iface; - TRACE(" returning Direct3D7 interface at %p.\n", *obj); - } + ddraw->d3dversion = 3; + *out = &ddraw->IDirect3D3_iface; + TRACE("Returning Direct3D3 interface %p.\n", *out); + } + else if (IsEqualGUID(&IID_IDirect3D2, riid)) + { + ddraw->d3dversion = 2; + *out = &ddraw->IDirect3D2_iface; + TRACE("Returning Direct3D2 interface %p.\n", *out); + } + else if (IsEqualGUID(&IID_IDirect3D, riid)) + { + ddraw->d3dversion = 1; + *out = &ddraw->IDirect3D_iface; + TRACE("Returning Direct3D interface %p.\n", *out); } /* Unknown interface */ else { - ERR("(%p)->(%s, %p): No interface found\n", This, debugstr_guid(refiid), obj); - wined3d_mutex_unlock(); + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + *out = NULL; return E_NOINTERFACE; } - IUnknown_AddRef( (IUnknown *) *obj ); - wined3d_mutex_unlock(); - + IUnknown_AddRef((IUnknown *)*out); return S_OK; } @@ -418,7 +366,7 @@ void ddraw_destroy_swapchain(struct ddraw *ddraw) wined3d_swapchain_decref(ddraw->wined3d_swapchain); ddraw->wined3d_swapchain = NULL; - if (DefaultSurfaceType == WINED3D_SURFACE_TYPE_OPENGL) + if (DefaultSurfaceType == DDRAW_SURFACE_TYPE_OPENGL) { UINT i; @@ -603,9 +551,6 @@ static HRESULT ddraw_set_focus_window(struct ddraw *ddraw, HWND window) ddraw->focuswindow = window; - /* Use the focus window for drawing too. */ - ddraw->dest_window = ddraw->focuswindow; - return DD_OK; } @@ -684,7 +629,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win swapchain_desc.device_window = window; swapchain_desc.windowed = windowed; - if (DefaultSurfaceType == WINED3D_SURFACE_TYPE_OPENGL) + if (DefaultSurfaceType == DDRAW_SURFACE_TYPE_OPENGL) hr = ddraw_attach_d3d_device(ddraw, &swapchain_desc); else hr = wined3d_device_init_gdi(ddraw->wined3d_device, &swapchain_desc); @@ -695,13 +640,13 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win return hr; } - if (FAILED(hr = wined3d_device_get_swapchain(ddraw->wined3d_device, 0, &ddraw->wined3d_swapchain))) + if (!(ddraw->wined3d_swapchain = wined3d_device_get_swapchain(ddraw->wined3d_device, 0))) { - ERR("Failed to get swapchain, hr %#x.\n", hr); - ddraw->wined3d_swapchain = NULL; - return hr; + ERR("Failed to get swapchain.\n"); + return DDERR_INVALIDPARAMS; } + wined3d_swapchain_incref(ddraw->wined3d_swapchain); ddraw_set_swapchain_window(ddraw, window); return DD_OK; @@ -751,23 +696,19 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win * (Probably others too, have to investigate) * *****************************************************************************/ -static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, DWORD cooplevel) +static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND window, DWORD cooplevel) { struct ddraw *This = impl_from_IDirectDraw7(iface); + struct wined3d_surface *rt = NULL, *ds = NULL; struct wined3d_stateblock *stateblock; - struct wined3d_surface *rt, *ds; BOOL restore_state = FALSE; - HWND window; HRESULT hr; - TRACE("iface %p, window %p, flags %#x.\n", iface, hwnd, cooplevel); + TRACE("iface %p, window %p, flags %#x.\n", iface, window, cooplevel); DDRAW_dump_cooperativelevel(cooplevel); wined3d_mutex_lock(); - /* Get the old window */ - window = This->dest_window; - /* Tests suggest that we need one of them: */ if(!(cooplevel & (DDSCL_SETFOCUSWINDOW | DDSCL_NORMAL | @@ -804,14 +745,14 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, return DDERR_INVALIDPARAMS; } - hr = ddraw_set_focus_window(This, hwnd); + hr = ddraw_set_focus_window(This, window); wined3d_mutex_unlock(); return hr; } if (cooplevel & DDSCL_EXCLUSIVE) { - if (!(cooplevel & DDSCL_FULLSCREEN) || !(hwnd || (cooplevel & DDSCL_CREATEDEVICEWINDOW))) + if (!(cooplevel & DDSCL_FULLSCREEN) || !(window || (cooplevel & DDSCL_CREATEDEVICEWINDOW))) { WARN("DDSCL_EXCLUSIVE requires DDSCL_FULLSCREEN and a window.\n"); wined3d_mutex_unlock(); @@ -849,20 +790,20 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, if (cooplevel & DDSCL_SETFOCUSWINDOW) { - if (!hwnd) + if (!window) { wined3d_mutex_unlock(); return DDERR_NOHWND; } - if (FAILED(hr = ddraw_set_focus_window(This, hwnd))) + if (FAILED(hr = ddraw_set_focus_window(This, window))) { wined3d_mutex_unlock(); return hr; } } - hwnd = device_window; + window = device_window; } } else @@ -874,28 +815,28 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, } if ((This->cooperative_level & DDSCL_EXCLUSIVE) - && (hwnd != window || !(cooplevel & DDSCL_EXCLUSIVE))) + && (window != This->dest_window || !(cooplevel & DDSCL_EXCLUSIVE))) wined3d_device_release_focus_window(This->wined3d_device); - if ((cooplevel & DDSCL_FULLSCREEN) != (This->cooperative_level & DDSCL_FULLSCREEN) || hwnd != window) + if ((cooplevel & DDSCL_FULLSCREEN) != (This->cooperative_level & DDSCL_FULLSCREEN) || window != This->dest_window) { if (This->cooperative_level & DDSCL_FULLSCREEN) - wined3d_device_restore_fullscreen_window(This->wined3d_device, window); + wined3d_device_restore_fullscreen_window(This->wined3d_device, This->dest_window); if (cooplevel & DDSCL_FULLSCREEN) { struct wined3d_display_mode display_mode; wined3d_get_adapter_display_mode(This->wined3d, WINED3DADAPTER_DEFAULT, &display_mode, NULL); - wined3d_device_setup_fullscreen_window(This->wined3d_device, hwnd, + wined3d_device_setup_fullscreen_window(This->wined3d_device, window, display_mode.width, display_mode.height); } } if ((cooplevel & DDSCL_EXCLUSIVE) - && (hwnd != window || !(This->cooperative_level & DDSCL_EXCLUSIVE))) + && (window != This->dest_window || !(This->cooperative_level & DDSCL_EXCLUSIVE))) { - hr = wined3d_device_acquire_focus_window(This->wined3d_device, hwnd); + hr = wined3d_device_acquire_focus_window(This->wined3d_device, window); if (FAILED(hr)) { ERR("Failed to acquire focus window, hr %#x.\n", hr); @@ -904,16 +845,12 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, } } - /* Don't override focus windows or private device windows */ - if (hwnd && !This->focuswindow && !This->devicewindow && (hwnd != window)) - This->dest_window = hwnd; - if (cooplevel & DDSCL_MULTITHREADED && !(This->cooperative_level & DDSCL_MULTITHREADED)) wined3d_device_set_multithreaded(This->wined3d_device); if (This->wined3d_swapchain) { - if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_GDI) + if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_GDI) { restore_state = TRUE; @@ -924,28 +861,21 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, return hr; } - if (FAILED(hr = wined3d_stateblock_capture(stateblock))) - { - ERR("Failed to capture stateblock, hr %#x.\n", hr); - wined3d_stateblock_decref(stateblock); - wined3d_mutex_unlock(); - return hr; - } - - wined3d_device_get_render_target(This->wined3d_device, 0, &rt); + wined3d_stateblock_capture(stateblock); + rt = wined3d_device_get_render_target(This->wined3d_device, 0); if (rt == This->wined3d_frontbuffer) - { - wined3d_surface_decref(rt); rt = NULL; - } + else if (rt) + wined3d_surface_incref(rt); - wined3d_device_get_depth_stencil(This->wined3d_device, &ds); + if ((ds = wined3d_device_get_depth_stencil(This->wined3d_device))) + wined3d_surface_incref(ds); } ddraw_destroy_swapchain(This); } - if (FAILED(hr = ddraw_create_swapchain(This, This->dest_window, !(cooplevel & DDSCL_FULLSCREEN)))) + if (FAILED(hr = ddraw_create_swapchain(This, window, !(cooplevel & DDSCL_FULLSCREEN)))) ERR("Failed to create swapchain, hr %#x.\n", hr); if (restore_state) @@ -962,14 +892,8 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, wined3d_surface_decref(rt); } - hr = wined3d_stateblock_apply(stateblock); + wined3d_stateblock_apply(stateblock); wined3d_stateblock_decref(stateblock); - if (FAILED(hr)) - { - ERR("Failed to apply stateblock, hr %#x.\n", hr); - wined3d_mutex_unlock(); - return hr; - } } /* Unhandled flags */ @@ -980,8 +904,14 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, if(cooplevel & DDSCL_FPUSETUP) WARN("(%p) Unhandled flag DDSCL_FPUSETUP, harmless\n", This); + if (cooplevel & DDSCL_EXCLUSIVE) + exclusive_ddraw = This; + else if (exclusive_ddraw == This) + exclusive_ddraw = NULL; + /* Store the cooperative_level */ This->cooperative_level = cooplevel; + This->dest_window = window; TRACE("SetCooperativeLevel retuning DD_OK\n"); wined3d_mutex_unlock(); @@ -1015,79 +945,6 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window return ddraw7_SetCooperativeLevel(&ddraw->IDirectDraw7_iface, window, flags); } -/***************************************************************************** - * - * Helper function for SetDisplayMode and RestoreDisplayMode - * - * Implements DirectDraw's SetDisplayMode, but ignores the value of - * ForceRefreshRate, since it is already handled by - * ddraw7_SetDisplayMode. RestoreDisplayMode can use this function - * without worrying that ForceRefreshRate will override the refresh rate. For - * argument and return value documentation, see - * ddraw7_SetDisplayMode. - * - *****************************************************************************/ -static HRESULT ddraw_set_display_mode(struct ddraw *ddraw, DWORD Width, DWORD Height, - DWORD BPP, DWORD RefreshRate, DWORD Flags) -{ - struct wined3d_display_mode mode; - enum wined3d_format_id format; - HRESULT hr; - - TRACE("ddraw %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", ddraw, Width, - Height, BPP, RefreshRate, Flags); - - wined3d_mutex_lock(); - if( !Width || !Height ) - { - ERR("Width %u, Height %u, what to do?\n", Width, Height); - /* It looks like Need for Speed Porsche Unleashed expects DD_OK here */ - wined3d_mutex_unlock(); - return DD_OK; - } - - switch(BPP) - { - case 8: format = WINED3DFMT_P8_UINT; break; - case 15: format = WINED3DFMT_B5G5R5X1_UNORM; break; - case 16: format = WINED3DFMT_B5G6R5_UNORM; break; - case 24: format = WINED3DFMT_B8G8R8_UNORM; break; - case 32: format = WINED3DFMT_B8G8R8X8_UNORM; break; - default: format = WINED3DFMT_UNKNOWN; break; - } - - /* Check the exclusive mode - if(!(ddraw->cooperative_level & DDSCL_EXCLUSIVE)) - return DDERR_NOEXCLUSIVEMODE; - * This is WRONG. Don't know if the SDK is completely - * wrong and if there are any conditions when DDERR_NOEXCLUSIVE - * is returned, but Half-Life 1.1.1.1 (Steam version) - * depends on this - */ - - mode.width = Width; - mode.height = Height; - mode.refresh_rate = RefreshRate; - mode.format_id = format; - mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; - - /* TODO: The possible return values from msdn suggest that - * the screen mode can't be changed if a surface is locked - * or some drawing is in progress - */ - - /* TODO: Lose the primary surface */ - hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode); - - wined3d_mutex_unlock(); - - switch(hr) - { - case WINED3DERR_NOTAVAILABLE: return DDERR_UNSUPPORTED; - default: return hr; - } -} - /***************************************************************************** * IDirectDraw7::SetDisplayMode * @@ -1110,22 +967,75 @@ static HRESULT ddraw_set_display_mode(struct ddraw *ddraw, DWORD Width, DWORD He * DD_OK on success * *****************************************************************************/ -static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DWORD Height, - DWORD BPP, DWORD RefreshRate, DWORD Flags) +static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DWORD height, + DWORD bpp, DWORD refresh_rate, DWORD flags) { struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + struct wined3d_display_mode mode; + enum wined3d_format_id format; + HRESULT hr; TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", - iface, Width, Height, BPP, RefreshRate, Flags); + iface, width, height, bpp, refresh_rate, flags); if (force_refresh_rate != 0) { TRACE("ForceRefreshRate overriding passed-in refresh rate (%u Hz) to %u Hz\n", - RefreshRate, force_refresh_rate); - RefreshRate = force_refresh_rate; + refresh_rate, force_refresh_rate); + refresh_rate = force_refresh_rate; } - return ddraw_set_display_mode(ddraw, Width, Height, BPP, RefreshRate, Flags); + wined3d_mutex_lock(); + + if (exclusive_ddraw && exclusive_ddraw != ddraw) + { + wined3d_mutex_unlock(); + return DDERR_NOEXCLUSIVEMODE; + } + + if (!width || !height) + { + /* It looks like Need for Speed Porsche Unleashed expects DD_OK here. */ + wined3d_mutex_unlock(); + return DD_OK; + } + + if (!restore_mode && FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, + WINED3DADAPTER_DEFAULT, &original_mode, NULL))) + ERR("Failed to get current display mode, hr %#x.\n", hr); + + switch (bpp) + { + case 8: format = WINED3DFMT_P8_UINT; break; + case 15: format = WINED3DFMT_B5G5R5X1_UNORM; break; + case 16: format = WINED3DFMT_B5G6R5_UNORM; break; + case 24: format = WINED3DFMT_B8G8R8_UNORM; break; + case 32: format = WINED3DFMT_B8G8R8X8_UNORM; break; + default: format = WINED3DFMT_UNKNOWN; break; + } + + mode.width = width; + mode.height = height; + mode.refresh_rate = refresh_rate; + mode.format_id = format; + mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; + + /* TODO: The possible return values from msdn suggest that the screen mode + * can't be changed if a surface is locked or some drawing is in progress. */ + /* TODO: Lose the primary surface. */ + if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode))) + { + ddraw->restore_mode = TRUE; + restore_mode = TRUE; + } + + wined3d_mutex_unlock(); + + switch (hr) + { + case WINED3DERR_NOTAVAILABLE: return DDERR_UNSUPPORTED; + default: return hr; + } } static HRESULT WINAPI ddraw4_SetDisplayMode(IDirectDraw4 *iface, DWORD width, DWORD height, @@ -1164,17 +1074,6 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO * * Restores the display mode to what it was at creation time. Basically. * - * A problem arises when there are 2 DirectDraw objects using the same hwnd: - * -> DD_1 finds the screen at 1400x1050x32 when created, sets it to 640x480x16 - * -> DD_2 is created, finds the screen at 640x480x16, sets it to 1024x768x32 - * -> DD_1 is released. The screen should be left at 1024x768x32. - * -> DD_2 is released. The screen should be set to 1400x1050x32 - * This case is unhandled right now, but Empire Earth does it this way. - * (But perhaps there is something in SetCooperativeLevel to prevent this) - * - * The msdn says that this method resets the display mode to what it was before - * SetDisplayMode was called. What if SetDisplayModes is called 2 times?? - * * Returns * DD_OK on success * DDERR_NOEXCLUSIVE mode if the device isn't in fullscreen mode @@ -1183,10 +1082,33 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface) { struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + HRESULT hr; TRACE("iface %p.\n", iface); - return ddraw_set_display_mode(ddraw, ddraw->orig_width, ddraw->orig_height, ddraw->orig_bpp, 0, 0); + wined3d_mutex_lock(); + + if (!ddraw->restore_mode) + { + wined3d_mutex_unlock(); + return DD_OK; + } + + if (exclusive_ddraw && exclusive_ddraw != ddraw) + { + wined3d_mutex_unlock(); + return DDERR_NOEXCLUSIVEMODE; + } + + if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &original_mode))) + { + ddraw->restore_mode = FALSE; + restore_mode = FALSE; + } + + wined3d_mutex_unlock(); + + return hr; } static HRESULT WINAPI ddraw4_RestoreDisplayMode(IDirectDraw4 *iface) @@ -1284,10 +1206,9 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD caps.dwSSBCKeyCaps = winecaps.ddraw_caps.ssb_color_key_caps; caps.dwSSBFXCaps = winecaps.ddraw_caps.ssb_fx_caps; - /* Even if WineD3D supports 3D rendering, remove the cap if ddraw is configured - * not to use it - */ - if (DefaultSurfaceType == WINED3D_SURFACE_TYPE_GDI) + /* Even if wined3d supports 3D rendering, remove the cap if ddraw is + * configured not to use it. */ + if (DefaultSurfaceType == DDRAW_SURFACE_TYPE_GDI) { caps.dwCaps &= ~DDCAPS_3D; caps.ddsCaps.dwCaps &= ~(DDSCAPS_3DDEVICE | DDSCAPS_MIPMAP | DDSCAPS_TEXTURE | DDSCAPS_ZBUFFER); @@ -1524,9 +1445,8 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i) { - hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, - mode.format_id, 0, WINED3D_RTYPE_SURFACE, formats[i], DefaultSurfaceType); - if (SUCCEEDED(hr)) + if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, + mode.format_id, 0, WINED3D_RTYPE_SURFACE, formats[i]))) { if (count < outsize) Codes[count] = formats[i]; @@ -2422,14 +2342,12 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, struct ddraw *ddraw = impl_from_IDirectDraw7(iface); struct wined3d_surface *wined3d_surface; struct ddraw_surface *surface_impl; - HRESULT hr; TRACE("iface %p, dc %p, surface %p.\n", iface, hdc, Surface); if (!Surface) return E_INVALIDARG; - hr = wined3d_device_get_surface_from_dc(ddraw->wined3d_device, hdc, &wined3d_surface); - if (FAILED(hr)) + if (!(wined3d_surface = wined3d_device_get_surface_from_dc(ddraw->wined3d_device, hdc))) { TRACE("No surface found for dc %p.\n", hdc); *Surface = NULL; @@ -2558,12 +2476,11 @@ static HRESULT WINAPI ddraw7_StartModeTest(IDirectDraw7 *iface, SIZE *Modes, DWO * *****************************************************************************/ static HRESULT ddraw_create_surface(struct ddraw *ddraw, DDSURFACEDESC2 *pDDSD, - struct ddraw_surface **surface, UINT level, UINT version) + struct ddraw_surface **surface, UINT version) { HRESULT hr; - TRACE("ddraw %p, surface_desc %p, surface %p, level %u.\n", - ddraw, pDDSD, surface, level); + TRACE("ddraw %p, surface_desc %p, surface %p.\n", ddraw, pDDSD, surface); if (TRACE_ON(ddraw)) { @@ -2571,7 +2488,7 @@ static HRESULT ddraw_create_surface(struct ddraw *ddraw, DDSURFACEDESC2 *pDDSD, DDRAW_dump_surface_desc(pDDSD); } - if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL) + if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL) { WARN("The application requests a 3D capable surface, but a non-OpenGL surface type was set in the registry.\n"); /* Do not fail surface creation, only fail 3D device creation. */ @@ -2585,8 +2502,7 @@ static HRESULT ddraw_create_surface(struct ddraw *ddraw, DDSURFACEDESC2 *pDDSD, return DDERR_OUTOFVIDEOMEMORY; } - hr = ddraw_surface_init(*surface, ddraw, pDDSD, level, version); - if (FAILED(hr)) + if (FAILED(hr = ddraw_surface_init(*surface, ddraw, pDDSD, version))) { WARN("Failed to initialize surface, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, *surface); @@ -2787,35 +2703,10 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD, copy_to_surfacedesc2(&desc2, DDSD); desc2.u4.ddpfPixelFormat.dwSize=sizeof(DDPIXELFORMAT); /* Just to be sure */ - /* Get the video mode from WineD3D - we will need it */ if (FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode, NULL))) { ERR("Failed to get display mode, hr %#x.\n", hr); - - switch (ddraw->orig_bpp) - { - case 8: - mode.format_id = WINED3DFMT_P8_UINT; - break; - - case 15: - mode.format_id = WINED3DFMT_B5G5R5X1_UNORM; - break; - - case 16: - mode.format_id = WINED3DFMT_B5G6R5_UNORM; - break; - - case 24: - mode.format_id = WINED3DFMT_B8G8R8_UNORM; - break; - - case 32: - mode.format_id = WINED3DFMT_B8G8R8X8_UNORM; - break; - } - mode.width = ddraw->orig_width; - mode.height = ddraw->orig_height; + return hr; } /* No pixelformat given? Use the current screen format */ @@ -2902,19 +2793,13 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD, { struct wined3d_swapchain_desc swapchain_desc; - hr = wined3d_swapchain_get_desc(ddraw->wined3d_swapchain, &swapchain_desc); - if (FAILED(hr)) - { - ERR("Failed to get present parameters.\n"); - return hr; - } - + wined3d_swapchain_get_desc(ddraw->wined3d_swapchain, &swapchain_desc); swapchain_desc.backbuffer_width = mode.width; swapchain_desc.backbuffer_height = mode.height; swapchain_desc.backbuffer_format = mode.format_id; hr = wined3d_device_reset(ddraw->wined3d_device, - &swapchain_desc, NULL, ddraw_reset_enum_callback); + &swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE); if (FAILED(hr)) { ERR("Failed to reset device.\n"); @@ -2923,8 +2808,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD, } /* Create the first surface */ - hr = ddraw_create_surface(ddraw, &desc2, &object, 0, version); - if (FAILED(hr)) + if (FAILED(hr = ddraw_create_surface(ddraw, &desc2, &object, version))) { WARN("ddraw_create_surface failed, hr %#x.\n", hr); return hr; @@ -2951,7 +2835,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD, { struct ddraw_surface *object2 = NULL; - if (FAILED(hr = ddraw_create_surface(ddraw, &desc2, &object2, 0, version))) + if (FAILED(hr = ddraw_create_surface(ddraw, &desc2, &object2, version))) { if (version == 7) IDirectDrawSurface7_Release(&object->IDirectDrawSurface7_iface); @@ -3126,7 +3010,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, if (TRACE_ON(ddraw)) { TRACE(" (%p) Requesting surface desc :\n", iface); - DDRAW_dump_surface_desc((LPDDSURFACEDESC2)surface_desc); + DDRAW_dump_surface_desc((DDSURFACEDESC2 *)surface_desc); } WARN("Application tried to create an explicit front or back buffer\n"); @@ -4535,9 +4419,8 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i) { - hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id, - WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, formats[i], WINED3D_SURFACE_TYPE_OPENGL); - if (SUCCEEDED(hr)) + if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id, + WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, formats[i]))) { DDPIXELFORMAT pformat; @@ -4560,9 +4443,8 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device * while others used dwZBufferBitDepth=32. In either case the pitch matches a 32 bits per * pixel format, so we use dwZBufferBitDepth=32. Some games expect 24. Windows Vista and * newer enumerate both versions, so we do the same(bug 22434) */ - hr = wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id, - WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, WINED3DFMT_X8D24_UNORM, WINED3D_SURFACE_TYPE_OPENGL); - if (SUCCEEDED(hr)) + if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id, + WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, WINED3DFMT_X8D24_UNORM))) { DDPIXELFORMAT x8d24 = { @@ -4788,11 +4670,6 @@ HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d, D3DDEVICEDESC *desc D3DPTFILTERCAPS_MAGFLINEAR | D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC | D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC); - desc7->dpcLineCaps.dwTextureBlendCaps &= ( - D3DPTBLENDCAPS_DECAL | D3DPTBLENDCAPS_MODULATE | D3DPTBLENDCAPS_DECALALPHA | - D3DPTBLENDCAPS_MODULATEALPHA | D3DPTBLENDCAPS_DECALMASK | D3DPTBLENDCAPS_MODULATEMASK | - D3DPTBLENDCAPS_COPY | D3DPTBLENDCAPS_ADD); - desc7->dpcLineCaps.dwTextureAddressCaps &= ( D3DPTADDRESSCAPS_WRAP | D3DPTADDRESSCAPS_MIRROR | D3DPTADDRESSCAPS_CLAMP | D3DPTADDRESSCAPS_BORDER | D3DPTADDRESSCAPS_INDEPENDENTUV); @@ -5216,7 +5093,6 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic struct ddraw *ddraw = ddraw_from_device_parent(device_parent); MONITORINFO monitor_info; HMONITOR monitor; - BOOL ret; RECT *r; TRACE("device_parent %p.\n", device_parent); @@ -5229,7 +5105,7 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic monitor = MonitorFromWindow(ddraw->swapchain_window, MONITOR_DEFAULTTOPRIMARY); monitor_info.cbSize = sizeof(monitor_info); - if (!(ret = GetMonitorInfoW(monitor, &monitor_info))) + if (!GetMonitorInfoW(monitor, &monitor_info)) { ERR("Failed to get monitor info.\n"); return; @@ -5238,14 +5114,14 @@ static void CDECL device_parent_mode_changed(struct wined3d_device_parent *devic r = &monitor_info.rcMonitor; TRACE("Resizing window %p to %s.\n", ddraw->swapchain_window, wine_dbgstr_rect(r)); - if (!(ret = SetWindowPos(ddraw->swapchain_window, HWND_TOP, r->left, r->top, - r->right - r->left, r->bottom - r->top, SWP_SHOWWINDOW | SWP_NOACTIVATE))) + if (!SetWindowPos(ddraw->swapchain_window, HWND_TOP, r->left, r->top, + r->right - r->left, r->bottom - r->top, SWP_SHOWWINDOW | SWP_NOACTIVATE)) ERR("Failed to resize window.\n"); } static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_parent *device_parent, void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, - enum wined3d_pool pool, UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface) + enum wined3d_pool pool, UINT sub_resource_idx, struct wined3d_surface **surface) { struct ddraw *ddraw = ddraw_from_device_parent(device_parent); struct ddraw_surface *tex_root = container_parent; @@ -5254,11 +5130,11 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_ HRESULT hr; TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n" - "\tpool %#x, level %u, face %u, surface %p.\n", - device_parent, container_parent, width, height, format, usage, pool, level, face, surface); + "\tpool %#x, sub_resource_idx %u, surface %p.\n", + device_parent, container_parent, width, height, format, usage, pool, sub_resource_idx, surface); /* The ddraw root surface is created before the wined3d texture. */ - if (!level && face == WINED3D_CUBEMAP_FACE_POSITIVE_X) + if (!sub_resource_idx) { ddraw_surface = tex_root; goto done; @@ -5266,50 +5142,9 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_ desc.dwWidth = width; desc.dwHeight = height; - if (level) - desc.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL; - else - desc.ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; - - if (desc.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) - { - desc.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES; - - switch (face) - { - case WINED3D_CUBEMAP_FACE_POSITIVE_X: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX; - break; - - case WINED3D_CUBEMAP_FACE_NEGATIVE_X: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; - break; - - case WINED3D_CUBEMAP_FACE_POSITIVE_Y: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; - break; - - case WINED3D_CUBEMAP_FACE_NEGATIVE_Y: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; - break; - - case WINED3D_CUBEMAP_FACE_POSITIVE_Z: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; - break; - - case WINED3D_CUBEMAP_FACE_NEGATIVE_Z: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; - break; - - default: - ERR("Unexpected cube face.\n"); - return DDERR_INVALIDPARAMS; - } - - } /* FIXME: Validate that format, usage, pool, etc. really make sense. */ - if (FAILED(hr = ddraw_create_surface(ddraw, &desc, &ddraw_surface, level, tex_root->version))) + if (FAILED(hr = ddraw_create_surface(ddraw, &desc, &ddraw_surface, tex_root->version))) return hr; done: @@ -5348,9 +5183,9 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic return E_FAIL; } - if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id, 0, - usage, WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, DefaultSurfaceType, - WINED3D_SURFACE_MAPPABLE, ddraw, &ddraw_frontbuffer_parent_ops, surface))) + if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id, usage, + WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, WINED3D_SURFACE_MAPPABLE, + ddraw, &ddraw_frontbuffer_parent_ops, surface))) ddraw->wined3d_frontbuffer = *surface; return hr; @@ -5384,9 +5219,8 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent return E_FAIL; } - hr = wined3d_swapchain_create(ddraw->wined3d_device, desc, - DefaultSurfaceType, NULL, &ddraw_null_wined3d_parent_ops, swapchain); - if (FAILED(hr)) + if (FAILED(hr = wined3d_swapchain_create(ddraw->wined3d_device, desc, NULL, + &ddraw_null_wined3d_parent_ops, swapchain))) WARN("Failed to create swapchain, hr %#x.\n", hr); return hr; @@ -5404,8 +5238,8 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops = HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) { + DWORD flags; HRESULT hr; - HDC hDC; ddraw->IDirectDraw7_iface.lpVtbl = &ddraw7_vtbl; ddraw->IDirectDraw_iface.lpVtbl = &ddraw1_vtbl; @@ -5419,18 +5253,20 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) ddraw->numIfaces = 1; ddraw->ref7 = 1; - /* Get the current screen settings. */ - hDC = GetDC(0); - ddraw->orig_bpp = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES); - ReleaseDC(0, hDC); - ddraw->orig_width = GetSystemMetrics(SM_CXSCREEN); - ddraw->orig_height = GetSystemMetrics(SM_CYSCREEN); + flags = WINED3D_LEGACY_DEPTH_BIAS; + if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL) + flags |= WINED3D_NO3D; - ddraw->wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS); - if (!ddraw->wined3d) + if (!(ddraw->wined3d = wined3d_create(7, flags))) { - WARN("Failed to create a wined3d object.\n"); - return E_OUTOFMEMORY; + if ((flags & WINED3D_NO3D) || !(ddraw->wined3d = wined3d_create(7, flags | WINED3D_NO3D))) + { + WARN("Failed to create a wined3d object.\n"); + return E_FAIL; + } + + WARN("Created a wined3d object without 3D support.\n"); + DefaultSurfaceType = DDRAW_SURFACE_TYPE_GDI; } hr = wined3d_device_create(ddraw->wined3d, WINED3DADAPTER_DEFAULT, device_type, diff --git a/reactos/dll/directx/wine/ddraw/ddraw_private.h b/reactos/dll/directx/wine/ddraw/ddraw_private.h index 3fe2dbb3dc1..25985bdfc0a 100644 --- a/reactos/dll/directx/wine/ddraw/ddraw_private.h +++ b/reactos/dll/directx/wine/ddraw/ddraw_private.h @@ -19,29 +19,32 @@ #ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #include #define COBJMACROS #define NONAMELESSSTRUCT #define NONAMELESSUNION -#include +#include "wine/debug.h" -#include -#include -#include -#include +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" -#include -//#include "ddraw.h" +#include "d3d.h" +#include "ddraw.h" #ifdef DDRAW_INIT_GUID -#include +#include "initguid.h" #endif -#include -#include +#include "wine/list.h" +#include "wine/wined3d.h" + +enum ddraw_surface_type +{ + DDRAW_SURFACE_TYPE_OPENGL, + DDRAW_SURFACE_TYPE_GDI, +}; extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN; +extern enum ddraw_surface_type DefaultSurfaceType DECLSPEC_HIDDEN; extern DWORD force_refresh_rate DECLSPEC_HIDDEN; /***************************************************************************** @@ -72,7 +75,8 @@ struct ddraw struct wined3d *wined3d; struct wined3d_device *wined3d_device; - BOOL d3d_initialized; + BOOL d3d_initialized; + BOOL restore_mode; struct ddraw_surface *primary; RECT primary_lock; @@ -83,9 +87,6 @@ struct ddraw /* DirectDraw things, which are not handled by WineD3D */ DWORD cooperative_level; - DWORD orig_width, orig_height; - DWORD orig_bpp; - /* D3D things */ HWND d3d_window; struct d3d_device *d3ddevice; @@ -125,13 +126,6 @@ void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut) DECLSPEC_H void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN; struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *ddraw, DWORD fvf) DECLSPEC_HIDDEN; -/* The default surface type */ -extern enum wined3d_surface_type DefaultSurfaceType DECLSPEC_HIDDEN; - -/***************************************************************************** - * IDirectDrawSurface implementation structure - *****************************************************************************/ - struct ddraw_surface { /* IUnknown fields */ @@ -191,7 +185,7 @@ struct ddraw_surface HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface) DECLSPEC_HIDDEN; HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, - DDSURFACEDESC2 *desc, UINT mip_level, UINT version) DECLSPEC_HIDDEN; + DDSURFACEDESC2 *desc, UINT version) DECLSPEC_HIDDEN; ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN; static inline struct ddraw_surface *impl_from_IDirect3DTexture(IDirect3DTexture *iface) @@ -281,9 +275,16 @@ struct d3d_device IUnknown *outer_unknown; struct wined3d_device *wined3d_device; struct ddraw *ddraw; - struct wined3d_buffer *indexbuffer; struct ddraw_surface *target; + struct wined3d_buffer *index_buffer; + UINT index_buffer_size; + UINT index_buffer_pos; + + struct wined3d_buffer *vertex_buffer; + UINT vertex_buffer_size; + UINT vertex_buffer_pos; + /* Viewport management */ struct list viewport_list; struct d3d_viewport *current_viewport; @@ -303,7 +304,7 @@ struct d3d_device DWORD vertex_type; DWORD render_flags; DWORD nb_vertices; - LPBYTE vertex_buffer; + LPBYTE sysmem_vertex_buffer; DWORD vertex_size; DWORD buffer_size; @@ -498,7 +499,8 @@ struct d3d_execute_buffer /* This buffer will store the transformed vertices */ void *vertex_data; WORD *indices; - int nb_indices; + unsigned int nb_indices; + unsigned int nb_vertices; /* This flags is set to TRUE if we allocated ourselves the * data buffer @@ -531,6 +533,10 @@ struct d3d_vertex_buffer /*** Storage for D3D7 specific things ***/ DWORD Caps; DWORD fvf; + DWORD size; + BOOL dynamic; + + BOOL read_since_last_map; }; HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, @@ -559,9 +565,7 @@ void DDRAW_dump_cooperativelevel(DWORD cooplevel) DECLSPEC_HIDDEN; void DDSD_to_DDSD2(const DDSURFACEDESC *in, DDSURFACEDESC2 *out) DECLSPEC_HIDDEN; void DDSD2_to_DDSD(const DDSURFACEDESC2 *in, DDSURFACEDESC *out) DECLSPEC_HIDDEN; -/* This only needs to be here as long the processvertices functionality of - * IDirect3DExecuteBuffer isn't in WineD3D */ -void multiply_matrix(LPD3DMATRIX dest, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN; +void multiply_matrix(D3DMATRIX *dst, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN; /* Used for generic dumping */ struct flag_info diff --git a/reactos/dll/directx/wine/ddraw/device.c b/reactos/dll/directx/wine/ddraw/device.c index d12a70e8f3e..930cd23d082 100644 --- a/reactos/dll/directx/wine/ddraw/device.c +++ b/reactos/dll/directx/wine/ddraw/device.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1998-2004 Lionel Ulmer * Copyright (c) 2002-2005 Christian Costa - * Copyright (c) 2006 Stefan Dösinger + * Copyright (c) 2006-2009, 2011-2012 Stefan Dösinger * Copyright (c) 2008 Alexander Dorofeyev * * This library is free software; you can redistribute it and/or @@ -27,8 +27,8 @@ * */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -233,14 +233,17 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface) if (!ref) { DWORD i; + struct list *vp_entry, *vp_entry2; wined3d_mutex_lock(); /* There is no need to unset any resources here, wined3d will take * care of that on uninit_3d(). */ - /* Free the index buffer. */ - wined3d_buffer_decref(This->indexbuffer); + if (This->index_buffer) + wined3d_buffer_decref(This->index_buffer); + if (This->vertex_buffer) + wined3d_buffer_decref(This->vertex_buffer); /* Set the device up to render to the front buffer since the back * buffer will vanish soon. */ @@ -302,6 +305,12 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface) ddraw_handle_table_destroy(&This->handle_table); + LIST_FOR_EACH_SAFE(vp_entry, vp_entry2, &This->viewport_list) + { + struct d3d_viewport *vp = LIST_ENTRY(vp_entry, struct d3d_viewport, entry); + IDirect3DDevice3_DeleteViewport(&This->IDirect3DDevice3_iface, &vp->IDirect3DViewport3_iface); + } + TRACE("Releasing target %p.\n", This->target); /* Release the render target. */ if (This->version != 1) @@ -756,6 +765,7 @@ static HRESULT WINAPI d3d_device3_AddViewport(IDirect3DDevice3 *iface, IDirect3D return DDERR_INVALIDPARAMS; wined3d_mutex_lock(); + IDirect3DViewport3_AddRef(viewport); list_add_head(&device->viewport_list, &vp->entry); /* Viewport must be usable for Clear() after AddViewport, so set active_device here. */ vp->active_device = device; @@ -808,6 +818,12 @@ static HRESULT WINAPI d3d_device3_DeleteViewport(IDirect3DDevice3 *iface, IDirec TRACE("iface %p, viewport %p.\n", iface, viewport); + if (!vp) + { + WARN("NULL viewport, returning DDERR_INVALIDPARAMS\n"); + return DDERR_INVALIDPARAMS; + } + wined3d_mutex_lock(); if (vp->active_device != device) @@ -817,9 +833,18 @@ static HRESULT WINAPI d3d_device3_DeleteViewport(IDirect3DDevice3 *iface, IDirec return DDERR_INVALIDPARAMS; } + if (device->current_viewport == vp) + { + TRACE("Deleting current viewport, unsetting and releasing\n"); + IDirect3DViewport3_Release(viewport); + device->current_viewport = NULL; + } + vp->active_device = NULL; list_remove(&vp->entry); + IDirect3DViewport3_Release(viewport); + wined3d_mutex_unlock(); return D3D_OK; @@ -832,7 +857,8 @@ static HRESULT WINAPI d3d_device2_DeleteViewport(IDirect3DDevice2 *iface, IDirec TRACE("iface %p, viewport %p.\n", iface, viewport); - return d3d_device3_DeleteViewport(&device->IDirect3DDevice3_iface, &vp->IDirect3DViewport3_iface); + return d3d_device3_DeleteViewport(&device->IDirect3DDevice3_iface, + vp ? &vp->IDirect3DViewport3_iface : NULL); } static HRESULT WINAPI d3d_device1_DeleteViewport(IDirect3DDevice *iface, IDirect3DViewport *viewport) @@ -842,7 +868,8 @@ static HRESULT WINAPI d3d_device1_DeleteViewport(IDirect3DDevice *iface, IDirect TRACE("iface %p, viewport %p.\n", iface, viewport); - return d3d_device3_DeleteViewport(&device->IDirect3DDevice3_iface, &vp->IDirect3DViewport3_iface); + return d3d_device3_DeleteViewport(&device->IDirect3DDevice3_iface, + vp ? &vp->IDirect3DViewport3_iface : NULL); } /***************************************************************************** @@ -1077,9 +1104,8 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface, for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i) { - hr = wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, - mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i], WINED3D_SURFACE_TYPE_OPENGL); - if (hr == D3D_OK) + if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, + mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i]) == D3D_OK) { DDPIXELFORMAT pformat; @@ -1100,10 +1126,9 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface, for (i = 0; i < sizeof(BumpFormatList) / sizeof(*BumpFormatList); ++i) { - hr = wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, + if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, mode.format_id, WINED3DUSAGE_QUERY_LEGACYBUMPMAP, - WINED3D_RTYPE_TEXTURE, BumpFormatList[i], WINED3D_SURFACE_TYPE_OPENGL); - if (hr == D3D_OK) + WINED3D_RTYPE_TEXTURE, BumpFormatList[i]) == D3D_OK) { DDPIXELFORMAT pformat; @@ -1207,9 +1232,8 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface, for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i) { - hr = wined3d_check_device_format(device->ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL, - mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i], WINED3D_SURFACE_TYPE_OPENGL); - if (hr == D3D_OK) + if (wined3d_check_device_format(device->ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL, + mode.format_id, 0, WINED3D_RTYPE_TEXTURE, FormatList[i]) == D3D_OK) { DDSURFACEDESC sdesc; @@ -1689,9 +1713,15 @@ static HRESULT WINAPI d3d_device3_SetCurrentViewport(IDirect3DDevice3 *iface, ID TRACE("iface %p, viewport %p.\n", iface, Direct3DViewport3); + if (!vp) + { + WARN("Direct3DViewport3 is NULL, returning DDERR_INVALIDPARAMS\n"); + return DDERR_INVALIDPARAMS; + } + wined3d_mutex_lock(); /* Do nothing if the specified viewport is the same as the current one */ - if (This->current_viewport == vp ) + if (This->current_viewport == vp) { wined3d_mutex_unlock(); return D3D_OK; @@ -1731,7 +1761,8 @@ static HRESULT WINAPI d3d_device2_SetCurrentViewport(IDirect3DDevice2 *iface, ID TRACE("iface %p, viewport %p.\n", iface, viewport); - return d3d_device3_SetCurrentViewport(&device->IDirect3DDevice3_iface, &vp->IDirect3DViewport3_iface); + return d3d_device3_SetCurrentViewport(&device->IDirect3DDevice3_iface, + vp ? &vp->IDirect3DViewport3_iface : NULL); } /***************************************************************************** @@ -1755,20 +1786,19 @@ static HRESULT WINAPI d3d_device3_GetCurrentViewport(IDirect3DDevice3 *iface, ID TRACE("iface %p, viewport %p.\n", iface, viewport); - if (!viewport) - return DDERR_INVALIDPARAMS; - wined3d_mutex_lock(); - *viewport = &device->current_viewport->IDirect3DViewport3_iface; + if (!device->current_viewport) + { + wined3d_mutex_unlock(); + WARN("No current viewport, returning D3DERR_NOCURRENTVIEWPORT\n"); + return D3DERR_NOCURRENTVIEWPORT; + } - /* AddRef the returned viewport */ - if (*viewport) - IDirect3DViewport3_AddRef(*viewport); + *viewport = &device->current_viewport->IDirect3DViewport3_iface; + IDirect3DViewport3_AddRef(*viewport); TRACE("Returning interface %p.\n", *viewport); - wined3d_mutex_unlock(); - return D3D_OK; } @@ -2106,16 +2136,16 @@ static HRESULT WINAPI d3d_device3_Vertex(IDirect3DDevice3 *iface, void *vertex) BYTE *old_buffer; device->buffer_size = device->buffer_size ? device->buffer_size * 2 : device->vertex_size * 3; - old_buffer = device->vertex_buffer; - device->vertex_buffer = HeapAlloc(GetProcessHeap(), 0, device->buffer_size); + old_buffer = device->sysmem_vertex_buffer; + device->sysmem_vertex_buffer = HeapAlloc(GetProcessHeap(), 0, device->buffer_size); if (old_buffer) { - memcpy(device->vertex_buffer, old_buffer, device->nb_vertices * device->vertex_size); + memcpy(device->sysmem_vertex_buffer, old_buffer, device->nb_vertices * device->vertex_size); HeapFree(GetProcessHeap(), 0, old_buffer); } } - memcpy(device->vertex_buffer + device->nb_vertices++ * device->vertex_size, vertex, device->vertex_size); + memcpy(device->sysmem_vertex_buffer + device->nb_vertices++ * device->vertex_size, vertex, device->vertex_size); wined3d_mutex_unlock(); return D3D_OK; @@ -2184,7 +2214,7 @@ static HRESULT WINAPI d3d_device3_End(IDirect3DDevice3 *iface, DWORD flags) TRACE("iface %p, flags %#x.\n", iface, flags); return IDirect3DDevice7_DrawPrimitive(&device->IDirect3DDevice7_iface, device->primitive_type, - device->vertex_type, device->vertex_buffer, device->nb_vertices, device->render_flags); + device->vertex_type, device->sysmem_vertex_buffer, device->nb_vertices, device->render_flags); } static HRESULT WINAPI d3d_device2_End(IDirect3DDevice2 *iface, DWORD flags) @@ -2217,7 +2247,7 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface, D3DRENDERSTATETYPE state, DWORD *value) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, state %#x, value %p.\n", iface, state, value); @@ -2231,8 +2261,7 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface, { enum wined3d_texture_filter_type tex_mag; - hr = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, &tex_mag); - + tex_mag = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER); switch (tex_mag) { case WINED3D_TEXF_POINT: @@ -2253,16 +2282,8 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface, enum wined3d_texture_filter_type tex_min; enum wined3d_texture_filter_type tex_mip; - hr = wined3d_device_get_sampler_state(device->wined3d_device, - 0, WINED3D_SAMP_MIN_FILTER, &tex_min); - if (FAILED(hr)) - { - wined3d_mutex_unlock(); - return hr; - } - hr = wined3d_device_get_sampler_state(device->wined3d_device, - 0, WINED3D_SAMP_MIP_FILTER, &tex_mip); - + tex_min = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MIN_FILTER); + tex_mip = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MIP_FILTER); switch (tex_min) { case WINED3D_TEXF_POINT: @@ -2311,12 +2332,10 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface, case D3DRENDERSTATE_TEXTUREADDRESS: case D3DRENDERSTATE_TEXTUREADDRESSU: - hr = wined3d_device_get_sampler_state(device->wined3d_device, - 0, WINED3D_SAMP_ADDRESS_U, value); + *value = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_ADDRESS_U); break; case D3DRENDERSTATE_TEXTUREADDRESSV: - hr = wined3d_device_get_sampler_state(device->wined3d_device, - 0, WINED3D_SAMP_ADDRESS_V, value); + *value = wined3d_device_get_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_ADDRESS_V); break; case D3DRENDERSTATE_BORDERCOLOR: @@ -2331,7 +2350,7 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface, break; case D3DRENDERSTATE_ZBIAS: - hr = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); + *value = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS); break; default: @@ -2342,7 +2361,7 @@ static HRESULT d3d_device7_GetRenderState(IDirect3DDevice7 *iface, hr = E_NOTIMPL; break; } - hr = wined3d_device_get_render_state(device->wined3d_device, state, value); + *value = wined3d_device_get_render_state(device->wined3d_device, state); } wined3d_mutex_unlock(); @@ -2372,7 +2391,6 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface, D3DRENDERSTATETYPE state, DWORD *value) { struct d3d_device *device = impl_from_IDirect3DDevice3(iface); - HRESULT hr; TRACE("iface %p, state %#x, value %p.\n", iface, state, value); @@ -2386,19 +2404,17 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface, *value = 0; wined3d_mutex_lock(); - hr = wined3d_device_get_texture(device->wined3d_device, 0, &tex); - if (SUCCEEDED(hr) && tex) + if ((tex = wined3d_device_get_texture(device->wined3d_device, 0))) { /* The parent of the texture is the IDirectDrawSurface7 * interface of the ddraw surface. */ struct ddraw_surface *parent = wined3d_texture_get_parent(tex); if (parent) *value = parent->Handle; - wined3d_texture_decref(tex); } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } case D3DRENDERSTATE_TEXTUREMAPBLEND: @@ -2412,12 +2428,12 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface, device->legacyTextureBlending = TRUE; - wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_COLOR_OP, &colorop); - wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_COLOR_ARG1, &colorarg1); - wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_COLOR_ARG2, &colorarg2); - wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_ALPHA_OP, &alphaop); - wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG1, &alphaarg1); - wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG2, &alphaarg2); + colorop = wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_COLOR_OP); + colorarg1 = wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_COLOR_ARG1); + colorarg2 = wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_COLOR_ARG2); + alphaop = wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_ALPHA_OP); + alphaarg1 = wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG1); + alphaarg2 = wined3d_device_get_texture_stage_state(device->wined3d_device, 0, WINED3D_TSS_ALPHA_ARG2); if (colorop == WINED3D_TOP_SELECT_ARG1 && colorarg1 == WINED3DTA_TEXTURE && alphaop == WINED3D_TOP_SELECT_ARG1 && alphaarg1 == WINED3DTA_TEXTURE) @@ -2434,13 +2450,10 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface, else { struct wined3d_texture *tex = NULL; - HRESULT hr; BOOL tex_alpha = FALSE; DDPIXELFORMAT ddfmt; - hr = wined3d_device_get_texture(device->wined3d_device, 0, &tex); - - if(hr == WINED3D_OK && tex) + if ((tex = wined3d_device_get_texture(device->wined3d_device, 0))) { struct wined3d_resource *sub_resource; @@ -2453,8 +2466,6 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface, PixelFormat_WineD3DtoDD(&ddfmt, desc.format); if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; } - - wined3d_texture_decref(tex); } if (!(colorop == WINED3D_TOP_MODULATE @@ -2507,7 +2518,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, D3DRENDERSTATETYPE state, DWORD value) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; + HRESULT hr = D3D_OK; TRACE("iface %p, state %#x, value %#x.\n", iface, state, value); @@ -2550,7 +2561,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, break; } - hr = wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, tex_mag); + wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MAG_FILTER, tex_mag); break; } @@ -2595,7 +2606,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MIP_FILTER, tex_mip); - hr = wined3d_device_set_sampler_state(device->wined3d_device, + wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_MIN_FILTER, tex_min); break; } @@ -2605,11 +2616,11 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, 0, WINED3D_SAMP_ADDRESS_V, value); /* Drop through */ case D3DRENDERSTATE_TEXTUREADDRESSU: - hr = wined3d_device_set_sampler_state(device->wined3d_device, + wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_ADDRESS_U, value); break; case D3DRENDERSTATE_TEXTUREADDRESSV: - hr = wined3d_device_set_sampler_state(device->wined3d_device, + wined3d_device_set_sampler_state(device->wined3d_device, 0, WINED3D_SAMP_ADDRESS_V, value); break; @@ -2627,7 +2638,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, break; case D3DRENDERSTATE_ZBIAS: - hr = wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DEPTHBIAS, value); break; default: @@ -2639,7 +2650,7 @@ static HRESULT d3d_device7_SetRenderState(IDirect3DDevice7 *iface, break; } - hr = wined3d_device_set_render_state(device->wined3d_device, state, value); + wined3d_device_set_render_state(device->wined3d_device, state, value); break; } wined3d_mutex_unlock(); @@ -2731,9 +2742,7 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface, BOOL tex_alpha = FALSE; DDPIXELFORMAT ddfmt; - hr = wined3d_device_get_texture(device->wined3d_device, 0, &tex); - - if(hr == WINED3D_OK && tex) + if ((tex = wined3d_device_get_texture(device->wined3d_device, 0))) { struct wined3d_resource *sub_resource; @@ -2746,8 +2755,6 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface, PixelFormat_WineD3DtoDD(&ddfmt, desc.format); if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; } - - wined3d_texture_decref(tex); } if (tex_alpha) @@ -3080,7 +3087,6 @@ static HRESULT d3d_device7_SetTransform(IDirect3DDevice7 *iface, { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); enum wined3d_transform_state wined3d_state; - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); @@ -3107,10 +3113,10 @@ static HRESULT d3d_device7_SetTransform(IDirect3DDevice7 *iface, /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_set_transform(device->wined3d_device, wined3d_state, (struct wined3d_matrix *)matrix); + wined3d_device_set_transform(device->wined3d_device, wined3d_state, (struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_SetTransform_FPUSetup(IDirect3DDevice7 *iface, @@ -3145,17 +3151,15 @@ static HRESULT WINAPI d3d_device3_SetTransform(IDirect3DDevice3 *iface, if (state == D3DTRANSFORMSTATE_PROJECTION) { D3DMATRIX projection; - HRESULT hr; wined3d_mutex_lock(); multiply_matrix(&projection, &device->legacy_clipspace, matrix); - hr = wined3d_device_set_transform(device->wined3d_device, + wined3d_device_set_transform(device->wined3d_device, WINED3D_TS_PROJECTION, (struct wined3d_matrix *)&projection); - if (SUCCEEDED(hr)) - device->legacy_projection = *matrix; + device->legacy_projection = *matrix; wined3d_mutex_unlock(); - return hr; + return D3D_OK; } return IDirect3DDevice7_SetTransform(&device->IDirect3DDevice7_iface, state, matrix); @@ -3193,7 +3197,6 @@ static HRESULT d3d_device7_GetTransform(IDirect3DDevice7 *iface, { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); enum wined3d_transform_state wined3d_state; - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); @@ -3220,10 +3223,10 @@ static HRESULT d3d_device7_GetTransform(IDirect3DDevice7 *iface, /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_get_transform(device->wined3d_device, wined3d_state, (struct wined3d_matrix *)matrix); + wined3d_device_get_transform(device->wined3d_device, wined3d_state, (struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_GetTransform_FPUSetup(IDirect3DDevice7 *iface, @@ -3299,7 +3302,6 @@ static HRESULT d3d_device7_MultiplyTransform(IDirect3DDevice7 *iface, { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); enum wined3d_transform_state wined3d_state; - HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, state, matrix); @@ -3323,11 +3325,11 @@ static HRESULT d3d_device7_MultiplyTransform(IDirect3DDevice7 *iface, /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ wined3d_mutex_lock(); - hr = wined3d_device_multiply_transform(device->wined3d_device, + wined3d_device_multiply_transform(device->wined3d_device, wined3d_state, (struct wined3d_matrix *)matrix); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_MultiplyTransform_FPUSetup(IDirect3DDevice7 *iface, @@ -3359,18 +3361,16 @@ static HRESULT WINAPI d3d_device3_MultiplyTransform(IDirect3DDevice3 *iface, if (state == D3DTRANSFORMSTATE_PROJECTION) { D3DMATRIX projection, tmp; - HRESULT hr; wined3d_mutex_lock(); multiply_matrix(&tmp, &device->legacy_projection, matrix); multiply_matrix(&projection, &device->legacy_clipspace, &tmp); - hr = wined3d_device_set_transform(device->wined3d_device, + wined3d_device_set_transform(device->wined3d_device, WINED3D_TS_PROJECTION, (struct wined3d_matrix *)&projection); - if (SUCCEEDED(hr)) - device->legacy_projection = tmp; + device->legacy_projection = tmp; wined3d_mutex_unlock(); - return hr; + return D3D_OK; } return IDirect3DDevice7_MultiplyTransform(&device->IDirect3DDevice7_iface, state, matrix); @@ -3407,13 +3407,45 @@ static HRESULT WINAPI d3d_device2_MultiplyTransform(IDirect3DDevice2 *iface, * For details, see IWineD3DDevice::DrawPrimitiveUP * *****************************************************************************/ + +/* The caller is responsible for wined3d locking */ +static HRESULT d3d_device_prepare_vertex_buffer(struct d3d_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->vertex_buffer_size < min_size || !device->vertex_buffer) + { + UINT size = max(device->vertex_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing vertex buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_vb(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_vb failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->vertex_buffer) + wined3d_buffer_decref(device->vertex_buffer); + + device->vertex_buffer = buffer; + device->vertex_buffer_size = size; + device->vertex_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface, D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count, DWORD flags) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - UINT stride; + UINT stride, vb_pos, size, align; HRESULT hr; + BYTE *data; TRACE("iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, flags %#x.\n", iface, primitive_type, fvf, vertices, vertex_count, flags); @@ -3423,21 +3455,39 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface, /* Get the stride */ stride = get_flexible_vertex_size(fvf); + size = vertex_count * stride; - /* Set the FVF */ wined3d_mutex_lock(); - hr = wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf)); - if (hr != D3D_OK) - { - wined3d_mutex_unlock(); - return hr; - } + hr = d3d_device_prepare_vertex_buffer(device, size); + if (FAILED(hr)) + goto done; - /* This method translates to the user pointer draw of WineD3D */ + vb_pos = device->vertex_buffer_pos; + align = vb_pos % stride; + if (align) align = stride - align; + if (vb_pos + size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, size, &data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(data, vertices, size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride); + if (FAILED(hr)) + goto done; + + wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf)); wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_primitive_up(device->wined3d_device, vertex_count, vertices, stride); - wined3d_mutex_unlock(); + hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vertex_count); +done: + wined3d_mutex_unlock(); return hr; } @@ -3523,12 +3573,45 @@ static HRESULT WINAPI d3d_device2_DrawPrimitive(IDirect3DDevice2 *iface, * For details, see IWineD3DDevice::DrawIndexedPrimitiveUP * *****************************************************************************/ +/* The caller is responsible for wined3d locking */ +static HRESULT d3d_device_prepare_index_buffer(struct d3d_device *device, UINT min_size) +{ + HRESULT hr; + + if (device->index_buffer_size < min_size || !device->index_buffer) + { + UINT size = max(device->index_buffer_size * 2, min_size); + struct wined3d_buffer *buffer; + + TRACE("Growing index buffer to %u bytes\n", size); + + hr = wined3d_buffer_create_ib(device->wined3d_device, size, WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, + WINED3D_POOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &buffer); + if (FAILED(hr)) + { + ERR("(%p) wined3d_buffer_create_ib failed with hr = %08x\n", device, hr); + return hr; + } + + if (device->index_buffer) + wined3d_buffer_decref(device->index_buffer); + device->index_buffer = buffer; + device->index_buffer_size = size; + device->index_buffer_pos = 0; + } + return D3D_OK; +} + static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, D3DPRIMITIVETYPE primitive_type, DWORD fvf, void *vertices, DWORD vertex_count, WORD *indices, DWORD index_count, DWORD flags) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); HRESULT hr; + UINT stride = get_flexible_vertex_size(fvf); + UINT vtx_size = stride * vertex_count, idx_size = index_count * sizeof(*indices); + UINT vb_pos, ib_pos, align; + BYTE *data; TRACE("iface %p, primitive_type %#x, fvf %#x, vertices %p, vertex_count %u, " "indices %p, index_count %u, flags %#x.\n", @@ -3536,19 +3619,54 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, /* Set the D3DDevice's FVF */ wined3d_mutex_lock(); - hr = wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf)); + + hr = d3d_device_prepare_vertex_buffer(device, vtx_size); if (FAILED(hr)) - { - WARN("Failed to set vertex declaration, hr %#x.\n", hr); - wined3d_mutex_unlock(); - return hr; - } + goto done; + vb_pos = device->vertex_buffer_pos; + align = vb_pos % stride; + if (align) align = stride - align; + if (vb_pos + vtx_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(data, vertices, vtx_size); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + vtx_size; + + hr = d3d_device_prepare_index_buffer(device, idx_size); + if (FAILED(hr)) + goto done; + ib_pos = device->index_buffer_pos; + if (device->index_buffer_size - idx_size < ib_pos) + ib_pos = 0; + + hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &data, + ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(data, indices, idx_size); + wined3d_buffer_unmap(device->index_buffer); + device->index_buffer_pos = ib_pos + idx_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride); + if (FAILED(hr)) + goto done; + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, WINED3DFMT_R16_UINT); + + wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, fvf)); wined3d_device_set_primitive_type(device->wined3d_device, primitive_type); - hr = wined3d_device_draw_indexed_primitive_up(device->wined3d_device, index_count, indices, - WINED3DFMT_R16_UINT, vertices, get_flexible_vertex_size(fvf)); - wined3d_mutex_unlock(); + wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / stride); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(*indices), index_count); +done: + wined3d_mutex_unlock(); return hr; } @@ -3719,82 +3837,106 @@ static HRESULT WINAPI d3d_device2_GetClipStatus(IDirect3DDevice2 *iface, D3DCLIP * (For details, see IWineD3DDevice::DrawPrimitiveStrided) * *****************************************************************************/ +static void pack_strided_data(BYTE *dst, DWORD count, const D3DDRAWPRIMITIVESTRIDEDDATA *src, DWORD fvf) +{ + DWORD i, tex, offset; + + for (i = 0; i < count; i++) + { + /* The contents of the strided data are determined by the fvf, + * not by the members set in src. So it's valid + * to have diffuse.lpvData set to 0xdeadbeef if the diffuse flag is + * not set in the fvf. */ + if (fvf & D3DFVF_POSITION_MASK) + { + offset = i * src->position.dwStride; + if (fvf & D3DFVF_XYZRHW) + { + memcpy(dst, ((BYTE *)src->position.lpvData) + offset, 4 * sizeof(float)); + dst += 4 * sizeof(float); + } + else + { + memcpy(dst, ((BYTE *)src->position.lpvData) + offset, 3 * sizeof(float)); + dst += 3 * sizeof(float); + } + } + + if (fvf & D3DFVF_NORMAL) + { + offset = i * src->normal.dwStride; + memcpy(dst, ((BYTE *)src->normal.lpvData) + offset, 3 * sizeof(float)); + dst += 3 * sizeof(float); + } + + if (fvf & D3DFVF_DIFFUSE) + { + offset = i * src->diffuse.dwStride; + memcpy(dst, ((BYTE *)src->diffuse.lpvData) + offset, sizeof(DWORD)); + dst += sizeof(DWORD); + } + + if (fvf & D3DFVF_SPECULAR) + { + offset = i * src->specular.dwStride; + memcpy(dst, ((BYTE *)src->specular.lpvData) + offset, sizeof(DWORD)); + dst += sizeof(DWORD); + } + + for (tex = 0; tex < GET_TEXCOUNT_FROM_FVF(fvf); ++tex) + { + DWORD attrib_count = GET_TEXCOORD_SIZE_FROM_FVF(fvf, tex); + offset = i * src->textureCoords[tex].dwStride; + memcpy(dst, ((BYTE *)src->textureCoords[tex].lpvData) + offset, attrib_count * sizeof(float)); + dst += attrib_count * sizeof(float); + } + } +} + static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIMITIVETYPE PrimitiveType, DWORD VertexType, D3DDRAWPRIMITIVESTRIDEDDATA *D3DDrawPrimStrideData, DWORD VertexCount, DWORD Flags) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - struct wined3d_strided_data wined3d_strided; - DWORD i; HRESULT hr; + UINT dst_stride = get_flexible_vertex_size(VertexType); + UINT dst_size = dst_stride * VertexCount; + UINT vb_pos, align; + BYTE *dst_data; TRACE("iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, flags %#x.\n", iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Flags); - memset(&wined3d_strided, 0, sizeof(wined3d_strided)); - /* Get the strided data right. the wined3d structure is a bit bigger - * Watch out: The contents of the strided data are determined by the fvf, - * not by the members set in D3DDrawPrimStrideData. So it's valid - * to have diffuse.lpvData set to 0xdeadbeef if the diffuse flag is - * not set in the fvf. - */ - if(VertexType & D3DFVF_POSITION_MASK) - { - wined3d_strided.position.format = WINED3DFMT_R32G32B32_FLOAT; - wined3d_strided.position.data = D3DDrawPrimStrideData->position.lpvData; - wined3d_strided.position.stride = D3DDrawPrimStrideData->position.dwStride; - if (VertexType & D3DFVF_XYZRHW) - { - wined3d_strided.position.format = WINED3DFMT_R32G32B32A32_FLOAT; - wined3d_strided.position_transformed = TRUE; - } - else - { - wined3d_strided.position_transformed = FALSE; - } - } - - if (VertexType & D3DFVF_NORMAL) - { - wined3d_strided.normal.format = WINED3DFMT_R32G32B32_FLOAT; - wined3d_strided.normal.data = D3DDrawPrimStrideData->normal.lpvData; - wined3d_strided.normal.stride = D3DDrawPrimStrideData->normal.dwStride; - } - - if (VertexType & D3DFVF_DIFFUSE) - { - wined3d_strided.diffuse.format = WINED3DFMT_B8G8R8A8_UNORM; - wined3d_strided.diffuse.data = D3DDrawPrimStrideData->diffuse.lpvData; - wined3d_strided.diffuse.stride = D3DDrawPrimStrideData->diffuse.dwStride; - } - - if (VertexType & D3DFVF_SPECULAR) - { - wined3d_strided.specular.format = WINED3DFMT_B8G8R8A8_UNORM; - wined3d_strided.specular.data = D3DDrawPrimStrideData->specular.lpvData; - wined3d_strided.specular.stride = D3DDrawPrimStrideData->specular.dwStride; - } - - for (i = 0; i < GET_TEXCOUNT_FROM_FVF(VertexType); ++i) - { - switch (GET_TEXCOORD_SIZE_FROM_FVF(VertexType, i)) - { - case 1: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32_FLOAT; break; - case 2: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32G32_FLOAT; break; - case 3: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32G32B32_FLOAT; break; - case 4: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32G32B32A32_FLOAT; break; - default: ERR("Unexpected texture coordinate size %d\n", - GET_TEXCOORD_SIZE_FROM_FVF(VertexType, i)); - } - wined3d_strided.tex_coords[i].data = D3DDrawPrimStrideData->textureCoords[i].lpvData; - wined3d_strided.tex_coords[i].stride = D3DDrawPrimStrideData->textureCoords[i].dwStride; - } - - /* WineD3D doesn't need the FVF here */ wined3d_mutex_lock(); - wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); - hr = wined3d_device_draw_primitive_strided(device->wined3d_device, VertexCount, &wined3d_strided); - wined3d_mutex_unlock(); + hr = d3d_device_prepare_vertex_buffer(device, dst_size); + if (FAILED(hr)) + goto done; + vb_pos = device->vertex_buffer_pos; + align = vb_pos % dst_stride; + if (align) align = dst_stride - align; + if (vb_pos + dst_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, dst_size, &dst_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + pack_strided_data(dst_data, VertexCount, D3DDrawPrimStrideData, VertexType); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + dst_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, dst_stride); + if (FAILED(hr)) + goto done; + wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, VertexType)); + + wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / dst_stride, VertexCount); + +done: + wined3d_mutex_unlock(); return hr; } @@ -3857,78 +3999,66 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface, WORD *Indices, DWORD IndexCount, DWORD Flags) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - struct wined3d_strided_data wined3d_strided; - DWORD i; HRESULT hr; + UINT vtx_dst_stride = get_flexible_vertex_size(VertexType); + UINT vtx_dst_size = VertexCount * vtx_dst_stride; + UINT vb_pos, align; + UINT idx_size = IndexCount * sizeof(WORD); + UINT ib_pos; + BYTE *dst_data; TRACE("iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, indices %p, index_count %u, flags %#x.\n", iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount, Flags); - memset(&wined3d_strided, 0, sizeof(wined3d_strided)); - /* Get the strided data right. the wined3d structure is a bit bigger - * Watch out: The contents of the strided data are determined by the fvf, - * not by the members set in D3DDrawPrimStrideData. So it's valid - * to have diffuse.lpvData set to 0xdeadbeef if the diffuse flag is - * not set in the fvf. */ - if (VertexType & D3DFVF_POSITION_MASK) - { - wined3d_strided.position.format = WINED3DFMT_R32G32B32_FLOAT; - wined3d_strided.position.data = D3DDrawPrimStrideData->position.lpvData; - wined3d_strided.position.stride = D3DDrawPrimStrideData->position.dwStride; - if (VertexType & D3DFVF_XYZRHW) - { - wined3d_strided.position.format = WINED3DFMT_R32G32B32A32_FLOAT; - wined3d_strided.position_transformed = TRUE; - } - else - { - wined3d_strided.position_transformed = FALSE; - } - } - - if (VertexType & D3DFVF_NORMAL) - { - wined3d_strided.normal.format = WINED3DFMT_R32G32B32_FLOAT; - wined3d_strided.normal.data = D3DDrawPrimStrideData->normal.lpvData; - wined3d_strided.normal.stride = D3DDrawPrimStrideData->normal.dwStride; - } - - if (VertexType & D3DFVF_DIFFUSE) - { - wined3d_strided.diffuse.format = WINED3DFMT_B8G8R8A8_UNORM; - wined3d_strided.diffuse.data = D3DDrawPrimStrideData->diffuse.lpvData; - wined3d_strided.diffuse.stride = D3DDrawPrimStrideData->diffuse.dwStride; - } - - if (VertexType & D3DFVF_SPECULAR) - { - wined3d_strided.specular.format = WINED3DFMT_B8G8R8A8_UNORM; - wined3d_strided.specular.data = D3DDrawPrimStrideData->specular.lpvData; - wined3d_strided.specular.stride = D3DDrawPrimStrideData->specular.dwStride; - } - - for (i = 0; i < GET_TEXCOUNT_FROM_FVF(VertexType); ++i) - { - switch (GET_TEXCOORD_SIZE_FROM_FVF(VertexType, i)) - { - case 1: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32_FLOAT; break; - case 2: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32G32_FLOAT; break; - case 3: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32G32B32_FLOAT; break; - case 4: wined3d_strided.tex_coords[i].format = WINED3DFMT_R32G32B32A32_FLOAT; break; - default: ERR("Unexpected texture coordinate size %d\n", - GET_TEXCOORD_SIZE_FROM_FVF(VertexType, i)); - } - wined3d_strided.tex_coords[i].data = D3DDrawPrimStrideData->textureCoords[i].lpvData; - wined3d_strided.tex_coords[i].stride = D3DDrawPrimStrideData->textureCoords[i].dwStride; - } - - /* WineD3D doesn't need the FVF here */ wined3d_mutex_lock(); - wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); - hr = wined3d_device_draw_indexed_primitive_strided(device->wined3d_device, - IndexCount, &wined3d_strided, VertexCount, Indices, WINED3DFMT_R16_UINT); - wined3d_mutex_unlock(); + hr = d3d_device_prepare_vertex_buffer(device, vtx_dst_size); + if (FAILED(hr)) + goto done; + + vb_pos = device->vertex_buffer_pos; + align = vb_pos % vtx_dst_stride; + if (align) align = vtx_dst_stride - align; + if (vb_pos + vtx_dst_size + align > device->vertex_buffer_size) + vb_pos = 0; + else + vb_pos += align; + + hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_dst_size, &dst_data, + vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + pack_strided_data(dst_data, VertexCount, D3DDrawPrimStrideData, VertexType); + wined3d_buffer_unmap(device->vertex_buffer); + device->vertex_buffer_pos = vb_pos + vtx_dst_size; + + hr = d3d_device_prepare_index_buffer(device, idx_size); + if (FAILED(hr)) + goto done; + ib_pos = device->index_buffer_pos; + if (device->index_buffer_size - idx_size < ib_pos) + ib_pos = 0; + + hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &dst_data, + ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); + if (FAILED(hr)) + goto done; + memcpy(dst_data, Indices, idx_size); + wined3d_buffer_unmap(device->index_buffer); + device->index_buffer_pos = ib_pos + idx_size; + + hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vtx_dst_stride); + if (FAILED(hr)) + goto done; + wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer, WINED3DFMT_R16_UINT); + wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vtx_dst_stride); + + wined3d_device_set_vertex_declaration(device->wined3d_device, ddraw_find_decl(device->ddraw, VertexType)); + wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), IndexCount); + +done: + wined3d_mutex_unlock(); return hr; } @@ -4010,15 +4140,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE stride = get_flexible_vertex_size(vb->fvf); wined3d_mutex_lock(); - hr = wined3d_device_set_vertex_declaration(device->wined3d_device, vb->wineD3DVertexDeclaration); - if (FAILED(hr)) - { - WARN("Failed to set vertex declaration, hr %#x.\n", hr); - wined3d_mutex_unlock(); - return hr; - } - - /* Set the vertex stream source */ + wined3d_device_set_vertex_declaration(device->wined3d_device, vb->wineD3DVertexDeclaration); hr = wined3d_device_set_stream_source(device->wined3d_device, 0, vb->wineD3DVertexBuffer, 0, stride); if (FAILED(hr)) { @@ -4030,6 +4152,10 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE /* Now draw the primitives */ wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); hr = wined3d_device_draw_primitive(device->wined3d_device, StartVertex, NumVertices); + + if (SUCCEEDED(hr)) + vb->read_since_last_map = TRUE; + wined3d_mutex_unlock(); return hr; @@ -4067,7 +4193,6 @@ static HRESULT WINAPI d3d_device3_DrawPrimitiveVB(IDirect3DDevice3 *iface, D3DPR PrimitiveType, &vb->IDirect3DVertexBuffer7_iface, StartVertex, NumVertices, Flags); } - /***************************************************************************** * IDirect3DDevice7::DrawIndexedPrimitiveVB * @@ -4092,10 +4217,9 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, struct d3d_device *This = impl_from_IDirect3DDevice7(iface); struct d3d_vertex_buffer *vb = unsafe_impl_from_IDirect3DVertexBuffer7(D3DVertexBuf); DWORD stride = get_flexible_vertex_size(vb->fvf); - struct wined3d_resource *wined3d_resource; - struct wined3d_resource_desc desc; WORD *LockedIndices; HRESULT hr; + UINT ib_pos; TRACE("iface %p, primitive_type %#x, vb %p, start_vertex %u, vertex_count %u, indices %p, index_count %u, flags %#x.\n", iface, PrimitiveType, D3DVertexBuf, StartVertex, NumVertices, Indices, IndexCount, Flags); @@ -4109,44 +4233,25 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, wined3d_mutex_lock(); - hr = wined3d_device_set_vertex_declaration(This->wined3d_device, vb->wineD3DVertexDeclaration); + wined3d_device_set_vertex_declaration(This->wined3d_device, vb->wineD3DVertexDeclaration); + + hr = d3d_device_prepare_index_buffer(This, IndexCount * sizeof(WORD)); if (FAILED(hr)) { - ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr); wined3d_mutex_unlock(); return hr; } + ib_pos = This->index_buffer_pos; - /* check that the buffer is large enough to hold the indices, - * reallocate if necessary. */ - wined3d_resource = wined3d_buffer_get_resource(This->indexbuffer); - wined3d_resource_get_desc(wined3d_resource, &desc); - if (desc.size < IndexCount * sizeof(WORD)) - { - UINT size = max(desc.size * 2, IndexCount * sizeof(WORD)); - struct wined3d_buffer *buffer; - - TRACE("Growing index buffer to %u bytes\n", size); - - hr = wined3d_buffer_create_ib(This->wined3d_device, size, WINED3DUSAGE_DYNAMIC /* Usage */, - WINED3D_POOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &buffer); - if (FAILED(hr)) - { - ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr); - wined3d_mutex_unlock(); - return hr; - } - - wined3d_buffer_decref(This->indexbuffer); - This->indexbuffer = buffer; - } + if (This->index_buffer_size - IndexCount * sizeof(WORD) < ib_pos) + ib_pos = 0; /* Copy the index stream into the index buffer. A new IWineD3DDevice * method could be created which takes an user pointer containing the * indices or a SetData-Method for the index buffer, which overrides the * index buffer data with our pointer. */ - hr = wined3d_buffer_map(This->indexbuffer, 0, IndexCount * sizeof(WORD), - (BYTE **)&LockedIndices, 0); + hr = wined3d_buffer_map(This->index_buffer, ib_pos, IndexCount * sizeof(WORD), + (BYTE **)&LockedIndices, ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD); if (FAILED(hr)) { ERR("Failed to map buffer, hr %#x.\n", hr); @@ -4154,11 +4259,12 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, return hr; } memcpy(LockedIndices, Indices, IndexCount * sizeof(WORD)); - wined3d_buffer_unmap(This->indexbuffer); + wined3d_buffer_unmap(This->index_buffer); + This->index_buffer_pos = ib_pos + IndexCount * sizeof(WORD); /* Set the index stream */ wined3d_device_set_base_vertex_index(This->wined3d_device, StartVertex); - hr = wined3d_device_set_index_buffer(This->wined3d_device, This->indexbuffer, WINED3DFMT_R16_UINT); + wined3d_device_set_index_buffer(This->wined3d_device, This->index_buffer, WINED3DFMT_R16_UINT); /* Set the vertex stream source */ hr = wined3d_device_set_stream_source(This->wined3d_device, 0, vb->wineD3DVertexBuffer, 0, stride); @@ -4171,7 +4277,10 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); - hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, 0, IndexCount); + hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, ib_pos / sizeof(WORD), IndexCount); + + if (SUCCEEDED(hr)) + vb->read_since_last_map = TRUE; wined3d_mutex_unlock(); @@ -4359,7 +4468,6 @@ static HRESULT d3d_device7_GetTexture(IDirect3DDevice7 *iface, struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct wined3d_texture *wined3d_texture; struct ddraw_surface *surface; - HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); @@ -4367,21 +4475,19 @@ static HRESULT d3d_device7_GetTexture(IDirect3DDevice7 *iface, return DDERR_INVALIDPARAMS; wined3d_mutex_lock(); - hr = wined3d_device_get_texture(device->wined3d_device, stage, &wined3d_texture); - if (FAILED(hr) || !wined3d_texture) + if (!(wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage))) { *texture = NULL; wined3d_mutex_unlock(); - return hr; + return D3D_OK; } surface = wined3d_texture_get_parent(wined3d_texture); *texture = &surface->IDirectDrawSurface7_iface; IDirectDrawSurface7_AddRef(*texture); - wined3d_texture_decref(wined3d_texture); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_GetTexture_FPUSetup(IDirect3DDevice7 *iface, @@ -4499,10 +4605,8 @@ static HRESULT WINAPI d3d_device3_SetTexture(IDirect3DDevice3 *iface, struct wined3d_texture *tex = NULL; BOOL tex_alpha = FALSE; DDPIXELFORMAT ddfmt; - HRESULT result; - result = wined3d_device_get_texture(device->wined3d_device, 0, &tex); - if (result == WINED3D_OK && tex) + if ((tex = wined3d_device_get_texture(device->wined3d_device, 0))) { struct wined3d_resource *sub_resource; @@ -4515,8 +4619,6 @@ static HRESULT WINAPI d3d_device3_SetTexture(IDirect3DDevice3 *iface, PixelFormat_WineD3DtoDD(&ddfmt, desc.format); if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; } - - wined3d_texture_decref(tex); } /* Arg 1/2 are already set to WINED3DTA_TEXTURE/WINED3DTA_CURRENT in case of D3DTBLEND_MODULATE */ @@ -4589,7 +4691,6 @@ static HRESULT d3d_device7_GetTextureStageState(IDirect3DDevice7 *iface, DWORD stage, D3DTEXTURESTAGESTATETYPE state, DWORD *value) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; const struct tss_lookup *l; TRACE("iface %p, stage %u, state %#x, value %p.\n", @@ -4610,7 +4711,7 @@ static HRESULT d3d_device7_GetTextureStageState(IDirect3DDevice7 *iface, if (l->sampler_state) { - hr = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state, value); + *value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state); switch (state) { @@ -4670,12 +4771,12 @@ static HRESULT d3d_device7_GetTextureStageState(IDirect3DDevice7 *iface, } else { - hr = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state, value); + *value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state); } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_GetTextureStageState_FPUSetup(IDirect3DDevice7 *iface, @@ -4731,7 +4832,6 @@ static HRESULT d3d_device7_SetTextureStageState(IDirect3DDevice7 *iface, { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); const struct tss_lookup *l; - HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, state, value); @@ -4809,16 +4909,16 @@ static HRESULT d3d_device7_SetTextureStageState(IDirect3DDevice7 *iface, break; } - hr = wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value); + wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value); } else { - hr = wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value); + wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value); } wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_SetTextureStageState_FPUSetup(IDirect3DDevice7 *iface, @@ -4992,7 +5092,6 @@ static HRESULT WINAPI d3d_device7_Clear_FPUPreserve(IDirect3DDevice7 *iface, DWO static HRESULT d3d_device7_SetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *viewport) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, viewport); @@ -5001,10 +5100,10 @@ static HRESULT d3d_device7_SetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *vi /* Note: D3DVIEWPORT7 is compatible with struct wined3d_viewport. */ wined3d_mutex_lock(); - hr = wined3d_device_set_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); + wined3d_device_set_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d_device7_SetViewport_FPUSetup(IDirect3DDevice7 *iface, D3DVIEWPORT7 *viewport) @@ -5043,7 +5142,6 @@ static HRESULT WINAPI d3d_device7_SetViewport_FPUPreserve(IDirect3DDevice7 *ifac static HRESULT d3d_device7_GetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *viewport) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, viewport); @@ -5052,10 +5150,10 @@ static HRESULT d3d_device7_GetViewport(IDirect3DDevice7 *iface, D3DVIEWPORT7 *vi /* Note: D3DVIEWPORT7 is compatible with struct wined3d_viewport. */ wined3d_mutex_lock(); - hr = wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); + wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport); wined3d_mutex_unlock(); - return hr_ddraw_from_wined3d(hr); + return D3D_OK; } static HRESULT WINAPI d3d_device7_GetViewport_FPUSetup(IDirect3DDevice7 *iface, D3DVIEWPORT7 *viewport) @@ -5094,7 +5192,6 @@ static HRESULT WINAPI d3d_device7_GetViewport_FPUPreserve(IDirect3DDevice7 *ifac static HRESULT d3d_device7_SetMaterial(IDirect3DDevice7 *iface, D3DMATERIAL7 *material) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; TRACE("iface %p, material %p.\n", iface, material); @@ -5103,10 +5200,10 @@ static HRESULT d3d_device7_SetMaterial(IDirect3DDevice7 *iface, D3DMATERIAL7 *ma wined3d_mutex_lock(); /* Note: D3DMATERIAL7 is compatible with struct wined3d_material. */ - hr = wined3d_device_set_material(device->wined3d_device, (struct wined3d_material *)material); + wined3d_device_set_material(device->wined3d_device, (struct wined3d_material *)material); wined3d_mutex_unlock(); - return hr_ddraw_from_wined3d(hr); + return D3D_OK; } static HRESULT WINAPI d3d_device7_SetMaterial_FPUSetup(IDirect3DDevice7 *iface, D3DMATERIAL7 *material) @@ -5145,16 +5242,15 @@ static HRESULT WINAPI d3d_device7_SetMaterial_FPUPreserve(IDirect3DDevice7 *ifac static HRESULT d3d_device7_GetMaterial(IDirect3DDevice7 *iface, D3DMATERIAL7 *material) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); - HRESULT hr; TRACE("iface %p, material %p.\n", iface, material); wined3d_mutex_lock(); /* Note: D3DMATERIAL7 is compatible with struct wined3d_material. */ - hr = wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material); + wined3d_device_get_material(device->wined3d_device, (struct wined3d_material *)material); wined3d_mutex_unlock(); - return hr_ddraw_from_wined3d(hr); + return D3D_OK; } static HRESULT WINAPI d3d_device7_GetMaterial_FPUSetup(IDirect3DDevice7 *iface, D3DMATERIAL7 *material) @@ -5452,7 +5548,6 @@ static HRESULT d3d_device7_ApplyStateBlock(IDirect3DDevice7 *iface, DWORD stateb { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct wined3d_stateblock *wined3d_sb; - HRESULT hr; TRACE("iface %p, stateblock %#x.\n", iface, stateblock); @@ -5465,10 +5560,10 @@ static HRESULT d3d_device7_ApplyStateBlock(IDirect3DDevice7 *iface, DWORD stateb return D3DERR_INVALIDSTATEBLOCK; } - hr = wined3d_stateblock_apply(wined3d_sb); + wined3d_stateblock_apply(wined3d_sb); wined3d_mutex_unlock(); - return hr_ddraw_from_wined3d(hr); + return D3D_OK; } static HRESULT WINAPI d3d_device7_ApplyStateBlock_FPUSetup(IDirect3DDevice7 *iface, DWORD stateblock) @@ -5508,7 +5603,6 @@ static HRESULT d3d_device7_CaptureStateBlock(IDirect3DDevice7 *iface, DWORD stat { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); struct wined3d_stateblock *wined3d_sb; - HRESULT hr; TRACE("iface %p, stateblock %#x.\n", iface, stateblock); @@ -5521,10 +5615,10 @@ static HRESULT d3d_device7_CaptureStateBlock(IDirect3DDevice7 *iface, DWORD stat return D3DERR_INVALIDSTATEBLOCK; } - hr = wined3d_stateblock_capture(wined3d_sb); + wined3d_stateblock_capture(wined3d_sb); wined3d_mutex_unlock(); - return hr_ddraw_from_wined3d(hr); + return D3D_OK; } static HRESULT WINAPI d3d_device7_CaptureStateBlock_FPUSetup(IDirect3DDevice7 *iface, DWORD stateblock) @@ -6603,17 +6697,6 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, device->legacy_projection = ident; device->legacy_clipspace = ident; - /* Create an index buffer, it's needed for indexed drawing */ - hr = wined3d_buffer_create_ib(ddraw->wined3d_device, 0x40000 /* Length. Don't know how long it should be */, - WINED3DUSAGE_DYNAMIC /* Usage */, WINED3D_POOL_DEFAULT, NULL, - &ddraw_null_wined3d_parent_ops, &device->indexbuffer); - if (FAILED(hr)) - { - ERR("Failed to create an index buffer, hr %#x.\n", hr); - ddraw_handle_table_destroy(&device->handle_table); - return hr; - } - /* This is for convenience. */ device->wined3d_device = ddraw->wined3d_device; wined3d_device_incref(ddraw->wined3d_device); @@ -6623,7 +6706,6 @@ static HRESULT d3d_device_init(struct d3d_device *device, struct ddraw *ddraw, if (FAILED(hr)) { ERR("Failed to set render target, hr %#x.\n", hr); - wined3d_buffer_decref(device->indexbuffer); ddraw_handle_table_destroy(&device->handle_table); return hr; } @@ -6659,7 +6741,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, TRACE("ddraw %p, target %p, version %u, device %p, outer_unknown %p.\n", ddraw, target, version, device, outer_unknown); - if (DefaultSurfaceType != WINED3D_SURFACE_TYPE_OPENGL) + if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL) { ERR_(winediag)("The application wants to create a Direct3D device, " "but the current DirectDrawRenderer does not support this.\n"); diff --git a/reactos/dll/directx/wine/ddraw/executebuffer.c b/reactos/dll/directx/wine/ddraw/executebuffer.c index d30b169c928..2925cfa1ca4 100644 --- a/reactos/dll/directx/wine/ddraw/executebuffer.c +++ b/reactos/dll/directx/wine/ddraw/executebuffer.c @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -71,8 +71,9 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, if (TRACE_ON(ddraw)) _dump_executedata(&(buffer->data)); - while (1) { - LPD3DINSTRUCTION current = (LPD3DINSTRUCTION) instr; + for (;;) + { + D3DINSTRUCTION *current = (D3DINSTRUCTION *)instr; BYTE size; WORD count; @@ -92,7 +93,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, } break; case D3DOP_TRIANGLE: { - int i; + DWORD i; D3DTLVERTEX *tl_vx = buffer->vertex_data; TRACE("TRIANGLE (%d)\n", count); @@ -103,8 +104,9 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, buffer->indices = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->indices) * buffer->nb_indices); } - for (i = 0; i < count; i++) { - LPD3DTRIANGLE ci = (LPD3DTRIANGLE) instr; + for (i = 0; i < count; ++i) + { + D3DTRIANGLE *ci = (D3DTRIANGLE *)instr; TRACE(" v1: %d v2: %d v3: %d\n",ci->u1.v1, ci->u2.v2, ci->u3.v3); TRACE(" Flags : "); if (TRACE_ON(ddraw)) @@ -133,7 +135,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, instr += size; } IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface, - D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, buffer->indices, count * 3, 0); + D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, buffer->nb_vertices, + buffer->indices, count * 3, 0); } break; case D3DOP_MATRIXLOAD: @@ -142,7 +145,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, break; case D3DOP_MATRIXMULTIPLY: { - int i; + DWORD i; TRACE("MATRIXMULTIPLY (%d)\n", count); for (i = 0; i < count; ++i) @@ -170,7 +173,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, } break; case D3DOP_STATETRANSFORM: { - int i; + DWORD i; TRACE("STATETRANSFORM (%d)\n", count); for (i = 0; i < count; ++i) @@ -200,11 +203,12 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, } break; case D3DOP_STATELIGHT: { - int i; + DWORD i; TRACE("STATELIGHT (%d)\n", count); - for (i = 0; i < count; i++) { - LPD3DSTATE ci = (LPD3DSTATE) instr; + for (i = 0; i < count; ++i) + { + D3DSTATE *ci = (D3DSTATE *)instr; TRACE("(%08x,%08x)\n", ci->u1.dlstLightStateType, ci->u2.dwArg[0]); @@ -266,12 +270,13 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, } break; case D3DOP_STATERENDER: { - int i; + DWORD i; IDirect3DDevice2 *d3d_device2 = &device->IDirect3DDevice2_iface; TRACE("STATERENDER (%d)\n", count); - for (i = 0; i < count; i++) { - LPD3DSTATE ci = (LPD3DSTATE) instr; + for (i = 0; i < count; ++i) + { + D3DSTATE *ci = (D3DSTATE *)instr; IDirect3DDevice2_SetRenderState(d3d_device2, ci->u1.drstRenderStateType, ci->u2.dwArg[0]); @@ -284,7 +289,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, /* TODO: Share code with IDirect3DVertexBuffer::ProcessVertices and / or * IWineD3DDevice::ProcessVertices */ - int i; + DWORD i; D3DMATRIX view_mat, world_mat, proj_mat; TRACE("PROCESSVERTICES (%d)\n", count); @@ -297,8 +302,9 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, wined3d_device_get_transform(device->wined3d_device, WINED3D_TS_WORLD_MATRIX(0), (struct wined3d_matrix *)&world_mat); - for (i = 0; i < count; i++) { - LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr; + for (i = 0; i < count; ++i) + { + D3DPROCESSVERTICES *ci = (D3DPROCESSVERTICES *)instr; TRACE(" Start : %d Dest : %d Count : %d\n", ci->wStart, ci->wDest, ci->dwCount); @@ -465,11 +471,12 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, } break; case D3DOP_BRANCHFORWARD: { - int i; + DWORD i; TRACE("BRANCHFORWARD (%d)\n", count); - for (i = 0; i < count; i++) { - LPD3DBRANCH ci = (LPD3DBRANCH) instr; + for (i = 0; i < count; ++i) + { + D3DBRANCH *ci = (D3DBRANCH *)instr; if ((buffer->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue) { @@ -502,16 +509,14 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, } break; case D3DOP_SETSTATUS: { - int i; + DWORD i; TRACE("SETSTATUS (%d)\n", count); - for (i = 0; i < count; i++) { - LPD3DSTATUS ci = (LPD3DSTATUS) instr; - - buffer->data.dsStatus = *ci; - - instr += size; - } + for (i = 0; i < count; ++i) + { + buffer->data.dsStatus = *(D3DSTATUS *)instr; + instr += size; + } } break; default: @@ -711,6 +716,7 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer * /* Prepares the transformed vertex buffer */ HeapFree(GetProcessHeap(), 0, buffer->vertex_data); buffer->vertex_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nbvert * sizeof(D3DTLVERTEX)); + buffer->nb_vertices = nbvert; if (TRACE_ON(ddraw)) _dump_executedata(data); diff --git a/reactos/dll/directx/wine/ddraw/light.c b/reactos/dll/directx/wine/ddraw/light.c index abd2731c721..c4062ac5db6 100644 --- a/reactos/dll/directx/wine/ddraw/light.c +++ b/reactos/dll/directx/wine/ddraw/light.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -166,67 +166,43 @@ static HRESULT WINAPI d3d_light_Initialize(IDirect3DLight *iface, IDirect3D *d3d return D3D_OK; } -/***************************************************************************** - * IDirect3DLight::SetLight - * - * Assigns a lighting value to this object - * - * Params: - * Light: Lighting parameter to set - * - * Returns: - * D3D_OK on success - * DDERR_INVALIDPARAMS if Light is NULL - * - *****************************************************************************/ -static void dump_light(const D3DLIGHT2 *light) -{ - TRACE(" - dwSize : %d\n", light->dwSize); -} - static const float zero_value[] = { 0.0, 0.0, 0.0, 0.0 }; -static HRESULT WINAPI d3d_light_SetLight(IDirect3DLight *iface, D3DLIGHT *lpLight) +static HRESULT WINAPI d3d_light_SetLight(IDirect3DLight *iface, D3DLIGHT *data) { struct d3d_light *light = impl_from_IDirect3DLight(iface); D3DLIGHT7 *light7 = &light->light7; - TRACE("iface %p, light %p.\n", iface, lpLight); + TRACE("iface %p, data %p.\n", iface, data); - if (TRACE_ON(ddraw)) - { - TRACE(" Light definition :\n"); - dump_light((LPD3DLIGHT2) lpLight); - } - - if ( (lpLight->dltType == 0) || (lpLight->dltType > D3DLIGHT_PARALLELPOINT) ) + if ((!data->dltType) || (data->dltType > D3DLIGHT_PARALLELPOINT)) return DDERR_INVALIDPARAMS; - if ( lpLight->dltType == D3DLIGHT_PARALLELPOINT ) - FIXME("D3DLIGHT_PARALLELPOINT not supported\n"); + if (data->dltType == D3DLIGHT_PARALLELPOINT) + FIXME("D3DLIGHT_PARALLELPOINT not implemented.\n"); - /* Translate D3DLIGH2 structure to D3DLIGHT7 */ - light7->dltType = lpLight->dltType; - light7->dcvDiffuse = lpLight->dcvColor; - if ((((LPD3DLIGHT2)lpLight)->dwFlags & D3DLIGHT_NO_SPECULAR) != 0) - light7->dcvSpecular = lpLight->dcvColor; + /* Translate D3DLIGHT2 structure to D3DLIGHT7. */ + light7->dltType = data->dltType; + light7->dcvDiffuse = data->dcvColor; + if (data->dwSize >= sizeof(D3DLIGHT2) && (((D3DLIGHT2 *)data)->dwFlags & D3DLIGHT_NO_SPECULAR)) + light7->dcvSpecular = data->dcvColor; else - light7->dcvSpecular = *(const D3DCOLORVALUE*)zero_value; - light7->dcvAmbient = lpLight->dcvColor; - light7->dvPosition = lpLight->dvPosition; - light7->dvDirection = lpLight->dvDirection; - light7->dvRange = lpLight->dvRange; - light7->dvFalloff = lpLight->dvFalloff; - light7->dvAttenuation0 = lpLight->dvAttenuation0; - light7->dvAttenuation1 = lpLight->dvAttenuation1; - light7->dvAttenuation2 = lpLight->dvAttenuation2; - light7->dvTheta = lpLight->dvTheta; - light7->dvPhi = lpLight->dvPhi; + light7->dcvSpecular = *(const D3DCOLORVALUE *)zero_value; + light7->dcvAmbient = data->dcvColor; + light7->dvPosition = data->dvPosition; + light7->dvDirection = data->dvDirection; + light7->dvRange = data->dvRange; + light7->dvFalloff = data->dvFalloff; + light7->dvAttenuation0 = data->dvAttenuation0; + light7->dvAttenuation1 = data->dvAttenuation1; + light7->dvAttenuation2 = data->dvAttenuation2; + light7->dvTheta = data->dvTheta; + light7->dvPhi = data->dvPhi; wined3d_mutex_lock(); - memcpy(&light->light, lpLight, lpLight->dwSize); + memcpy(&light->light, data, data->dwSize); if (light->light.dwFlags & D3DLIGHT_ACTIVE) light_update(light); wined3d_mutex_unlock(); @@ -252,12 +228,6 @@ static HRESULT WINAPI d3d_light_GetLight(IDirect3DLight *iface, D3DLIGHT *lpLigh TRACE("iface %p, light %p.\n", iface, lpLight); - if (TRACE_ON(ddraw)) - { - TRACE(" Returning light definition :\n"); - dump_light(&light->light); - } - wined3d_mutex_lock(); memcpy(lpLight, &light->light, lpLight->dwSize); wined3d_mutex_unlock(); diff --git a/reactos/dll/directx/wine/ddraw/main.c b/reactos/dll/directx/wine/ddraw/main.c index d6d531d252b..e4c1ac14a65 100644 --- a/reactos/dll/directx/wine/ddraw/main.c +++ b/reactos/dll/directx/wine/ddraw/main.c @@ -24,20 +24,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #define DDRAW_INIT_GUID #include "ddraw_private.h" -#include +#include "rpcproxy.h" -#include -//#include "winreg.h" +#include "wine/exception.h" +#include "winreg.h" WINE_DEFAULT_DEBUG_CHANNEL(ddraw); /* The configured default surface */ -enum wined3d_surface_type DefaultSurfaceType = WINED3D_SURFACE_TYPE_OPENGL; +enum ddraw_surface_type DefaultSurfaceType = DDRAW_SURFACE_TYPE_OPENGL; static struct list global_ddraw_list = LIST_INIT(global_ddraw_list); @@ -46,6 +46,22 @@ static HINSTANCE instance; /* value of ForceRefreshRate */ DWORD force_refresh_rate = 0; +/* Structure for converting DirectDrawEnumerateA to DirectDrawEnumerateExA */ +struct callback_info +{ + LPDDENUMCALLBACKA callback; + void *context; +}; + +/* Enumeration callback for converting DirectDrawEnumerateA to DirectDrawEnumerateExA */ +static HRESULT CALLBACK enum_callback(GUID *guid, char *description, char *driver_name, + void *context, HMONITOR monitor) +{ + const struct callback_info *info = context; + + return info->callback(guid, description, driver_name, info->context); +} + /* Handle table functions */ BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size) { @@ -254,25 +270,21 @@ DDRAW_Create(const GUID *guid, * Arguments, return values: See DDRAW_Create * ***********************************************************************/ -HRESULT WINAPI DECLSPEC_HOTPATCH -DirectDrawCreate(GUID *GUID, - LPDIRECTDRAW *DD, - IUnknown *UnkOuter) +HRESULT WINAPI DECLSPEC_HOTPATCH DirectDrawCreate(GUID *driver_guid, IDirectDraw **ddraw, IUnknown *outer) { HRESULT hr; - TRACE("driver_guid %s, ddraw %p, outer_unknown %p.\n", - debugstr_guid(GUID), DD, UnkOuter); + TRACE("driver_guid %s, ddraw %p, outer %p.\n", + debugstr_guid(driver_guid), ddraw, outer); wined3d_mutex_lock(); - hr = DDRAW_Create(GUID, (void **) DD, UnkOuter, &IID_IDirectDraw); + hr = DDRAW_Create(driver_guid, (void **)ddraw, outer, &IID_IDirectDraw); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) { - hr = IDirectDraw_Initialize(*DD, GUID); - if (FAILED(hr)) - IDirectDraw_Release(*DD); + if (FAILED(hr = IDirectDraw_Initialize(*ddraw, driver_guid))) + IDirectDraw_Release(*ddraw); } return hr; @@ -336,27 +348,15 @@ DirectDrawCreateEx(GUID *guid, * * ***********************************************************************/ -HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA Callback, void *Context) +HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA callback, void *context) { - TRACE("callback %p, context %p.\n", Callback, Context); + struct callback_info info; - TRACE(" Enumerating default DirectDraw HAL interface\n"); - /* We only have one driver */ - __TRY - { - static CHAR driver_desc[] = "DirectDraw HAL", - driver_name[] = "display"; + TRACE("callback %p, context %p.\n", callback, context); - Callback(NULL, driver_desc, driver_name, Context); - } - __EXCEPT_PAGE_FAULT - { - return DDERR_INVALIDPARAMS; - } - __ENDTRY - - TRACE(" End of enumeration\n"); - return DD_OK; + info.callback = callback; + info.context = context; + return DirectDrawEnumerateExA(enum_callback, &info, 0x0); } /*********************************************************************** @@ -368,35 +368,79 @@ HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA Callback, void *Context) * The Flag member is not supported right now. * ***********************************************************************/ -HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA Callback, void *Context, DWORD Flags) +HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *context, DWORD flags) { - TRACE("callback %p, context %p, flags %#x.\n", Callback, Context, Flags); + struct wined3d *wined3d; + DWORD wined3d_flags; - if (Flags & ~(DDENUM_ATTACHEDSECONDARYDEVICES | + TRACE("callback %p, context %p, flags %#x.\n", callback, context, flags); + + if (flags & ~(DDENUM_ATTACHEDSECONDARYDEVICES | DDENUM_DETACHEDSECONDARYDEVICES | DDENUM_NONDISPLAYDEVICES)) return DDERR_INVALIDPARAMS; - if (Flags) - FIXME("flags 0x%08x not handled\n", Flags); + if (flags) + FIXME("flags 0x%08x not handled\n", flags); - TRACE("Enumerating default DirectDraw HAL interface\n"); + wined3d_flags = WINED3D_LEGACY_DEPTH_BIAS; + if (DefaultSurfaceType != DDRAW_SURFACE_TYPE_OPENGL) + wined3d_flags |= WINED3D_NO3D; + + TRACE("Enumerating ddraw interfaces\n"); + if (!(wined3d = wined3d_create(7, wined3d_flags))) + { + if ((wined3d_flags & WINED3D_NO3D) || !(wined3d = wined3d_create(7, wined3d_flags | WINED3D_NO3D))) + { + WARN("Failed to create a wined3d object.\n"); + return E_FAIL; + } + + WARN("Created a wined3d object without 3D support.\n"); + DefaultSurfaceType = DDRAW_SURFACE_TYPE_GDI; + } - /* We only have one driver by now */ __TRY { + /* QuickTime expects the description "DirectDraw HAL" */ static CHAR driver_desc[] = "DirectDraw HAL", driver_name[] = "display"; + struct wined3d_adapter_identifier adapter_id; + HRESULT hr = S_OK; + UINT adapter = 0; + BOOL cont_enum; - /* QuickTime expects the description "DirectDraw HAL" */ - Callback(NULL, driver_desc, driver_name, Context, 0); + /* The Battle.net System Checker expects both a NULL device and a GUID-based device */ + TRACE("Default interface: DirectDraw HAL\n"); + cont_enum = callback(NULL, driver_desc, driver_name, context, 0); + for (adapter = 0; SUCCEEDED(hr) && cont_enum; adapter++) + { + char DriverName[512] = ""; + + /* The Battle.net System Checker expects the GetAdapterIdentifier DeviceName to match the + * Driver Name, so obtain the DeviceName and GUID from D3D. */ + memset(&adapter_id, 0x0, sizeof(adapter_id)); + adapter_id.device_name = DriverName; + adapter_id.device_name_size = sizeof(DriverName); + wined3d_mutex_lock(); + hr = wined3d_get_adapter_identifier(wined3d, adapter, 0x0, &adapter_id); + wined3d_mutex_unlock(); + if (SUCCEEDED(hr)) + { + TRACE("Interface %d: %s\n", adapter, wine_dbgstr_guid(&adapter_id.device_identifier)); + cont_enum = callback(&adapter_id.device_identifier, driver_desc, + adapter_id.device_name, context, 0); + } + } } __EXCEPT_PAGE_FAULT { + wined3d_decref(wined3d); return DDERR_INVALIDPARAMS; } __ENDTRY; + wined3d_decref(wined3d); TRACE("End of enumeration\n"); return DD_OK; } @@ -866,12 +910,12 @@ DllMain(HINSTANCE hInstDLL, if (!strcmp(buffer,"gdi")) { TRACE("Defaulting to GDI surfaces\n"); - DefaultSurfaceType = WINED3D_SURFACE_TYPE_GDI; + DefaultSurfaceType = DDRAW_SURFACE_TYPE_GDI; } else if (!strcmp(buffer,"opengl")) { TRACE("Defaulting to opengl surfaces\n"); - DefaultSurfaceType = WINED3D_SURFACE_TYPE_OPENGL; + DefaultSurfaceType = DDRAW_SURFACE_TYPE_OPENGL; } else { diff --git a/reactos/dll/directx/wine/ddraw/material.c b/reactos/dll/directx/wine/ddraw/material.c index 884159b53ab..5317bf5ad05 100644 --- a/reactos/dll/directx/wine/ddraw/material.c +++ b/reactos/dll/directx/wine/ddraw/material.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -75,7 +75,7 @@ static HRESULT WINAPI d3d_material3_QueryInterface(IDirect3DMaterial3 *iface, RE if (IsEqualGUID(&IID_IUnknown, riid)) { - IUnknown_AddRef(iface); + IDirect3DMaterial3_AddRef(iface); *obp = iface; TRACE(" Creating IUnknown interface at %p.\n", *obp); return S_OK; diff --git a/reactos/dll/directx/wine/ddraw/palette.c b/reactos/dll/directx/wine/ddraw/palette.c index eb5ac2fff43..7d879ad3b10 100644 --- a/reactos/dll/directx/wine/ddraw/palette.c +++ b/reactos/dll/directx/wine/ddraw/palette.c @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" diff --git a/reactos/dll/directx/wine/ddraw/surface.c b/reactos/dll/directx/wine/ddraw/surface.c index b87da4d74d2..a9e003f46a0 100644 --- a/reactos/dll/directx/wine/ddraw/surface.c +++ b/reactos/dll/directx/wine/ddraw/surface.c @@ -21,8 +21,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -311,18 +311,20 @@ static HRESULT WINAPI d3d_texture1_QueryInterface(IDirect3DTexture *iface, REFII return ddraw_surface7_QueryInterface(&surface->IDirectDrawSurface7_iface, riid, object); } -static void ddraw_surface_add_iface(struct ddraw_surface *This) +static void ddraw_surface_add_iface(struct ddraw_surface *surface) { - ULONG iface_count = InterlockedIncrement(&This->iface_count); - TRACE("%p increasing iface count to %u.\n", This, iface_count); + ULONG iface_count = InterlockedIncrement(&surface->iface_count); + TRACE("%p increasing iface count to %u.\n", surface, iface_count); if (iface_count == 1) { + if (surface->ifaceToRelease) + IUnknown_AddRef(surface->ifaceToRelease); wined3d_mutex_lock(); - if (This->wined3d_surface) - wined3d_surface_incref(This->wined3d_surface); - if (This->wined3d_texture) - wined3d_texture_incref(This->wined3d_texture); + if (surface->wined3d_surface) + wined3d_surface_incref(surface->wined3d_surface); + if (surface->wined3d_texture) + wined3d_texture_incref(surface->wined3d_texture); wined3d_mutex_unlock(); } } @@ -447,7 +449,6 @@ static ULONG WINAPI d3d_texture1_AddRef(IDirect3DTexture *iface) static void ddraw_surface_cleanup(struct ddraw_surface *surface) { struct ddraw_surface *surf; - IUnknown *ifaceToRelease; UINT i; TRACE("surface %p.\n", surface); @@ -472,7 +473,6 @@ static void ddraw_surface_cleanup(struct ddraw_surface *surface) if (surface->device1) IUnknown_Release(&surface->device1->IUnknown_inner); - ifaceToRelease = surface->ifaceToRelease; if (surface->iface_count > 1) { @@ -485,10 +485,6 @@ static void ddraw_surface_cleanup(struct ddraw_surface *surface) if (surface->wined3d_surface) wined3d_surface_decref(surface->wined3d_surface); - - /* Reduce the ddraw refcount */ - if (ifaceToRelease) - IUnknown_Release(ifaceToRelease); } ULONG ddraw_surface_release_iface(struct ddraw_surface *This) @@ -498,6 +494,8 @@ ULONG ddraw_surface_release_iface(struct ddraw_surface *This) if (iface_count == 0) { + IUnknown *release_iface = This->ifaceToRelease; + /* Complex attached surfaces are destroyed implicitly when the root is released */ wined3d_mutex_lock(); if(!This->is_complex_root) @@ -511,6 +509,9 @@ ULONG ddraw_surface_release_iface(struct ddraw_surface *This) else ddraw_surface_cleanup(This); wined3d_mutex_unlock(); + + if (release_iface) + IUnknown_Release(release_iface); } return iface_count; @@ -4711,11 +4712,8 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir /* Update the wined3d frontbuffer if this is the frontbuffer. */ if ((This->surface_desc.ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER) && This->ddraw->wined3d_frontbuffer) - { - hr = wined3d_surface_set_palette(This->ddraw->wined3d_frontbuffer, palette_impl ? palette_impl->wineD3DPalette : NULL); - if (FAILED(hr)) - ERR("Failed to set frontbuffer palette, hr %#x.\n", hr); - } + wined3d_surface_set_palette(This->ddraw->wined3d_frontbuffer, + palette_impl ? palette_impl->wineD3DPalette : NULL); /* If this is a front buffer, also update the back buffers * TODO: How do things work for palettized cube textures? @@ -5440,13 +5438,13 @@ struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface7(IDirectDrawSurface7 * if (!iface) return NULL; if (iface->lpVtbl != &ddraw_surface7_vtbl) { - HRESULT hr = IUnknown_QueryInterface(iface, &IID_IDirectDrawSurface7, (void **)&iface); + HRESULT hr = IDirectDrawSurface7_QueryInterface(iface, &IID_IDirectDrawSurface7, (void **)&iface); if (FAILED(hr)) { WARN("Object %p doesn't expose interface IDirectDrawSurface7.\n", iface); return NULL; } - IUnknown_Release(iface); + IDirectDrawSurface7_Release(iface); } return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface7_iface); } @@ -5456,13 +5454,13 @@ struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface4(IDirectDrawSurface4 * if (!iface) return NULL; if (iface->lpVtbl != &ddraw_surface4_vtbl) { - HRESULT hr = IUnknown_QueryInterface(iface, &IID_IDirectDrawSurface4, (void **)&iface); + HRESULT hr = IDirectDrawSurface4_QueryInterface(iface, &IID_IDirectDrawSurface4, (void **)&iface); if (FAILED(hr)) { WARN("Object %p doesn't expose interface IDirectDrawSurface4.\n", iface); return NULL; } - IUnknown_Release(iface); + IDirectDrawSurface4_Release(iface); } return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface4_iface); } @@ -5472,13 +5470,13 @@ static struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface3(IDirectDrawSur if (!iface) return NULL; if (iface->lpVtbl != &ddraw_surface3_vtbl) { - HRESULT hr = IUnknown_QueryInterface(iface, &IID_IDirectDrawSurface3, (void **)&iface); + HRESULT hr = IDirectDrawSurface3_QueryInterface(iface, &IID_IDirectDrawSurface3, (void **)&iface); if (FAILED(hr)) { WARN("Object %p doesn't expose interface IDirectDrawSurface3.\n", iface); return NULL; } - IUnknown_Release(iface); + IDirectDrawSurface3_Release(iface); } return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface3_iface); } @@ -5488,13 +5486,13 @@ static struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface2(IDirectDrawSur if (!iface) return NULL; if (iface->lpVtbl != &ddraw_surface2_vtbl) { - HRESULT hr = IUnknown_QueryInterface(iface, &IID_IDirectDrawSurface2, (void **)&iface); + HRESULT hr = IDirectDrawSurface2_QueryInterface(iface, &IID_IDirectDrawSurface2, (void **)&iface); if (FAILED(hr)) { WARN("Object %p doesn't expose interface IDirectDrawSurface2.\n", iface); return NULL; } - IUnknown_Release(iface); + IDirectDrawSurface2_Release(iface); } return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface2_iface); } @@ -5504,13 +5502,13 @@ struct ddraw_surface *unsafe_impl_from_IDirectDrawSurface(IDirectDrawSurface *if if (!iface) return NULL; if (iface->lpVtbl != &ddraw_surface1_vtbl) { - HRESULT hr = IUnknown_QueryInterface(iface, &IID_IDirectDrawSurface, (void **)&iface); + HRESULT hr = IDirectDrawSurface_QueryInterface(iface, &IID_IDirectDrawSurface, (void **)&iface); if (FAILED(hr)) { WARN("Object %p doesn't expose interface IDirectDrawSurface.\n", iface); return NULL; } - IUnknown_Release(iface); + IDirectDrawSurface_Release(iface); } return CONTAINING_RECORD(iface, struct ddraw_surface, IDirectDrawSurface_iface); } @@ -5594,6 +5592,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface) struct wined3d_resource *resource; enum wined3d_format_id format; UINT layers, levels, i, j; + DDSURFACEDESC2 *mip_desc; enum wined3d_pool pool; HRESULT hr; @@ -5640,6 +5639,41 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface) if (mip == surface) continue; + mip_desc = &mip->surface_desc; + + if (j) + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL; + else + mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; + + if (mip_desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) + { + mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES; + + switch (i) + { + case WINED3D_CUBEMAP_FACE_POSITIVE_X: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX; + break; + case WINED3D_CUBEMAP_FACE_NEGATIVE_X: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; + break; + case WINED3D_CUBEMAP_FACE_POSITIVE_Y: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; + break; + case WINED3D_CUBEMAP_FACE_NEGATIVE_Y: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; + break; + case WINED3D_CUBEMAP_FACE_POSITIVE_Z: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; + break; + case WINED3D_CUBEMAP_FACE_NEGATIVE_Z: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; + break; + } + + } + *attach = mip; attach = &mip->complex_array[0]; } @@ -5648,8 +5682,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface) return DD_OK; } -HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, - DDSURFACEDESC2 *desc, UINT mip_level, UINT version) +HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, DDSURFACEDESC2 *desc, UINT version) { enum wined3d_pool pool = WINED3D_POOL_DEFAULT; DWORD flags = WINED3D_SURFACE_MAPPABLE; @@ -5751,10 +5784,9 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, surface->first_attached = surface; - hr = wined3d_surface_create(ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, format, mip_level, - usage, pool, WINED3D_MULTISAMPLE_NONE, 0, DefaultSurfaceType, flags, - surface, &ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface); - if (FAILED(hr)) + if (FAILED(hr = wined3d_surface_create(ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, format, + usage, pool, WINED3D_MULTISAMPLE_NONE, 0, flags, surface, + &ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface))) { WARN("Failed to create wined3d surface, hr %#x.\n", hr); return hr; diff --git a/reactos/dll/directx/wine/ddraw/utils.c b/reactos/dll/directx/wine/ddraw/utils.c index c69a1cf70b0..e2e7c5a35fc 100644 --- a/reactos/dll/directx/wine/ddraw/utils.c +++ b/reactos/dll/directx/wine/ddraw/utils.c @@ -21,8 +21,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -446,6 +446,7 @@ enum wined3d_format_id PixelFormat_DD2WineD3D(const DDPIXELFORMAT *DDPixelFormat } WARN("32 bit RGB pixel format does not match.\n"); + return WINED3DFMT_UNKNOWN; default: WARN("Invalid dwRGBBitCount in Pixelformat structure.\n"); @@ -457,10 +458,6 @@ enum wined3d_format_id PixelFormat_DD2WineD3D(const DDPIXELFORMAT *DDPixelFormat /* Alpha only Pixelformat */ switch(DDPixelFormat->u1.dwAlphaBitDepth) { - case 1: - case 2: - case 4: - FIXME("Unsupported Alpha-Only bit depth 0x%x.\n", DDPixelFormat->u1.dwAlphaBitDepth); case 8: return WINED3DFMT_A8_UNORM; diff --git a/reactos/dll/directx/wine/ddraw/vertexbuffer.c b/reactos/dll/directx/wine/ddraw/vertexbuffer.c index 41da3d0c8be..5acd2e618a4 100644 --- a/reactos/dll/directx/wine/ddraw/vertexbuffer.c +++ b/reactos/dll/directx/wine/ddraw/vertexbuffer.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -66,21 +66,21 @@ static HRESULT WINAPI d3d_vertex_buffer7_QueryInterface(IDirect3DVertexBuffer7 * if ( IsEqualGUID( &IID_IUnknown, riid ) ) { - IUnknown_AddRef(iface); + IDirect3DVertexBuffer7_AddRef(iface); *obj = iface; TRACE(" Creating IUnknown interface at %p.\n", *obj); return S_OK; } if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) ) { - IUnknown_AddRef(iface); + IDirect3DVertexBuffer7_AddRef(iface); *obj = &buffer->IDirect3DVertexBuffer_iface; TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obj); return S_OK; } if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) ) { - IUnknown_AddRef(iface); + IDirect3DVertexBuffer7_AddRef(iface); *obj = iface; TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obj); return S_OK; @@ -185,6 +185,27 @@ static ULONG WINAPI d3d_vertex_buffer1_Release(IDirect3DVertexBuffer *iface) * IDirect3DVertexBuffer Methods *****************************************************************************/ +static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer *buffer, BOOL dynamic, + struct wined3d_buffer **wined3d_buffer) +{ + DWORD usage = WINED3DUSAGE_STATICDECL; + enum wined3d_pool pool; + + if (buffer->Caps & D3DVBCAPS_SYSTEMMEMORY) + pool = WINED3D_POOL_SYSTEM_MEM; + else + pool = WINED3D_POOL_DEFAULT; + + if (buffer->Caps & D3DVBCAPS_WRITEONLY) + usage |= WINED3DUSAGE_WRITEONLY; + if (dynamic) + usage |= WINED3DUSAGE_DYNAMIC; + + return wined3d_buffer_create_vb(buffer->ddraw->wined3d_device, + buffer->size, usage, pool, buffer, &ddraw_null_wined3d_parent_ops, + wined3d_buffer); +} + /***************************************************************************** * IDirect3DVertexBuffer7::Lock * @@ -224,9 +245,29 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, wined3d_flags |= WINED3D_MAP_READONLY; if (flags & DDLOCK_NOOVERWRITE) wined3d_flags |= WINED3D_MAP_NOOVERWRITE; - if (flags & DDLOCK_DISCARDCONTENTS) + if (flags & DDLOCK_DISCARDCONTENTS && buffer->read_since_last_map) + { wined3d_flags |= WINED3D_MAP_DISCARD; + if (!buffer->dynamic) + { + struct wined3d_buffer *new_buffer; + wined3d_mutex_lock(); + hr = d3d_vertex_buffer_create_wined3d_buffer(buffer, TRUE, &new_buffer); + if (SUCCEEDED(hr)) + { + buffer->dynamic = TRUE; + wined3d_buffer_decref(buffer->wineD3DVertexBuffer); + buffer->wineD3DVertexBuffer = new_buffer; + } + else + { + WARN("Failed to create a dynamic buffer\n"); + } + wined3d_mutex_unlock(); + } + } + wined3d_mutex_lock(); if (data_size) { @@ -237,6 +278,10 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, } hr = wined3d_buffer_map(buffer->wineD3DVertexBuffer, 0, 0, (BYTE **)data, wined3d_flags); + + if (SUCCEEDED(hr)) + buffer->read_since_last_map = FALSE; + wined3d_mutex_unlock(); return hr; @@ -339,7 +384,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7 * the vertex ops */ doClip = !!(vertex_op & D3DVOP_CLIP); - wined3d_device_get_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, (DWORD *)&oldClip); + oldClip = wined3d_device_get_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING); if (doClip != oldClip) wined3d_device_set_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, doClip); @@ -534,7 +579,6 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf, struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc) { struct d3d_vertex_buffer *buffer; - DWORD usage; HRESULT hr = D3D_OK; TRACE("Vertex buffer description:\n"); @@ -554,16 +598,11 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf, buffer->ddraw = ddraw; buffer->Caps = desc->dwCaps; buffer->fvf = desc->dwFVF; - - usage = desc->dwCaps & D3DVBCAPS_WRITEONLY ? WINED3DUSAGE_WRITEONLY : 0; - usage |= WINED3DUSAGE_STATICDECL; + buffer->size = get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices; wined3d_mutex_lock(); - hr = wined3d_buffer_create_vb(ddraw->wined3d_device, - get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices, - usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3D_POOL_SYSTEM_MEM : WINED3D_POOL_DEFAULT, - buffer, &ddraw_null_wined3d_parent_ops, &buffer->wineD3DVertexBuffer); + hr = d3d_vertex_buffer_create_wined3d_buffer(buffer, FALSE, &buffer->wineD3DVertexBuffer); if (FAILED(hr)) { WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr); diff --git a/reactos/dll/directx/wine/ddraw/viewport.c b/reactos/dll/directx/wine/ddraw/viewport.c index 05b5556dd7f..f9eddda888f 100644 --- a/reactos/dll/directx/wine/ddraw/viewport.c +++ b/reactos/dll/directx/wine/ddraw/viewport.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -//#include "wine/port.h" +#include "config.h" +#include "wine/port.h" #include "ddraw_private.h" @@ -41,13 +41,11 @@ static void update_clip_space(struct d3d_device *device, offset->x, offset->y, offset->z, 1.0f, }; D3DMATRIX projection; - HRESULT hr; multiply_matrix(&projection, &clip_space, &device->legacy_projection); - hr = wined3d_device_set_transform(device->wined3d_device, + wined3d_device_set_transform(device->wined3d_device, WINED3D_TS_PROJECTION, (struct wined3d_matrix *)&projection); - if (SUCCEEDED(hr)) - device->legacy_clipspace = clip_space; + device->legacy_clipspace = clip_space; } /***************************************************************************** @@ -344,10 +342,10 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE This->viewports.vp1.dvMinZ = 0.0; This->viewports.vp1.dvMaxZ = 1.0; - if (This->active_device) { + if (This->active_device) + { IDirect3DDevice3 *d3d_device3 = &This->active_device->IDirect3DDevice3_iface; - IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport); - if (current_viewport) + if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport))) { if (current_viewport == iface) viewport_activate(This, FALSE); IDirect3DViewport3_Release(current_viewport); @@ -672,6 +670,12 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface, TRACE("iface %p, rect_count %u, rects %p, flags %#x.\n", iface, rect_count, rects, flags); + if (!rects || !rect_count) + { + WARN("rect_count = %u, rects = %p, ignoring clear\n", rect_count, rects); + return D3D_OK; + } + if (This->active_device == NULL) { ERR(" Trying to clear a viewport not attached to a device !\n"); return D3DERR_VIEWPORTHASNODEVICE; @@ -701,8 +705,7 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface, hr = IDirect3DDevice7_Clear(&This->active_device->IDirect3DDevice7_iface, rect_count, rects, flags & (D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET), color, 1.0, 0x00000000); - IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport); - if (current_viewport) + if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport))) { struct d3d_viewport *vp = impl_from_IDirect3DViewport3(current_viewport); viewport_activate(vp, TRUE); @@ -975,10 +978,10 @@ static HRESULT WINAPI d3d_viewport_SetViewport2(IDirect3DViewport3 *iface, D3DVI memset(&(This->viewports.vp2), 0, sizeof(This->viewports.vp2)); memcpy(&(This->viewports.vp2), lpData, lpData->dwSize); - if (This->active_device) { + if (This->active_device) + { IDirect3DDevice3 *d3d_device3 = &This->active_device->IDirect3DDevice3_iface; - IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport); - if (current_viewport) + if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport))) { if (current_viewport == iface) viewport_activate(This, FALSE); IDirect3DViewport3_Release(current_viewport); @@ -1062,6 +1065,12 @@ static HRESULT WINAPI d3d_viewport_Clear2(IDirect3DViewport3 *iface, DWORD rect_ TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, depth %.8e, stencil %u.\n", iface, rect_count, rects, flags, color, depth, stencil); + if (!rects || !rect_count) + { + WARN("rect_count = %u, rects = %p, ignoring clear\n", rect_count, rects); + return D3D_OK; + } + wined3d_mutex_lock(); if (!viewport->active_device) @@ -1077,8 +1086,7 @@ static HRESULT WINAPI d3d_viewport_Clear2(IDirect3DViewport3 *iface, DWORD rect_ hr = IDirect3DDevice7_Clear(&viewport->active_device->IDirect3DDevice7_iface, rect_count, rects, flags, color, depth, stencil); - IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport); - if (current_viewport) + if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, ¤t_viewport))) { struct d3d_viewport *vp = impl_from_IDirect3DViewport3(current_viewport); viewport_activate(vp, TRUE); diff --git a/reactos/dll/directx/wine/wined3d/CMakeLists.txt b/reactos/dll/directx/wine/wined3d/CMakeLists.txt index d36e7b655eb..b5ac102275e 100644 --- a/reactos/dll/directx/wine/wined3d/CMakeLists.txt +++ b/reactos/dll/directx/wine/wined3d/CMakeLists.txt @@ -22,6 +22,7 @@ list(APPEND SOURCE palette.c query.c resource.c + sampler.c shader.c shader_sm1.c shader_sm4.c diff --git a/reactos/dll/directx/wine/wined3d/arb_program_shader.c b/reactos/dll/directx/wine/wined3d/arb_program_shader.c index 5341d6a626a..e8da8059ae6 100644 --- a/reactos/dll/directx/wine/wined3d/arb_program_shader.c +++ b/reactos/dll/directx/wine/wined3d/arb_program_shader.c @@ -27,10 +27,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #include #include "wined3d_private.h" @@ -39,6 +39,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DECLARE_DEBUG_CHANNEL(d3d_constants); WINE_DECLARE_DEBUG_CHANNEL(d3d); +static BOOL shader_is_pshader_version(enum wined3d_shader_type type) +{ + return type == WINED3D_SHADER_TYPE_PIXEL; +} + +static BOOL shader_is_vshader_version(enum wined3d_shader_type type) +{ + return type == WINED3D_SHADER_TYPE_VERTEX; +} + /* Extract a line. Note that this modifies the source string. */ static char *get_line(char **ptr) { @@ -316,9 +326,13 @@ struct shader_arb_priv unsigned int highest_dirty_ps_const, highest_dirty_vs_const; char *vshader_const_dirty, *pshader_const_dirty; const struct wined3d_context *last_context; + + const struct fragment_pipeline *fragment_pipe; + BOOL ffp_proj_control; }; -/* GL locking for state handlers is done by the caller. */ +/* Context activation for state handlers is done by the caller. */ + static BOOL need_rel_addr_const(const struct arb_vshader_private *shader_data, const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info) { @@ -365,7 +379,7 @@ static unsigned int reserved_vs_const(const struct arb_vshader_private *shader_d * @target_type should be either GL_VERTEX_PROGRAM_ARB (for vertex shaders) * or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders) */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static unsigned int shader_arb_load_constantsF(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts) @@ -531,7 +545,7 @@ static void shader_arb_load_np2fixup_constants(void *shader_priv, } } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ static void shader_arb_ps_local_constants(const struct arb_ps_compiled_shader *gl_shader, const struct wined3d_context *context, const struct wined3d_state *state, UINT rt_height) { @@ -595,7 +609,7 @@ static void shader_arb_ps_local_constants(const struct arb_ps_compiled_shader *g checkGLcall("Load ps int consts"); } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *gl_shader, const struct wined3d_context *context, const struct wined3d_state *state) { @@ -625,20 +639,52 @@ static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *g checkGLcall("Load vs int consts"); } +static void shader_arb_select(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode, + enum wined3d_shader_mode fragment_mode); + /** * Loads the app-supplied constants into the currently set ARB_[vertex/fragment]_programs. * * We only support float constants in ARB at the moment, so don't * worry about the Integers or Booleans */ -/* GL locking is done by the caller (state handler) */ -static void shader_arb_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader) +/* Context activation is done by the caller (state handler). */ +static void shader_arb_load_constants_internal(const struct wined3d_context *context, + BOOL usePixelShader, BOOL useVertexShader, BOOL from_shader_select) { struct wined3d_device *device = context->swapchain->device; - const struct wined3d_state *state = &device->stateBlock->state; + const struct wined3d_stateblock *stateblock = device->stateBlock; + const struct wined3d_state *state = &stateblock->state; const struct wined3d_gl_info *gl_info = context->gl_info; struct shader_arb_priv *priv = device->shader_priv; + if (!from_shader_select) + { + const struct wined3d_shader *vshader = state->vertex_shader, *pshader = state->pixel_shader; + if (vshader + && (stateblock->changed.vertexShaderConstantsB & vshader->reg_maps.boolean_constants + || (!gl_info->supported[NV_VERTEX_PROGRAM2_OPTION] + && (stateblock->changed.vertexShaderConstantsI + & vshader->reg_maps.integer_constants & ~vshader->reg_maps.local_int_consts)))) + { + TRACE("bool/integer vertex shader constants potentially modified, forcing shader reselection.\n"); + shader_arb_select(context, + useVertexShader ? WINED3D_SHADER_MODE_SHADER : WINED3D_SHADER_MODE_FFP, + usePixelShader ? WINED3D_SHADER_MODE_SHADER : WINED3D_SHADER_MODE_FFP); + } + else if (pshader + && (stateblock->changed.pixelShaderConstantsB & pshader->reg_maps.boolean_constants + || (!gl_info->supported[NV_FRAGMENT_PROGRAM_OPTION] + && (stateblock->changed.pixelShaderConstantsI + & pshader->reg_maps.integer_constants & ~pshader->reg_maps.local_int_consts)))) + { + TRACE("bool/integer pixel shader constants potentially modified, forcing shader reselection.\n"); + shader_arb_select(context, + useVertexShader ? WINED3D_SHADER_MODE_SHADER : WINED3D_SHADER_MODE_FFP, + usePixelShader ? WINED3D_SHADER_MODE_SHADER : WINED3D_SHADER_MODE_FFP); + } + } + if (context != priv->last_context) { memset(priv->vshader_const_dirty, 1, @@ -676,6 +722,11 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha } } +static void shader_arb_load_constants(const struct wined3d_context *context, BOOL ps, BOOL vs) +{ + shader_arb_load_constants_internal(context, ps, vs, FALSE); +} + static void shader_arb_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) { struct wined3d_context *context = context_get_current(); @@ -770,6 +821,7 @@ static DWORD shader_generate_arb_declarations(const struct wined3d_shader *shade max_constantsF -= reserved_vs_const(shader_data, reg_maps, gl_info); max_constantsF -= count_bits(reg_maps->integer_constants); + max_constantsF -= gl_info->reserved_arb_constants; for (i = 0; i < shader->limits.constant_float; ++i) { @@ -974,7 +1026,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction switch (reg->type) { case WINED3DSPR_TEMP: - sprintf(register_name, "R%u", reg->idx); + sprintf(register_name, "R%u", reg->idx[0].offset); break; case WINED3DSPR_INPUT: @@ -982,19 +1034,21 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction { if (reg_maps->shader_version.major < 3) { - if (!reg->idx) strcpy(register_name, "fragment.color.primary"); - else strcpy(register_name, "fragment.color.secondary"); + if (!reg->idx[0].offset) + strcpy(register_name, "fragment.color.primary"); + else + strcpy(register_name, "fragment.color.secondary"); } else { - if(reg->rel_addr) + if (reg->idx[0].rel_addr) { char rel_reg[50]; - shader_arb_get_src_param(ins, reg->rel_addr, 0, rel_reg); + shader_arb_get_src_param(ins, reg->idx[0].rel_addr, 0, rel_reg); if (!strcmp(rel_reg, "**aL_emul**")) { - DWORD idx = ctx->aL + reg->idx; + DWORD idx = ctx->aL + reg->idx[0].offset; if(idx < MAX_REG_INPUT) { strcpy(register_name, ctx->ps_input[idx]); @@ -1020,7 +1074,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction FIXME("Relative input register addressing with more than 8 registers\n"); /* This is better than nothing for now */ - sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx); + sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx[0].offset); } else if(ctx->cur_ps_args->super.vp_mode != vertexshader) { @@ -1032,39 +1086,40 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction * For now use the texcoords and hope for the best */ FIXME("Non-vertex shader varying input with indirect addressing\n"); - sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx); + sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx[0].offset); } else { /* D3D supports indirect addressing only with aL in loop registers. The loop instruction * pulls GL_NV_fragment_program2 in */ - sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx); + sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx[0].offset); } } else { - if(reg->idx < MAX_REG_INPUT) + if (reg->idx[0].offset < MAX_REG_INPUT) { - strcpy(register_name, ctx->ps_input[reg->idx]); + strcpy(register_name, ctx->ps_input[reg->idx[0].offset]); } else { - ERR("Pixel shader input register out of bounds: %u\n", reg->idx); - sprintf(register_name, "out_of_bounds_%u", reg->idx); + ERR("Pixel shader input register out of bounds: %u\n", reg->idx[0].offset); + sprintf(register_name, "out_of_bounds_%u", reg->idx[0].offset); } } } } else { - if (ctx->cur_vs_args->super.swizzle_map & (1 << reg->idx)) *is_color = TRUE; - sprintf(register_name, "vertex.attrib[%u]", reg->idx); + if (ctx->cur_vs_args->super.swizzle_map & (1 << reg->idx[0].offset)) + *is_color = TRUE; + sprintf(register_name, "vertex.attrib[%u]", reg->idx[0].offset); } break; case WINED3DSPR_CONST: - if (!pshader && reg->rel_addr) + if (!pshader && reg->idx[0].rel_addr) { const struct arb_vshader_private *shader_data = shader->backend_data; UINT rel_offset = shader_data->rel_offset; @@ -1073,9 +1128,12 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction if (reg_maps->shader_version.major < 2) { sprintf(rel_reg, "A0.x"); - } else { - shader_arb_get_src_param(ins, reg->rel_addr, 0, rel_reg); - if(ctx->target_version == ARB) { + } + else + { + shader_arb_get_src_param(ins, reg->idx[0].rel_addr, 0, rel_reg); + if (ctx->target_version == ARB) + { if (!strcmp(rel_reg, "**aL_emul**")) { aL = TRUE; @@ -1085,19 +1143,19 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction } } } - if(aL) - sprintf(register_name, "C[%u]", ctx->aL + reg->idx); - else if (reg->idx >= rel_offset) - sprintf(register_name, "C[%s + %u]", rel_reg, reg->idx - rel_offset); + if (aL) + sprintf(register_name, "C[%u]", ctx->aL + reg->idx[0].offset); + else if (reg->idx[0].offset >= rel_offset) + sprintf(register_name, "C[%s + %u]", rel_reg, reg->idx[0].offset - rel_offset); else - sprintf(register_name, "C[%s - %u]", rel_reg, rel_offset - reg->idx); + sprintf(register_name, "C[%s - %u]", rel_reg, rel_offset - reg->idx[0].offset); } else { if (reg_maps->usesrelconstF) - sprintf(register_name, "C[%u]", reg->idx); + sprintf(register_name, "C[%u]", reg->idx[0].offset); else - sprintf(register_name, "C%u", reg->idx); + sprintf(register_name, "C%u", reg->idx[0].offset); } break; @@ -1106,52 +1164,45 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction { if (reg_maps->shader_version.major == 1 && reg_maps->shader_version.minor <= 3) - { - /* In ps <= 1.3, Tx is a temporary register as destination to all instructions, - * and as source to most instructions. For some instructions it is the texcoord - * input. Those instructions know about the special use - */ - sprintf(register_name, "T%u", reg->idx); - } else { - /* in ps 1.4 and 2.x Tx is always a (read-only) varying */ - sprintf(register_name, "fragment.texcoord[%u]", reg->idx); - } + /* In ps <= 1.3, Tx is a temporary register as destination + * to all instructions, and as source to most instructions. + * For some instructions it is the texcoord input. Those + * instructions know about the special use. */ + sprintf(register_name, "T%u", reg->idx[0].offset); + else + /* In ps 1.4 and 2.x Tx is always a (read-only) varying. */ + sprintf(register_name, "fragment.texcoord[%u]", reg->idx[0].offset); } else { if (reg_maps->shader_version.major == 1 || ctx->target_version >= NV2) - { - sprintf(register_name, "A%u", reg->idx); - } + sprintf(register_name, "A%u", reg->idx[0].offset); else - { - sprintf(register_name, "A%u_SHADOW", reg->idx); - } + sprintf(register_name, "A%u_SHADOW", reg->idx[0].offset); } break; case WINED3DSPR_COLOROUT: - if (ctx->cur_ps_args->super.srgb_correction && !reg->idx) + if (ctx->cur_ps_args->super.srgb_correction && !reg->idx[0].offset) { strcpy(register_name, "TMP_COLOR"); } else { - if(ctx->cur_ps_args->super.srgb_correction) FIXME("sRGB correction on higher render targets\n"); + if (ctx->cur_ps_args->super.srgb_correction) + FIXME("sRGB correction on higher render targets.\n"); if (reg_maps->rt_mask > 1) - { - sprintf(register_name, "result.color[%u]", reg->idx); - } + sprintf(register_name, "result.color[%u]", reg->idx[0].offset); else - { strcpy(register_name, "result.color"); - } } break; case WINED3DSPR_RASTOUT: - if(reg->idx == 1) sprintf(register_name, "%s", ctx->fog_output); - else sprintf(register_name, "%s", rastout_reg_names[reg->idx]); + if (reg->idx[0].offset == 1) + sprintf(register_name, "%s", ctx->fog_output); + else + sprintf(register_name, "%s", rastout_reg_names[reg->idx[0].offset]); break; case WINED3DSPR_DEPTHOUT: @@ -1160,26 +1211,19 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction case WINED3DSPR_ATTROUT: /* case WINED3DSPR_OUTPUT: */ - if (pshader) sprintf(register_name, "oD[%u]", reg->idx); - else strcpy(register_name, ctx->color_output[reg->idx]); + if (pshader) + sprintf(register_name, "oD[%u]", reg->idx[0].offset); + else + strcpy(register_name, ctx->color_output[reg->idx[0].offset]); break; case WINED3DSPR_TEXCRDOUT: if (pshader) - { - sprintf(register_name, "oT[%u]", reg->idx); - } + sprintf(register_name, "oT[%u]", reg->idx[0].offset); + else if (reg_maps->shader_version.major < 3) + strcpy(register_name, ctx->texcrd_output[reg->idx[0].offset]); else - { - if (reg_maps->shader_version.major < 3) - { - strcpy(register_name, ctx->texcrd_output[reg->idx]); - } - else - { - strcpy(register_name, ctx->vs_output[reg->idx]); - } - } + strcpy(register_name, ctx->vs_output[reg->idx[0].offset]); break; case WINED3DSPR_LOOP: @@ -1203,27 +1247,21 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction break; case WINED3DSPR_CONSTINT: - sprintf(register_name, "I%u", reg->idx); + sprintf(register_name, "I%u", reg->idx[0].offset); break; case WINED3DSPR_MISCTYPE: - if (!reg->idx) - { + if (!reg->idx[0].offset) sprintf(register_name, "vpos"); - } - else if(reg->idx == 1) - { + else if (reg->idx[0].offset == 1) sprintf(register_name, "fragment.facing.x"); - } else - { - FIXME("Unknown MISCTYPE register index %u\n", reg->idx); - } + FIXME("Unknown MISCTYPE register index %u.\n", reg->idx[0].offset); break; default: - FIXME("Unhandled register type %#x[%u]\n", reg->type, reg->idx); - sprintf(register_name, "unrecognized_register[%u]", reg->idx); + FIXME("Unhandled register type %#x[%u].\n", reg->type, reg->idx[0].offset); + sprintf(register_name, "unrecognized_register[%u]", reg->idx[0].offset); break; } } @@ -1555,9 +1593,9 @@ static void pshader_hw_bem(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader_dst_param *dst = &ins->dst[0]; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + DWORD sampler_code = dst->reg.idx[0].offset; char dst_name[50]; char src_name[2][50]; - DWORD sampler_code = dst->reg.idx; shader_arb_get_dst_param(ins, dst, dst_name); @@ -1754,11 +1792,7 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "%s%s %s%s;\n", instruction, shader_arb_get_modifier(ins), dst_str, arguments); } -static void shader_hw_nop(const struct wined3d_shader_instruction *ins) -{ - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - shader_addline(buffer, "NOP;\n"); -} +static void shader_hw_nop(const struct wined3d_shader_instruction *ins) {} static void shader_hw_mov(const struct wined3d_shader_instruction *ins) { @@ -1835,7 +1869,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "ARL A0.x, %s;\n", src0_param); } } - else if (ins->dst[0].reg.type == WINED3DSPR_COLOROUT && !ins->dst[0].reg.idx && pshader) + else if (ins->dst[0].reg.type == WINED3DSPR_COLOROUT && !ins->dst[0].reg.idx[0].offset && pshader) { if (ctx->cur_ps_args->super.srgb_correction && shader->u.ps.color0_mov) { @@ -1885,18 +1919,19 @@ static void pshader_hw_texkill(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "SWZ TA, %s, %c, %c, %c, %c;\n", reg_dest, x, y, z, w); } shader_addline(buffer, "KIL %s;\n", kilsrc); - } else { + } + else + { /* ARB fp doesn't like swizzles on the parameter of the KIL instruction. To mask the 4th component, * copy the register into our general purpose TMP variable, overwrite .w and pass TMP to KIL * * ps_1_3 shaders use the texcoord incarnation of the Tx register. ps_1_4 shaders can use the same, * or pass in any temporary register(in shader phase 2) */ - if(ins->ctx->reg_maps->shader_version.minor <= 3) { - sprintf(reg_dest, "fragment.texcoord[%u]", dst->reg.idx); - } else { + if (ins->ctx->reg_maps->shader_version.minor <= 3) + sprintf(reg_dest, "fragment.texcoord[%u]", dst->reg.idx[0].offset); + else shader_arb_get_dst_param(ins, dst, reg_dest); - } shader_addline(buffer, "SWZ TA, %s, x, y, z, 1;\n", reg_dest); shader_addline(buffer, "KIL TA;\n"); } @@ -1922,9 +1957,9 @@ static void pshader_hw_tex(const struct wined3d_shader_instruction *ins) /* 1.0-1.4: Use destination register number as texture code. 2.0+: Use provided sampler number as texure code. */ if (shader_version < WINED3D_SHADER_VERSION(2,0)) - reg_sampler_code = dst->reg.idx; + reg_sampler_code = dst->reg.idx[0].offset; else - reg_sampler_code = ins->src[1].reg.idx; + reg_sampler_code = ins->src[1].reg.idx[0].offset; /* 1.0-1.3: Use the texcoord varying. 1.4+: Use provided coordinate source register. */ @@ -1991,7 +2026,7 @@ static void pshader_hw_texcoord(const struct wined3d_shader_instruction *ins) if (shader_version < WINED3D_SHADER_VERSION(1,4)) { - DWORD reg = dst->reg.idx; + DWORD reg = dst->reg.idx[0].offset; shader_arb_get_dst_param(ins, &ins->dst[0], dst_str); shader_addline(buffer, "MOV_SAT %s, fragment.texcoord[%u];\n", dst_str, reg); @@ -2001,7 +2036,7 @@ static void pshader_hw_texcoord(const struct wined3d_shader_instruction *ins) shader_arb_get_src_param(ins, &ins->src[0], 0, reg_src); shader_arb_get_dst_param(ins, &ins->dst[0], dst_str); shader_addline(buffer, "MOV %s, %s;\n", dst_str, reg_src); - } + } } static void pshader_hw_texreg2ar(const struct wined3d_shader_instruction *ins) @@ -2009,7 +2044,7 @@ static void pshader_hw_texreg2ar(const struct wined3d_shader_instruction *ins) struct wined3d_shader_buffer *buffer = ins->ctx->buffer; DWORD flags = 0; - DWORD reg1 = ins->dst[0].reg.idx; + DWORD reg1 = ins->dst[0].reg.idx[0].offset; char dst_str[50]; char src_str[50]; @@ -2031,7 +2066,7 @@ static void pshader_hw_texreg2gb(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - DWORD reg1 = ins->dst[0].reg.idx; + DWORD reg1 = ins->dst[0].reg.idx[0].offset; char dst_str[50]; char src_str[50]; @@ -2045,7 +2080,7 @@ static void pshader_hw_texreg2gb(const struct wined3d_shader_instruction *ins) static void pshader_hw_texreg2rgb(const struct wined3d_shader_instruction *ins) { - DWORD reg1 = ins->dst[0].reg.idx; + DWORD reg1 = ins->dst[0].reg.idx[0].offset; char dst_str[50]; char src_str[50]; @@ -2066,7 +2101,7 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins) /* All versions have a destination register. The Tx where the texture coordinates come * from is the varying incarnation of the texture register */ - reg_dest_code = dst->reg.idx; + reg_dest_code = dst->reg.idx[0].offset; shader_arb_get_dst_param(ins, &ins->dst[0], dst_reg); shader_arb_get_src_param(ins, &ins->src[0], 0, src_reg); sprintf(reg_coord, "fragment.texcoord[%u]", reg_dest_code); @@ -2112,7 +2147,7 @@ static void pshader_hw_texbem(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x2pad(const struct wined3d_shader_instruction *ins) { - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char src0_name[50], dst_name[50]; BOOL is_color; @@ -2122,7 +2157,7 @@ static void pshader_hw_texm3x2pad(const struct wined3d_shader_instruction *ins) /* The next instruction will be a texm3x2tex or texm3x2depth that writes to the uninitialized * T register. Use this register to store the calculated vector */ - tmp_reg.idx = reg + 1; + tmp_reg.idx[0].offset = reg + 1; shader_arb_get_register_name(ins, &tmp_reg, dst_name, &is_color); shader_addline(buffer, "DP3 %s.x, fragment.texcoord[%u], %s;\n", dst_name, reg, src0_name); } @@ -2131,7 +2166,7 @@ static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins) { struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; DWORD flags; - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50]; @@ -2151,7 +2186,7 @@ static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char src0_name[50], dst_name[50]; struct wined3d_shader_register tmp_reg = ins->dst[0].reg; @@ -2161,7 +2196,7 @@ static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins) * incrementing ins->dst[0].register_idx numbers. So the pad instruction already knows the final destination * register, and this register is uninitialized(otherwise the assembler complains that it is 'redeclared') */ - tmp_reg.idx = reg + 2 - tex_mx->current_row; + tmp_reg.idx[0].offset = reg + 2 - tex_mx->current_row; shader_arb_get_register_name(ins, &tmp_reg, dst_name, &is_color); shader_arb_get_src_param(ins, &ins->src[0], 0, src0_name); @@ -2175,7 +2210,7 @@ static void pshader_hw_texm3x3tex(const struct wined3d_shader_instruction *ins) struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50], dst_name[50]; @@ -2197,7 +2232,7 @@ static void pshader_hw_texm3x3vspec(const struct wined3d_shader_instruction *ins struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50]; @@ -2238,7 +2273,7 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins) struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char dst_str[50]; char src0_name[50]; @@ -2310,7 +2345,7 @@ static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins) static void pshader_hw_texdp3tex(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - DWORD sampler_idx = ins->dst[0].reg.idx; + DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; char src0[50]; char dst_str[50]; @@ -2334,7 +2369,7 @@ static void pshader_hw_texdp3(const struct wined3d_shader_instruction *ins) /* Handle output register */ shader_arb_get_dst_param(ins, dst, dst_str); shader_arb_get_src_param(ins, &ins->src[0], 0, src0); - shader_addline(buffer, "DP3 %s, fragment.texcoord[%u], %s;\n", dst_str, dst->reg.idx, src0); + shader_addline(buffer, "DP3 %s, fragment.texcoord[%u], %s;\n", dst_str, dst->reg.idx[0].offset, src0); } /** Process the WINED3DSIO_TEXM3X3 instruction in ARB @@ -2350,7 +2385,7 @@ static void pshader_hw_texm3x3(const struct wined3d_shader_instruction *ins) shader_arb_get_dst_param(ins, dst, dst_str); shader_arb_get_src_param(ins, &ins->src[0], 0, src0); shader_arb_get_register_name(ins, &ins->dst[0].reg, dst_name, &is_color); - shader_addline(buffer, "DP3 %s.z, fragment.texcoord[%u], %s;\n", dst_name, dst->reg.idx, src0); + shader_addline(buffer, "DP3 %s.z, fragment.texcoord[%u], %s;\n", dst_name, dst->reg.idx[0].offset, src0); shader_addline(buffer, "MOV %s, %s;\n", dst_str, dst_name); } @@ -2370,7 +2405,7 @@ static void pshader_hw_texm3x2depth(const struct wined3d_shader_instruction *ins shader_arb_get_src_param(ins, &ins->src[0], 0, src0); shader_arb_get_register_name(ins, &ins->dst[0].reg, dst_name, &is_color); - shader_addline(buffer, "DP3 %s.y, fragment.texcoord[%u], %s;\n", dst_name, dst->reg.idx, src0); + shader_addline(buffer, "DP3 %s.y, fragment.texcoord[%u], %s;\n", dst_name, dst->reg.idx[0].offset, src0); /* How to deal with the special case dst_name.g == 0? if r != 0, then * the r * (1 / 0) will give infinity, which is clamped to 1.0, the correct @@ -2431,10 +2466,11 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) tmp_dst = ins->dst[0]; tmp_src[0] = ins->src[0]; tmp_src[1] = ins->src[1]; - for (i = 0; i < nComponents; i++) { + for (i = 0; i < nComponents; ++i) + { tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i; shader_hw_map2gl(&tmp_ins); - ++tmp_src[1].reg.idx; + ++tmp_src[1].reg.idx[0].offset; } } @@ -3091,7 +3127,7 @@ static void shader_hw_endif(const struct wined3d_shader_instruction *ins) static void shader_hw_texldd(const struct wined3d_shader_instruction *ins) { - DWORD sampler_idx = ins->src[1].reg.idx; + DWORD sampler_idx = ins->src[1].reg.idx[0].offset; char reg_dest[40]; char reg_src[3][40]; WORD flags = TEX_DERIV; @@ -3109,7 +3145,7 @@ static void shader_hw_texldd(const struct wined3d_shader_instruction *ins) static void shader_hw_texldl(const struct wined3d_shader_instruction *ins) { - DWORD sampler_idx = ins->src[1].reg.idx; + DWORD sampler_idx = ins->src[1].reg.idx[0].offset; char reg_dest[40]; char reg_coord[40]; WORD flags = TEX_LOD; @@ -3134,7 +3170,7 @@ static void shader_hw_label(const struct wined3d_shader_instruction *ins) */ if(priv->target_version == ARB) return; - shader_addline(buffer, "l%u:\n", ins->src[0].reg.idx); + shader_addline(buffer, "l%u:\n", ins->src[0].reg.idx[0].offset); } static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx, @@ -3266,10 +3302,10 @@ static void shader_hw_ret(const struct wined3d_shader_instruction *ins) static void shader_hw_call(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - shader_addline(buffer, "CAL l%u;\n", ins->src[0].reg.idx); + shader_addline(buffer, "CAL l%u;\n", ins->src[0].reg.idx[0].offset); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLuint create_arb_blt_vertex_program(const struct wined3d_gl_info *gl_info) { GLuint program_id = 0; @@ -3308,7 +3344,7 @@ static GLuint create_arb_blt_vertex_program(const struct wined3d_gl_info *gl_inf return program_id; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLuint create_arb_blt_fragment_program(const struct wined3d_gl_info *gl_info, enum tex_types tex_type, BOOL masked) { @@ -3544,7 +3580,7 @@ static void init_ps_input(const struct wined3d_shader *shader, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, const struct arb_ps_compile_args *args, struct arb_ps_compiled_shader *compiled) @@ -4133,13 +4169,14 @@ static void init_output_registers(const struct wined3d_shader *shader, DWORD sig } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, const struct arb_vs_compile_args *args, struct arb_vs_compiled_shader *compiled) { const struct arb_vshader_private *shader_data = shader->backend_data; const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; + struct shader_arb_priv *priv = shader->device->shader_priv; const struct wined3d_shader_lconst *lconst; const DWORD *function = shader->function; GLuint ret; @@ -4232,11 +4269,10 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader, */ if (!gl_info->supported[NV_VERTEX_PROGRAM]) { - struct wined3d_device *device = shader->device; const char *color_init = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_0001); shader_addline(buffer, "MOV result.color.secondary, %s;\n", color_init); - if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !device->frag_pipe->ffp_proj_control) + if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !priv->ffp_proj_control) { int i; const char *one = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_ONE); @@ -4282,7 +4318,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader, { GLint native; - GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB, &native)); + GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB, &native)); checkGLcall("glGetProgramivARB()"); if (!native) WARN("Program exceeds native resource limits.\n"); @@ -4301,7 +4337,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader, return ret; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *shader, const struct arb_ps_compile_args *args) { @@ -4615,8 +4651,9 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state, } } -/* GL locking is done by the caller */ -static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) +/* Context activation is done by the caller. */ +static void shader_arb_select(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode, + enum wined3d_shader_mode fragment_mode) { struct wined3d_device *device = context->swapchain->device; struct shader_arb_priv *priv = device->shader_priv; @@ -4625,7 +4662,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, int i; /* Deal with pixel shaders first so the vertex shader arg function has the input signature ready */ - if (usePS) + if (fragment_mode == WINED3D_SHADER_MODE_SHADER) { struct wined3d_shader *ps = state->pixel_shader; struct arb_ps_compile_args compile_args; @@ -4642,11 +4679,12 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, priv->current_fprogram_id);"); if (!priv->use_arbfp_fixed_func) - { - /* Enable OpenGL fragment programs. */ - gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); - checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);"); - } + priv->fragment_pipe->enable_extension(gl_info, FALSE); + + /* Enable OpenGL fragment programs. */ + gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); + checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);"); + TRACE("(%p) : Bound fragment program %u and enabled GL_FRAGMENT_PROGRAM_ARB\n", device, priv->current_fprogram_id); @@ -4662,7 +4700,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, priv->pshader_const_dirty[i] = 1; } /* Also takes care of loading local constants */ - shader_arb_load_constants(context, TRUE, FALSE); + shader_arb_load_constants_internal(context, TRUE, FALSE, TRUE); } else { @@ -4674,18 +4712,22 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, if (compiled->np2fixup_info.super.active) shader_arb_load_np2fixup_constants(priv, gl_info, state); } - else if (gl_info->supported[ARB_FRAGMENT_PROGRAM] && !priv->use_arbfp_fixed_func) + else { - /* Disable only if we're not using arbfp fixed function fragment processing. If this is used, - * keep GL_FRAGMENT_PROGRAM_ARB enabled, and the fixed function pipeline will bind the fixed function - * replacement shader - */ - gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB); - checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); - priv->current_fprogram_id = 0; + if (gl_info->supported[ARB_FRAGMENT_PROGRAM] && !priv->use_arbfp_fixed_func) + { + /* Disable only if we're not using arbfp fixed function fragment + * processing. If this is used, keep GL_FRAGMENT_PROGRAM_ARB + * enabled, and the fixed function pipeline will bind the fixed + * function replacement shader. */ + gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB); + checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); + priv->current_fprogram_id = 0; + } + priv->fragment_pipe->enable_extension(gl_info, fragment_mode == WINED3D_SHADER_MODE_FFP); } - if (useVS) + if (vertex_mode == WINED3D_SHADER_MODE_SHADER) { struct wined3d_shader *vs = state->vertex_shader; struct arb_vs_compile_args compile_args; @@ -4727,7 +4769,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_arb_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info, enum tex_types tex_type, const SIZE *ds_mask_size) { @@ -4747,7 +4789,7 @@ static void shader_arb_select_depth_blt(void *shader_priv, const struct wined3d_ gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_arb_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) { struct shader_arb_priv *priv = shader_priv; @@ -4793,13 +4835,11 @@ static void shader_arb_destroy(struct wined3d_shader *shader) { struct wined3d_context *context = context_acquire(device, NULL); - ENTER_GL(); for (i = 0; i < shader_data->num_gl_shaders; ++i) { GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))"); } - LEAVE_GL(); context_release(context); } @@ -4819,13 +4859,11 @@ static void shader_arb_destroy(struct wined3d_shader *shader) { struct wined3d_context *context = context_acquire(device, NULL); - ENTER_GL(); for (i = 0; i < shader_data->num_gl_shaders; ++i) { GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))"); } - LEAVE_GL(); context_release(context); } @@ -4850,9 +4888,18 @@ static const struct wine_rb_functions sig_tree_functions = sig_tree_compare }; -static HRESULT shader_arb_alloc(struct wined3d_device *device) +static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct fragment_pipeline *fragment_pipe) { struct shader_arb_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv)); + struct fragment_caps fragment_caps; + void *fragment_priv; + + if (!(fragment_priv = fragment_pipe->alloc_private(&arb_program_shader_backend, priv))) + { + ERR("Failed to initialize fragment pipe.\n"); + HeapFree(GetProcessHeap(), 0, priv); + return E_FAIL; + } priv->vshader_const_dirty = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv->vshader_const_dirty) * device->d3d_vshader_constantF); @@ -4873,12 +4920,18 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device) ERR("RB tree init failed\n"); goto fail; } + + fragment_pipe->get_caps(&device->adapter->gl_info, &fragment_caps); + priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL; + device->fragment_priv = fragment_priv; + priv->fragment_pipe = fragment_pipe; device->shader_priv = priv; return WINED3D_OK; fail: HeapFree(GetProcessHeap(), 0, priv->pshader_const_dirty); HeapFree(GetProcessHeap(), 0, priv->vshader_const_dirty); + fragment_pipe->free_private(device); HeapFree(GetProcessHeap(), 0, priv); return E_OUTOFMEMORY; } @@ -4902,10 +4955,9 @@ static void shader_arb_free(struct wined3d_device *device) struct shader_arb_priv *priv = device->shader_priv; int i; - ENTER_GL(); - if(priv->depth_blt_vprogram_id) { + if (priv->depth_blt_vprogram_id) GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_vprogram_id)); - } + for (i = 0; i < tex_type_count; ++i) { if (priv->depth_blt_fprogram_id_full[i]) @@ -4917,11 +4969,11 @@ static void shader_arb_free(struct wined3d_device *device) GL_EXTCALL(glDeleteProgramsARB(1, &priv->depth_blt_fprogram_id_masked[i])); } } - LEAVE_GL(); wine_rb_destroy(&priv->signature_tree, release_signature, NULL); HeapFree(GetProcessHeap(), 0, priv->pshader_const_dirty); HeapFree(GetProcessHeap(), 0, priv->vshader_const_dirty); + priv->fragment_pipe->free_private(device); HeapFree(GetProcessHeap(), 0, device->shader_priv); } @@ -4938,6 +4990,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[ARB_VERTEX_PROGRAM]) { DWORD vs_consts; + UINT vs_version; /* 96 is the minimum allowed value of MAX_PROGRAM_ENV_PARAMETERS_ARB * for vertex programs. If the native limit is less than that it's @@ -4950,31 +5003,35 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[NV_VERTEX_PROGRAM3]) { - caps->VertexShaderVersion = 3; + vs_version = 3; TRACE("Hardware vertex shader version 3.0 enabled (NV_VERTEX_PROGRAM3)\n"); } else if (vs_consts >= 256) { /* Shader Model 2.0 requires at least 256 vertex shader constants */ - caps->VertexShaderVersion = 2; + vs_version = 2; TRACE("Hardware vertex shader version 2.0 enabled (ARB_PROGRAM)\n"); } else { - caps->VertexShaderVersion = 1; + vs_version = 1; TRACE("Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)\n"); } - caps->MaxVertexShaderConst = vs_consts; + caps->vs_version = min(wined3d_settings.max_sm_vs, vs_version); + caps->vs_uniform_count = vs_consts; } else { - caps->VertexShaderVersion = 0; - caps->MaxVertexShaderConst = 0; + caps->vs_version = 0; + caps->vs_uniform_count = 0; } + caps->gs_version = 0; + if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) { DWORD ps_consts; + UINT ps_version; /* Similar as above for vertex programs, but the minimum for fragment * programs is 24. */ @@ -4985,31 +5042,34 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[NV_FRAGMENT_PROGRAM2]) { - caps->PixelShaderVersion = 3; + ps_version = 3; TRACE("Hardware pixel shader version 3.0 enabled (NV_FRAGMENT_PROGRAM2)\n"); } else if (ps_consts >= 32) { /* Shader Model 2.0 requires at least 32 pixel shader constants */ - caps->PixelShaderVersion = 2; + ps_version = 2; TRACE("Hardware pixel shader version 2.0 enabled (ARB_PROGRAM)\n"); } else { - caps->PixelShaderVersion = 1; + ps_version = 1; TRACE("Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)\n"); } - caps->PixelShader1xMaxValue = 8.0f; - caps->MaxPixelShaderConst = ps_consts; + caps->ps_version = min(wined3d_settings.max_sm_ps, ps_version); + caps->ps_uniform_count = ps_consts; + caps->ps_1x_max_value = 8.0f; } else { - caps->PixelShaderVersion = 0; - caps->PixelShader1xMaxValue = 0.0f; - caps->MaxPixelShaderConst = 0; + caps->ps_version = 0; + caps->ps_uniform_count = 0; + caps->ps_1x_max_value = 0.0f; } - caps->VSClipping = use_nv_clip(gl_info); + caps->wined3d_caps = WINED3D_SHADER_CAP_SRGB_WRITE; + if (use_nv_clip(gl_info)) + caps->wined3d_caps |= WINED3D_SHADER_CAP_VS_CLIPPING; } static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup) @@ -5057,113 +5117,117 @@ static void shader_arb_add_instruction_modifiers(const struct wined3d_shader_ins static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABLE_SIZE] = { - /* WINED3DSIH_ABS */ shader_hw_map2gl, - /* WINED3DSIH_ADD */ shader_hw_map2gl, - /* WINED3DSIH_AND */ NULL, - /* WINED3DSIH_BEM */ pshader_hw_bem, - /* WINED3DSIH_BREAK */ shader_hw_break, - /* WINED3DSIH_BREAKC */ shader_hw_breakc, - /* WINED3DSIH_BREAKP */ NULL, - /* WINED3DSIH_CALL */ shader_hw_call, - /* WINED3DSIH_CALLNZ */ NULL, - /* WINED3DSIH_CMP */ pshader_hw_cmp, - /* WINED3DSIH_CND */ pshader_hw_cnd, - /* WINED3DSIH_CRS */ shader_hw_map2gl, - /* WINED3DSIH_CUT */ NULL, - /* WINED3DSIH_DCL */ NULL, - /* WINED3DSIH_DEF */ NULL, - /* WINED3DSIH_DEFB */ NULL, - /* WINED3DSIH_DEFI */ NULL, - /* WINED3DSIH_DIV */ NULL, - /* WINED3DSIH_DP2ADD */ pshader_hw_dp2add, - /* WINED3DSIH_DP3 */ shader_hw_map2gl, - /* WINED3DSIH_DP4 */ shader_hw_map2gl, - /* WINED3DSIH_DST */ shader_hw_map2gl, - /* WINED3DSIH_DSX */ shader_hw_map2gl, - /* WINED3DSIH_DSY */ shader_hw_dsy, - /* WINED3DSIH_ELSE */ shader_hw_else, - /* WINED3DSIH_EMIT */ NULL, - /* WINED3DSIH_ENDIF */ shader_hw_endif, - /* WINED3DSIH_ENDLOOP */ shader_hw_endloop, - /* WINED3DSIH_ENDREP */ shader_hw_endrep, - /* WINED3DSIH_EQ */ NULL, - /* WINED3DSIH_EXP */ shader_hw_scalar_op, - /* WINED3DSIH_EXPP */ shader_hw_scalar_op, - /* WINED3DSIH_FRC */ shader_hw_map2gl, - /* WINED3DSIH_FTOI */ NULL, - /* WINED3DSIH_GE */ NULL, - /* WINED3DSIH_IADD */ NULL, - /* WINED3DSIH_IEQ */ NULL, - /* WINED3DSIH_IF */ NULL /* Hardcoded into the shader */, - /* WINED3DSIH_IFC */ shader_hw_ifc, - /* WINED3DSIH_IGE */ NULL, - /* WINED3DSIH_IMUL */ NULL, - /* WINED3DSIH_ITOF */ NULL, - /* WINED3DSIH_LABEL */ shader_hw_label, - /* WINED3DSIH_LD */ NULL, - /* WINED3DSIH_LIT */ shader_hw_map2gl, - /* WINED3DSIH_LOG */ shader_hw_log, - /* WINED3DSIH_LOGP */ shader_hw_log, - /* WINED3DSIH_LOOP */ shader_hw_loop, - /* WINED3DSIH_LRP */ shader_hw_lrp, - /* WINED3DSIH_LT */ NULL, - /* WINED3DSIH_M3x2 */ shader_hw_mnxn, - /* WINED3DSIH_M3x3 */ shader_hw_mnxn, - /* WINED3DSIH_M3x4 */ shader_hw_mnxn, - /* WINED3DSIH_M4x3 */ shader_hw_mnxn, - /* WINED3DSIH_M4x4 */ shader_hw_mnxn, - /* WINED3DSIH_MAD */ shader_hw_map2gl, - /* WINED3DSIH_MAX */ shader_hw_map2gl, - /* WINED3DSIH_MIN */ shader_hw_map2gl, - /* WINED3DSIH_MOV */ shader_hw_mov, - /* WINED3DSIH_MOVA */ shader_hw_mov, - /* WINED3DSIH_MOVC */ NULL, - /* WINED3DSIH_MUL */ shader_hw_map2gl, - /* WINED3DSIH_NOP */ shader_hw_nop, - /* WINED3DSIH_NRM */ shader_hw_nrm, - /* WINED3DSIH_PHASE */ NULL, - /* WINED3DSIH_POW */ shader_hw_pow, - /* WINED3DSIH_RCP */ shader_hw_rcp, - /* WINED3DSIH_REP */ shader_hw_rep, - /* WINED3DSIH_RET */ shader_hw_ret, - /* WINED3DSIH_ROUND_NI */ NULL, - /* WINED3DSIH_RSQ */ shader_hw_scalar_op, - /* WINED3DSIH_SAMPLE */ NULL, - /* WINED3DSIH_SAMPLE_GRAD */ NULL, - /* WINED3DSIH_SAMPLE_LOD */ NULL, - /* WINED3DSIH_SETP */ NULL, - /* WINED3DSIH_SGE */ shader_hw_map2gl, - /* WINED3DSIH_SGN */ shader_hw_sgn, - /* WINED3DSIH_SINCOS */ shader_hw_sincos, - /* WINED3DSIH_SLT */ shader_hw_map2gl, - /* WINED3DSIH_SQRT */ NULL, - /* WINED3DSIH_SUB */ shader_hw_map2gl, - /* WINED3DSIH_TEX */ pshader_hw_tex, - /* WINED3DSIH_TEXBEM */ pshader_hw_texbem, - /* WINED3DSIH_TEXBEML */ pshader_hw_texbem, - /* WINED3DSIH_TEXCOORD */ pshader_hw_texcoord, - /* WINED3DSIH_TEXDEPTH */ pshader_hw_texdepth, - /* WINED3DSIH_TEXDP3 */ pshader_hw_texdp3, - /* WINED3DSIH_TEXDP3TEX */ pshader_hw_texdp3tex, - /* WINED3DSIH_TEXKILL */ pshader_hw_texkill, - /* WINED3DSIH_TEXLDD */ shader_hw_texldd, - /* WINED3DSIH_TEXLDL */ shader_hw_texldl, - /* WINED3DSIH_TEXM3x2DEPTH */ pshader_hw_texm3x2depth, - /* WINED3DSIH_TEXM3x2PAD */ pshader_hw_texm3x2pad, - /* WINED3DSIH_TEXM3x2TEX */ pshader_hw_texm3x2tex, - /* WINED3DSIH_TEXM3x3 */ pshader_hw_texm3x3, - /* WINED3DSIH_TEXM3x3DIFF */ NULL, - /* WINED3DSIH_TEXM3x3PAD */ pshader_hw_texm3x3pad, - /* WINED3DSIH_TEXM3x3SPEC */ pshader_hw_texm3x3spec, - /* WINED3DSIH_TEXM3x3TEX */ pshader_hw_texm3x3tex, - /* WINED3DSIH_TEXM3x3VSPEC */ pshader_hw_texm3x3vspec, - /* WINED3DSIH_TEXREG2AR */ pshader_hw_texreg2ar, - /* WINED3DSIH_TEXREG2GB */ pshader_hw_texreg2gb, - /* WINED3DSIH_TEXREG2RGB */ pshader_hw_texreg2rgb, - /* WINED3DSIH_UDIV */ NULL, - /* WINED3DSIH_USHR */ NULL, - /* WINED3DSIH_UTOF */ NULL, - /* WINED3DSIH_XOR */ NULL, + /* WINED3DSIH_ABS */ shader_hw_map2gl, + /* WINED3DSIH_ADD */ shader_hw_map2gl, + /* WINED3DSIH_AND */ NULL, + /* WINED3DSIH_BEM */ pshader_hw_bem, + /* WINED3DSIH_BREAK */ shader_hw_break, + /* WINED3DSIH_BREAKC */ shader_hw_breakc, + /* WINED3DSIH_BREAKP */ NULL, + /* WINED3DSIH_CALL */ shader_hw_call, + /* WINED3DSIH_CALLNZ */ NULL, + /* WINED3DSIH_CMP */ pshader_hw_cmp, + /* WINED3DSIH_CND */ pshader_hw_cnd, + /* WINED3DSIH_CRS */ shader_hw_map2gl, + /* WINED3DSIH_CUT */ NULL, + /* WINED3DSIH_DCL */ shader_hw_nop, + /* WINED3DSIH_DCL_CONSTANT_BUFFER */ shader_hw_nop, + /* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_hw_nop, + /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ shader_hw_nop, + /* WINED3DSIH_DCL_VERTICES_OUT */ shader_hw_nop, + /* WINED3DSIH_DEF */ shader_hw_nop, + /* WINED3DSIH_DEFB */ shader_hw_nop, + /* WINED3DSIH_DEFI */ shader_hw_nop, + /* WINED3DSIH_DIV */ NULL, + /* WINED3DSIH_DP2ADD */ pshader_hw_dp2add, + /* WINED3DSIH_DP3 */ shader_hw_map2gl, + /* WINED3DSIH_DP4 */ shader_hw_map2gl, + /* WINED3DSIH_DST */ shader_hw_map2gl, + /* WINED3DSIH_DSX */ shader_hw_map2gl, + /* WINED3DSIH_DSY */ shader_hw_dsy, + /* WINED3DSIH_ELSE */ shader_hw_else, + /* WINED3DSIH_EMIT */ NULL, + /* WINED3DSIH_ENDIF */ shader_hw_endif, + /* WINED3DSIH_ENDLOOP */ shader_hw_endloop, + /* WINED3DSIH_ENDREP */ shader_hw_endrep, + /* WINED3DSIH_EQ */ NULL, + /* WINED3DSIH_EXP */ shader_hw_scalar_op, + /* WINED3DSIH_EXPP */ shader_hw_scalar_op, + /* WINED3DSIH_FRC */ shader_hw_map2gl, + /* WINED3DSIH_FTOI */ NULL, + /* WINED3DSIH_GE */ NULL, + /* WINED3DSIH_IADD */ NULL, + /* WINED3DSIH_IEQ */ NULL, + /* WINED3DSIH_IF */ NULL /* Hardcoded into the shader */, + /* WINED3DSIH_IFC */ shader_hw_ifc, + /* WINED3DSIH_IGE */ NULL, + /* WINED3DSIH_IMUL */ NULL, + /* WINED3DSIH_ITOF */ NULL, + /* WINED3DSIH_LABEL */ shader_hw_label, + /* WINED3DSIH_LD */ NULL, + /* WINED3DSIH_LIT */ shader_hw_map2gl, + /* WINED3DSIH_LOG */ shader_hw_log, + /* WINED3DSIH_LOGP */ shader_hw_log, + /* WINED3DSIH_LOOP */ shader_hw_loop, + /* WINED3DSIH_LRP */ shader_hw_lrp, + /* WINED3DSIH_LT */ NULL, + /* WINED3DSIH_M3x2 */ shader_hw_mnxn, + /* WINED3DSIH_M3x3 */ shader_hw_mnxn, + /* WINED3DSIH_M3x4 */ shader_hw_mnxn, + /* WINED3DSIH_M4x3 */ shader_hw_mnxn, + /* WINED3DSIH_M4x4 */ shader_hw_mnxn, + /* WINED3DSIH_MAD */ shader_hw_map2gl, + /* WINED3DSIH_MAX */ shader_hw_map2gl, + /* WINED3DSIH_MIN */ shader_hw_map2gl, + /* WINED3DSIH_MOV */ shader_hw_mov, + /* WINED3DSIH_MOVA */ shader_hw_mov, + /* WINED3DSIH_MOVC */ NULL, + /* WINED3DSIH_MUL */ shader_hw_map2gl, + /* WINED3DSIH_NOP */ shader_hw_nop, + /* WINED3DSIH_NRM */ shader_hw_nrm, + /* WINED3DSIH_PHASE */ shader_hw_nop, + /* WINED3DSIH_POW */ shader_hw_pow, + /* WINED3DSIH_RCP */ shader_hw_rcp, + /* WINED3DSIH_REP */ shader_hw_rep, + /* WINED3DSIH_RET */ shader_hw_ret, + /* WINED3DSIH_ROUND_NI */ NULL, + /* WINED3DSIH_RSQ */ shader_hw_scalar_op, + /* WINED3DSIH_SAMPLE */ NULL, + /* WINED3DSIH_SAMPLE_GRAD */ NULL, + /* WINED3DSIH_SAMPLE_LOD */ NULL, + /* WINED3DSIH_SETP */ NULL, + /* WINED3DSIH_SGE */ shader_hw_map2gl, + /* WINED3DSIH_SGN */ shader_hw_sgn, + /* WINED3DSIH_SINCOS */ shader_hw_sincos, + /* WINED3DSIH_SLT */ shader_hw_map2gl, + /* WINED3DSIH_SQRT */ NULL, + /* WINED3DSIH_SUB */ shader_hw_map2gl, + /* WINED3DSIH_TEX */ pshader_hw_tex, + /* WINED3DSIH_TEXBEM */ pshader_hw_texbem, + /* WINED3DSIH_TEXBEML */ pshader_hw_texbem, + /* WINED3DSIH_TEXCOORD */ pshader_hw_texcoord, + /* WINED3DSIH_TEXDEPTH */ pshader_hw_texdepth, + /* WINED3DSIH_TEXDP3 */ pshader_hw_texdp3, + /* WINED3DSIH_TEXDP3TEX */ pshader_hw_texdp3tex, + /* WINED3DSIH_TEXKILL */ pshader_hw_texkill, + /* WINED3DSIH_TEXLDD */ shader_hw_texldd, + /* WINED3DSIH_TEXLDL */ shader_hw_texldl, + /* WINED3DSIH_TEXM3x2DEPTH */ pshader_hw_texm3x2depth, + /* WINED3DSIH_TEXM3x2PAD */ pshader_hw_texm3x2pad, + /* WINED3DSIH_TEXM3x2TEX */ pshader_hw_texm3x2tex, + /* WINED3DSIH_TEXM3x3 */ pshader_hw_texm3x3, + /* WINED3DSIH_TEXM3x3DIFF */ NULL, + /* WINED3DSIH_TEXM3x3PAD */ pshader_hw_texm3x3pad, + /* WINED3DSIH_TEXM3x3SPEC */ pshader_hw_texm3x3spec, + /* WINED3DSIH_TEXM3x3TEX */ pshader_hw_texm3x3tex, + /* WINED3DSIH_TEXM3x3VSPEC */ pshader_hw_texm3x3vspec, + /* WINED3DSIH_TEXREG2AR */ pshader_hw_texreg2ar, + /* WINED3DSIH_TEXREG2GB */ pshader_hw_texreg2gb, + /* WINED3DSIH_TEXREG2RGB */ pshader_hw_texreg2rgb, + /* WINED3DSIH_UDIV */ NULL, + /* WINED3DSIH_USHR */ NULL, + /* WINED3DSIH_UTOF */ NULL, + /* WINED3DSIH_XOR */ NULL, }; static BOOL get_bool_const(const struct wined3d_shader_instruction *ins, @@ -5266,26 +5330,29 @@ static void record_instruction(struct list *list, const struct wined3d_shader_in dst_param = HeapAlloc(GetProcessHeap(), 0, sizeof(*dst_param)); if(!dst_param) goto free; *dst_param = *ins->dst; - if(ins->dst->reg.rel_addr) + if (ins->dst->reg.idx[0].rel_addr) { - rel_addr = HeapAlloc(GetProcessHeap(), 0, sizeof(*dst_param->reg.rel_addr)); - if(!rel_addr) goto free; - *rel_addr = *ins->dst->reg.rel_addr; - dst_param->reg.rel_addr = rel_addr; + rel_addr = HeapAlloc(GetProcessHeap(), 0, sizeof(*rel_addr)); + if (!rel_addr) + goto free; + *rel_addr = *ins->dst->reg.idx[0].rel_addr; + dst_param->reg.idx[0].rel_addr = rel_addr; } rec->ins.dst = dst_param; src_param = HeapAlloc(GetProcessHeap(), 0, sizeof(*src_param) * ins->src_count); - if(!src_param) goto free; - for(i = 0; i < ins->src_count; i++) + if (!src_param) + goto free; + for (i = 0; i < ins->src_count; ++i) { src_param[i] = ins->src[i]; - if(ins->src[i].reg.rel_addr) + if (ins->src[i].reg.idx[0].rel_addr) { rel_addr = HeapAlloc(GetProcessHeap(), 0, sizeof(*rel_addr)); - if(!rel_addr) goto free; - *rel_addr = *ins->src[i].reg.rel_addr; - src_param[i].reg.rel_addr = rel_addr; + if (!rel_addr) + goto free; + *rel_addr = *ins->src[i].reg.idx[0].rel_addr; + src_param[i].reg.idx[0].rel_addr = rel_addr; } } rec->ins.src = src_param; @@ -5296,14 +5363,14 @@ free: ERR("Out of memory\n"); if(dst_param) { - HeapFree(GetProcessHeap(), 0, (void *) dst_param->reg.rel_addr); + HeapFree(GetProcessHeap(), 0, (void *)dst_param->reg.idx[0].rel_addr); HeapFree(GetProcessHeap(), 0, dst_param); } if(src_param) { for(i = 0; i < ins->src_count; i++) { - HeapFree(GetProcessHeap(), 0, (void *) src_param[i].reg.rel_addr); + HeapFree(GetProcessHeap(), 0, (void *)src_param[i].reg.idx[0].rel_addr); } HeapFree(GetProcessHeap(), 0, src_param); } @@ -5318,23 +5385,46 @@ static void free_recorded_instruction(struct list *list) LIST_FOR_EACH_ENTRY_SAFE(rec_ins, entry2, list, struct recorded_instruction, entry) { list_remove(&rec_ins->entry); - if(rec_ins->ins.dst) + if (rec_ins->ins.dst) { - HeapFree(GetProcessHeap(), 0, (void *) rec_ins->ins.dst->reg.rel_addr); - HeapFree(GetProcessHeap(), 0, (void *) rec_ins->ins.dst); + HeapFree(GetProcessHeap(), 0, (void *)rec_ins->ins.dst->reg.idx[0].rel_addr); + HeapFree(GetProcessHeap(), 0, (void *)rec_ins->ins.dst); } - if(rec_ins->ins.src) + if (rec_ins->ins.src) { - for(i = 0; i < rec_ins->ins.src_count; i++) + for (i = 0; i < rec_ins->ins.src_count; ++i) { - HeapFree(GetProcessHeap(), 0, (void *) rec_ins->ins.src[i].reg.rel_addr); + HeapFree(GetProcessHeap(), 0, (void *)rec_ins->ins.src[i].reg.idx[0].rel_addr); } - HeapFree(GetProcessHeap(), 0, (void *) rec_ins->ins.src); + HeapFree(GetProcessHeap(), 0, (void *)rec_ins->ins.src); } HeapFree(GetProcessHeap(), 0, rec_ins); } } +static void pop_control_frame(const struct wined3d_shader_instruction *ins) +{ + struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; + struct control_frame *control_frame; + + if (ins->handler_idx == WINED3DSIH_ENDLOOP || ins->handler_idx == WINED3DSIH_ENDREP) + { + struct list *e = list_head(&priv->control_frames); + control_frame = LIST_ENTRY(e, struct control_frame, entry); + list_remove(&control_frame->entry); + HeapFree(GetProcessHeap(), 0, control_frame); + priv->loop_depth--; + } + else if (ins->handler_idx == WINED3DSIH_ENDIF) + { + /* Non-ifc ENDIFs were already handled previously. */ + struct list *e = list_head(&priv->control_frames); + control_frame = LIST_ENTRY(e, struct control_frame, entry); + list_remove(&control_frame->entry); + HeapFree(GetProcessHeap(), 0, control_frame); + } +} + static void shader_arb_handle_instruction(const struct wined3d_shader_instruction *ins) { SHADER_HANDLER hw_fct; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; @@ -5369,7 +5459,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio list_init(&priv->record); priv->recording = TRUE; control_frame->outer_loop = TRUE; - get_loop_control_const(ins, shader, ins->src[0].reg.idx, &control_frame->loop_control); + get_loop_control_const(ins, shader, ins->src[0].reg.idx[0].offset, &control_frame->loop_control); return; /* Instruction is handled */ } /* Record this loop in the outer loop's recording */ @@ -5466,8 +5556,9 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio list_add_head(&priv->control_frames, &control_frame->entry); control_frame->type = IF; - bool_const = get_bool_const(ins, shader, ins->src[0].reg.idx); - if(ins->src[0].modifiers == WINED3DSPSM_NOT) bool_const = !bool_const; + bool_const = get_bool_const(ins, shader, ins->src[0].reg.idx[0].offset); + if (ins->src[0].modifiers == WINED3DSPSM_NOT) + bool_const = !bool_const; if (!priv->muted && !bool_const) { shader_addline(buffer, "#if(FALSE){\n"); @@ -5503,6 +5594,8 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio return; /* Instruction is handled. */ } /* In case of an ifc, generate a HW shader instruction */ + if (control_frame->type != IFC) + ERR("Control frame does not match.\n"); } else if(ins->handler_idx == WINED3DSIH_ENDIF) { @@ -5517,9 +5610,16 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio HeapFree(GetProcessHeap(), 0, control_frame); return; /* Instruction is handled */ } + /* In case of an ifc, generate a HW shader instruction */ + if (control_frame->type != IFC) + ERR("Control frame does not match.\n"); } - if(priv->muted) return; + if(priv->muted) + { + pop_control_frame(ins); + return; + } /* Select handler */ hw_fct = shader_arb_instruction_handler_table[ins->handler_idx]; @@ -5532,27 +5632,18 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio } hw_fct(ins); - if(ins->handler_idx == WINED3DSIH_ENDLOOP || ins->handler_idx == WINED3DSIH_ENDREP) - { - struct list *e = list_head(&priv->control_frames); - control_frame = LIST_ENTRY(e, struct control_frame, entry); - list_remove(&control_frame->entry); - HeapFree(GetProcessHeap(), 0, control_frame); - priv->loop_depth--; - } - else if(ins->handler_idx == WINED3DSIH_ENDIF) - { - /* Non-ifc ENDIFs don't reach that place because of the return in the if block above */ - struct list *e = list_head(&priv->control_frames); - control_frame = LIST_ENTRY(e, struct control_frame, entry); - list_remove(&control_frame->entry); - HeapFree(GetProcessHeap(), 0, control_frame); - } - + pop_control_frame(ins); shader_arb_add_instruction_modifiers(ins); } +static BOOL shader_arb_has_ffp_proj_control(void *shader_priv) +{ + struct shader_arb_priv *priv = shader_priv; + + return priv->ffp_proj_control; +} + const struct wined3d_shader_backend_ops arb_program_shader_backend = { shader_arb_handle_instruction, @@ -5569,6 +5660,7 @@ const struct wined3d_shader_backend_ops arb_program_shader_backend = shader_arb_context_destroyed, shader_arb_get_caps, shader_arb_color_fixup_supported, + shader_arb_has_ffp_proj_control, }; /* ARB_fragment_program fixed function pipeline replacement definitions */ @@ -5582,10 +5674,9 @@ struct arbfp_ffp_desc { struct ffp_frag_desc parent; GLuint shader; - unsigned int num_textures_used; }; -/* Context activation and GL locking are done by the caller. */ +/* Context activation is done by the caller. */ static void arbfp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) { if (enable) @@ -5600,31 +5691,29 @@ static void arbfp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) } } -static HRESULT arbfp_alloc(struct wined3d_device *device) +static void *arbfp_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) { struct shader_arb_priv *priv; - /* Share private data between the shader backend and the pipeline replacement, if both - * are the arb implementation. This is needed to figure out whether ARBfp should be disabled - * if no pixel shader is bound or not - */ - if (device->shader_backend == &arb_program_shader_backend) - { - device->fragment_priv = device->shader_priv; - } - else - { - device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_arb_priv)); - if (!device->fragment_priv) return E_OUTOFMEMORY; - } - priv = device->fragment_priv; + + /* Share private data between the shader backend and the pipeline + * replacement, if both are the arb implementation. This is needed to + * figure out whether ARBfp should be disabled if no pixel shader is bound + * or not. */ + if (shader_backend == &arb_program_shader_backend) + priv = shader_priv; + else if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv)))) + return NULL; + if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1) { ERR("Failed to initialize rbtree.\n"); - HeapFree(GetProcessHeap(), 0, device->fragment_priv); - return E_OUTOFMEMORY; + if (priv != shader_priv) + HeapFree(GetProcessHeap(), 0, priv); + return NULL; } priv->use_arbfp_fixed_func = TRUE; - return WINED3D_OK; + + return priv; } /* Context activation is done by the caller. */ @@ -5633,11 +5722,9 @@ static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *context) const struct wined3d_gl_info *gl_info = context; struct arbfp_ffp_desc *entry_arb = WINE_RB_ENTRY_VALUE(entry, struct arbfp_ffp_desc, parent.entry); - ENTER_GL(); GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader)); checkGLcall("glDeleteProgramsARB(1, &entry_arb->shader)"); HeapFree(GetProcessHeap(), 0, entry_arb); - LEAVE_GL(); } /* Context activation is done by the caller. */ @@ -5656,6 +5743,8 @@ static void arbfp_free(struct wined3d_device *device) static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { + caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL + | WINED3D_FRAGMENT_CAP_SRGB_WRITE; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE | WINED3DTEXOPCAPS_SELECTARG1 | @@ -5757,14 +5846,10 @@ static void set_bumpmat_arbfp(struct wined3d_context *context, const struct wine if (use_ps(state)) { + /* The pixel shader has to know the bump env matrix. Do a constants + * update. */ if (stage && (state->pixel_shader->reg_maps.bumpmat & (1 << stage))) - { - /* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled - * anyway - */ - if (!isStateDirty(context, STATE_PIXELSHADERCONSTANT)) - context_apply_state(context, state, STATE_PIXELSHADERCONSTANT); - } + context->load_constants = 1; if(device->shader_backend == &arb_program_shader_backend) { /* Exit now, don't set the bumpmat below, otherwise we may overwrite pixel shader constants */ @@ -5797,14 +5882,10 @@ static void tex_bumpenvlum_arbfp(struct wined3d_context *context, if (use_ps(state)) { + /* The pixel shader has to know the luminance offset. Do a constants + * update. */ if (stage && (state->pixel_shader->reg_maps.luminanceparams & (1 << stage))) - { - /* The pixel shader has to know the luminance offset. Do a constants update if it - * isn't scheduled anyway - */ - if (!isStateDirty(context, STATE_PIXELSHADERCONSTANT)) - context_apply_state(context, state, STATE_PIXELSHADERCONSTANT); - } + context->load_constants = 1; if(device->shader_backend == &arb_program_shader_backend) { /* Exit now, don't set the bumpmat below, otherwise we may overwrite pixel shader constants */ @@ -5904,7 +5985,6 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta { const char *dstmask, *dstreg, *arg0, *arg1, *arg2; unsigned int mul = 1; - BOOL mul_final_dest = FALSE; if(color && alpha) dstmask = ""; else if(color) dstmask = ".xyz"; @@ -5936,11 +6016,6 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta /* FALLTHROUGH */ case WINED3D_TOP_MODULATE_2X: mul *= 2; - if (!strcmp(dstreg, "result.color")) - { - dstreg = "ret"; - mul_final_dest = TRUE; - } /* FALLTHROUGH */ case WINED3D_TOP_MODULATE: shader_addline(buffer, "MUL %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2); @@ -5948,11 +6023,6 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta case WINED3D_TOP_ADD_SIGNED_2X: mul = 2; - if (!strcmp(dstreg, "result.color")) - { - dstreg = "ret"; - mul_final_dest = TRUE; - } /* FALLTHROUGH */ case WINED3D_TOP_ADD_SIGNED: shader_addline(buffer, "SUB arg2, %s, const.w;\n", arg2); @@ -6013,11 +6083,6 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta case WINED3D_TOP_DOTPRODUCT3: mul = 4; - if (!strcmp(dstreg, "result.color")) - { - dstreg = "ret"; - mul_final_dest = TRUE; - } shader_addline(buffer, "SUB arg1, %s, const.w;\n", arg1); shader_addline(buffer, "SUB arg2, %s, const.w;\n", arg2); shader_addline(buffer, "DP3_SAT %s%s, arg1, arg2;\n", dstreg, dstmask); @@ -6041,11 +6106,10 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta FIXME("Unhandled texture op %08x\n", op); } - if(mul == 2) { - shader_addline(buffer, "MUL_SAT %s%s, %s, const.y;\n", mul_final_dest ? "result.color" : dstreg, dstmask, dstreg); - } else if(mul == 4) { - shader_addline(buffer, "MUL_SAT %s%s, %s, const.z;\n", mul_final_dest ? "result.color" : dstreg, dstmask, dstreg); - } + if (mul == 2) + shader_addline(buffer, "MUL_SAT %s%s, %s, const.y;\n", dstreg, dstmask, dstreg); + else if (mul == 4) + shader_addline(buffer, "MUL_SAT %s%s, %s, const.z;\n", dstreg, dstmask, dstreg); } static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, const struct wined3d_gl_info *gl_info) @@ -6160,7 +6224,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con if(tfactor_used) { shader_addline(&buffer, "PARAM tfactor = program.env[%u];\n", ARB_FFP_CONST_TFACTOR); } - shader_addline(&buffer, "PARAM specular_enable = program.env[%u];\n", ARB_FFP_CONST_SPECULAR_ENABLE); + shader_addline(&buffer, "PARAM specular_enable = program.env[%u];\n", ARB_FFP_CONST_SPECULAR_ENABLE); if(settings->sRGB_write) { shader_addline(&buffer, "PARAM srgb_consts1 = {%f, %f, %f, %f};\n", @@ -6344,7 +6408,6 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi const struct wined3d_device *device = context->swapchain->device; const struct wined3d_gl_info *gl_info = context->gl_info; struct shader_arb_priv *priv = device->fragment_priv; - BOOL use_vshader = use_vs(state); BOOL use_pshader = use_ps(state); struct ffp_frag_settings settings; const struct arbfp_ffp_desc *desc; @@ -6365,9 +6428,9 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi state_texfactor_arbfp(context, state, STATE_RENDER(WINED3D_RS_TEXTUREFACTOR)); state_arb_specularenable(context, state, STATE_RENDER(WINED3D_RS_SPECULARENABLE)); } - else if (use_pshader && !isStateDirty(context, context->state_table[STATE_VSHADER].representative)) + else if (use_pshader) { - device->shader_backend->shader_select(context, use_pshader, use_vshader); + context->select_shader = 1; } return; } @@ -6385,15 +6448,8 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi ERR("Out of memory\n"); return; } - new_desc->num_textures_used = 0; - for (i = 0; i < gl_info->limits.texture_stages; ++i) - { - if (settings.op[i].cop == WINED3D_TOP_DISABLE) - break; - new_desc->num_textures_used = i; - } - memcpy(&new_desc->parent.settings, &settings, sizeof(settings)); + new_desc->parent.settings = settings; new_desc->shader = gen_arbfp_ffp_shader(&settings, gl_info); add_ffp_frag_shader(&priv->fragment_shaders, &new_desc->parent); TRACE("Allocated fixed function replacement shader descriptor %p\n", new_desc); @@ -6424,24 +6480,8 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi context->last_was_pshader = TRUE; } - /* Finally, select the shader. If a pixel shader is used, it will be set and enabled by the shader backend. - * If this shader backend is arbfp(most likely), then it will simply overwrite the last fixed function - * replacement shader. If the shader backend is not ARB, it currently is important that the opengl implementation - * type overwrites GL_ARB_fragment_program. This is currently the case with GLSL. If we really want to use - * atifs or nvrc pixel shaders with arb fragment programs we'd have to disable GL_FRAGMENT_PROGRAM_ARB here - * - * Don't call shader_select if the vertex shader is dirty, because it will be called later on by the vertex - * shader handler. - */ - if (!isStateDirty(context, context->state_table[STATE_VSHADER].representative)) - { - device->shader_backend->shader_select(context, use_pshader, use_vshader); - - if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (use_vshader || use_pshader)) - context_apply_state(context, state, STATE_VERTEXSHADERCONSTANT); - } - if (use_pshader) - context_apply_state(context, state, STATE_PIXELSHADERCONSTANT); + context->select_shader = 1; + context->load_constants = 1; } /* We can't link the fog states to the fragment state directly since the @@ -6495,20 +6535,6 @@ static void textransform(struct wined3d_context *context, const struct wined3d_s fragment_prog_arbfp(context, state, state_id); } -static void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) -{ - const struct wined3d_gl_info *gl_info = context->gl_info; - const struct wined3d_surface *rt = state->fb->render_targets[0]; - - TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); - - if (state->render_states[WINED3D_RS_SRGBWRITEENABLE] - && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) - gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); - else - gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); -} - static const struct StateEntryTemplate arbfp_fragmentstate_template[] = { {STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), state_texfactor_arbfp }, WINED3D_GL_EXT_NONE }, @@ -6661,7 +6687,6 @@ const struct fragment_pipeline arbfp_fragment_pipeline = { arbfp_free, shader_arb_color_fixup_supported, arbfp_fragmentstate_template, - TRUE /* We can disable projected textures */ }; struct arbfp_blit_priv { @@ -6688,7 +6713,6 @@ static void arbfp_blit_free(struct wined3d_device *device) const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct arbfp_blit_priv *priv = device->blit_priv; - ENTER_GL(); GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_rect_shader)); GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_2d_shader)); GL_EXTCALL(glDeleteProgramsARB(1, &priv->uyvy_rect_shader)); @@ -6701,7 +6725,6 @@ static void arbfp_blit_free(struct wined3d_device *device) if (priv->palette_texture) gl_info->gl_ops.gl.p_glDeleteTextures(1, &priv->palette_texture); - LEAVE_GL(); HeapFree(GetProcessHeap(), 0, device->blit_priv); device->blit_priv = NULL; @@ -6955,11 +6978,10 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, return 0; } - ENTER_GL(); GL_EXTCALL(glGenProgramsARB(1, &shader)); GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)); - LEAVE_GL(); - if(!shader) { + if (!shader) + { shader_buffer_free(&buffer); return 0; } @@ -6983,7 +7005,6 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, shader_addline(&buffer, "TEX result.color, index.a, texture[1], 1D;\n"); shader_addline(&buffer, "END\n"); - ENTER_GL(); GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(buffer.buffer), buffer.buffer)); checkGLcall("glProgramStringARB()"); @@ -7002,7 +7023,6 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, priv->p8_2d_shader = shader; shader_buffer_free(&buffer); - LEAVE_GL(); return shader; } @@ -7018,8 +7038,6 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d d3dfmt_p8_init_palette(surface, table, colorkey); - ENTER_GL(); - if (gl_info->supported[APPLE_CLIENT_STORAGE]) { gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); @@ -7050,7 +7068,6 @@ static void upload_palette(const struct wined3d_surface *surface, struct wined3d /* Switch back to unit 0 in which the 2D texture will be stored. */ context_active_texture(context, gl_info, 0); - LEAVE_GL(); } /* Context activation is done by the caller. */ @@ -7069,13 +7086,12 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ return 0; } - ENTER_GL(); GL_EXTCALL(glGenProgramsARB(1, &shader)); checkGLcall("GL_EXTCALL(glGenProgramsARB(1, &shader))"); GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)); checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)"); - LEAVE_GL(); - if(!shader) { + if (!shader) + { shader_buffer_free(&buffer); return 0; } @@ -7162,7 +7178,6 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ shader_addline(&buffer, "MAD result.color.z, chroma.y, yuv_coef.w, luminance.%c;\n", luminance_component); shader_addline(&buffer, "END\n"); - ENTER_GL(); GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(buffer.buffer), buffer.buffer)); checkGLcall("glProgramStringARB()"); @@ -7184,7 +7199,6 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_ } shader_buffer_free(&buffer); - LEAVE_GL(); switch (yuv_fixup) { @@ -7226,10 +7240,8 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, if (surface->flags & SFLAG_CONVERTED) { - ENTER_GL(); gl_info->gl_ops.gl.p_glEnable(textype); checkGLcall("glEnable(textype)"); - LEAVE_GL(); return WINED3D_OK; } @@ -7238,10 +7250,8 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, TRACE("Fixup:\n"); dump_color_fixup_desc(surface->resource.format->color_fixup); /* Don't bother setting up a shader for unconverted formats */ - ENTER_GL(); gl_info->gl_ops.gl.p_glEnable(textype); checkGLcall("glEnable(textype)"); - LEAVE_GL(); return WINED3D_OK; } @@ -7270,23 +7280,19 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, default: FIXME("Unsupported complex fixup %#x, not setting a shader\n", fixup); - ENTER_GL(); gl_info->gl_ops.gl.p_glEnable(textype); checkGLcall("glEnable(textype)"); - LEAVE_GL(); return E_NOTIMPL; } if (!shader) shader = gen_yuv_shader(priv, gl_info, fixup, textype); - ENTER_GL(); gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)"); GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)); checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader)"); GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, size)); checkGLcall("glProgramLocalParameter4fvARB"); - LEAVE_GL(); return WINED3D_OK; } @@ -7294,7 +7300,6 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context, /* Context activation is done by the caller. */ static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info) { - ENTER_GL(); gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D); @@ -7309,7 +7314,6 @@ static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info) gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); } - LEAVE_GL(); } static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, @@ -7406,13 +7410,9 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter, arbfp_blit_set(device->blit_priv, context, src_surface); - ENTER_GL(); - /* Draw a textured quad */ draw_textured_quad(src_surface, context, &src_rect, &dst_rect, filter); - LEAVE_GL(); - /* Leave the opengl state valid for blitting */ arbfp_blit_unset(context->gl_info); diff --git a/reactos/dll/directx/wine/wined3d/ati_fragment_shader.c b/reactos/dll/directx/wine/wined3d/ati_fragment_shader.c index 1d3cfabbce6..34330c2872d 100644 --- a/reactos/dll/directx/wine/wined3d/ati_fragment_shader.c +++ b/reactos/dll/directx/wine/wined3d/ati_fragment_shader.c @@ -18,18 +18,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include -//#include +#include +#include #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DECLARE_DEBUG_CHANNEL(d3d); -/* GL locking for state handlers is done by the caller. */ +/* Context activation for state handlers is done by the caller. */ /* Some private defines, Constant associations, etc. * Env bump matrix and per stage constant should be independent, @@ -157,6 +157,7 @@ static const char *debug_rep(GLuint rep) { case GL_RED: return "GL_RED"; case GL_GREEN: return "GL_GREEN"; case GL_BLUE: return "GL_BLUE"; + case GL_ALPHA: return "GL_ALPHA"; default: return "unknown argrep"; } } @@ -468,11 +469,11 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con */ wrap_op3(gl_info, GL_MAD_ATI, GL_REG_0_ATI + stage + 1, GL_ALPHA, GL_NONE, GL_REG_0_ATI + stage, GL_RED, argmodextra_y, - ATI_FFP_CONST_BUMPMAT(stage), GL_BLUE, GL_NONE, + ATI_FFP_CONST_BUMPMAT(stage), GL_BLUE, GL_2X_BIT_ATI | GL_BIAS_BIT_ATI, GL_REG_0_ATI + stage + 1, GL_GREEN, GL_NONE); wrap_op3(gl_info, GL_MAD_ATI, GL_REG_0_ATI + stage + 1, GL_GREEN_BIT_ATI, GL_NONE, GL_REG_0_ATI + stage, GL_GREEN, argmodextra_y, - ATI_FFP_CONST_BUMPMAT(stage), GL_ALPHA, GL_NONE, + ATI_FFP_CONST_BUMPMAT(stage), GL_ALPHA, GL_2X_BIT_ATI | GL_BIAS_BIT_ATI, GL_REG_0_ATI + stage + 1, GL_ALPHA, GL_NONE); } @@ -857,10 +858,10 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined { if (settings.op[i].cop == WINED3D_TOP_DISABLE) break; - new_desc->num_textures_used = i; + new_desc->num_textures_used = i + 1; } - memcpy(&new_desc->parent.settings, &settings, sizeof(settings)); + new_desc->parent.settings = settings; new_desc->shader = gen_ati_shader(settings.op, gl_info); add_ffp_frag_shader(&priv->fragment_shaders, &new_desc->parent); TRACE("Allocated fixed function replacement shader descriptor %p\n", new_desc); @@ -926,9 +927,6 @@ static void textransform(struct wined3d_context *context, const struct wined3d_s static void atifs_apply_pixelshader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_device *device = context->swapchain->device; - BOOL use_vshader = use_vs(state); - context->last_was_pshader = use_ps(state); /* The ATIFS code does not support pixel shaders currently, but we have to * provide a state handler to call shader_select to select a vertex shader @@ -943,13 +941,8 @@ static void atifs_apply_pixelshader(struct wined3d_context *context, const struc * startup, and blitting disables all shaders and dirtifies all shader * states. If atifs can deal with this it keeps the rest of the code * simpler. */ - if (!isStateDirty(context, context->state_table[STATE_VSHADER].representative)) - { - device->shader_backend->shader_select(context, FALSE, use_vshader); - - if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && use_vshader) - context_apply_state(context, state, STATE_VERTEXSHADERCONSTANT); - } + context->select_shader = 1; + context->load_constants = 1; } static void atifs_srgbwriteenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -1092,7 +1085,7 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = { {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, }; -/* Context activation and GL locking are done by the caller. */ +/* Context activation is done by the caller. */ static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable) { if (enable) @@ -1109,6 +1102,7 @@ static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable) static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { + caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE | WINED3DTEXOPCAPS_SELECTARG1 | @@ -1154,24 +1148,21 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen caps->MaxSimultaneousTextures = 6; } -static HRESULT atifs_alloc(struct wined3d_device *device) +static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) { struct atifs_private_data *priv; - device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data)); - if (!device->fragment_priv) - { - ERR("Out of memory\n"); - return E_OUTOFMEMORY; - } - priv = device->fragment_priv; + if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv)))) + return NULL; + if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1) { ERR("Failed to initialize rbtree.\n"); - HeapFree(GetProcessHeap(), 0, device->fragment_priv); - return E_OUTOFMEMORY; + HeapFree(GetProcessHeap(), 0, priv); + return NULL; } - return WINED3D_OK; + + return priv; } /* Context activation is done by the caller. */ @@ -1181,11 +1172,9 @@ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context) const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct atifs_ffp_desc *entry_ati = WINE_RB_ENTRY_VALUE(entry, struct atifs_ffp_desc, parent.entry); - ENTER_GL(); GL_EXTCALL(glDeleteFragmentShaderATI(entry_ati->shader)); checkGLcall("glDeleteFragmentShaderATI(entry->shader)"); HeapFree(GetProcessHeap(), 0, entry_ati); - LEAVE_GL(); } /* Context activation is done by the caller. */ @@ -1227,5 +1216,4 @@ const struct fragment_pipeline atifs_fragment_pipeline = { atifs_free, atifs_color_fixup_supported, atifs_fragmentstate_template, - TRUE /* We can disable projected textures */ }; diff --git a/reactos/dll/directx/wine/wined3d/buffer.c b/reactos/dll/directx/wine/wined3d/buffer.c index 1e9a8b3b56d..e9a07a5e4d6 100644 --- a/reactos/dll/directx/wine/wined3d/buffer.c +++ b/reactos/dll/directx/wine/wined3d/buffer.c @@ -22,8 +22,8 @@ * */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" @@ -98,10 +98,8 @@ static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_g { if(!This->buffer_object) return; - ENTER_GL(); GL_EXTCALL(glDeleteBuffersARB(1, &This->buffer_object)); checkGLcall("glDeleteBuffersARB"); - LEAVE_GL(); This->buffer_object = 0; if(This->query) @@ -120,8 +118,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc TRACE("Creating an OpenGL vertex buffer object for wined3d_buffer %p with usage %s.\n", This, debug_d3dusage(This->resource.usage)); - ENTER_GL(); - /* Make sure that the gl error is cleared. Do not use checkGLcall * here because checkGLcall just prints a fixme and continues. However, * if an error during VBO creation occurs we can fall back to non-vbo operation @@ -140,7 +136,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc if (!This->buffer_object || error != GL_NO_ERROR) { ERR("Failed to create a VBO with error %s (%#x)\n", debug_glerror(error), error); - LEAVE_GL(); goto fail; } @@ -151,7 +146,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc if (error != GL_NO_ERROR) { ERR("Failed to bind the VBO with error %s (%#x)\n", debug_glerror(error), error); - LEAVE_GL(); goto fail; } @@ -188,7 +182,6 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This, const struc */ GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, This->resource.allocatedMemory, gl_usage)); error = gl_info->gl_ops.gl.p_glGetError(); - LEAVE_GL(); if (error != GL_NO_ERROR) { ERR("glBufferDataARB failed with error %s (%#x)\n", debug_glerror(error), error); @@ -516,10 +509,8 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_inf if (This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) device_invalidate_state(This->resource.device, STATE_INDEXBUFFER); - ENTER_GL(); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); GL_EXTCALL(glGetBufferSubDataARB(This->buffer_type_hint, 0, This->resource.size, This->resource.allocatedMemory)); - LEAVE_GL(); This->flags |= WINED3D_BUFFER_DOUBLEBUFFER; return This->resource.allocatedMemory; @@ -610,10 +601,8 @@ static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const st if (flags & WINED3D_MAP_DISCARD) { - ENTER_GL(); GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, NULL, This->buffer_object_usage)); checkGLcall("glBufferDataARB\n"); - LEAVE_GL(); return; } @@ -664,10 +653,8 @@ drop_query: } gl_info->gl_ops.gl.p_glFinish(); - ENTER_GL(); GL_EXTCALL(glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)); checkGLcall("glBufferParameteriAPPLE(This->buffer_type_hint, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_TRUE)"); - LEAVE_GL(); This->flags &= ~WINED3D_BUFFER_APPLESYNC; } @@ -677,8 +664,6 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined BYTE *map; UINT start = 0, len = 0; - ENTER_GL(); - /* This potentially invalidates the element array buffer binding, but the * caller always takes care of this. */ GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); @@ -704,16 +689,13 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined syncflags |= WINED3D_MAP_DISCARD; if (flags & WINED3D_BUFFER_NOSYNC) syncflags |= WINED3D_MAP_NOOVERWRITE; - LEAVE_GL(); buffer_sync_apple(This, syncflags, gl_info); - ENTER_GL(); } map = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_WRITE_ONLY_ARB)); checkGLcall("glMapBufferARB"); } if (!map) { - LEAVE_GL(); ERR("Failed to map opengl buffer\n"); return; } @@ -739,8 +721,6 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined } GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint)); checkGLcall("glUnmapBufferARB"); - - LEAVE_GL(); } /* Do not call while under the GL lock. */ @@ -938,12 +918,10 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) } } - ENTER_GL(); GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object)); checkGLcall("glBindBufferARB"); GL_EXTCALL(glBufferSubDataARB(buffer->buffer_type_hint, start, len, data + start)); checkGLcall("glBufferSubDataARB"); - LEAVE_GL(); } HeapFree(GetProcessHeap(), 0, data); @@ -1048,8 +1026,6 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN context = context_acquire(device, NULL); gl_info = context->gl_info; - ENTER_GL(); - if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) context_invalidate_state(context, STATE_INDEXBUFFER); GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object)); @@ -1064,25 +1040,18 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN else { if (buffer->flags & WINED3D_BUFFER_APPLESYNC) - { - LEAVE_GL(); buffer_sync_apple(buffer, flags, gl_info); - ENTER_GL(); - } buffer->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(buffer->buffer_type_hint, GL_READ_WRITE_ARB)); checkGLcall("glMapBufferARB"); } - LEAVE_GL(); if (((DWORD_PTR)buffer->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1)) { WARN("Pointer %p is not %u byte aligned.\n", buffer->resource.allocatedMemory, RESOURCE_ALIGNMENT); - ENTER_GL(); GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint)); checkGLcall("glUnmapBufferARB"); - LEAVE_GL(); buffer->resource.allocatedMemory = NULL; if (buffer->resource.usage & WINED3DUSAGE_DYNAMIC) @@ -1168,8 +1137,6 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) context = context_acquire(device, NULL); gl_info = context->gl_info; - ENTER_GL(); - if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) context_invalidate_state(context, STATE_INDEXBUFFER); GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object)); @@ -1194,7 +1161,6 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) } GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint)); - LEAVE_GL(); if (wined3d_settings.strict_draw_ordering) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); @@ -1241,6 +1207,15 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device TRACE("size %#x, usage %#x, format %s, memory @ %p, iface @ %p.\n", buffer->resource.size, buffer->resource.usage, debug_d3dformat(buffer->resource.format->id), buffer->resource.allocatedMemory, buffer); + if (device->create_parms.flags & WINED3DCREATE_SOFTWARE_VERTEXPROCESSING) + { + /* SWvp always returns the same pointer in buffer maps and retains data in DISCARD maps. + * Keep a system memory copy of the buffer to provide the same behavior to the application. + * Still use a VBO to support OpenGL 3 core contexts. */ + TRACE("Using doublebuffer mode because of software vertex processing\n"); + buffer->flags |= WINED3D_BUFFER_DOUBLEBUFFER; + } + dynamic_buffer_ok = gl_info->supported[APPLE_FLUSH_BUFFER_RANGE] || gl_info->supported[ARB_MAP_BUFFER_RANGE]; /* Observations show that drawStridedSlow is faster on dynamic VBs than converting + @@ -1308,10 +1283,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, struct wined3 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate memory\n"); return E_OUTOFMEMORY; - } FIXME("Ignoring access flags (pool)\n"); @@ -1353,7 +1325,6 @@ HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Out of memory\n"); *buffer = NULL; return WINED3DERR_OUTOFVIDEOMEMORY; } @@ -1385,7 +1356,6 @@ HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Out of memory\n"); *buffer = NULL; return WINED3DERR_OUTOFVIDEOMEMORY; } diff --git a/reactos/dll/directx/wine/wined3d/context.c b/reactos/dll/directx/wine/wined3d/context.c index 72301e0ca7d..cf6522554dc 100644 --- a/reactos/dll/directx/wine/wined3d/context.c +++ b/reactos/dll/directx/wine/wined3d/context.c @@ -19,10 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #ifdef HAVE_FLOAT_H # include #endif @@ -35,7 +35,7 @@ static DWORD wined3d_context_tls_idx; /* FBO helper functions */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -84,7 +84,7 @@ static void context_bind_fbo(struct wined3d_context *context, GLenum target, GLu checkGLcall("glBindFramebuffer()"); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info, GLenum target) { unsigned int i; @@ -101,7 +101,7 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info, checkGLcall("glFramebufferTexture2D()"); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -130,7 +130,7 @@ static void context_attach_depth_stencil_rb(const struct wined3d_gl_info *gl_inf } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_attach_depth_stencil_fbo(struct wined3d_context *context, GLenum fbo_target, struct wined3d_surface *depth_stencil, DWORD location) { @@ -212,7 +212,7 @@ static void context_attach_depth_stencil_fbo(struct wined3d_context *context, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_attach_surface_fbo(struct wined3d_context *context, GLenum fbo_target, DWORD idx, struct wined3d_surface *surface, DWORD location) { @@ -262,7 +262,7 @@ static void context_attach_surface_fbo(struct wined3d_context *context, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ void context_check_fbo_status(const struct wined3d_context *context, GLenum target) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -341,7 +341,7 @@ static struct fbo_entry *context_create_fbo_entry(const struct wined3d_context * return entry; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum target, struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location, struct fbo_entry *entry) @@ -357,7 +357,7 @@ static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum targ entry->attached = FALSE; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_destroy_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry) { if (entry->id) @@ -371,8 +371,7 @@ static void context_destroy_fbo_entry(struct wined3d_context *context, struct fb HeapFree(GetProcessHeap(), 0, entry); } - -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context, GLenum target, struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location) { @@ -418,7 +417,7 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context, return entry; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum target, struct fbo_entry *entry) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -442,7 +441,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ entry->attached = TRUE; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void context_apply_fbo_state(struct wined3d_context *context, GLenum target, struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location) { @@ -471,7 +470,7 @@ static void context_apply_fbo_state(struct wined3d_context *context, GLenum targ } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) { @@ -496,10 +495,8 @@ void context_alloc_occlusion_query(struct wined3d_context *context, struct wined { if (gl_info->supported[ARB_OCCLUSION_QUERY]) { - ENTER_GL(); GL_EXTCALL(glGenQueriesARB(1, &query->id)); checkGLcall("glGenQueriesARB"); - LEAVE_GL(); TRACE("Allocated occlusion query %u in context %p.\n", query->id, context); } @@ -559,19 +556,15 @@ void context_alloc_event_query(struct wined3d_context *context, struct wined3d_e } else if (gl_info->supported[APPLE_FENCE]) { - ENTER_GL(); GL_EXTCALL(glGenFencesAPPLE(1, &query->object.id)); checkGLcall("glGenFencesAPPLE"); - LEAVE_GL(); TRACE("Allocated event query %u in context %p.\n", query->object.id, context); } else if(gl_info->supported[NV_FENCE]) { - ENTER_GL(); GL_EXTCALL(glGenFencesNV(1, &query->object.id)); checkGLcall("glGenFencesNV"); - LEAVE_GL(); TRACE("Allocated event query %u in context %p.\n", query->object.id, context); } @@ -771,7 +764,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx) backup = TRUE; } - if (backup || !pwglMakeCurrent(ctx->hdc, ctx->glCtx)) + if (backup || !wglMakeCurrent(ctx->hdc, ctx->glCtx)) { HDC dc; @@ -805,7 +798,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx) return FALSE; } - if (!pwglMakeCurrent(dc, ctx->glCtx)) + if (!wglMakeCurrent(dc, ctx->glCtx)) { ERR("Fallback to backup window (dc %p) failed too, last error %#x.\n", dc, GetLastError()); @@ -825,7 +818,7 @@ static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HD return; } - if (!pwglMakeCurrent(dc, gl_ctx)) + if (!wglMakeCurrent(dc, gl_ctx)) { ERR("Failed to restore GL context %p on device context %p, last error %#x.\n", gl_ctx, dc, GetLastError()); @@ -897,15 +890,14 @@ static void context_destroy_gl_resources(struct wined3d_context *context) unsigned int i; int restore_pf; - restore_ctx = pwglGetCurrentContext(); - restore_dc = pwglGetCurrentDC(); + restore_ctx = wglGetCurrentContext(); + restore_dc = wglGetCurrentDC(); restore_pf = GetPixelFormat(restore_dc); if (context->valid && restore_ctx != context->glCtx) context_set_gl_context(context); - else restore_ctx = NULL; - - ENTER_GL(); + else + restore_ctx = NULL; LIST_FOR_EACH_ENTRY(occlusion_query, &context->occlusion_queries, struct wined3d_occlusion_query, entry) { @@ -975,8 +967,6 @@ static void context_destroy_gl_resources(struct wined3d_context *context) checkGLcall("context cleanup"); } - LEAVE_GL(); - HeapFree(GetProcessHeap(), 0, context->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, context->free_event_queries); @@ -984,14 +974,14 @@ static void context_destroy_gl_resources(struct wined3d_context *context) { context_restore_gl_context(gl_info, restore_dc, restore_ctx, restore_pf); } - else if (pwglGetCurrentContext() && !pwglMakeCurrent(NULL, NULL)) + else if (wglGetCurrentContext() && !wglMakeCurrent(NULL, NULL)) { ERR("Failed to disable GL context.\n"); } ReleaseDC(context->win_handle, context->hdc); - if (!pwglDeleteContext(context->glCtx)) + if (!wglDeleteContext(context->glCtx)) { DWORD err = GetLastError(); ERR("wglDeleteContext(%p) failed, last error %#x.\n", context->glCtx, err); @@ -1052,10 +1042,10 @@ BOOL context_set_current(struct wined3d_context *ctx) return FALSE; ctx->current = 1; } - else if(pwglGetCurrentContext()) + else if(wglGetCurrentContext()) { TRACE("Clearing current D3D context.\n"); - if (!pwglMakeCurrent(NULL, NULL)) + if (!wglMakeCurrent(NULL, NULL)) { DWORD err = GetLastError(); ERR("Failed to clear current GL context, last error %#x.\n", err); @@ -1095,14 +1085,14 @@ static void context_enter(struct wined3d_context *context) if (!context->level++) { const struct wined3d_context *current_context = context_get_current(); - HGLRC current_gl = pwglGetCurrentContext(); + HGLRC current_gl = wglGetCurrentContext(); if (current_gl && (!current_context || current_context->glCtx != current_gl)) { TRACE("Another GL context (%p on device context %p) is already current.\n", - current_gl, pwglGetCurrentDC()); + current_gl, wglGetCurrentDC()); context->restore_ctx = current_gl; - context->restore_dc = pwglGetCurrentDC(); + context->restore_dc = wglGetCurrentDC(); context->restore_pf = GetPixelFormat(context->restore_dc); } } @@ -1233,7 +1223,7 @@ static int context_choose_pixel_format(const struct wined3d_device *device, HDC return iPixelFormat; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void bind_dummy_textures(const struct wined3d_device *device, const struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -1287,10 +1277,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)); if (!ret) - { - ERR("Failed to allocate context memory.\n"); return NULL; - } ret->blit_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, gl_info->limits.buffers * sizeof(*ret->blit_targets)); @@ -1380,7 +1367,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, goto out; } - if (!(ctx = pwglCreateContext(hdc))) + if (!(ctx = wglCreateContext(hdc))) { ERR("Failed to create a WGL context.\n"); context_release(ret); @@ -1389,12 +1376,12 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, if (device->context_count) { - if (!pwglShareLists(device->contexts[0]->glCtx, ctx)) + if (!wglShareLists(device->contexts[0]->glCtx, ctx)) { ERR("wglShareLists(%p, %p) failed, last error %#x.\n", device->contexts[0]->glCtx, ctx, GetLastError()); context_release(ret); - if (!pwglDeleteContext(ctx)) + if (!wglDeleteContext(ctx)) ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx, GetLastError()); goto out; } @@ -1404,7 +1391,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, { ERR("Failed to add the newly created context to the context list\n"); context_release(ret); - if (!pwglDeleteContext(ctx)) + if (!wglDeleteContext(ctx)) ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx, GetLastError()); goto out; } @@ -1439,7 +1426,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, ERR("Cannot activate context to set up defaults.\n"); device_context_remove(device, ret); context_release(ret); - if (!pwglDeleteContext(ctx)) + if (!wglDeleteContext(ctx)) ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx, GetLastError()); goto out; } @@ -1474,8 +1461,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, swap_interval, ret, GetLastError()); } - ENTER_GL(); - gl_info->gl_ops.gl.p_glGetIntegerv(GL_AUX_BUFFERS, &ret->aux_buffers); TRACE("Setting up the screen\n"); @@ -1569,7 +1554,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, { GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT)); } - device->frag_pipe->enable_extension(gl_info, TRUE); + ret->select_shader = 1; /* If this happens to be the first context for the device, dummy textures * are not created yet. In that case, they will be created (and bound) by @@ -1577,8 +1562,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, if (device->dummy_texture_2d[0]) bind_dummy_textures(device, ret); - LEAVE_GL(); - TRACE("Created context %p.\n", ret); return ret; @@ -1622,7 +1605,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont if (destroy) HeapFree(GetProcessHeap(), 0, context); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void set_blit_dimension(const struct wined3d_gl_info *gl_info, UINT width, UINT height) { const GLdouble projection[] = @@ -1693,9 +1676,7 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con { if (context->blit_w != rt_size.cx || context->blit_h != rt_size.cy) { - ENTER_GL(); set_blit_dimension(gl_info, rt_size.cx, rt_size.cy); - LEAVE_GL(); context->blit_w = rt_size.cx; context->blit_h = rt_size.cy; /* No need to dirtify here, the states are still dirtified because @@ -1706,23 +1687,6 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con } context->last_was_blit = TRUE; - /* TODO: Use a display list */ - - /* Disable shaders */ - ENTER_GL(); - device->shader_backend->shader_select(context, FALSE, FALSE); - LEAVE_GL(); - - context_invalidate_state(context, STATE_VSHADER); - context_invalidate_state(context, STATE_PIXELSHADER); - - /* Call ENTER_GL() once for all gl calls below. In theory we should not call - * helper functions in between gl calls. This function is full of context_invalidate_state - * which can safely be called from here, we only lock once instead locking/unlocking - * after each GL call. - */ - ENTER_GL(); - /* Disable all textures. The caller can then bind a texture it wants to blit * from * @@ -1865,9 +1829,11 @@ static void SetupForBlit(const struct wined3d_device *device, struct wined3d_con context_invalidate_state(context, STATE_RENDER(WINED3D_RS_CLIPPING)); set_blit_dimension(gl_info, rt_size.cx, rt_size.cy); - device->frag_pipe->enable_extension(gl_info, FALSE); - LEAVE_GL(); + /* Disable shaders */ + device->shader_backend->shader_select(context, WINED3D_SHADER_MODE_NONE, WINED3D_SHADER_MODE_NONE); + context->select_shader = 1; + context->load_constants = 1; context->blit_w = rt_size.cx; context->blit_h = rt_size.cy; @@ -1885,7 +1851,7 @@ static inline GLenum draw_buffer_from_rt_mask(DWORD rt_mask) return rt_mask & ~(1 << 31); } -/* Context activation and GL locking are done by the caller. */ +/* Context activation is done by the caller. */ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt_mask) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -1935,7 +1901,7 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt } } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -1948,7 +1914,7 @@ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) context->draw_buffers_mask = context_generate_rt_mask(buffer); } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit) { GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0 + unit)); @@ -2081,9 +2047,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine { surface_internal_preload(rt, SRGB_RGB); - ENTER_GL(); context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->draw_binding); - LEAVE_GL(); if (rt->resource.format->id != WINED3DFMT_NULL) rt_mask = 1; else @@ -2091,9 +2055,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine } else { - ENTER_GL(); context_bind_fbo(context, GL_FRAMEBUFFER, NULL); - LEAVE_GL(); rt_mask = context_generate_rt_mask_from_surface(rt); } } @@ -2104,7 +2066,6 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask; - ENTER_GL(); if (rt_mask != *cur_mask) { context_apply_draw_buffers(context, rt_mask); @@ -2115,7 +2076,6 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine { context_check_fbo_status(context, GL_FRAMEBUFFER); } - LEAVE_GL(); SetupForBlit(device, context); context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -2157,8 +2117,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win { context_validate_onscreen_formats(context, fb->depth_stencil); - ENTER_GL(); - if (!rt_count || surface_is_offscreen(rts[0])) { for (i = 0; i < rt_count; ++i) @@ -2183,8 +2141,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win rt_mask = context_generate_rt_mask_from_surface(rts[0]); } - LEAVE_GL(); - /* If the framebuffer is not the device's fb the device's fb has to be reapplied * next draw. Otherwise we could mark the framebuffer state clean here, once the * state management allows this */ @@ -2210,7 +2166,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask; - ENTER_GL(); if (rt_mask != *cur_mask) { context_apply_draw_buffers(context, rt_mask); @@ -2224,10 +2179,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win } if (context->last_was_blit) - { - device->frag_pipe->enable_extension(gl_info, TRUE); context->last_was_blit = FALSE; - } /* Blending and clearing should be orthogonal, but tests on the nvidia * driver show that disabling blending when clearing improves the clearing @@ -2235,7 +2187,6 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win gl_info->gl_ops.gl.p_glDisable(GL_BLEND); gl_info->gl_ops.gl.p_glEnable(GL_SCISSOR_TEST); checkGLcall("glEnable GL_SCISSOR_TEST"); - LEAVE_GL(); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE)); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE)); @@ -2271,7 +2222,7 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const return rt_mask; } -/* GL locking and context activation are done by the caller */ +/* Context activation is done by the caller. */ void context_state_fb(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_device *device = context->swapchain->device; @@ -2303,7 +2254,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat } } -/* GL locking and context activation are done by the caller */ +/* Context activation is done by the caller. */ void context_state_drawbuf(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_device *device = context->swapchain->device; @@ -2344,7 +2295,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de device_preload_textures(device); if (isStateDirty(context, STATE_VDECL) || isStateDirty(context, STATE_STREAMSRC)) device_update_stream_info(device, context->gl_info); - if (state->index_buffer && !state->user_stream) + if (state->index_buffer) { if (device->strided_streams.all_vbo) wined3d_buffer_preload(state->index_buffer); @@ -2352,10 +2303,6 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de buffer_get_sysmem(state->index_buffer, context->gl_info); } - ENTER_GL(); - if (context->last_was_blit) - device->frag_pipe->enable_extension(context->gl_info, TRUE); - for (i = 0; i < context->numDirtyEntries; ++i) { DWORD rep = context->dirtyArray[i]; @@ -2365,12 +2312,25 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de state_table[rep].apply(context, state, rep); } + if (context->select_shader) + { + device->shader_backend->shader_select(context, + use_vs(state) ? WINED3D_SHADER_MODE_SHADER : WINED3D_SHADER_MODE_FFP, + use_ps(state) ? WINED3D_SHADER_MODE_SHADER : WINED3D_SHADER_MODE_FFP); + context->select_shader = 0; + } + + if (context->load_constants) + { + device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state)); + context->load_constants = 0; + } + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { context_check_fbo_status(context, GL_FRAMEBUFFER); } - LEAVE_GL(); context->numDirtyEntries = 0; /* This makes the whole list clean */ context->last_was_blit = FALSE; @@ -2488,15 +2448,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str if (context != current_context) { if (!context_set_current(context)) - { ERR("Failed to activate the new context.\n"); - } - else - { - ENTER_GL(); - device->frag_pipe->enable_extension(context->gl_info, !context->last_was_blit); - LEAVE_GL(); - } } else if (context->restore_ctx) { diff --git a/reactos/dll/directx/wine/wined3d/device.c b/reactos/dll/directx/wine/wined3d/device.c index a0c19602fca..bbd27df736e 100644 --- a/reactos/dll/directx/wine/wined3d/device.c +++ b/reactos/dll/directx/wine/wined3d/device.c @@ -24,10 +24,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #ifdef HAVE_FLOAT_H # include #endif @@ -65,7 +65,7 @@ const struct wined3d_matrix identity = /* Note that except for WINED3DPT_POINTLIST and WINED3DPT_LINELIST these * actually have the same values in GL and D3D. */ -static GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) +GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) { switch(primitive_type) { @@ -174,16 +174,18 @@ static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) } /* Context activation is done by the caller. */ -void device_stream_info_from_declaration(struct wined3d_device *device, struct wined3d_stream_info *stream_info) +static void device_stream_info_from_declaration(struct wined3d_device *device, struct wined3d_stream_info *stream_info) { const struct wined3d_state *state = &device->stateBlock->state; /* We need to deal with frequency data! */ struct wined3d_vertex_declaration *declaration = state->vertex_declaration; BOOL use_vshader; unsigned int i; + WORD map; stream_info->use_map = 0; stream_info->swizzle_map = 0; + stream_info->all_vbo = 1; /* Check for transformed vertices, disable vertex shader if present. */ stream_info->position_transformed = declaration->position_transformed; @@ -205,37 +207,25 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w if (!buffer) continue; - data.buffer_object = 0; - data.addr = NULL; - stride = stream->stride; - if (state->user_stream) - { - TRACE("Stream %u is UP, %p\n", element->input_slot, buffer); - data.buffer_object = 0; - data.addr = (BYTE *)buffer; - } - else - { - TRACE("Stream %u isn't UP, %p\n", element->input_slot, buffer); - buffer_get_memory(buffer, &device->adapter->gl_info, &data); - /* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets - * (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory - * sources. In most sane cases the pointer - offset will still be > 0, otherwise it will wrap - * around to some big value. Hope that with the indices, the driver wraps it back internally. If - * not, drawStridedSlow is needed, including a vertex buffer path. */ - if (state->load_base_vertex_index < 0) - { - WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n", - state->load_base_vertex_index); - data.buffer_object = 0; - data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info); - if ((UINT_PTR)data.addr < -state->load_base_vertex_index * stride) - { - FIXME("System memory vertex data load offset is negative!\n"); - } - } + TRACE("Stream %u, buffer %p.\n", element->input_slot, buffer); + buffer_get_memory(buffer, &device->adapter->gl_info, &data); + + /* We can't use VBOs if the base vertex index is negative. OpenGL + * doesn't accept negative offsets (or rather offsets bigger than the + * VBO, because the pointer is unsigned), so use system memory + * sources. In most sane cases the pointer - offset will still be > 0, + * otherwise it will wrap around to some big value. Hope that with the + * indices, the driver wraps it back internally. If not, + * drawStridedSlow() is needed, including a vertex buffer path. */ + if (state->load_base_vertex_index < 0) + { + WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n", state->load_base_vertex_index); + data.buffer_object = 0; + data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info); + if ((UINT_PTR)data.addr < -state->load_base_vertex_index * stride) + FIXME("System memory vertex data load offset is negative!\n"); } data.addr += element->offset; @@ -295,111 +285,33 @@ void device_stream_info_from_declaration(struct wined3d_device *device, struct w } } + /* Preload the vertex buffers. */ device->num_buffer_queries = 0; - if (!state->user_stream) + for (i = 0, map = stream_info->use_map; map; map >>= 1, ++i) { - WORD map = stream_info->use_map; - stream_info->all_vbo = 1; + struct wined3d_stream_info_element *element; + struct wined3d_buffer *buffer; - /* PreLoad all the vertex buffers. */ - for (i = 0; map; map >>= 1, ++i) + if (!(map & 1)) + continue; + + element = &stream_info->elements[i]; + buffer = state->streams[element->stream_idx].buffer; + wined3d_buffer_preload(buffer); + + /* If the preload dropped the buffer object, update the stream info. */ + if (buffer->buffer_object != element->data.buffer_object) { - struct wined3d_stream_info_element *element; - struct wined3d_buffer *buffer; - - if (!(map & 1)) continue; - - element = &stream_info->elements[i]; - buffer = state->streams[element->stream_idx].buffer; - wined3d_buffer_preload(buffer); - - /* If the preload dropped the buffer object, update the stream info. */ - if (buffer->buffer_object != element->data.buffer_object) - { - element->data.buffer_object = 0; - element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info) - + (ptrdiff_t)element->data.addr; - } - - if (!buffer->buffer_object) - stream_info->all_vbo = 0; - - if (buffer->query) - device->buffer_queries[device->num_buffer_queries++] = buffer->query; + element->data.buffer_object = 0; + element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info) + (ptrdiff_t)element->data.addr; } + + if (!buffer->buffer_object) + stream_info->all_vbo = 0; + + if (buffer->query) + device->buffer_queries[device->num_buffer_queries++] = buffer->query; } - else - { - stream_info->all_vbo = 0; - } -} - -static void stream_info_element_from_strided(const struct wined3d_gl_info *gl_info, - const struct wined3d_strided_element *strided, struct wined3d_stream_info_element *e) -{ - e->data.addr = strided->data; - e->data.buffer_object = 0; - e->format = wined3d_get_format(gl_info, strided->format); - e->stride = strided->stride; - e->stream_idx = 0; -} - -static void device_stream_info_from_strided(const struct wined3d_gl_info *gl_info, - const struct wined3d_strided_data *strided, struct wined3d_stream_info *stream_info) -{ - unsigned int i; - - memset(stream_info, 0, sizeof(*stream_info)); - - if (strided->position.data) - stream_info_element_from_strided(gl_info, &strided->position, &stream_info->elements[WINED3D_FFP_POSITION]); - if (strided->normal.data) - stream_info_element_from_strided(gl_info, &strided->normal, &stream_info->elements[WINED3D_FFP_NORMAL]); - if (strided->diffuse.data) - stream_info_element_from_strided(gl_info, &strided->diffuse, &stream_info->elements[WINED3D_FFP_DIFFUSE]); - if (strided->specular.data) - stream_info_element_from_strided(gl_info, &strided->specular, &stream_info->elements[WINED3D_FFP_SPECULAR]); - - for (i = 0; i < WINED3DDP_MAXTEXCOORD; ++i) - { - if (strided->tex_coords[i].data) - stream_info_element_from_strided(gl_info, &strided->tex_coords[i], - &stream_info->elements[WINED3D_FFP_TEXCOORD0 + i]); - } - - stream_info->position_transformed = strided->position_transformed; - - for (i = 0; i < sizeof(stream_info->elements) / sizeof(*stream_info->elements); ++i) - { - if (!stream_info->elements[i].format) continue; - - if (!gl_info->supported[ARB_VERTEX_ARRAY_BGRA] - && stream_info->elements[i].format->id == WINED3DFMT_B8G8R8A8_UNORM) - { - stream_info->swizzle_map |= 1 << i; - } - stream_info->use_map |= 1 << i; - } -} - -static void device_trace_strided_stream_info(const struct wined3d_stream_info *stream_info) -{ - TRACE("Strided Data:\n"); - TRACE_STRIDED(stream_info, WINED3D_FFP_POSITION); - TRACE_STRIDED(stream_info, WINED3D_FFP_BLENDWEIGHT); - TRACE_STRIDED(stream_info, WINED3D_FFP_BLENDINDICES); - TRACE_STRIDED(stream_info, WINED3D_FFP_NORMAL); - TRACE_STRIDED(stream_info, WINED3D_FFP_PSIZE); - TRACE_STRIDED(stream_info, WINED3D_FFP_DIFFUSE); - TRACE_STRIDED(stream_info, WINED3D_FFP_SPECULAR); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD0); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD1); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD2); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD3); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD4); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD5); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD6); - TRACE_STRIDED(stream_info, WINED3D_FFP_TEXCOORD7); } /* Context activation is done by the caller. */ @@ -409,18 +321,8 @@ void device_update_stream_info(struct wined3d_device *device, const struct wined const struct wined3d_state *state = &device->stateBlock->state; DWORD prev_all_vbo = stream_info->all_vbo; - if (device->up_strided) - { - /* Note: this is a ddraw fixed-function code path. */ - TRACE("=============================== Strided Input ================================\n"); - device_stream_info_from_strided(gl_info, device->up_strided, stream_info); - if (TRACE_ON(d3d)) device_trace_strided_stream_info(stream_info); - } - else - { - TRACE("============================= Vertex Declaration =============================\n"); - device_stream_info_from_declaration(device, stream_info); - } + TRACE("============================= Vertex Declaration =============================\n"); + device_stream_info_from_declaration(device, stream_info); if (state->vertex_shader && !stream_info->position_transformed) { @@ -710,8 +612,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c return; } - ENTER_GL(); - /* Only set the values up once, as they are not changing. */ if (flags & WINED3DCLEAR_STENCIL) { @@ -816,8 +716,6 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c } } - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering || (flags & WINED3DCLEAR_TARGET && target->container.type == WINED3D_CONTAINER_SWAPCHAIN && target->container.u.swapchain->front_buffer == target)) @@ -897,26 +795,18 @@ UINT CDECL wined3d_device_get_swapchain_count(const struct wined3d_device *devic return device->swapchain_count; } -HRESULT CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, - UINT swapchain_idx, struct wined3d_swapchain **swapchain) +struct wined3d_swapchain * CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx) { - TRACE("device %p, swapchain_idx %u, swapchain %p.\n", - device, swapchain_idx, swapchain); + TRACE("device %p, swapchain_idx %u.\n", device, swapchain_idx); if (swapchain_idx >= device->swapchain_count) { WARN("swapchain_idx %u >= swapchain_count %u.\n", swapchain_idx, device->swapchain_count); - *swapchain = NULL; - - return WINED3DERR_INVALIDCALL; + return NULL; } - *swapchain = device->swapchains[swapchain_idx]; - wined3d_swapchain_incref(*swapchain); - TRACE("Returning %p.\n", *swapchain); - - return WINED3D_OK; + return device->swapchains[swapchain_idx]; } static void device_load_logo(struct wined3d_device *device, const char *filename) @@ -945,8 +835,8 @@ static void device_load_logo(struct wined3d_device *device, const char *filename bm.bmHeight = 32; } - hr = wined3d_surface_create(device, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, 0, 0, - WINED3D_POOL_SYSTEM_MEM, WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_TYPE_OPENGL, WINED3D_SURFACE_MAPPABLE, + hr = wined3d_surface_create(device, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, 0, + WINED3D_POOL_SYSTEM_MEM, WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_MAPPABLE, NULL, &wined3d_null_parent_ops, &device->logo_surface); if (FAILED(hr)) { @@ -986,7 +876,6 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ * OpenGL will only allow that when a valid texture is bound. * We emulate this by creating dummy textures and binding them * to each texture stage when the currently set D3D texture is NULL. */ - ENTER_GL(); if (gl_info->supported[APPLE_CLIENT_STORAGE]) { @@ -1065,8 +954,6 @@ static void create_dummy_textures(struct wined3d_device *device, struct wined3d_ gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); } - - LEAVE_GL(); } /* Context activation is done by the caller. */ @@ -1074,7 +961,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w { unsigned int count = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers); - ENTER_GL(); if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) { gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_cube); @@ -1095,7 +981,6 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w gl_info->gl_ops.gl.p_glDeleteTextures(count, device->dummy_texture_2d); checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)"); - LEAVE_GL(); memset(device->dummy_texture_cube, 0, gl_info->limits.textures * sizeof(*device->dummy_texture_cube)); memset(device->dummy_texture_3d, 0, gl_info->limits.textures * sizeof(*device->dummy_texture_3d)); @@ -1225,7 +1110,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, if (device->d3d_initialized) return WINED3DERR_INVALIDCALL; - if (!device->adapter->opengl) + if (device->wined3d->flags & WINED3D_NO3D) return WINED3DERR_INVALIDCALL; device->valid_rt_mask = 0; @@ -1249,6 +1134,17 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, } } + if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->fragment_pipe))) + { + TRACE("Shader private data couldn't be allocated\n"); + goto err_out; + } + if (FAILED(hr = device->blitter->alloc_private(device))) + { + TRACE("Blitter private data couldn't be allocated\n"); + goto err_out; + } + /* Setup the implicit swapchain. This also initializes a context. */ TRACE("Creating implicit swapchain\n"); hr = device->device_parent->ops->create_swapchain(device->device_parent, @@ -1285,25 +1181,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, if (device->fb.depth_stencil) wined3d_surface_incref(device->fb.depth_stencil); - hr = device->shader_backend->shader_alloc_private(device); - if (FAILED(hr)) - { - TRACE("Shader private data couldn't be allocated\n"); - goto err_out; - } - hr = device->frag_pipe->alloc_private(device); - if (FAILED(hr)) - { - TRACE("Fragment pipeline private data couldn't be allocated\n"); - goto err_out; - } - hr = device->blitter->alloc_private(device); - if (FAILED(hr)) - { - TRACE("Blitter private data couldn't be allocated\n"); - goto err_out; - } - /* Set up some starting GL setup */ /* Setup all the devices defaults */ @@ -1313,8 +1190,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, create_dummy_textures(device, context); - ENTER_GL(); - /* Initialize the current view state */ device->view_ident = 1; device->contexts[0]->last_was_rhw = 0; @@ -1341,7 +1216,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, } TRACE("All defaults now set up, leaving 3D init.\n"); - LEAVE_GL(); context_release(context); @@ -1364,8 +1238,6 @@ err_out: wined3d_swapchain_decref(swapchain); if (device->blit_priv) device->blitter->free_private(device); - if (device->fragment_priv) - device->frag_pipe->free_private(device); if (device->shader_priv) device->shader_backend->shader_free_private(device); @@ -1440,25 +1312,10 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) resource->resource_ops->resource_unload(resource); } - TRACE("Deleting high order patches\n"); - for (i = 0; i < PATCHMAP_SIZE; ++i) - { - struct wined3d_rect_patch *patch; - struct list *e1, *e2; - - LIST_FOR_EACH_SAFE(e1, e2, &device->patches[i]) - { - patch = LIST_ENTRY(e1, struct wined3d_rect_patch, entry); - wined3d_device_delete_patch(device, patch->Handle); - } - } - /* Delete the mouse cursor texture */ if (device->cursorTexture) { - ENTER_GL(); gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->cursorTexture); - LEAVE_GL(); device->cursorTexture = 0; } @@ -1467,15 +1324,12 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) */ if (device->depth_blt_texture) { - ENTER_GL(); gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); - LEAVE_GL(); device->depth_blt_texture = 0; } /* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */ device->blitter->free_private(device); - device->frag_pipe->free_private(device); device->shader_backend->shader_free_private(device); /* Release the buffers (with sanity checks)*/ @@ -1567,18 +1421,6 @@ void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device) device->create_parms.flags |= WINED3DCREATE_MULTITHREADED; } -HRESULT CDECL wined3d_device_get_wined3d(const struct wined3d_device *device, struct wined3d **wined3d) -{ - TRACE("device %p, wined3d %p.\n", device, wined3d); - - *wined3d = device->wined3d; - wined3d_incref(*wined3d); - - TRACE("Returning %p.\n", *wined3d); - - return WINED3D_OK; -} - UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device *device) { TRACE("device %p.\n", device); @@ -1590,6 +1432,62 @@ UINT CDECL wined3d_device_get_available_texture_mem(const struct wined3d_device return device->adapter->TextureRam - device->adapter->UsedTextureRam; } +void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx, + struct wined3d_buffer *buffer, UINT offset) +{ + struct wined3d_buffer *prev_buffer; + + TRACE("device %p, idx %u, buffer %p, offset %u.\n", device, idx, buffer, offset); + + if (idx >= MAX_STREAM_OUT) + { + WARN("Invalid stream output %u.\n", idx); + return; + } + + prev_buffer = device->updateStateBlock->state.stream_output[idx].buffer; + device->updateStateBlock->state.stream_output[idx].buffer = buffer; + device->updateStateBlock->state.stream_output[idx].offset = offset; + + if (device->isRecordingState) + { + if (buffer) + wined3d_buffer_incref(buffer); + if (prev_buffer) + wined3d_buffer_decref(prev_buffer); + return; + } + + if (prev_buffer != buffer) + { + if (buffer) + { + InterlockedIncrement(&buffer->resource.bind_count); + wined3d_buffer_incref(buffer); + } + if (prev_buffer) + { + InterlockedDecrement(&prev_buffer->resource.bind_count); + wined3d_buffer_decref(prev_buffer); + } + } +} + +struct wined3d_buffer * CDECL wined3d_device_get_stream_output(struct wined3d_device *device, + UINT idx, UINT *offset) +{ + TRACE("device %p, idx %u, offset %p.\n", device, idx, offset); + + if (idx >= MAX_STREAM_OUT) + { + WARN("Invalid stream output %u.\n", idx); + return NULL; + } + + *offset = device->stateBlock->state.stream_output[idx].offset; + return device->stateBlock->state.stream_output[idx].buffer; +} + HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride) { @@ -1736,7 +1634,7 @@ HRESULT CDECL wined3d_device_get_stream_source_freq(const struct wined3d_device return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_transform(struct wined3d_device *device, +void CDECL wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state d3dts, const struct wined3d_matrix *matrix) { TRACE("device %p, state %s, matrix %p.\n", @@ -1752,7 +1650,7 @@ HRESULT CDECL wined3d_device_set_transform(struct wined3d_device *device, TRACE("Recording... not performing anything.\n"); device->updateStateBlock->changed.transform[d3dts >> 5] |= 1 << (d3dts & 0x1f); device->updateStateBlock->state.transforms[d3dts] = *matrix; - return WINED3D_OK; + return; } /* If the new matrix is the same as the current one, @@ -1764,7 +1662,7 @@ HRESULT CDECL wined3d_device_set_transform(struct wined3d_device *device, if (!memcmp(&device->stateBlock->state.transforms[d3dts].u.m[0][0], matrix, sizeof(*matrix))) { TRACE("The application is setting the same matrix over again.\n"); - return WINED3D_OK; + return; } device->stateBlock->state.transforms[d3dts] = *matrix; @@ -1773,25 +1671,20 @@ HRESULT CDECL wined3d_device_set_transform(struct wined3d_device *device, if (d3dts < WINED3D_TS_WORLD_MATRIX(device->adapter->gl_info.limits.blends)) device_invalidate_state(device, STATE_TRANSFORM(d3dts)); - - return WINED3D_OK; - } -HRESULT CDECL wined3d_device_get_transform(const struct wined3d_device *device, +void CDECL wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix) { TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); *matrix = device->stateBlock->state.transforms[state]; - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_multiply_transform(struct wined3d_device *device, +void CDECL wined3d_device_multiply_transform(struct wined3d_device *device, enum wined3d_transform_state state, const struct wined3d_matrix *matrix) { - const struct wined3d_matrix *mat = NULL; + const struct wined3d_matrix *mat; struct wined3d_matrix temp; TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); @@ -1803,14 +1696,14 @@ HRESULT CDECL wined3d_device_multiply_transform(struct wined3d_device *device, if (state > HIGHEST_TRANSFORMSTATE) { WARN("Unhandled transform state %#x.\n", state); - return WINED3D_OK; + return; } mat = &device->updateStateBlock->state.transforms[state]; multiply_matrix(&temp, mat, matrix); /* Apply change via set transform - will reapply to eg. lights this way. */ - return wined3d_device_set_transform(device, state, &temp); + wined3d_device_set_transform(device, state, &temp); } /* Note lights are real special cases. Although the device caps state only @@ -1872,10 +1765,8 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, TRACE("Adding new light\n"); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Out of memory error when allocating a light\n"); return E_OUTOFMEMORY; - } + list_add_head(&device->updateStateBlock->state.light_map[hash_idx], &object->entry); object->glIndex = -1; object->OriginalIndex = light_idx; @@ -2193,7 +2084,7 @@ HRESULT CDECL wined3d_device_get_clip_status(const struct wined3d_device *device return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material) +void CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material) { TRACE("device %p, material %p.\n", device, material); @@ -2204,15 +2095,13 @@ HRESULT CDECL wined3d_device_set_material(struct wined3d_device *device, const s if (device->isRecordingState) { TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; + return; } device_invalidate_state(device, STATE_MATERIAL); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material) +void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material) { TRACE("device %p, material %p.\n", device, material); @@ -2231,11 +2120,9 @@ HRESULT CDECL wined3d_device_get_material(const struct wined3d_device *device, s material->emissive.r, material->emissive.g, material->emissive.b, material->emissive.a); TRACE("power %.8e.\n", material->power); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, +void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *buffer, enum wined3d_format_id format_id) { struct wined3d_buffer *prev_buffer; @@ -2257,7 +2144,7 @@ HRESULT CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, wined3d_buffer_incref(buffer); if (prev_buffer) wined3d_buffer_decref(prev_buffer); - return WINED3D_OK; + return; } if (prev_buffer != buffer) @@ -2274,43 +2161,22 @@ HRESULT CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, wined3d_buffer_decref(prev_buffer); } } - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device, struct wined3d_buffer **buffer) +struct wined3d_buffer * CDECL wined3d_device_get_index_buffer(const struct wined3d_device *device, + enum wined3d_format_id *format) { - TRACE("device %p, buffer %p.\n", device, buffer); + TRACE("device %p, format %p.\n", device, format); - *buffer = device->stateBlock->state.index_buffer; - - if (*buffer) - wined3d_buffer_incref(*buffer); - - TRACE("Returning %p.\n", *buffer); - - return WINED3D_OK; + *format = device->stateBlock->state.index_format; + return device->stateBlock->state.index_buffer; } -/* Method to offer d3d9 a simple way to set the base vertex index without messing with the index buffer */ -HRESULT CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index) +void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index) { TRACE("device %p, base_index %d.\n", device, base_index); - if (device->updateStateBlock->state.base_vertex_index == base_index) - { - TRACE("Application is setting the old value over, nothing to do\n"); - return WINED3D_OK; - } - device->updateStateBlock->state.base_vertex_index = base_index; - - if (device->isRecordingState) - { - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } - return WINED3D_OK; } INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device) @@ -2320,7 +2186,7 @@ INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *devi return device->stateBlock->state.base_vertex_index; } -HRESULT CDECL wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport) +void CDECL wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport) { TRACE("device %p, viewport %p.\n", device, viewport); TRACE("x %u, y %u, w %u, h %u, min_z %.8e, max_z %.8e.\n", @@ -2333,24 +2199,20 @@ HRESULT CDECL wined3d_device_set_viewport(struct wined3d_device *device, const s if (device->isRecordingState) { TRACE("Recording... not performing anything\n"); - return WINED3D_OK; + return; } device_invalidate_state(device, STATE_VIEWPORT); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport) +void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport) { TRACE("device %p, viewport %p.\n", device, viewport); *viewport = device->stateBlock->state.viewport; - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device, +void CDECL wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value) { DWORD old_value = device->stateBlock->state.render_states[state]; @@ -2364,7 +2226,7 @@ HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device, if (device->isRecordingState) { TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; + return; } /* Compared here and not before the assignment to allow proper stateblock recording. */ @@ -2372,21 +2234,16 @@ HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device, TRACE("Application is setting the old value over, nothing to do.\n"); else device_invalidate_state(device, STATE_RENDER(state)); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_render_state(const struct wined3d_device *device, - enum wined3d_render_state state, DWORD *value) +DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state) { - TRACE("device %p, state %s (%#x), value %p.\n", device, debug_d3drenderstate(state), state, value); + TRACE("device %p, state %s (%#x).\n", device, debug_d3drenderstate(state), state); - *value = device->stateBlock->state.render_states[state]; - - return WINED3D_OK; + return device->stateBlock->state.render_states[state]; } -HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, +void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value) { DWORD old_value; @@ -2401,7 +2258,7 @@ HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, / sizeof(*device->stateBlock->state.sampler_states)) { WARN("Invalid sampler %u.\n", sampler_idx); - return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ + return; /* Windows accepts overflowing this array ... we do not. */ } old_value = device->stateBlock->state.sampler_states[sampler_idx][state]; @@ -2412,25 +2269,23 @@ HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, if (device->isRecordingState) { TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; + return; } if (old_value == value) { TRACE("Application is setting the old value over, nothing to do.\n"); - return WINED3D_OK; + return; } device_invalidate_state(device, STATE_SAMPLER(sampler_idx)); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device, - UINT sampler_idx, enum wined3d_sampler_state state, DWORD *value) +DWORD CDECL wined3d_device_get_sampler_state(const struct wined3d_device *device, + UINT sampler_idx, enum wined3d_sampler_state state) { - TRACE("device %p, sampler_idx %u, state %s, value %p.\n", - device, sampler_idx, debug_d3dsamplerstate(state), value); + TRACE("device %p, sampler_idx %u, state %s.\n", + device, sampler_idx, debug_d3dsamplerstate(state)); if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); @@ -2439,16 +2294,13 @@ HRESULT CDECL wined3d_device_get_sampler_state(const struct wined3d_device *devi / sizeof(*device->stateBlock->state.sampler_states)) { WARN("Invalid sampler %u.\n", sampler_idx); - return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ + return 0; /* Windows accepts overflowing this array ... we do not. */ } - *value = device->stateBlock->state.sampler_states[sampler_idx][state]; - TRACE("Returning %#x.\n", *value); - - return WINED3D_OK; + return device->stateBlock->state.sampler_states[sampler_idx][state]; } -HRESULT CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect) +void CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect) { TRACE("device %p, rect %s.\n", device, wine_dbgstr_rect(rect)); @@ -2456,32 +2308,28 @@ HRESULT CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, con if (EqualRect(&device->updateStateBlock->state.scissor_rect, rect)) { TRACE("App is setting the old scissor rectangle over, nothing to do.\n"); - return WINED3D_OK; + return; } CopyRect(&device->updateStateBlock->state.scissor_rect, rect); if (device->isRecordingState) { TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; + return; } device_invalidate_state(device, STATE_SCISSORRECT); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect) +void CDECL wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect) { TRACE("device %p, rect %p.\n", device, rect); *rect = device->updateStateBlock->state.scissor_rect; TRACE("Returning rect %s.\n", wine_dbgstr_rect(rect)); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, +void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration) { struct wined3d_vertex_declaration *prev = device->updateStateBlock->state.vertex_declaration; @@ -2499,78 +2347,146 @@ HRESULT CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *devic if (device->isRecordingState) { TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; + return; } - else if (declaration == prev) + + if (declaration == prev) { /* Checked after the assignment to allow proper stateblock recording. */ TRACE("Application is setting the old declaration over, nothing to do.\n"); - return WINED3D_OK; + return; } device_invalidate_state(device, STATE_VDECL); - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device, - struct wined3d_vertex_declaration **declaration) +struct wined3d_vertex_declaration * CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device) { - TRACE("device %p, declaration %p.\n", device, declaration); + TRACE("device %p.\n", device); - *declaration = device->stateBlock->state.vertex_declaration; - if (*declaration) - wined3d_vertex_declaration_incref(*declaration); - - return WINED3D_OK; + return device->stateBlock->state.vertex_declaration; } -HRESULT CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) +void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) { struct wined3d_shader *prev = device->updateStateBlock->state.vertex_shader; TRACE("device %p, shader %p.\n", device, shader); - device->updateStateBlock->state.vertex_shader = shader; - device->updateStateBlock->changed.vertexShader = TRUE; - - if (device->isRecordingState) - { - if (shader) - wined3d_shader_incref(shader); - if (prev) - wined3d_shader_decref(prev); - TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; - } - - if (shader == prev) - { - TRACE("Application is setting the old shader over, nothing to do.\n"); - return WINED3D_OK; - } - if (shader) wined3d_shader_incref(shader); if (prev) wined3d_shader_decref(prev); - device_invalidate_state(device, STATE_VSHADER); + device->updateStateBlock->state.vertex_shader = shader; + device->updateStateBlock->changed.vertexShader = TRUE; - return WINED3D_OK; + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + return; + } + + if (shader == prev) + { + TRACE("Application is setting the old shader over, nothing to do.\n"); + return; + } + + device_invalidate_state(device, STATE_VSHADER); } struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(const struct wined3d_device *device) { - struct wined3d_shader *shader; - TRACE("device %p.\n", device); - shader = device->stateBlock->state.vertex_shader; - if (shader) - wined3d_shader_incref(shader); + return device->stateBlock->state.vertex_shader; +} - TRACE("Returning %p.\n", shader); - return shader; +void CDECL wined3d_device_set_vs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer) +{ + struct wined3d_buffer *prev; + + TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.vs_cb[idx]; + device->updateStateBlock->state.vs_cb[idx] = buffer; + + if (device->isRecordingState) + { + if (buffer) + wined3d_buffer_incref(buffer); + if (prev) + wined3d_buffer_decref(prev); + return; + } + + if (prev != buffer) + { + if (buffer) + { + InterlockedIncrement(&buffer->resource.bind_count); + wined3d_buffer_incref(buffer); + } + if (prev) + { + InterlockedDecrement(&prev->resource.bind_count); + wined3d_buffer_decref(prev); + } + } +} + +struct wined3d_buffer * CDECL wined3d_device_get_vs_cb(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.vs_cb[idx]; +} + +void CDECL wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler) +{ + struct wined3d_sampler *prev; + + TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.vs_sampler[idx]; + device->updateStateBlock->state.vs_sampler[idx] = sampler; + + if (sampler) + wined3d_sampler_incref(sampler); + if (prev) + wined3d_sampler_decref(prev); +} + +struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.vs_sampler[idx]; } HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, @@ -2919,53 +2835,126 @@ void device_update_tex_unit_map(struct wined3d_device *device) device_map_vsamplers(device, ps, gl_info); } -HRESULT CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader) +void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader) { struct wined3d_shader *prev = device->updateStateBlock->state.pixel_shader; TRACE("device %p, shader %p.\n", device, shader); - device->updateStateBlock->state.pixel_shader = shader; - device->updateStateBlock->changed.pixelShader = TRUE; - - if (device->isRecordingState) - { - if (shader) - wined3d_shader_incref(shader); - if (prev) - wined3d_shader_decref(prev); - TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; - } - - if (shader == prev) - { - TRACE("Application is setting the old shader over, nothing to do.\n"); - return WINED3D_OK; - } - if (shader) wined3d_shader_incref(shader); if (prev) wined3d_shader_decref(prev); - device_invalidate_state(device, STATE_PIXELSHADER); + device->updateStateBlock->state.pixel_shader = shader; + device->updateStateBlock->changed.pixelShader = TRUE; - return WINED3D_OK; + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + return; + } + + if (shader == prev) + { + TRACE("Application is setting the old shader over, nothing to do.\n"); + return; + } + + device_invalidate_state(device, STATE_PIXELSHADER); } struct wined3d_shader * CDECL wined3d_device_get_pixel_shader(const struct wined3d_device *device) { - struct wined3d_shader *shader; - TRACE("device %p.\n", device); - shader = device->stateBlock->state.pixel_shader; - if (shader) - wined3d_shader_incref(shader); + return device->stateBlock->state.pixel_shader; +} - TRACE("Returning %p.\n", shader); - return shader; +void CDECL wined3d_device_set_ps_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer) +{ + struct wined3d_buffer *prev; + + TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.ps_cb[idx]; + device->updateStateBlock->state.ps_cb[idx] = buffer; + + if (device->isRecordingState) + { + if (buffer) + wined3d_buffer_incref(buffer); + if (prev) + wined3d_buffer_decref(prev); + return; + } + + if (prev != buffer) + { + if (buffer) + { + InterlockedIncrement(&buffer->resource.bind_count); + wined3d_buffer_incref(buffer); + } + if (prev) + { + InterlockedDecrement(&prev->resource.bind_count); + wined3d_buffer_decref(prev); + } + } +} + +struct wined3d_buffer * CDECL wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.ps_cb[idx]; +} + +void CDECL wined3d_device_set_ps_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler) +{ + struct wined3d_sampler *prev; + + TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.ps_sampler[idx]; + device->updateStateBlock->state.ps_sampler[idx] = sampler; + + if (sampler) + wined3d_sampler_incref(sampler); + if (prev) + wined3d_sampler_decref(prev); +} + +struct wined3d_sampler * CDECL wined3d_device_get_ps_sampler(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.ps_sampler[idx]; } HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, @@ -3105,6 +3094,118 @@ HRESULT CDECL wined3d_device_get_ps_consts_f(const struct wined3d_device *device return WINED3D_OK; } +void CDECL wined3d_device_set_geometry_shader(struct wined3d_device *device, struct wined3d_shader *shader) +{ + struct wined3d_shader *prev = device->updateStateBlock->state.geometry_shader; + + TRACE("device %p, shader %p.\n", device, shader); + + if (shader) + wined3d_shader_incref(shader); + if (prev) + wined3d_shader_decref(prev); + + device->updateStateBlock->state.geometry_shader = shader; + + if (device->isRecordingState || shader == prev) + return; + + device_invalidate_state(device, STATE_GEOMETRY_SHADER); +} + +struct wined3d_shader * CDECL wined3d_device_get_geometry_shader(const struct wined3d_device *device) +{ + TRACE("device %p.\n", device); + + return device->stateBlock->state.geometry_shader; +} + +void CDECL wined3d_device_set_gs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer) +{ + struct wined3d_buffer *prev; + + TRACE("device %p, idx %u, buffer %p.\n", device, idx, buffer); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.gs_cb[idx]; + device->updateStateBlock->state.gs_cb[idx] = buffer; + + if (device->isRecordingState) + { + if (buffer) + wined3d_buffer_incref(buffer); + if (prev) + wined3d_buffer_decref(prev); + return; + } + + if (prev != buffer) + { + if (buffer) + { + InterlockedIncrement(&buffer->resource.bind_count); + wined3d_buffer_incref(buffer); + } + if (prev) + { + InterlockedDecrement(&prev->resource.bind_count); + wined3d_buffer_decref(prev); + } + } +} + +struct wined3d_buffer * CDECL wined3d_device_get_gs_cb(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_CONSTANT_BUFFERS) + { + WARN("Invalid constant buffer index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.gs_cb[idx]; +} + +void CDECL wined3d_device_set_gs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler) +{ + struct wined3d_sampler *prev; + + TRACE("device %p, idx %u, sampler %p.\n", device, idx, sampler); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return; + } + + prev = device->updateStateBlock->state.gs_sampler[idx]; + device->updateStateBlock->state.gs_sampler[idx] = sampler; + + if (sampler) + wined3d_sampler_incref(sampler); + if (prev) + wined3d_sampler_decref(prev); +} + +struct wined3d_sampler * CDECL wined3d_device_get_gs_sampler(const struct wined3d_device *device, UINT idx) +{ + TRACE("device %p, idx %u.\n", device, idx); + + if (idx >= MAX_SAMPLER_OBJECTS) + { + WARN("Invalid sampler index %u.\n", idx); + return NULL; + } + + return device->stateBlock->state.gs_sampler[idx]; +} + /* Context activation is done by the caller. */ /* Do not call while under the GL lock. */ #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) @@ -3381,7 +3482,6 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_state *state = &device->stateBlock->state; struct wined3d_stream_info stream_info; const struct wined3d_gl_info *gl_info; - BOOL streamWasUP = state->user_stream; struct wined3d_context *context; struct wined3d_shader *vs; unsigned int i; @@ -3399,14 +3499,9 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, context = context_acquire(device, NULL); gl_info = context->gl_info; - /* ProcessVertices reads from vertex buffers, which have to be assigned. - * DrawPrimitive and DrawPrimitiveUP control the streamIsUP flag, thus - * restore it afterwards. */ vs = state->vertex_shader; state->vertex_shader = NULL; - state->user_stream = FALSE; device_stream_info_from_declaration(device, &stream_info); - state->user_stream = streamWasUP; state->vertex_shader = vs; /* We can't convert FROM a VBO, and vertex buffers used to source into @@ -3427,10 +3522,8 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_buffer *vb = state->streams[e->stream_idx].buffer; e->data.buffer_object = 0; e->data.addr = (BYTE *)((ULONG_PTR)e->data.addr + (ULONG_PTR)buffer_get_sysmem(vb, gl_info)); - ENTER_GL(); GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object)); vb->buffer_object = 0; - LEAVE_GL(); } if (e->data.addr) e->data.addr += e->stride * src_start_idx; @@ -3444,7 +3537,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, return hr; } -HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, +void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -3456,14 +3549,14 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi if (state > WINED3D_HIGHEST_TEXTURE_STATE) { WARN("Invalid state %#x passed.\n", state); - return WINED3D_OK; + return; } if (stage >= gl_info->limits.texture_stages) { WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n", stage, gl_info->limits.texture_stages - 1); - return WINED3D_OK; + return; } old_value = device->updateStateBlock->state.texture_states[stage][state]; @@ -3473,14 +3566,14 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi if (device->isRecordingState) { TRACE("Recording... not performing anything.\n"); - return WINED3D_OK; + return; } /* Checked after the assignments to allow proper stateblock recording. */ if (old_value == value) { TRACE("Application is setting the old value over, nothing to do.\n"); - return WINED3D_OK; + return; } if (stage > device->stateBlock->state.lowest_disabled_stage @@ -3490,7 +3583,7 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi /* Colorop change above lowest disabled stage? That won't change * anything in the GL setup. Changes in other states are important on * disabled stages too. */ - return WINED3D_OK; + return; } if (state == WINED3D_TSS_COLOR_OP) @@ -3534,26 +3627,21 @@ HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *devi } device_invalidate_state(device, STATE_TEXTURESTAGE(stage, state)); - - return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *device, - UINT stage, enum wined3d_texture_stage_state state, DWORD *value) +DWORD CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *device, + UINT stage, enum wined3d_texture_stage_state state) { - TRACE("device %p, stage %u, state %s, value %p.\n", - device, stage, debug_d3dtexturestate(state), value); + TRACE("device %p, stage %u, state %s.\n", + device, stage, debug_d3dtexturestate(state)); if (state > WINED3D_HIGHEST_TEXTURE_STATE) { WARN("Invalid state %#x passed.\n", state); - return WINED3D_OK; + return 0; } - *value = device->updateStateBlock->state.texture_states[stage][state]; - TRACE("Returning %#x.\n", *value); - - return WINED3D_OK; + return device->updateStateBlock->state.texture_states[stage][state]; } HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, @@ -3630,8 +3718,6 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, { LONG bind_count = InterlockedDecrement(&prev->resource.bind_count); - wined3d_texture_decref(prev); - if (!texture && stage < gl_info->limits.texture_stages) { device_invalidate_state(device, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP)); @@ -3655,6 +3741,8 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, } } } + + wined3d_texture_decref(prev); } device_invalidate_state(device, STATE_SAMPLER(stage)); @@ -3662,10 +3750,9 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_texture(const struct wined3d_device *device, - UINT stage, struct wined3d_texture **texture) +struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_device *device, UINT stage) { - TRACE("device %p, stage %u, texture %p.\n", device, stage, texture); + TRACE("device %p, stage %u.\n", device, stage); if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); @@ -3673,42 +3760,25 @@ HRESULT CDECL wined3d_device_get_texture(const struct wined3d_device *device, if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures)) { WARN("Ignoring invalid stage %u.\n", stage); - return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ + return NULL; /* Windows accepts overflowing this array ... we do not. */ } - *texture = device->stateBlock->state.textures[stage]; - if (*texture) - wined3d_texture_incref(*texture); - - TRACE("Returning %p.\n", *texture); - - return WINED3D_OK; + return device->stateBlock->state.textures[stage]; } HRESULT CDECL wined3d_device_get_back_buffer(const struct wined3d_device *device, UINT swapchain_idx, UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type, struct wined3d_surface **backbuffer) { struct wined3d_swapchain *swapchain; - HRESULT hr; TRACE("device %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", device, swapchain_idx, backbuffer_idx, backbuffer_type, backbuffer); - hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); - if (FAILED(hr)) - { - WARN("Failed to get swapchain %u, hr %#x.\n", swapchain_idx, hr); - return hr; - } - - hr = wined3d_swapchain_get_back_buffer(swapchain, backbuffer_idx, backbuffer_type, backbuffer); - wined3d_swapchain_decref(swapchain); - if (FAILED(hr)) - { - WARN("Failed to get backbuffer %u, hr %#x.\n", backbuffer_idx, hr); - return hr; - } + if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx))) + return WINED3DERR_INVALIDCALL; + if (!(*backbuffer = wined3d_swapchain_get_back_buffer(swapchain, backbuffer_idx, backbuffer_type))) + return WINED3DERR_INVALIDCALL; return WINED3D_OK; } @@ -3724,18 +3794,14 @@ HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *devic struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation) { struct wined3d_swapchain *swapchain; - HRESULT hr; TRACE("device %p, swapchain_idx %u, mode %p, rotation %p.\n", device, swapchain_idx, mode, rotation); - if (SUCCEEDED(hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain))) - { - hr = wined3d_swapchain_get_display_mode(swapchain, mode, rotation); - wined3d_swapchain_decref(swapchain); - } + if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx))) + return WINED3DERR_INVALIDCALL; - return hr; + return wined3d_swapchain_get_display_mode(swapchain, mode, rotation); } HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device) @@ -3852,6 +3918,12 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n", device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil); + if (!rect_count && rects) + { + WARN("Rects is %p, but rect_count is 0, ignoring clear\n", rects); + return WINED3D_OK; + } + if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { struct wined3d_surface *ds = device->fb.depth_stencil; @@ -3908,13 +3980,6 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT return WINED3DERR_INVALIDCALL; } - /* The index buffer is not needed here, but restore it, otherwise it is hell to keep track of */ - if (device->stateBlock->state.user_stream) - { - device_invalidate_state(device, STATE_INDEXBUFFER); - device->stateBlock->state.user_stream = FALSE; - } - if (device->stateBlock->state.load_base_vertex_index) { device->stateBlock->state.load_base_vertex_index = 0; @@ -3923,7 +3988,7 @@ HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT /* Account for the loading offset due to index buffers. Instead of * reloading all sources correct it with the startvertex parameter. */ - drawPrimitive(device, vertex_count, start_vertex, FALSE, NULL); + draw_primitive(device, start_vertex, vertex_count, 0, 0, FALSE, NULL); return WINED3D_OK; } @@ -3949,12 +4014,6 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic return WINED3DERR_INVALIDCALL; } - if (device->stateBlock->state.user_stream) - { - device_invalidate_state(device, STATE_INDEXBUFFER); - device->stateBlock->state.user_stream = FALSE; - } - if (!gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] && device->stateBlock->state.load_base_vertex_index != device->stateBlock->state.base_vertex_index) { @@ -3962,163 +4021,17 @@ HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *devic device_invalidate_state(device, STATE_BASEVERTEXINDEX); } - drawPrimitive(device, index_count, start_idx, TRUE, NULL); + draw_primitive(device, start_idx, index_count, 0, 0, TRUE, NULL); return WINED3D_OK; } -HRESULT CDECL wined3d_device_draw_primitive_up(struct wined3d_device *device, UINT vertex_count, - const void *stream_data, UINT stream_stride) +void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device, + UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count) { - struct wined3d_stream_state *stream; - struct wined3d_buffer *vb; + TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count); - TRACE("device %p, vertex count %u, stream_data %p, stream_stride %u.\n", - device, vertex_count, stream_data, stream_stride); - - if (!device->stateBlock->state.vertex_declaration) - { - WARN("Called without a valid vertex declaration set.\n"); - return WINED3DERR_INVALIDCALL; - } - - /* Note in the following, it's not this type, but that's the purpose of streamIsUP */ - stream = &device->stateBlock->state.streams[0]; - vb = stream->buffer; - stream->buffer = (struct wined3d_buffer *)stream_data; - if (vb) - wined3d_buffer_decref(vb); - stream->offset = 0; - stream->stride = stream_stride; - device->stateBlock->state.user_stream = TRUE; - if (device->stateBlock->state.load_base_vertex_index) - { - device->stateBlock->state.load_base_vertex_index = 0; - device_invalidate_state(device, STATE_BASEVERTEXINDEX); - } - - /* TODO: Only mark dirty if drawing from a different UP address */ - device_invalidate_state(device, STATE_STREAMSRC); - - drawPrimitive(device, vertex_count, 0, FALSE, NULL); - - /* MSDN specifies stream zero settings must be set to NULL */ - stream->buffer = NULL; - stream->stride = 0; - - /* stream zero settings set to null at end, as per the msdn. No need to - * mark dirty here, the app has to set the new stream sources or use UP - * drawing again. */ - return WINED3D_OK; -} - -HRESULT CDECL wined3d_device_draw_indexed_primitive_up(struct wined3d_device *device, - UINT index_count, const void *index_data, enum wined3d_format_id index_data_format_id, - const void *stream_data, UINT stream_stride) -{ - struct wined3d_stream_state *stream; - struct wined3d_buffer *vb, *ib; - - TRACE("device %p, index_count %u, index_data %p, index_data_format %s, stream_data %p, stream_stride %u.\n", - device, index_count, index_data, debug_d3dformat(index_data_format_id), stream_data, stream_stride); - - if (!device->stateBlock->state.vertex_declaration) - { - WARN("(%p) : Called without a valid vertex declaration set\n", device); - return WINED3DERR_INVALIDCALL; - } - - stream = &device->stateBlock->state.streams[0]; - vb = stream->buffer; - stream->buffer = (struct wined3d_buffer *)stream_data; - if (vb) - wined3d_buffer_decref(vb); - stream->offset = 0; - stream->stride = stream_stride; - device->stateBlock->state.user_stream = TRUE; - device->stateBlock->state.index_format = index_data_format_id; - - /* Set to 0 as per msdn. Do it now due to the stream source loading during drawPrimitive */ - device->stateBlock->state.base_vertex_index = 0; - if (device->stateBlock->state.load_base_vertex_index) - { - device->stateBlock->state.load_base_vertex_index = 0; - device_invalidate_state(device, STATE_BASEVERTEXINDEX); - } - /* Invalidate the state until we have nicer tracking of the stream source pointers */ - device_invalidate_state(device, STATE_STREAMSRC); - device_invalidate_state(device, STATE_INDEXBUFFER); - - drawPrimitive(device, index_count, 0, TRUE, index_data); - - /* MSDN specifies stream zero settings and index buffer must be set to NULL */ - stream->buffer = NULL; - stream->stride = 0; - ib = device->stateBlock->state.index_buffer; - if (ib) - { - wined3d_buffer_decref(ib); - device->stateBlock->state.index_buffer = NULL; - } - /* No need to mark the stream source state dirty here. Either the app calls UP drawing again, or it has to call - * SetStreamSource to specify a vertex buffer - */ - - return WINED3D_OK; -} - -HRESULT CDECL wined3d_device_draw_primitive_strided(struct wined3d_device *device, - UINT vertex_count, const struct wined3d_strided_data *strided_data) -{ - /* Mark the state dirty until we have nicer tracking. It's fine to change - * baseVertexIndex because that call is only called by ddraw which does - * not need that value. */ - device_invalidate_state(device, STATE_VDECL); - device_invalidate_state(device, STATE_STREAMSRC); - device_invalidate_state(device, STATE_INDEXBUFFER); - - device->stateBlock->state.base_vertex_index = 0; - device->up_strided = strided_data; - drawPrimitive(device, vertex_count, 0, FALSE, NULL); - device->up_strided = NULL; - - /* Invalidate the states again to make sure the values from the stateblock - * are properly applied in the next regular draw. Note that the application- - * provided strided data has ovwritten pretty much the entire vertex and - * and index stream related states */ - device_invalidate_state(device, STATE_VDECL); - device_invalidate_state(device, STATE_STREAMSRC); - device_invalidate_state(device, STATE_INDEXBUFFER); - return WINED3D_OK; -} - -HRESULT CDECL wined3d_device_draw_indexed_primitive_strided(struct wined3d_device *device, - UINT index_count, const struct wined3d_strided_data *strided_data, - UINT vertex_count, const void *index_data, enum wined3d_format_id index_data_format_id) -{ - enum wined3d_format_id prev_idx_format; - - /* Mark the state dirty until we have nicer tracking - * its fine to change baseVertexIndex because that call is only called by ddraw which does not need - * that value. - */ - device_invalidate_state(device, STATE_VDECL); - device_invalidate_state(device, STATE_STREAMSRC); - device_invalidate_state(device, STATE_INDEXBUFFER); - - prev_idx_format = device->stateBlock->state.index_format; - device->stateBlock->state.index_format = index_data_format_id; - device->stateBlock->state.user_stream = TRUE; - device->stateBlock->state.base_vertex_index = 0; - device->up_strided = strided_data; - drawPrimitive(device, index_count, 0, TRUE, index_data); - device->up_strided = NULL; - device->stateBlock->state.index_format = prev_idx_format; - - device_invalidate_state(device, STATE_VDECL); - device_invalidate_state(device, STATE_STREAMSRC); - device_invalidate_state(device, STATE_INDEXBUFFER); - return WINED3D_OK; + draw_primitive(device, start_idx, index_count, start_instance, instance_count, TRUE, NULL); } /* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */ @@ -4263,17 +4176,13 @@ HRESULT CDECL wined3d_device_get_front_buffer_data(const struct wined3d_device * UINT swapchain_idx, struct wined3d_surface *dst_surface) { struct wined3d_swapchain *swapchain; - HRESULT hr; TRACE("device %p, swapchain_idx %u, dst_surface %p.\n", device, swapchain_idx, dst_surface); - hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); - if (FAILED(hr)) return hr; + if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx))) + return WINED3DERR_INVALIDCALL; - hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_surface); - wined3d_swapchain_decref(swapchain); - - return hr; + return wined3d_swapchain_get_front_buffer_data(swapchain, dst_surface); } HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes) @@ -4339,7 +4248,7 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software) +void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software) { static BOOL warned; @@ -4352,8 +4261,6 @@ HRESULT CDECL wined3d_device_set_software_vertex_processing(struct wined3d_devic } device->softwareVertexProcessing = software; - - return WINED3D_OK; } BOOL CDECL wined3d_device_get_software_vertex_processing(const struct wined3d_device *device) @@ -4375,27 +4282,14 @@ HRESULT CDECL wined3d_device_get_raster_status(const struct wined3d_device *devi UINT swapchain_idx, struct wined3d_raster_status *raster_status) { struct wined3d_swapchain *swapchain; - HRESULT hr; TRACE("device %p, swapchain_idx %u, raster_status %p.\n", device, swapchain_idx, raster_status); - hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); - if (FAILED(hr)) - { - WARN("Failed to get swapchain %u, hr %#x.\n", swapchain_idx, hr); - return hr; - } + if (!(swapchain = wined3d_device_get_swapchain(device, swapchain_idx))) + return WINED3DERR_INVALIDCALL; - hr = wined3d_swapchain_get_raster_status(swapchain, raster_status); - wined3d_swapchain_decref(swapchain); - if (FAILED(hr)) - { - WARN("Failed to get raster status, hr %#x.\n", hr); - return hr; - } - - return WINED3D_OK; + return wined3d_swapchain_get_raster_status(swapchain, raster_status); } HRESULT CDECL wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments) @@ -4449,140 +4343,6 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, return surface_upload_from_surface(dst_surface, dst_point, src_surface, src_rect); } -HRESULT CDECL wined3d_device_draw_rect_patch(struct wined3d_device *device, UINT handle, - const float *num_segs, const struct wined3d_rect_patch_info *rect_patch_info) -{ - struct wined3d_rect_patch *patch; - GLenum old_primitive_type; - unsigned int i; - struct list *e; - BOOL found; - - TRACE("device %p, handle %#x, num_segs %p, rect_patch_info %p.\n", - device, handle, num_segs, rect_patch_info); - - if (!(handle || rect_patch_info)) - { - /* TODO: Write a test for the return value, thus the FIXME */ - FIXME("Both handle and rect_patch_info are NULL.\n"); - return WINED3DERR_INVALIDCALL; - } - - if (handle) - { - i = PATCHMAP_HASHFUNC(handle); - found = FALSE; - LIST_FOR_EACH(e, &device->patches[i]) - { - patch = LIST_ENTRY(e, struct wined3d_rect_patch, entry); - if (patch->Handle == handle) - { - found = TRUE; - break; - } - } - - if (!found) - { - TRACE("Patch does not exist. Creating a new one\n"); - patch = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*patch)); - patch->Handle = handle; - list_add_head(&device->patches[i], &patch->entry); - } else { - TRACE("Found existing patch %p\n", patch); - } - } - else - { - /* Since opengl does not load tesselated vertex attributes into numbered vertex - * attributes we have to tesselate, read back, and draw. This needs a patch - * management structure instance. Create one. - * - * A possible improvement is to check if a vertex shader is used, and if not directly - * draw the patch. - */ - FIXME("Drawing an uncached patch. This is slow\n"); - patch = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*patch)); - } - - if (num_segs[0] != patch->numSegs[0] || num_segs[1] != patch->numSegs[1] - || num_segs[2] != patch->numSegs[2] || num_segs[3] != patch->numSegs[3] - || (rect_patch_info && memcmp(rect_patch_info, &patch->rect_patch_info, sizeof(*rect_patch_info)))) - { - HRESULT hr; - TRACE("Tesselation density or patch info changed, retesselating\n"); - - if (rect_patch_info) - patch->rect_patch_info = *rect_patch_info; - - patch->numSegs[0] = num_segs[0]; - patch->numSegs[1] = num_segs[1]; - patch->numSegs[2] = num_segs[2]; - patch->numSegs[3] = num_segs[3]; - - hr = tesselate_rectpatch(device, patch); - if (FAILED(hr)) - { - WARN("Patch tesselation failed.\n"); - - /* Do not release the handle to store the params of the patch */ - if (!handle) - HeapFree(GetProcessHeap(), 0, patch); - - return hr; - } - } - - old_primitive_type = device->stateBlock->state.gl_primitive_type; - device->stateBlock->state.gl_primitive_type = GL_TRIANGLES; - wined3d_device_draw_primitive_strided(device, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided); - device->stateBlock->state.gl_primitive_type = old_primitive_type; - - /* Destroy uncached patches */ - if (!handle) - { - HeapFree(GetProcessHeap(), 0, patch->mem); - HeapFree(GetProcessHeap(), 0, patch); - } - return WINED3D_OK; -} - -HRESULT CDECL wined3d_device_draw_tri_patch(struct wined3d_device *device, UINT handle, - const float *segment_count, const struct wined3d_tri_patch_info *patch_info) -{ - FIXME("device %p, handle %#x, segment_count %p, patch_info %p stub!\n", - device, handle, segment_count, patch_info); - - return WINED3D_OK; -} - -HRESULT CDECL wined3d_device_delete_patch(struct wined3d_device *device, UINT handle) -{ - struct wined3d_rect_patch *patch; - struct list *e; - int i; - - TRACE("device %p, handle %#x.\n", device, handle); - - i = PATCHMAP_HASHFUNC(handle); - LIST_FOR_EACH(e, &device->patches[i]) - { - patch = LIST_ENTRY(e, struct wined3d_rect_patch, entry); - if (patch->Handle == handle) - { - TRACE("Deleting patch %p\n", patch); - list_remove(&patch->entry); - HeapFree(GetProcessHeap(), 0, patch->mem); - HeapFree(GetProcessHeap(), 0, patch); - return WINED3D_OK; - } - } - - /* TODO: Write a test for the return value */ - FIXME("Attempt to destroy nonexistent patch\n"); - return WINED3DERR_INVALIDCALL; -} - /* Do not call while under the GL lock. */ HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device, struct wined3d_surface *surface, const RECT *rect, const struct wined3d_color *color) @@ -4628,43 +4388,25 @@ void CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, if (FAILED(hr)) ERR("Color fill failed, hr %#x.\n", hr); } -HRESULT CDECL wined3d_device_get_render_target(const struct wined3d_device *device, - UINT render_target_idx, struct wined3d_surface **render_target) +struct wined3d_surface * CDECL wined3d_device_get_render_target(const struct wined3d_device *device, + UINT render_target_idx) { - TRACE("device %p, render_target_idx %u, render_target %p.\n", - device, render_target_idx, render_target); + TRACE("device %p, render_target_idx %u.\n", device, render_target_idx); if (render_target_idx >= device->adapter->gl_info.limits.buffers) { WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers); - return WINED3DERR_INVALIDCALL; + return NULL; } - *render_target = device->fb.render_targets[render_target_idx]; - TRACE("Returning render target %p.\n", *render_target); - - if (!*render_target) - return WINED3DERR_NOTFOUND; - - wined3d_surface_incref(*render_target); - - return WINED3D_OK; + return device->fb.render_targets[render_target_idx]; } -HRESULT CDECL wined3d_device_get_depth_stencil(const struct wined3d_device *device, - struct wined3d_surface **depth_stencil) +struct wined3d_surface * CDECL wined3d_device_get_depth_stencil(const struct wined3d_device *device) { - TRACE("device %p, depth_stencil %p.\n", device, depth_stencil); + TRACE("device %p.\n", device); - *depth_stencil = device->fb.depth_stencil; - TRACE("Returning depth/stencil surface %p.\n", *depth_stencil); - - if (!*depth_stencil) - return WINED3DERR_NOTFOUND; - - wined3d_surface_incref(*depth_stencil); - - return WINED3D_OK; + return device->fb.depth_stencil; } HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, @@ -4681,13 +4423,6 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } - prev = device->fb.render_targets[render_target_idx]; - if (render_target == prev) - { - TRACE("Trying to do a NOP SetRenderTarget operation.\n"); - return WINED3D_OK; - } - /* Render target 0 can't be set to NULL. */ if (!render_target && !render_target_idx) { @@ -4701,6 +4436,33 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; } + /* Set the viewport and scissor rectangles, if requested. Tests show that + * stateblock recording is ignored, the change goes directly into the + * primary stateblock. */ + if (!render_target_idx && set_viewport) + { + struct wined3d_state *state = &device->stateBlock->state; + + state->viewport.x = 0; + state->viewport.y = 0; + state->viewport.width = render_target->resource.width; + state->viewport.height = render_target->resource.height; + state->viewport.min_z = 0.0f; + state->viewport.max_z = 1.0f; + device_invalidate_state(device, STATE_VIEWPORT); + + state->scissor_rect.top = 0; + state->scissor_rect.left = 0; + state->scissor_rect.right = render_target->resource.width; + state->scissor_rect.bottom = render_target->resource.height; + device_invalidate_state(device, STATE_SCISSORRECT); + } + + + prev = device->fb.render_targets[render_target_idx]; + if (render_target == prev) + return WINED3D_OK; + if (render_target) wined3d_surface_incref(render_target); device->fb.render_targets[render_target_idx] = render_target; @@ -4709,33 +4471,12 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, if (prev) wined3d_surface_decref(prev); - /* Render target 0 is special. */ - if (!render_target_idx && set_viewport) - { - /* Set the viewport and scissor rectangles, if requested. Tests show - * that stateblock recording is ignored, the change goes directly - * into the primary stateblock. */ - device->stateBlock->state.viewport.height = device->fb.render_targets[0]->resource.height; - device->stateBlock->state.viewport.width = device->fb.render_targets[0]->resource.width; - device->stateBlock->state.viewport.x = 0; - device->stateBlock->state.viewport.y = 0; - device->stateBlock->state.viewport.max_z = 1.0f; - device->stateBlock->state.viewport.min_z = 0.0f; - device_invalidate_state(device, STATE_VIEWPORT); - - device->stateBlock->state.scissor_rect.top = 0; - device->stateBlock->state.scissor_rect.left = 0; - device->stateBlock->state.scissor_rect.right = device->stateBlock->state.viewport.width; - device->stateBlock->state.scissor_rect.bottom = device->stateBlock->state.viewport.height; - device_invalidate_state(device, STATE_SCISSORRECT); - } - device_invalidate_state(device, STATE_FRAMEBUFFER); return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil) +void CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil) { struct wined3d_surface *prev = device->fb.depth_stencil; @@ -4745,7 +4486,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st if (prev == depth_stencil) { TRACE("Trying to do a NOP SetRenderTarget operation.\n"); - return WINED3D_OK; + return; } if (prev) @@ -4784,7 +4525,7 @@ HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, st device_invalidate_state(device, STATE_FRAMEBUFFER); - return WINED3D_OK; + return; } HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, @@ -4797,9 +4538,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device if (device->cursorTexture) { struct wined3d_context *context = context_acquire(device, NULL); - ENTER_GL(); context->gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->cursorTexture); - LEAVE_GL(); context_release(context); device->cursorTexture = 0; } @@ -4864,8 +4603,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device context = context_acquire(device, NULL); - ENTER_GL(); - if (gl_info->supported[APPLE_CLIENT_STORAGE]) { gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); @@ -4888,8 +4625,6 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); } - LEAVE_GL(); - context_release(context); } else @@ -5046,7 +4781,6 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d device->shader_backend->shader_destroy(shader); } - ENTER_GL(); if (device->depth_blt_texture) { gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->depth_blt_texture); @@ -5057,10 +4791,8 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d gl_info->gl_ops.gl.p_glDeleteTextures(1, &device->cursorTexture); device->cursorTexture = 0; } - LEAVE_GL(); device->blitter->free_private(device); - device->frag_pipe->free_private(device); device->shader_backend->shader_free_private(device); destroy_dummy_textures(device, gl_info); @@ -5082,11 +4814,26 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru struct wined3d_surface *target; HRESULT hr; + if (FAILED(hr = device->shader_backend->shader_alloc_private(device, device->adapter->fragment_pipe))) + { + ERR("Failed to allocate shader private data, hr %#x.\n", hr); + return hr; + } + + if (FAILED(hr = device->blitter->alloc_private(device))) + { + ERR("Failed to allocate blitter private data, hr %#x.\n", hr); + device->shader_backend->shader_free_private(device); + return hr; + } + /* Recreate the primary swapchain's context */ swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); if (!swapchain->context) { ERR("Failed to allocate memory for swapchain context array.\n"); + device->blitter->free_private(device); + device->shader_backend->shader_free_private(device); return E_OUTOFMEMORY; } @@ -5094,6 +4841,8 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru if (!(context = context_create(swapchain, target, swapchain->ds_format))) { WARN("Failed to create context.\n"); + device->blitter->free_private(device); + device->shader_backend->shader_free_private(device); HeapFree(GetProcessHeap(), 0, swapchain->context); return E_FAIL; } @@ -5103,71 +4852,43 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru create_dummy_textures(device, context); context_release(context); - hr = device->shader_backend->shader_alloc_private(device); - if (FAILED(hr)) - { - ERR("Failed to allocate shader private data, hr %#x.\n", hr); - goto err; - } - - hr = device->frag_pipe->alloc_private(device); - if (FAILED(hr)) - { - ERR("Failed to allocate fragment pipe private data, hr %#x.\n", hr); - device->shader_backend->shader_free_private(device); - goto err; - } - - hr = device->blitter->alloc_private(device); - if (FAILED(hr)) - { - ERR("Failed to allocate blitter private data, hr %#x.\n", hr); - device->frag_pipe->free_private(device); - device->shader_backend->shader_free_private(device); - goto err; - } - return WINED3D_OK; - -err: - context_acquire(device, NULL); - destroy_dummy_textures(device, context->gl_info); - context_release(context); - context_destroy(device, context); - HeapFree(GetProcessHeap(), 0, swapchain->context); - swapchain->num_contexts = 0; - return hr; } /* Do not call while under the GL lock. */ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, - wined3d_device_reset_cb callback) + wined3d_device_reset_cb callback, BOOL reset_state) { struct wined3d_resource *resource, *cursor; struct wined3d_swapchain *swapchain; struct wined3d_display_mode m; BOOL DisplayModeChanged = FALSE; BOOL update_desc = FALSE; + HRESULT hr = WINED3D_OK; unsigned int i; - HRESULT hr; TRACE("device %p, swapchain_desc %p, mode %p, callback %p.\n", device, swapchain_desc, mode, callback); - if (FAILED(hr = wined3d_device_get_swapchain(device, 0, &swapchain))) + if (!(swapchain = wined3d_device_get_swapchain(device, 0))) { ERR("Failed to get the first implicit swapchain.\n"); - return hr; + return WINED3DERR_INVALIDCALL; } - stateblock_unbind_resources(device->stateBlock); - if (swapchain->back_buffers && swapchain->back_buffers[0]) - wined3d_device_set_render_target(device, 0, swapchain->back_buffers[0], FALSE); - else - wined3d_device_set_render_target(device, 0, swapchain->front_buffer, FALSE); - for (i = 1; i < device->adapter->gl_info.limits.buffers; ++i) + if (reset_state) + stateblock_unbind_resources(device->stateBlock); + + if (device->fb.render_targets) { - wined3d_device_set_render_target(device, i, NULL, FALSE); + if (swapchain->back_buffers && swapchain->back_buffers[0]) + wined3d_device_set_render_target(device, 0, swapchain->back_buffers[0], FALSE); + else + wined3d_device_set_render_target(device, 0, swapchain->front_buffer, FALSE); + for (i = 1; i < device->adapter->gl_info.limits.buffers; ++i) + { + wined3d_device_set_render_target(device, i, NULL, FALSE); + } } wined3d_device_set_depth_stencil(device, NULL); @@ -5177,13 +4898,13 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, device->onscreen_depth_stencil = NULL; } - LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) + if (reset_state) { - TRACE("Enumerating resource %p.\n", resource); - if (FAILED(hr = callback(resource))) + LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) { - wined3d_swapchain_decref(swapchain); - return hr; + TRACE("Enumerating resource %p.\n", resource); + if (FAILED(hr = callback(resource))) + return hr; } } @@ -5235,8 +4956,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (swapchain_desc->enable_auto_depth_stencil && !device->auto_depth_stencil) { - HRESULT hr; - TRACE("Creating the depth stencil buffer\n"); if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, @@ -5246,7 +4965,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, &device->auto_depth_stencil))) { ERR("Failed to create the depth stencil buffer, hr %#x.\n", hr); - wined3d_swapchain_decref(swapchain); return WINED3DERR_INVALIDCALL; } } @@ -5309,36 +5027,24 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, { UINT i; - hr = wined3d_surface_update_desc(swapchain->front_buffer, swapchain->desc.backbuffer_width, + if (FAILED(hr = wined3d_surface_update_desc(swapchain->front_buffer, swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height, swapchain->desc.backbuffer_format, - swapchain->desc.multisample_type, swapchain->desc.multisample_quality); - if (FAILED(hr)) - { - wined3d_swapchain_decref(swapchain); + swapchain->desc.multisample_type, swapchain->desc.multisample_quality))) return hr; - } for (i = 0; i < swapchain->desc.backbuffer_count; ++i) { - hr = wined3d_surface_update_desc(swapchain->back_buffers[i], swapchain->desc.backbuffer_width, + if (FAILED(hr = wined3d_surface_update_desc(swapchain->back_buffers[i], swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height, swapchain->desc.backbuffer_format, - swapchain->desc.multisample_type, swapchain->desc.multisample_quality); - if (FAILED(hr)) - { - wined3d_swapchain_decref(swapchain); + swapchain->desc.multisample_type, swapchain->desc.multisample_quality))) return hr; - } } if (device->auto_depth_stencil) { - hr = wined3d_surface_update_desc(device->auto_depth_stencil, swapchain->desc.backbuffer_width, + if (FAILED(hr = wined3d_surface_update_desc(device->auto_depth_stencil, swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height, device->auto_depth_stencil->resource.format->id, - swapchain->desc.multisample_type, swapchain->desc.multisample_quality); - if (FAILED(hr)) - { - wined3d_swapchain_decref(swapchain); + swapchain->desc.multisample_type, swapchain->desc.multisample_quality))) return hr; - } } } @@ -5348,7 +5054,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, device->adapter->ordinal, &m))) { WARN("Failed to set display mode, hr %#x.\n", hr); - wined3d_swapchain_decref(swapchain); return WINED3DERR_INVALIDCALL; } @@ -5362,7 +5067,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window))) { ERR("Failed to acquire focus window, hr %#x.\n", hr); - wined3d_swapchain_decref(swapchain); return hr; } @@ -5405,30 +5109,50 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, device->exStyle = exStyle; } - TRACE("Resetting stateblock.\n"); - wined3d_stateblock_decref(device->updateStateBlock); - wined3d_stateblock_decref(device->stateBlock); + if (reset_state) + { + TRACE("Resetting stateblock.\n"); + wined3d_stateblock_decref(device->updateStateBlock); + wined3d_stateblock_decref(device->stateBlock); - if (device->d3d_initialized) - delete_opengl_contexts(device, swapchain); + if (device->d3d_initialized) + delete_opengl_contexts(device, swapchain); - /* Note: No parent needed for initial internal stateblock */ - hr = wined3d_stateblock_create(device, WINED3D_SBT_INIT, &device->stateBlock); - if (FAILED(hr)) - ERR("Resetting the stateblock failed with error %#x.\n", hr); + /* Note: No parent needed for initial internal stateblock */ + hr = wined3d_stateblock_create(device, WINED3D_SBT_INIT, &device->stateBlock); + if (FAILED(hr)) + ERR("Resetting the stateblock failed with error %#x.\n", hr); + else + TRACE("Created stateblock %p.\n", device->stateBlock); + device->updateStateBlock = device->stateBlock; + wined3d_stateblock_incref(device->updateStateBlock); + + stateblock_init_default_state(device->stateBlock); + } else - TRACE("Created stateblock %p.\n", device->stateBlock); - device->updateStateBlock = device->stateBlock; - wined3d_stateblock_incref(device->updateStateBlock); + { + struct wined3d_surface *rt = device->fb.render_targets[0]; + struct wined3d_state *state = &device->stateBlock->state; - stateblock_init_default_state(device->stateBlock); + /* Note the min_z / max_z is not reset. */ + state->viewport.x = 0; + state->viewport.y = 0; + state->viewport.width = rt->resource.width; + state->viewport.height = rt->resource.height; + device_invalidate_state(device, STATE_VIEWPORT); + + state->scissor_rect.top = 0; + state->scissor_rect.left = 0; + state->scissor_rect.right = rt->resource.width; + state->scissor_rect.bottom = rt->resource.height; + device_invalidate_state(device, STATE_SCISSORRECT); + } swapchain_update_render_to_fbo(swapchain); swapchain_update_draw_bindings(swapchain); - if (device->d3d_initialized) + if (reset_state && device->d3d_initialized) hr = create_primary_opengl_context(device, swapchain); - wined3d_swapchain_decref(swapchain); /* All done. There is no need to reload resources or shaders, this will happen automatically on the * first use @@ -5446,13 +5170,12 @@ HRESULT CDECL wined3d_device_set_dialog_box_mode(struct wined3d_device *device, } -HRESULT CDECL wined3d_device_get_creation_parameters(const struct wined3d_device *device, +void CDECL wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *parameters) { TRACE("device %p, parameters %p.\n", device, parameters); *parameters = device->create_parms; - return WINED3D_OK; } void CDECL wined3d_device_set_gamma_ramp(const struct wined3d_device *device, @@ -5463,11 +5186,8 @@ void CDECL wined3d_device_set_gamma_ramp(const struct wined3d_device *device, TRACE("device %p, swapchain_idx %u, flags %#x, ramp %p.\n", device, swapchain_idx, flags, ramp); - if (SUCCEEDED(wined3d_device_get_swapchain(device, swapchain_idx, &swapchain))) - { + if ((swapchain = wined3d_device_get_swapchain(device, swapchain_idx))) wined3d_swapchain_set_gamma_ramp(swapchain, flags, ramp); - wined3d_swapchain_decref(swapchain); - } } void CDECL wined3d_device_get_gamma_ramp(const struct wined3d_device *device, @@ -5478,11 +5198,8 @@ void CDECL wined3d_device_get_gamma_ramp(const struct wined3d_device *device, TRACE("device %p, swapchain_idx %u, ramp %p.\n", device, swapchain_idx, ramp); - if (SUCCEEDED(wined3d_device_get_swapchain(device, swapchain_idx, &swapchain))) - { + if ((swapchain = wined3d_device_get_swapchain(device, swapchain_idx))) wined3d_swapchain_get_gamma_ramp(swapchain, ramp); - wined3d_swapchain_decref(swapchain); - } } void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) @@ -5607,15 +5324,14 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso TRACE("Resource released.\n"); } -HRESULT CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *device, - HDC dc, struct wined3d_surface **surface) +struct wined3d_surface * CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *device, HDC dc) { struct wined3d_resource *resource; - TRACE("device %p, dc %p, surface %p.\n", device, dc, surface); + TRACE("device %p, dc %p.\n", device, dc); if (!dc) - return WINED3DERR_INVALIDCALL; + return NULL; LIST_FOR_EACH_ENTRY(resource, &device->resources, struct wined3d_resource, resource_list_entry) { @@ -5626,13 +5342,12 @@ HRESULT CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *de if (s->hDC == dc) { TRACE("Found surface %p for dc %p.\n", s, dc); - *surface = s; - return WINED3D_OK; + return s; } } } - return WINED3DERR_INVALIDCALL; + return NULL; } HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, @@ -5661,36 +5376,28 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, device->create_parms.focus_window = focus_window; device->create_parms.flags = flags; - for (i = 0; i < PATCHMAP_SIZE; ++i) list_init(&device->patches[i]); - - select_shader_mode(&adapter->gl_info, &device->ps_selected_mode, &device->vs_selected_mode); device->shader_backend = adapter->shader_backend; + device->shader_backend->shader_get_caps(&adapter->gl_info, &shader_caps); + device->vs_version = shader_caps.vs_version; + device->gs_version = shader_caps.gs_version; + device->ps_version = shader_caps.ps_version; + device->d3d_vshader_constantF = shader_caps.vs_uniform_count; + device->d3d_pshader_constantF = shader_caps.ps_uniform_count; + device->vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING; - if (device->shader_backend) - { - device->shader_backend->shader_get_caps(&adapter->gl_info, &shader_caps); - device->vshader_version = shader_caps.VertexShaderVersion; - device->pshader_version = shader_caps.PixelShaderVersion; - device->d3d_vshader_constantF = shader_caps.MaxVertexShaderConst; - device->d3d_pshader_constantF = shader_caps.MaxPixelShaderConst; - device->vs_clipping = shader_caps.VSClipping; - } fragment_pipeline = adapter->fragment_pipe; - device->frag_pipe = fragment_pipeline; - if (fragment_pipeline) - { - fragment_pipeline->get_caps(&adapter->gl_info, &ffp_caps); - device->max_ffp_textures = ffp_caps.MaxSimultaneousTextures; + fragment_pipeline->get_caps(&adapter->gl_info, &ffp_caps); + device->max_ffp_textures = ffp_caps.MaxSimultaneousTextures; - hr = compile_state_table(device->StateTable, device->multistate_funcs, &adapter->gl_info, - ffp_vertexstate_template, fragment_pipeline, misc_state_template); - if (FAILED(hr)) - { - ERR("Failed to compile state table, hr %#x.\n", hr); - wined3d_decref(device->wined3d); - return hr; - } + if (fragment_pipeline->states + && FAILED(hr = compile_state_table(device->StateTable, device->multistate_funcs, + &adapter->gl_info, ffp_vertexstate_template, fragment_pipeline, misc_state_template))) + { + ERR("Failed to compile state table, hr %#x.\n", hr); + wined3d_decref(device->wined3d); + return hr; } + device->blitter = adapter->blitter; hr = wined3d_stateblock_create(device, WINED3D_SBT_INIT, &device->stateBlock); diff --git a/reactos/dll/directx/wine/wined3d/directx.c b/reactos/dll/directx/wine/wined3d/directx.c index 9b44c030ce9..acdcc57f3b6 100644 --- a/reactos/dll/directx/wine/wined3d/directx.c +++ b/reactos/dll/directx/wine/wined3d/directx.c @@ -21,13 +21,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include #include "wined3d_private.h" -//#include "winternl.h" +#include "winternl.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -97,6 +97,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_depth_texture", ARB_DEPTH_TEXTURE }, {"GL_ARB_draw_buffers", ARB_DRAW_BUFFERS }, {"GL_ARB_draw_elements_base_vertex", ARB_DRAW_ELEMENTS_BASE_VERTEX }, + {"GL_ARB_draw_instanced", ARB_DRAW_INSTANCED }, {"GL_ARB_fragment_program", ARB_FRAGMENT_PROGRAM }, {"GL_ARB_fragment_shader", ARB_FRAGMENT_SHADER }, {"GL_ARB_framebuffer_object", ARB_FRAMEBUFFER_OBJECT }, @@ -104,6 +105,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_geometry_shader4", ARB_GEOMETRY_SHADER4 }, {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL }, {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX }, + {"GL_ARB_instanced_arrays", ARB_INSTANCED_ARRAYS, }, {"GL_ARB_map_buffer_alignment", ARB_MAP_BUFFER_ALIGNMENT }, {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE }, {"GL_ARB_multisample", ARB_MULTISAMPLE }, /* needs GLX_ARB_MULTISAMPLE as well */ @@ -113,6 +115,7 @@ static const struct wined3d_extension_map gl_extension_map[] = {"GL_ARB_point_parameters", ARB_POINT_PARAMETERS }, {"GL_ARB_point_sprite", ARB_POINT_SPRITE }, {"GL_ARB_provoking_vertex", ARB_PROVOKING_VERTEX }, + {"GL_ARB_shader_bit_encoding", ARB_SHADER_BIT_ENCODING }, {"GL_ARB_shader_objects", ARB_SHADER_OBJECTS }, {"GL_ARB_shader_texture_lod", ARB_SHADER_TEXTURE_LOD }, {"GL_ARB_shading_language_100", ARB_SHADING_LANGUAGE_100 }, @@ -276,10 +279,10 @@ static void WineD3D_ReleaseFakeGLContext(const struct wined3d_fake_gl_ctx *ctx) { TRACE("Destroying fake GL context.\n"); - if (!pwglMakeCurrent(NULL, NULL)) + if (!wglMakeCurrent(NULL, NULL)) ERR("Failed to disable fake GL context.\n"); - if (!pwglDeleteContext(ctx->gl_ctx)) + if (!wglDeleteContext(ctx->gl_ctx)) { DWORD err = GetLastError(); ERR("wglDeleteContext(%p) failed, last error %#x.\n", ctx->gl_ctx, err); @@ -288,7 +291,7 @@ static void WineD3D_ReleaseFakeGLContext(const struct wined3d_fake_gl_ctx *ctx) ReleaseDC(ctx->wnd, ctx->dc); DestroyWindow(ctx->wnd); - if (ctx->restore_gl_ctx && !pwglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx)) + if (ctx->restore_gl_ctx && !wglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx)) ERR("Failed to restore previous GL context.\n"); } @@ -300,8 +303,8 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx) TRACE("getting context...\n"); - ctx->restore_dc = pwglGetCurrentDC(); - ctx->restore_gl_ctx = pwglGetCurrentContext(); + ctx->restore_dc = wglGetCurrentDC(); + ctx->restore_gl_ctx = wglGetCurrentContext(); /* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */ ctx->wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window", @@ -338,14 +341,14 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx) SetPixelFormat(ctx->dc, iPixelFormat, &pfd); /* Create a GL context. */ - if (!(ctx->gl_ctx = pwglCreateContext(ctx->dc))) + if (!(ctx->gl_ctx = wglCreateContext(ctx->dc))) { WARN("Failed to create default context for capabilities initialization.\n"); goto fail; } /* Make it the current GL context. */ - if (!pwglMakeCurrent(ctx->dc, ctx->gl_ctx)) + if (!wglMakeCurrent(ctx->dc, ctx->gl_ctx)) { ERR("Failed to make fake GL context current.\n"); goto fail; @@ -354,13 +357,13 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx) return TRUE; fail: - if (ctx->gl_ctx) pwglDeleteContext(ctx->gl_ctx); + if (ctx->gl_ctx) wglDeleteContext(ctx->gl_ctx); ctx->gl_ctx = NULL; if (ctx->dc) ReleaseDC(ctx->wnd, ctx->dc); ctx->dc = NULL; if (ctx->wnd) DestroyWindow(ctx->wnd); ctx->wnd = NULL; - if (ctx->restore_gl_ctx && !pwglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx)) + if (ctx->restore_gl_ctx && !wglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx)) ERR("Failed to restore previous GL context.\n"); return FALSE; @@ -409,8 +412,8 @@ ULONG CDECL wined3d_decref(struct wined3d *wined3d) return refcount; } -/* GL locking is done by the caller */ -static inline BOOL test_arb_vs_offset_limit(const struct wined3d_gl_info *gl_info) +/* Context activation is done by the caller. */ +static BOOL test_arb_vs_offset_limit(const struct wined3d_gl_info *gl_info) { GLuint prog; BOOL ret = FALSE; @@ -520,8 +523,6 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info) /* No PBO -> No point in testing them. */ if (!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) return; - ENTER_GL(); - while (gl_info->gl_ops.gl.p_glGetError()); gl_info->gl_ops.gl.p_glGenTextures(1, &texture); gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, texture); @@ -539,12 +540,10 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info) checkGLcall("Loading the PBO test texture"); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); - LEAVE_GL(); gl_info->gl_ops.gl.p_glFinish(); /* just to be sure */ memset(check, 0, sizeof(check)); - ENTER_GL(); gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, check); checkGLcall("Reading back the PBO test texture"); @@ -552,8 +551,6 @@ static void test_pbo_functionality(struct wined3d_gl_info *gl_info) GL_EXTCALL(glDeleteBuffersARB(1, &pbo)); checkGLcall("PBO test cleanup"); - LEAVE_GL(); - if (memcmp(check, pattern, sizeof(check))) { WARN("PBO test failed, read back data doesn't match original.\n" @@ -610,11 +607,9 @@ static BOOL match_allows_spec_alpha(const struct wined3d_gl_info *gl_info, const if (!gl_info->supported[EXT_SECONDARY_COLOR]) return FALSE; - ENTER_GL(); while (gl_info->gl_ops.gl.p_glGetError()); GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE, 4, data); error = gl_info->gl_ops.gl.p_glGetError(); - LEAVE_GL(); if (error == GL_NO_ERROR) { @@ -645,14 +640,12 @@ static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const ch if (!gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]) return FALSE; - ENTER_GL(); while (gl_info->gl_ops.gl.p_glGetError()); GL_EXTCALL(glGenProgramsARB(1, &prog)); if(!prog) { ERR("Failed to create the NVvp clip test program\n"); - LEAVE_GL(); return FALSE; } GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog)); @@ -672,7 +665,6 @@ static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const ch GL_EXTCALL(glDeleteProgramsARB(1, &prog)); checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup"); - LEAVE_GL(); return ret; } @@ -688,8 +680,6 @@ static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, const ch memset(data, 0xcc, sizeof(data)); - ENTER_GL(); - gl_info->gl_ops.gl.p_glGenTextures(1, &tex); gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex); gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -726,8 +716,6 @@ static BOOL match_fbo_tex_update(const struct wined3d_gl_info *gl_info, const ch gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex); checkGLcall("glDeleteTextures"); - LEAVE_GL(); - return *(DWORD *)data == 0x11111111; } @@ -740,8 +728,6 @@ static BOOL match_broken_rgba16(const struct wined3d_gl_info *gl_info, const cha GLuint tex; GLint size; - ENTER_GL(); - gl_info->gl_ops.gl.p_glGenTextures(1, &tex); gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex); gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT, NULL); @@ -756,8 +742,6 @@ static BOOL match_broken_rgba16(const struct wined3d_gl_info *gl_info, const cha gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex); checkGLcall("glDeleteTextures"); - LEAVE_GL(); - return size < 16; } @@ -767,6 +751,14 @@ static BOOL match_fglrx(const struct wined3d_gl_info *gl_info, const char *gl_re return gl_vendor == GL_VENDOR_FGLRX; } +static BOOL match_r200(const struct wined3d_gl_info *gl_info, const char *gl_renderer, + enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device) +{ + if (card_vendor != HW_VENDOR_AMD) return FALSE; + if (device == CARD_AMD_RADEON_8500) return TRUE; + return FALSE; +} + static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info) { /* MacOS needs uniforms for relative addressing offsets. This can accumulate to quite a few uniforms. @@ -877,6 +869,19 @@ static void quirk_limited_tex_filtering(struct wined3d_gl_info *gl_info) gl_info->quirks |= WINED3D_QUIRK_LIMITED_TEX_FILTERING; } +static void quirk_r200_constants(struct wined3d_gl_info *gl_info) +{ + /* The Mesa r200 driver (and there is no other driver for this GPU Wine would run on) + * loads some fog parameters (start, end, exponent, but not the color) into the + * program. + * + * Apparently the fog hardware is only able to handle linear fog with a range of 0.0;1.0, + * and it is the responsibility of the vertex pipeline to handle non-linear fog and + * linear fog with start and end other than 0.0 and 1.0. */ + TRACE("Reserving 1 ARB constant for compiler private use.\n"); + gl_info->reserved_arb_constants = max(gl_info->reserved_arb_constants, 1); +} + struct driver_quirk { BOOL (*match)(const struct wined3d_gl_info *gl_info, const char *gl_renderer, @@ -957,6 +962,11 @@ static const struct driver_quirk quirk_table[] = quirk_limited_tex_filtering, "Texture filtering, blending and VTF support is limited" }, + { + match_r200, + quirk_r200_constants, + "r200 vertex shader constants" + }, }; /* Certain applications (Steam) complain if we report an outdated driver version. In general, @@ -1075,6 +1085,7 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8800GTS, "NVIDIA GeForce 8800 GTS", DRIVER_NVIDIA_GEFORCE6, 320 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8800GTX, "NVIDIA GeForce 8800 GTX", DRIVER_NVIDIA_GEFORCE6, 768 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9200, "NVIDIA GeForce 9200", DRIVER_NVIDIA_GEFORCE6, 256 }, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9300, "NVIDIA GeForce 9300", DRIVER_NVIDIA_GEFORCE6, 256 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9400M, "NVIDIA GeForce 9400M", DRIVER_NVIDIA_GEFORCE6, 256 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9400GT, "NVIDIA GeForce 9400 GT", DRIVER_NVIDIA_GEFORCE6, 256 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9500GT, "NVIDIA GeForce 9500 GT", DRIVER_NVIDIA_GEFORCE6, 256 }, @@ -1100,6 +1111,7 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX465, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX470, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE6, 1280}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX480, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE6, 1536}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT520, "NVIDIA GeForce GT 520", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT540M, "NVIDIA GeForce GT 540M", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX550, "NVIDIA GeForce GTX 550 Ti", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT555M, "NVIDIA GeForce GT 555M", DRIVER_NVIDIA_GEFORCE6, 1024}, @@ -1107,7 +1119,14 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX560, "NVIDIA GeForce GTX 560", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX570, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE6, 1280}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX580, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE6, 1536}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT610, "NVIDIA GeForce GT 610", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT630M, "NVIDIA GeForce GT 630M", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT640M, "NVIDIA GeForce GT 640M", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT650M, "NVIDIA GeForce GT 650M", DRIVER_NVIDIA_GEFORCE6, 2048}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX650, "NVIDIA GeForce GTX 650", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX650TI, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE6, 2048}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660TI, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE6, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE6, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX680, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE6, 2048}, @@ -1141,6 +1160,8 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6700, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600, 1024}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6800, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600, 1024}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6900, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7700, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600, 1024}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7800, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600, 2048}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7900, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600, 2048}, /* Intel cards */ {HW_VENDOR_INTEL, CARD_INTEL_830M, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800, 32 }, @@ -1416,9 +1437,9 @@ static enum wined3d_gl_vendor wined3d_guess_gl_vendor(const struct wined3d_gl_in return GL_VENDOR_INTEL; if (strstr(gl_vendor_string, "Mesa") + || strstr(gl_vendor_string, "X.Org") || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.") || strstr(gl_vendor_string, "DRI R300 Project") - || strstr(gl_vendor_string, "X.Org R300 Project") || strstr(gl_vendor_string, "Tungsten Graphics, Inc") || strstr(gl_vendor_string, "VMware, Inc.") || strstr(gl_renderer, "Mesa") @@ -1506,7 +1527,14 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl { {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680}, /* Geforce 600 - highend */ {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670}, /* Geforce 600 - midend high */ + {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI}, /* Geforce 600 - midend high */ + {"GTX 660", CARD_NVIDIA_GEFORCE_GTX660}, /* Geforce 600 - midend high */ + {"GTX 650 Ti", CARD_NVIDIA_GEFORCE_GTX650TI}, /* Geforce 600 - lowend */ + {"GTX 650", CARD_NVIDIA_GEFORCE_GTX650}, /* Geforce 600 - lowend */ + {"GT 650M", CARD_NVIDIA_GEFORCE_GT650M}, /* Geforce 600 - midend mobile */ + {"GT 640M", CARD_NVIDIA_GEFORCE_GT640M}, /* Geforce 600 - midend mobile */ {"GT 630M", CARD_NVIDIA_GEFORCE_GT630M}, /* Geforce 600 - midend mobile */ + {"GT 610", CARD_NVIDIA_GEFORCE_GT610}, /* Geforce 600 - lowend */ {"GTX 580", CARD_NVIDIA_GEFORCE_GTX580}, /* Geforce 500 - highend */ {"GTX 570", CARD_NVIDIA_GEFORCE_GTX570}, /* Geforce 500 - midend high */ {"GTX 560 Ti", CARD_NVIDIA_GEFORCE_GTX560TI}, /* Geforce 500 - midend */ @@ -1514,6 +1542,7 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl {"GT 555M", CARD_NVIDIA_GEFORCE_GT555M}, /* Geforce 500 - midend mobile */ {"GTX 550 Ti", CARD_NVIDIA_GEFORCE_GTX550}, /* Geforce 500 - midend */ {"GT 540M", CARD_NVIDIA_GEFORCE_GT540M}, /* Geforce 500 - midend mobile */ + {"GT 520", CARD_NVIDIA_GEFORCE_GT520}, /* Geforce 500 - lowend */ {"GTX 480", CARD_NVIDIA_GEFORCE_GTX480}, /* Geforce 400 - highend */ {"GTX 470", CARD_NVIDIA_GEFORCE_GTX470}, /* Geforce 400 - midend high */ {"GTX 465", CARD_NVIDIA_GEFORCE_GTX465}, /* Geforce 400 - midend */ @@ -1551,7 +1580,7 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl {"9500", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */ {"9400M", CARD_NVIDIA_GEFORCE_9400M}, /* Geforce 9 - lowend */ {"9400", CARD_NVIDIA_GEFORCE_9400GT}, /* Geforce 9 - lowend */ - {"9300", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ + {"9300", CARD_NVIDIA_GEFORCE_9300}, /* Geforce 9 - lowend low */ {"9200", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ {"9100", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ {"G 100", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ @@ -1573,9 +1602,7 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl if (strstr(gl_renderer, cards[i].renderer)) return cards[i].id; } - - /* Geforce8-compatible fall back if the GPU is not in the list yet */ - return CARD_NVIDIA_GEFORCE_8300GS; + return PCI_DEVICE_NONE; } /* Both the GeforceFX, 6xxx and 7xxx series support D3D9. The last two types have more @@ -1610,9 +1637,7 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl if (strstr(gl_renderer, cards[i].renderer)) return cards[i].id; } - - /* Geforce 6/7 - lowend */ - return CARD_NVIDIA_GEFORCE_6200; /* Geforce 6100/6150/6200/7300/7400/7500 */ + return PCI_DEVICE_NONE; } if (d3d_level >= 9) @@ -1699,15 +1724,20 @@ static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_in { /* Southern Islands */ {"HD 7900", CARD_AMD_RADEON_HD7900}, + {"HD 7800", CARD_AMD_RADEON_HD7800}, + {"HD 7700", CARD_AMD_RADEON_HD7700}, /* Northern Islands */ + {"HD 6970", CARD_AMD_RADEON_HD6900}, {"HD 6900", CARD_AMD_RADEON_HD6900}, {"HD 6800", CARD_AMD_RADEON_HD6800}, {"HD 6770M",CARD_AMD_RADEON_HD6600M}, {"HD 6750M",CARD_AMD_RADEON_HD6600M}, {"HD 6700", CARD_AMD_RADEON_HD6700}, + {"HD 6670", CARD_AMD_RADEON_HD6600}, {"HD 6630M",CARD_AMD_RADEON_HD6600M}, {"HD 6600M",CARD_AMD_RADEON_HD6600M}, {"HD 6600", CARD_AMD_RADEON_HD6600}, + {"HD 6570", CARD_AMD_RADEON_HD6600}, {"HD 6500M",CARD_AMD_RADEON_HD6600M}, {"HD 6500", CARD_AMD_RADEON_HD6600}, {"HD 6400", CARD_AMD_RADEON_HD6400}, @@ -1724,6 +1754,7 @@ static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_in {"HD 5570", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD PRO mapped to HD5600 series */ {"HD 5550", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD LE mapped to HD5600 series */ {"HD 5450", CARD_AMD_RADEON_HD5400}, /* Radeon EG CEDAR PRO */ + {"HD 5000", CARD_AMD_RADEON_HD5600}, /* Defaulting to HD 5600 */ /* R700 */ {"HD 4890", CARD_AMD_RADEON_HD4800}, /* Radeon RV790 */ {"HD 4870", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */ @@ -1762,9 +1793,7 @@ static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_in if (strstr(gl_renderer, cards[i].renderer)) return cards[i].id; } - - /* Default for when no GPU has been found */ - return CARD_AMD_RADEON_HD3200; + return PCI_DEVICE_NONE; } if (d3d_level >= 9) @@ -1801,18 +1830,8 @@ static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_in { return CARD_AMD_RADEON_XPRESS_200M; } - - /* Radeon R3xx */ - return CARD_AMD_RADEON_9500; /* Radeon 9500/9550/9600/9700/9800/X300/X550/X600 */ } - - if (d3d_level >= 8) - return CARD_AMD_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */ - - if (d3d_level >= 7) - return CARD_AMD_RADEON_7200; /* Radeon 7000/7100/7200/7500 */ - - return CARD_AMD_RAGE_128PRO; + return PCI_DEVICE_NONE; } static enum wined3d_pci_device select_card_intel(const struct wined3d_gl_info *gl_info, @@ -1880,163 +1899,108 @@ static enum wined3d_pci_device select_card_intel(const struct wined3d_gl_info *g return cards[i].id; } - return CARD_INTEL_915G; + return PCI_DEVICE_NONE; } static enum wined3d_pci_device select_card_amd_mesa(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { - UINT d3d_level; unsigned int i; - /* See http://developer.amd.com/drivers/pc_vendor_id/Pages/default.aspx + /* 20101109 - These are never returned by current Gallium radeon + * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351. * - * Beware: renderer string do not match exact card model, - * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */ - if (strstr(gl_renderer, "Gallium")) + * These are returned but not handled: RC410, RV380. */ + static const struct { - /* 20101109 - These are never returned by current Gallium radeon - * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351. - * - * These are returned but not handled: RC410, RV380. */ - static const struct - { - const char *renderer; - enum wined3d_pci_device id; - } - cards[] = - { - /* Southern Islands */ - {"TAHITI", CARD_AMD_RADEON_HD7900}, - /* Northern Islands */ - {"CAYMAN", CARD_AMD_RADEON_HD6900}, - {"BARTS", CARD_AMD_RADEON_HD6800}, - {"TURKS", CARD_AMD_RADEON_HD6600}, - {"SUMO2", CARD_AMD_RADEON_HD6410D}, /* SUMO2 first, because we do a strstr(). */ - {"SUMO", CARD_AMD_RADEON_HD6550D}, - {"CAICOS", CARD_AMD_RADEON_HD6400}, - {"PALM", CARD_AMD_RADEON_HD6300}, - /* Evergreen */ - {"HEMLOCK", CARD_AMD_RADEON_HD5900}, - {"CYPRESS", CARD_AMD_RADEON_HD5800}, - {"JUNIPER", CARD_AMD_RADEON_HD5700}, - {"REDWOOD", CARD_AMD_RADEON_HD5600}, - {"CEDAR", CARD_AMD_RADEON_HD5400}, - /* R700 */ - {"R700", CARD_AMD_RADEON_HD4800}, /* HD4800 - highend */ - {"RV790", CARD_AMD_RADEON_HD4800}, - {"RV770", CARD_AMD_RADEON_HD4800}, - {"RV740", CARD_AMD_RADEON_HD4700}, /* HD4700 - midend */ - {"RV730", CARD_AMD_RADEON_HD4600}, /* HD4600 - midend */ - {"RV710", CARD_AMD_RADEON_HD4350}, /* HD4500/HD4350 - lowend */ - /* R600/R700 integrated */ - {"RS880", CARD_AMD_RADEON_HD3200}, - {"RS780", CARD_AMD_RADEON_HD3200}, - /* R600 */ - {"R680", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ - {"R600", CARD_AMD_RADEON_HD2900}, - {"RV670", CARD_AMD_RADEON_HD2900}, - {"RV635", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend; HD3830 is China-only midend */ - {"RV630", CARD_AMD_RADEON_HD2600}, - {"RV620", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ - {"RV610", CARD_AMD_RADEON_HD2350}, - /* R500 */ - {"R580", CARD_AMD_RADEON_X1600}, - {"R520", CARD_AMD_RADEON_X1600}, - {"RV570", CARD_AMD_RADEON_X1600}, - {"RV560", CARD_AMD_RADEON_X1600}, - {"RV535", CARD_AMD_RADEON_X1600}, - {"RV530", CARD_AMD_RADEON_X1600}, - {"RV516", CARD_AMD_RADEON_X700}, /* X700 is actually R400. */ - {"RV515", CARD_AMD_RADEON_X700}, - /* R400 */ - {"R481", CARD_AMD_RADEON_X700}, - {"R480", CARD_AMD_RADEON_X700}, - {"R430", CARD_AMD_RADEON_X700}, - {"R423", CARD_AMD_RADEON_X700}, - {"R420", CARD_AMD_RADEON_X700}, - {"R410", CARD_AMD_RADEON_X700}, - {"RV410", CARD_AMD_RADEON_X700}, - /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400MHz */ - {"RS740", CARD_AMD_RADEON_XPRESS_200M}, - {"RS690", CARD_AMD_RADEON_XPRESS_200M}, - {"RS600", CARD_AMD_RADEON_XPRESS_200M}, - {"RS485", CARD_AMD_RADEON_XPRESS_200M}, - {"RS482", CARD_AMD_RADEON_XPRESS_200M}, - {"RS480", CARD_AMD_RADEON_XPRESS_200M}, - {"RS400", CARD_AMD_RADEON_XPRESS_200M}, - /* R300 */ - {"R360", CARD_AMD_RADEON_9500}, - {"R350", CARD_AMD_RADEON_9500}, - {"R300", CARD_AMD_RADEON_9500}, - {"RV370", CARD_AMD_RADEON_9500}, - {"RV360", CARD_AMD_RADEON_9500}, - {"RV351", CARD_AMD_RADEON_9500}, - {"RV350", CARD_AMD_RADEON_9500}, - }; + const char *renderer; + enum wined3d_pci_device id; + } + cards[] = + { + /* Southern Islands */ + {"TAHITI", CARD_AMD_RADEON_HD7900}, + {"PITCAIRN", CARD_AMD_RADEON_HD7800}, + {"CAPE VERDE", CARD_AMD_RADEON_HD7700}, + /* Northern Islands */ + {"CAYMAN", CARD_AMD_RADEON_HD6900}, + {"BARTS", CARD_AMD_RADEON_HD6800}, + {"TURKS", CARD_AMD_RADEON_HD6600}, + {"SUMO2", CARD_AMD_RADEON_HD6410D}, /* SUMO2 first, because we do a strstr(). */ + {"SUMO", CARD_AMD_RADEON_HD6550D}, + {"CAICOS", CARD_AMD_RADEON_HD6400}, + {"PALM", CARD_AMD_RADEON_HD6300}, + /* Evergreen */ + {"HEMLOCK", CARD_AMD_RADEON_HD5900}, + {"CYPRESS", CARD_AMD_RADEON_HD5800}, + {"JUNIPER", CARD_AMD_RADEON_HD5700}, + {"REDWOOD", CARD_AMD_RADEON_HD5600}, + {"CEDAR", CARD_AMD_RADEON_HD5400}, + /* R700 */ + {"R700", CARD_AMD_RADEON_HD4800}, + {"RV790", CARD_AMD_RADEON_HD4800}, + {"RV770", CARD_AMD_RADEON_HD4800}, + {"RV740", CARD_AMD_RADEON_HD4700}, + {"RV730", CARD_AMD_RADEON_HD4600}, + {"RV710", CARD_AMD_RADEON_HD4350}, + /* R600/R700 integrated */ + {"RS880", CARD_AMD_RADEON_HD3200}, + {"RS780", CARD_AMD_RADEON_HD3200}, + /* R600 */ + {"R680", CARD_AMD_RADEON_HD2900}, + {"R600", CARD_AMD_RADEON_HD2900}, + {"RV670", CARD_AMD_RADEON_HD2900}, + {"RV635", CARD_AMD_RADEON_HD2600}, + {"RV630", CARD_AMD_RADEON_HD2600}, + {"RV620", CARD_AMD_RADEON_HD2350}, + {"RV610", CARD_AMD_RADEON_HD2350}, + /* R500 */ + {"R580", CARD_AMD_RADEON_X1600}, + {"R520", CARD_AMD_RADEON_X1600}, + {"RV570", CARD_AMD_RADEON_X1600}, + {"RV560", CARD_AMD_RADEON_X1600}, + {"RV535", CARD_AMD_RADEON_X1600}, + {"RV530", CARD_AMD_RADEON_X1600}, + {"RV516", CARD_AMD_RADEON_X700}, + {"RV515", CARD_AMD_RADEON_X700}, + /* R400 */ + {"R481", CARD_AMD_RADEON_X700}, + {"R480", CARD_AMD_RADEON_X700}, + {"R430", CARD_AMD_RADEON_X700}, + {"R423", CARD_AMD_RADEON_X700}, + {"R420", CARD_AMD_RADEON_X700}, + {"R410", CARD_AMD_RADEON_X700}, + {"RV410", CARD_AMD_RADEON_X700}, + /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400MHz */ + {"RS740", CARD_AMD_RADEON_XPRESS_200M}, + {"RS690", CARD_AMD_RADEON_XPRESS_200M}, + {"RS600", CARD_AMD_RADEON_XPRESS_200M}, + {"RS485", CARD_AMD_RADEON_XPRESS_200M}, + {"RS482", CARD_AMD_RADEON_XPRESS_200M}, + {"RS480", CARD_AMD_RADEON_XPRESS_200M}, + {"RS400", CARD_AMD_RADEON_XPRESS_200M}, + /* R300 */ + {"R360", CARD_AMD_RADEON_9500}, + {"R350", CARD_AMD_RADEON_9500}, + {"R300", CARD_AMD_RADEON_9500}, + {"RV370", CARD_AMD_RADEON_9500}, + {"RV360", CARD_AMD_RADEON_9500}, + {"RV351", CARD_AMD_RADEON_9500}, + {"RV350", CARD_AMD_RADEON_9500}, + }; - for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) - { - if (strstr(gl_renderer, cards[i].renderer)) - return cards[i].id; - } + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) + { + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; } - d3d_level = d3d_level_from_gl_info(gl_info); - if (d3d_level >= 10) - return CARD_AMD_RADEON_HD2600; - - if (d3d_level >= 9) - { - static const struct - { - const char *renderer; - enum wined3d_pci_device id; - } - cards[] = - { - /* R700 */ - {"(R700", CARD_AMD_RADEON_HD4800}, /* HD4800 - highend */ - {"(RV790", CARD_AMD_RADEON_HD4800}, - {"(RV770", CARD_AMD_RADEON_HD4800}, - {"(RV740", CARD_AMD_RADEON_HD4700}, /* HD4700 - midend */ - {"(RV730", CARD_AMD_RADEON_HD4600}, /* HD4600 - midend */ - {"(RV710", CARD_AMD_RADEON_HD4350}, /* HD4500/HD4350 - lowend */ - /* R600/R700 integrated */ - {"RS880", CARD_AMD_RADEON_HD3200}, - {"RS780", CARD_AMD_RADEON_HD3200}, - /* R600 */ - {"(R680", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ - {"(R600", CARD_AMD_RADEON_HD2900}, - {"(RV670", CARD_AMD_RADEON_HD2900}, - {"(RV635", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend; HD3830 is China-only midend */ - {"(RV630", CARD_AMD_RADEON_HD2600}, - {"(RV620", CARD_AMD_RADEON_HD2350}, /* HD2300/HD2400/HD3400 - lowend */ - {"(RV610", CARD_AMD_RADEON_HD2350}, - }; - - for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) - { - if (strstr(gl_renderer, cards[i].renderer)) - return cards[i].id; - } - - return CARD_AMD_RADEON_9500; - } - - if (d3d_level >= 8) - return CARD_AMD_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */ - - if (d3d_level >= 7) - return CARD_AMD_RADEON_7200; /* Radeon 7000/7100/7200/7500 */ - - return CARD_AMD_RAGE_128PRO; + return PCI_DEVICE_NONE; } static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { - UINT d3d_level; unsigned int i; static const struct @@ -2049,6 +2013,7 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i /* Kepler */ {"NVE4", CARD_NVIDIA_GEFORCE_GTX680}, /* Fermi */ + {"NVD9", CARD_NVIDIA_GEFORCE_GT520}, {"NVCF", CARD_NVIDIA_GEFORCE_GTX550}, {"NVCE", CARD_NVIDIA_GEFORCE_GTX560}, {"NVC8", CARD_NVIDIA_GEFORCE_GTX570}, @@ -2119,12 +2084,41 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i if (strstr(gl_renderer, cards[i].renderer)) return cards[i].id; } + return PCI_DEVICE_NONE; +} - FIXME("Unknown renderer %s.\n", debugstr_a(gl_renderer)); +static const struct gl_vendor_selection +{ + enum wined3d_gl_vendor gl_vendor; + const char *description; /* Description of the card selector i.e. Apple OS/X Intel */ + enum wined3d_pci_device (*select_card)(const struct wined3d_gl_info *gl_info, const char *gl_renderer); +} +nvidia_gl_vendor_table[] = +{ + {GL_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, + {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, + {GL_VENDOR_MESA, "Mesa Nouveau driver", select_card_nvidia_mesa}, +}, +amd_gl_vendor_table[] = +{ + {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_FGLRX, "AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_MESA, "Mesa AMD/ATI driver", select_card_amd_mesa}, +}, +intel_gl_vendor_table[] = +{ + {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", select_card_intel}, + {GL_VENDOR_INTEL, "Mesa Intel driver", select_card_intel}, + {GL_VENDOR_MESA, "Mesa Intel driver", select_card_intel}, +}; - d3d_level = d3d_level_from_gl_info(gl_info); +static enum wined3d_pci_device select_card_fallback_nvidia(const struct wined3d_gl_info *gl_info) +{ + UINT d3d_level = d3d_level_from_gl_info(gl_info); if (d3d_level >= 10) return CARD_NVIDIA_GEFORCE_8800GTX; + if (d3d_level >= 9 && gl_info->supported[NV_VERTEX_PROGRAM3]) + return CARD_NVIDIA_GEFORCE_6800; if (d3d_level >= 9) return CARD_NVIDIA_GEFORCEFX_5800; if (d3d_level >= 8) @@ -2136,40 +2130,74 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i return CARD_NVIDIA_RIVA_128; } - -struct vendor_card_selection +static enum wined3d_pci_device select_card_fallback_amd(const struct wined3d_gl_info *gl_info) +{ + UINT d3d_level = d3d_level_from_gl_info(gl_info); + if (d3d_level >= 10) + return CARD_AMD_RADEON_HD2900; + if (d3d_level >= 9) + return CARD_AMD_RADEON_9500; + if (d3d_level >= 8) + return CARD_AMD_RADEON_8500; + if (d3d_level >= 7) + return CARD_AMD_RADEON_7200; + return CARD_AMD_RAGE_128PRO; +} + +static enum wined3d_pci_device select_card_fallback_intel(const struct wined3d_gl_info *gl_info) +{ + UINT d3d_level = d3d_level_from_gl_info(gl_info); + if (d3d_level >= 10) + return CARD_INTEL_G45; + return CARD_INTEL_915G; +} + +static enum wined3d_pci_device select_card_handler(const struct gl_vendor_selection *table, + unsigned int table_size, enum wined3d_gl_vendor gl_vendor, + const struct wined3d_gl_info *gl_info, const char *gl_renderer) +{ + unsigned int i; + + for (i = 0; i < table_size; ++i) + { + if (table[i].gl_vendor != gl_vendor) + continue; + + TRACE("Applying card selector \"%s\".\n", table[i].description); + return table[i].select_card(gl_info, gl_renderer); + } + FIXME("Couldn't find a suitable card selector for GL vendor %04x (using GL_RENDERER %s)\n", + gl_vendor, debugstr_a(gl_renderer)); + + return PCI_DEVICE_NONE; +} + +static const struct { - enum wined3d_gl_vendor gl_vendor; enum wined3d_pci_vendor card_vendor; const char *description; /* Description of the card selector i.e. Apple OS/X Intel */ - enum wined3d_pci_device (*select_card)(const struct wined3d_gl_info *gl_info, const char *gl_renderer); -}; - -static const struct vendor_card_selection vendor_card_select_table[] = + const struct gl_vendor_selection *gl_vendor_selection; + unsigned int gl_vendor_count; + enum wined3d_pci_device (*select_card_fallback)(const struct wined3d_gl_info *gl_info); +} +card_vendor_table[] = { - {GL_VENDOR_NVIDIA, HW_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_APPLE, HW_VENDOR_NVIDIA, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_APPLE, HW_VENDOR_AMD, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, - {GL_VENDOR_APPLE, HW_VENDOR_INTEL, "Apple OSX Intel binary driver", select_card_intel}, - {GL_VENDOR_FGLRX, HW_VENDOR_AMD, "AMD/ATI binary driver", select_card_amd_binary}, - {GL_VENDOR_MESA, HW_VENDOR_AMD, "Mesa AMD/ATI driver", select_card_amd_mesa}, - {GL_VENDOR_MESA, HW_VENDOR_NVIDIA, "Mesa Nouveau driver", select_card_nvidia_mesa}, - {GL_VENDOR_MESA, HW_VENDOR_INTEL, "Mesa Intel driver", select_card_intel}, - {GL_VENDOR_INTEL, HW_VENDOR_INTEL, "Mesa Intel driver", select_card_intel} + {HW_VENDOR_NVIDIA, "Nvidia", nvidia_gl_vendor_table, + sizeof(nvidia_gl_vendor_table) / sizeof(nvidia_gl_vendor_table[0]), + select_card_fallback_nvidia}, + {HW_VENDOR_AMD, "AMD", amd_gl_vendor_table, + sizeof(amd_gl_vendor_table) / sizeof(amd_gl_vendor_table[0]), + select_card_fallback_amd}, + {HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table, + sizeof(intel_gl_vendor_table) / sizeof(intel_gl_vendor_table[0]), + select_card_fallback_intel}, }; static enum wined3d_pci_device wined3d_guess_card(const struct wined3d_gl_info *gl_info, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor) { - UINT d3d_level; - - /* Above is a list of Nvidia and ATI GPUs. Both vendors have dozens of - * different GPUs with roughly the same features. In most cases GPUs from a - * certain family differ in clockspeeds, the amount of video memory and the - * number of shader pipelines. - * - * A Direct3D device object contains the PCI id (vendor + device) of the + /* A Direct3D device object contains the PCI id (vendor + device) of the * videocard which is used for rendering. Various applications use this * information to get a rough estimation of the features of the card and * some might use it for enabling 3d effects only on certain types of @@ -2220,67 +2248,76 @@ static enum wined3d_pci_device wined3d_guess_card(const struct wined3d_gl_info * * memory can be overruled using a registry setting. */ int i; + enum wined3d_pci_device device; - for (i = 0; i < (sizeof(vendor_card_select_table) / sizeof(*vendor_card_select_table)); ++i) + for (i = 0; i < (sizeof(card_vendor_table) / sizeof(*card_vendor_table)); ++i) { - if ((vendor_card_select_table[i].gl_vendor != *gl_vendor) - || (vendor_card_select_table[i].card_vendor != *card_vendor)) + if (card_vendor_table[i].card_vendor != *card_vendor) continue; - TRACE("Applying card_selector \"%s\".\n", vendor_card_select_table[i].description); - return vendor_card_select_table[i].select_card(gl_info, gl_renderer); + + TRACE("Applying card selector \"%s\".\n", card_vendor_table[i].description); + device = select_card_handler(card_vendor_table[i].gl_vendor_selection, + card_vendor_table[i].gl_vendor_count, *gl_vendor, gl_info, gl_renderer); + if (device != PCI_DEVICE_NONE) + return device; + + TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer)); + return card_vendor_table[i].select_card_fallback(gl_info); } - FIXME("No card selector available for GL vendor %#x and card vendor %04x (using GL_RENDERER %s).\n", - *gl_vendor, *card_vendor, debugstr_a(gl_renderer)); + FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n", + *card_vendor, debugstr_a(gl_renderer)); - /* Default to generic Nvidia hardware based on the supported OpenGL extensions. The choice - * for Nvidia was because the hardware and drivers they make are of good quality. This makes - * them a good generic choice. */ + /* Default to generic Nvidia hardware based on the supported OpenGL extensions. */ *card_vendor = HW_VENDOR_NVIDIA; - d3d_level = d3d_level_from_gl_info(gl_info); - if (d3d_level >= 9) - return CARD_NVIDIA_GEFORCEFX_5600; - if (d3d_level >= 8) - return CARD_NVIDIA_GEFORCE3; - if (d3d_level >= 7) - return CARD_NVIDIA_GEFORCE; - if (d3d_level >= 6) - return CARD_NVIDIA_RIVA_TNT; - return CARD_NVIDIA_RIVA_128; + return select_card_fallback_nvidia(gl_info); } -static const struct fragment_pipeline *select_fragment_implementation(const struct wined3d_gl_info *gl_info) +static const struct fragment_pipeline *select_fragment_implementation(const struct wined3d_gl_info *gl_info, + const struct wined3d_shader_backend_ops *shader_backend_ops) { - int vs_selected_mode, ps_selected_mode; - - select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode); - if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL) - && gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_fragment_pipeline; - else if (ps_selected_mode == SHADER_ATI) return &atifs_fragment_pipeline; - else if (gl_info->supported[NV_REGISTER_COMBINERS] - && gl_info->supported[NV_TEXTURE_SHADER2]) return &nvts_fragment_pipeline; - else if (gl_info->supported[NV_REGISTER_COMBINERS]) return &nvrc_fragment_pipeline; - else return &ffp_fragment_pipeline; + if (shader_backend_ops == &glsl_shader_backend) + return &glsl_fragment_pipe; + if (shader_backend_ops == &arb_program_shader_backend && gl_info->supported[ARB_FRAGMENT_PROGRAM]) + return &arbfp_fragment_pipeline; + if (gl_info->supported[ATI_FRAGMENT_SHADER]) + return &atifs_fragment_pipeline; + if (gl_info->supported[NV_REGISTER_COMBINERS] && gl_info->supported[NV_TEXTURE_SHADER2]) + return &nvts_fragment_pipeline; + if (gl_info->supported[NV_REGISTER_COMBINERS]) + return &nvrc_fragment_pipeline; + return &ffp_fragment_pipeline; } static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info) { - int vs_selected_mode, ps_selected_mode; + BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20); - select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode); - if (vs_selected_mode == SHADER_GLSL || ps_selected_mode == SHADER_GLSL) return &glsl_shader_backend; - if (vs_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_ARB) return &arb_program_shader_backend; + if (glsl && gl_info->supported[ARB_FRAGMENT_SHADER]) + return &glsl_shader_backend; + if (glsl && gl_info->supported[ARB_VERTEX_SHADER]) + { + /* Geforce4 cards support GLSL but for vertex shaders only. Further + * its reported GLSL caps are wrong. This combined with the fact that + * GLSL won't offer more features or performance, use ARB shaders only + * on this card. */ + if (gl_info->supported[NV_VERTEX_PROGRAM] && !gl_info->supported[NV_VERTEX_PROGRAM2]) + return &arb_program_shader_backend; + return &glsl_shader_backend; + } + if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_FRAGMENT_PROGRAM]) + return &arb_program_shader_backend; return &none_shader_backend; } -static const struct blit_shader *select_blit_implementation(const struct wined3d_gl_info *gl_info) +static const struct blit_shader *select_blit_implementation(const struct wined3d_gl_info *gl_info, + const struct wined3d_shader_backend_ops *shader_backend_ops) { - int vs_selected_mode, ps_selected_mode; - - select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode); - if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL) - && gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_blit; - else return &ffp_blit; + if ((shader_backend_ops == &glsl_shader_backend + || shader_backend_ops == &arb_program_shader_backend) + && gl_info->supported[ARB_FRAGMENT_PROGRAM]) + return &arbfp_blit; + return &ffp_blit; } static void parse_extension_string(struct wined3d_gl_info *gl_info, const char *extensions, @@ -2319,7 +2356,7 @@ static void parse_extension_string(struct wined3d_gl_info *gl_info, const char * static void load_gl_funcs(struct wined3d_gl_info *gl_info) { -#define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)pwglGetProcAddress(#pfn); +#define USE_GL_FUNC(pfn) gl_info->gl_ops.ext.p_##pfn = (void *)wglGetProcAddress(#pfn); GL_EXT_FUNCS_GEN; #undef USE_GL_FUNC @@ -2556,13 +2593,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) TRACE("adapter %p.\n", adapter); - ENTER_GL(); - gl_renderer_str = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_RENDERER); TRACE("GL_RENDERER: %s.\n", debugstr_a(gl_renderer_str)); if (!gl_renderer_str) { - LEAVE_GL(); ERR("Received a NULL GL_RENDERER.\n"); return FALSE; } @@ -2571,7 +2605,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) TRACE("GL_VENDOR: %s.\n", debugstr_a(gl_vendor_str)); if (!gl_vendor_str) { - LEAVE_GL(); ERR("Received a NULL GL_VENDOR.\n"); return FALSE; } @@ -2581,7 +2614,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) TRACE("GL_VERSION: %s.\n", debugstr_a(gl_version_str)); if (!gl_version_str) { - LEAVE_GL(); ERR("Received a NULL GL_VERSION.\n"); return FALSE; } @@ -2591,13 +2623,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) GL_Extensions = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_EXTENSIONS); if (!GL_Extensions) { - LEAVE_GL(); ERR("Received a NULL GL_EXTENSIONS.\n"); return FALSE; } - LEAVE_GL(); - memset(gl_info->supported, 0, sizeof(gl_info->supported)); gl_info->supported[WINED3D_GL_EXT_NONE] = TRUE; @@ -2608,7 +2637,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) /* Now work out what GL support this card really has. */ load_gl_funcs( gl_info ); - hdc = pwglGetCurrentDC(); + hdc = wglGetCurrentDC(); /* Not all GL drivers might offer WGL extensions e.g. VirtualBox. */ if (GL_EXTCALL(wglGetExtensionsStringARB)) WGL_Extensions = (const char *)GL_EXTCALL(wglGetExtensionsStringARB(hdc)); @@ -2740,8 +2769,6 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) gl_info->supported[ARB_FRAMEBUFFER_SRGB] = FALSE; } - ENTER_GL(); - wined3d_adapter_init_limits(gl_info); if (gl_info->supported[ARB_VERTEX_PROGRAM] && test_arb_vs_offset_limit(gl_info)) @@ -2761,11 +2788,9 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter) checkGLcall("extension detection"); - LEAVE_GL(); - - adapter->fragment_pipe = select_fragment_implementation(gl_info); adapter->shader_backend = select_shader_backend(gl_info); - adapter->blitter = select_blit_implementation(gl_info); + adapter->fragment_pipe = select_fragment_implementation(gl_info, adapter->shader_backend); + adapter->blitter = select_blit_implementation(gl_info, adapter->shader_backend); adapter->fragment_pipe->get_caps(gl_info, &fragment_caps); gl_info->limits.texture_stages = fragment_caps.MaxTextureBlendStages; @@ -3430,16 +3455,6 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3 return WINED3D_OK; } -/* Check if we support bumpmapping for a format */ -static BOOL CheckBumpMapCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) -{ - /* Ask the fixed function pipeline implementation if it can deal - * with the conversion. If we've got a GL extension giving native - * support this will be an identity conversion. */ - return (format->flags & WINED3DFMT_FLAG_BUMPMAP) - && adapter->fragment_pipe->color_fixup_supported(format->color_fixup); -} - /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */ static BOOL CheckDepthStencilCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *display_format, const struct wined3d_format *ds_format) @@ -3481,16 +3496,6 @@ static BOOL CheckDepthStencilCapability(const struct wined3d_adapter *adapter, return FALSE; } -static BOOL CheckFilterCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) -{ - /* The flags entry of a format contains the filtering capability */ - if ((format->flags & WINED3DFMT_FLAG_FILTERING) - || !(adapter->gl_info.quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING)) - return TRUE; - - return FALSE; -} - /* Check the render target capabilities of a format */ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *adapter_format, const struct wined3d_format *check_format) @@ -3537,336 +3542,11 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter, return FALSE; } -static BOOL CheckSrgbReadCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) -{ - return format->flags & WINED3DFMT_FLAG_SRGB_READ; -} - -static BOOL CheckSrgbWriteCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) -{ - /* Only offer SRGB writing on X8R8G8B8/A8R8G8B8 when we use ARB or GLSL shaders as we are - * doing the color fixup in shaders. - * Note Windows drivers (at least on the Geforce 8800) also offer this on R5G6B5. */ - if (format->flags & WINED3DFMT_FLAG_SRGB_WRITE) - { - int vs_selected_mode; - int ps_selected_mode; - select_shader_mode(&adapter->gl_info, &ps_selected_mode, &vs_selected_mode); - - if ((ps_selected_mode == SHADER_ARB) || (ps_selected_mode == SHADER_GLSL)) - { - TRACE("[OK]\n"); - return TRUE; - } - } - - TRACE("[FAILED] - sRGB writes not supported by format %s.\n", debug_d3dformat(format->id)); - return FALSE; -} - -/* Check if a format support blending in combination with pixel shaders */ -static BOOL CheckPostPixelShaderBlendingCapability(const struct wined3d_adapter *adapter, - const struct wined3d_format *format) -{ - /* The flags entry of a format contains the post pixel shader blending capability */ - if (format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) return TRUE; - - return FALSE; -} - -static BOOL CheckWrapAndMipCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) -{ - /* OpenGL supports mipmapping on all formats basically. Wrapping is unsupported, - * but we have to report mipmapping so we cannot reject this flag. Tests show that - * windows reports WRAPANDMIP on unfilterable surfaces as well, apparently to show - * that wrapping is supported. The lack of filtering will sort out the mipmapping - * capability anyway. - * - * For now lets report this on all formats, but in the future we may want to - * restrict it to some should games need that - */ - return TRUE; -} - -/* Check if a texture format is supported on the given adapter */ -static BOOL CheckTextureCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) -{ - const struct wined3d_gl_info *gl_info = &adapter->gl_info; - - switch (format->id) - { - /***** - * supported: RGB(A) formats - */ - case WINED3DFMT_B8G8R8_UNORM: - TRACE("[FAILED] - Not enumerated on Windows.\n"); - return FALSE; - case WINED3DFMT_B8G8R8A8_UNORM: - case WINED3DFMT_B8G8R8X8_UNORM: - case WINED3DFMT_B5G6R5_UNORM: - case WINED3DFMT_B5G5R5X1_UNORM: - case WINED3DFMT_B5G5R5A1_UNORM: - case WINED3DFMT_B4G4R4A4_UNORM: - case WINED3DFMT_A8_UNORM: - case WINED3DFMT_B4G4R4X4_UNORM: - case WINED3DFMT_R8G8B8A8_UNORM: - case WINED3DFMT_R8G8B8X8_UNORM: - case WINED3DFMT_B10G10R10A2_UNORM: - case WINED3DFMT_R10G10B10A2_UNORM: - case WINED3DFMT_R16G16_UNORM: - TRACE("[OK]\n"); - return TRUE; - - case WINED3DFMT_B2G3R3_UNORM: - TRACE("[FAILED] - Not supported on Windows.\n"); - return FALSE; - - /***** - * Not supported: Palettized - * Only some Geforce/Voodoo3/G400 cards offer 8-bit textures in case of <=Direct3D7. - * Since it is not widely available, don't offer it. Further no Windows driver offers - * WINED3DFMT_P8_UINT_A8_NORM, so don't offer it either. - */ - case WINED3DFMT_P8_UINT: - case WINED3DFMT_P8_UINT_A8_UNORM: - return FALSE; - - /***** - * Supported: (Alpha)-Luminance - */ - case WINED3DFMT_L8_UNORM: - case WINED3DFMT_L8A8_UNORM: - case WINED3DFMT_L16_UNORM: - TRACE("[OK]\n"); - return TRUE; - - /* Not supported on Windows, thus disabled */ - case WINED3DFMT_L4A4_UNORM: - TRACE("[FAILED] - not supported on windows\n"); - return FALSE; - - /***** - * Supported: Depth/Stencil formats - */ - case WINED3DFMT_D16_LOCKABLE: - case WINED3DFMT_D16_UNORM: - case WINED3DFMT_X8D24_UNORM: - case WINED3DFMT_D24_UNORM_S8_UINT: - case WINED3DFMT_S8_UINT_D24_FLOAT: - case WINED3DFMT_D32_UNORM: - case WINED3DFMT_D32_FLOAT: - return TRUE; - - case WINED3DFMT_INTZ: - if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL] - || gl_info->supported[ARB_FRAMEBUFFER_OBJECT]) - return TRUE; - return FALSE; - - /* Not supported on Windows */ - case WINED3DFMT_S1_UINT_D15_UNORM: - case WINED3DFMT_S4X4_UINT_D24_UNORM: - TRACE("[FAILED] - not supported on windows\n"); - return FALSE; - - /***** - * Not supported everywhere(depends on GL_ATI_envmap_bumpmap or - * GL_NV_texture_shader). Emulated by shaders - */ - case WINED3DFMT_R8G8_SNORM: - case WINED3DFMT_R8G8_SNORM_L8X8_UNORM: - case WINED3DFMT_R5G5_SNORM_L6_UNORM: - case WINED3DFMT_R8G8B8A8_SNORM: - case WINED3DFMT_R16G16_SNORM: - /* Ask the shader backend if it can deal with the conversion. If - * we've got a GL extension giving native support this will be an - * identity conversion. */ - if (adapter->shader_backend->shader_color_fixup_supported(format->color_fixup)) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - case WINED3DFMT_DXT1: - case WINED3DFMT_DXT2: - case WINED3DFMT_DXT3: - case WINED3DFMT_DXT4: - case WINED3DFMT_DXT5: - if (gl_info->supported[EXT_TEXTURE_COMPRESSION_S3TC]) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - - /***** - * Odd formats - not supported - */ - case WINED3DFMT_VERTEXDATA: - case WINED3DFMT_R16_UINT: - case WINED3DFMT_R32_UINT: - case WINED3DFMT_R16G16B16A16_SNORM: - case WINED3DFMT_R10G10B10_SNORM_A2_UNORM: - case WINED3DFMT_R10G11B11_SNORM: - case WINED3DFMT_R16: - case WINED3DFMT_AL16: - TRACE("[FAILED]\n"); /* Enable when implemented */ - return FALSE; - - /***** - * WINED3DFMT_R8G8_SNORM_Cx: Not supported right now - */ - case WINED3DFMT_R8G8_SNORM_Cx: - TRACE("[FAILED]\n"); /* Enable when implemented */ - return FALSE; - - /* YUV formats */ - case WINED3DFMT_UYVY: - case WINED3DFMT_YUY2: - if (gl_info->supported[APPLE_YCBCR_422]) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - case WINED3DFMT_YV12: - TRACE("[FAILED]\n"); - return FALSE; - - case WINED3DFMT_R16G16B16A16_UNORM: - if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16) - { - TRACE("[FAILED]\n"); - return FALSE; - } - TRACE("[OK]\n"); - return TRUE; - - /* Not supported */ - case WINED3DFMT_B2G3R3A8_UNORM: - TRACE("[FAILED]\n"); /* Enable when implemented */ - return FALSE; - - /* Floating point formats */ - case WINED3DFMT_R16_FLOAT: - case WINED3DFMT_R16G16_FLOAT: - case WINED3DFMT_R16G16B16A16_FLOAT: - if (gl_info->supported[ARB_TEXTURE_FLOAT] && gl_info->supported[ARB_HALF_FLOAT_PIXEL]) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - case WINED3DFMT_R32_FLOAT: - case WINED3DFMT_R32G32_FLOAT: - case WINED3DFMT_R32G32B32A32_FLOAT: - if (gl_info->supported[ARB_TEXTURE_FLOAT]) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - /* ATI instancing hack: Although ATI cards do not support Shader Model 3.0, they support - * instancing. To query if the card supports instancing CheckDeviceFormat with the special format - * MAKEFOURCC('I','N','S','T') is used. Should a (broken) app check for this provide a proper return value. - * We can do instancing with all shader versions, but we need vertex shaders. - * - * Additionally applications have to set the D3DRS_POINTSIZE render state to MAKEFOURCC('I','N','S','T') once - * to enable instancing. WineD3D doesn't need that and just ignores it. - * - * With Shader Model 3.0 capable cards Instancing 'just works' in Windows. - */ - case WINED3DFMT_INST: - TRACE("ATI Instancing check hack\n"); - if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER]) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - /* Some weird FOURCC formats */ - case WINED3DFMT_R8G8_B8G8: - case WINED3DFMT_G8R8_G8B8: - case WINED3DFMT_MULTI2_ARGB8: - TRACE("[FAILED]\n"); - return FALSE; - - /* Vendor specific formats */ - case WINED3DFMT_ATI2N: - if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC] - || gl_info->supported[ARB_TEXTURE_COMPRESSION_RGTC]) - { - if (adapter->shader_backend->shader_color_fixup_supported(format->color_fixup) - && adapter->fragment_pipe->color_fixup_supported(format->color_fixup)) - { - TRACE("[OK]\n"); - return TRUE; - } - - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - /* Depth bound test. To query if the card supports it CheckDeviceFormat with the special - * format MAKEFOURCC('N','V','D','B') is used. - * It is enabled by setting D3DRS_ADAPTIVETESS_X render state to MAKEFOURCC('N','V','D','B') and - * then controlled by setting D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax) - * to test value. - */ - case WINED3DFMT_NVDB: - if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST]) - { - TRACE("[OK]\n"); - return TRUE; - } - TRACE("[FAILED]\n"); - return FALSE; - - case WINED3DFMT_NVHU: - case WINED3DFMT_NVHS: - /* These formats seem to be similar to the HILO formats in GL_NV_texture_shader. NVHU - * is said to be GL_UNSIGNED_HILO16, NVHS GL_SIGNED_HILO16. Rumours say that d3d computes - * a 3rd channel similarly to D3DFMT_CxV8U8(So NVHS could be called D3DFMT_CxV16U16). - * ATI refused to support formats which can easily be emulated with pixel shaders, so - * Applications have to deal with not having NVHS and NVHU. - */ - TRACE("[FAILED]\n"); - return FALSE; - - case WINED3DFMT_NULL: - if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]) - return TRUE; - return FALSE; - - case WINED3DFMT_UNKNOWN: - return FALSE; - - default: - ERR("Unhandled format %s.\n", debug_d3dformat(format->id)); - break; - } - return FALSE; -} - static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *adapter_format, - const struct wined3d_format *check_format, - enum wined3d_surface_type surface_type) + const struct wined3d_format *check_format, BOOL no3d) { - if (surface_type == WINED3D_SURFACE_TYPE_GDI) + if (no3d) { switch (check_format->id) { @@ -3898,8 +3578,10 @@ static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter, } } - /* All format that are supported for textures are supported for surfaces as well */ - if (CheckTextureCapability(adapter, check_format)) return TRUE; + /* All formats that are supported for textures are supported for surfaces + * as well. */ + if (check_format->flags & WINED3DFMT_FLAG_TEXTURE) + return TRUE; /* All depth stencil formats are supported on surfaces */ if (CheckDepthStencilCapability(adapter, adapter_format, check_format)) return TRUE; @@ -3917,28 +3599,9 @@ static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter, return FALSE; } -static BOOL CheckVertexTextureCapability(const struct wined3d_adapter *adapter, - const struct wined3d_format *format) -{ - const struct wined3d_gl_info *gl_info = &adapter->gl_info; - - if (!gl_info->limits.vertex_samplers || !(format->flags & WINED3DFMT_FLAG_VTF)) - return FALSE; - - switch (format->id) - { - case WINED3DFMT_R32G32B32A32_FLOAT: - case WINED3DFMT_R32_FLOAT: - return TRUE; - default: - return !(gl_info->quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING); - } -} - HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, - enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id, - enum wined3d_surface_type surface_type) + enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id) { const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx]; const struct wined3d_gl_info *gl_info = &adapter->gl_info; @@ -3947,10 +3610,10 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad DWORD usage_caps = 0; TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s,\n" - "resource_type %s, check_format %s, surface_type %#x.\n", + "resource_type %s, check_format %s.\n", wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id), debug_d3dusage(usage), debug_d3dusagequery(usage), debug_d3dresourcetype(resource_type), - debug_d3dformat(check_format_id), surface_type); + debug_d3dformat(check_format_id)); if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; @@ -3967,7 +3630,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad * - WINED3DUSAGE_SOFTWAREPROCESSING * - WINED3DUSAGE_QUERY_WRAPANDMIP */ - if (surface_type != WINED3D_SURFACE_TYPE_OPENGL) + if (wined3d->flags & WINED3D_NO3D) { TRACE("[FAILED]\n"); return WINED3DERR_NOTAVAILABLE; @@ -3979,7 +3642,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad return WINED3DERR_NOTAVAILABLE; } - if (!CheckTextureCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_TEXTURE)) { TRACE("[FAILED] - Cube texture format not supported.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4015,7 +3678,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_FILTER) { - if (!CheckFilterCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_FILTERING)) { TRACE("[FAILED] - No filter support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4025,7 +3688,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { - if (!CheckPostPixelShaderBlendingCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { TRACE("[FAILED] - No post pixelshader blending support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4035,7 +3698,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_SRGBREAD) { - if (!CheckSrgbReadCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_SRGB_READ)) { TRACE("[FAILED] - No sRGB read support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4045,7 +3708,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_SRGBWRITE) { - if (!CheckSrgbWriteCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_SRGB_WRITE)) { TRACE("[FAILED] - No sRGB write support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4055,7 +3718,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { - if (!CheckVertexTextureCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_VTF)) { TRACE("[FAILED] - No vertex texture support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4063,15 +3726,18 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad usage_caps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; } + /* OpenGL supports mipmapping on all formats. Wrapping is + * unsupported, but we have to report mipmapping so we cannot + * reject this flag. Tests show that Windows reports WRAPANDMIP on + * unfilterable surfaces as well, apparently to show that wrapping + * is supported. The lack of filtering will sort out the + * mipmapping capability anyway. + * + * For now lets report this on all formats, but in the future we + * may want to restrict it to some should applications need that. */ if (usage & WINED3DUSAGE_QUERY_WRAPANDMIP) - { - if (!CheckWrapAndMipCapability(adapter, format)) - { - TRACE("[FAILED] - No wrapping and mipmapping support.\n"); - return WINED3DERR_NOTAVAILABLE; - } usage_caps |= WINED3DUSAGE_QUERY_WRAPANDMIP; - } + break; case WINED3D_RTYPE_SURFACE: @@ -4080,7 +3746,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad * - WINED3DUSAGE_NONSECURE (d3d9ex) * - WINED3DUSAGE_RENDERTARGET */ - if (!CheckSurfaceCapability(adapter, adapter_format, format, surface_type)) + if (!CheckSurfaceCapability(adapter, adapter_format, format, wined3d->flags & WINED3D_NO3D)) { TRACE("[FAILED] - Not supported for plain surfaces.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4108,7 +3774,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { - if (!CheckPostPixelShaderBlendingCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { TRACE("[FAILED] - No post pixelshader blending support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4129,13 +3795,13 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad * - WINED3DUSAGE_TEXTAPI (d3d9ex) * - WINED3DUSAGE_QUERY_WRAPANDMIP */ - if (surface_type != WINED3D_SURFACE_TYPE_OPENGL) + if (wined3d->flags & WINED3D_NO3D) { TRACE("[FAILED]\n"); return WINED3DERR_NOTAVAILABLE; } - if (!CheckTextureCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_TEXTURE)) { TRACE("[FAILED] - Texture format not supported.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4171,7 +3837,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_FILTER) { - if (!CheckFilterCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_FILTERING)) { TRACE("[FAILED] - No filter support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4181,7 +3847,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP) { - if (!CheckBumpMapCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_BUMPMAP)) { TRACE("[FAILED] - No legacy bumpmap support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4191,7 +3857,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { - if (!CheckPostPixelShaderBlendingCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { TRACE("[FAILED] - No post pixelshader blending support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4201,7 +3867,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_SRGBREAD) { - if (!CheckSrgbReadCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_SRGB_READ)) { TRACE("[FAILED] - No sRGB read support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4211,7 +3877,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_SRGBWRITE) { - if (!CheckSrgbWriteCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_SRGB_WRITE)) { TRACE("[FAILED] - No sRGB write support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4221,7 +3887,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { - if (!CheckVertexTextureCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_VTF)) { TRACE("[FAILED] - No vertex texture support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4230,14 +3896,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad } if (usage & WINED3DUSAGE_QUERY_WRAPANDMIP) - { - if (!CheckWrapAndMipCapability(adapter, format)) - { - TRACE("[FAILED] - No wrapping and mipmapping support.\n"); - return WINED3DERR_NOTAVAILABLE; - } usage_caps |= WINED3DUSAGE_QUERY_WRAPANDMIP; - } if (usage & WINED3DUSAGE_DEPTHSTENCIL) { @@ -4267,7 +3926,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad * - D3DUSAGE_SOFTWAREPROCESSING * - D3DUSAGE_QUERY_WRAPANDMIP */ - if (surface_type != WINED3D_SURFACE_TYPE_OPENGL) + if (wined3d->flags & WINED3D_NO3D) { TRACE("[FAILED]\n"); return WINED3DERR_NOTAVAILABLE; @@ -4279,7 +3938,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad return WINED3DERR_NOTAVAILABLE; } - if (!CheckTextureCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_TEXTURE)) { TRACE("[FAILED] - Format not supported.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4349,7 +4008,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_FILTER) { - if (!CheckFilterCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_FILTERING)) { TRACE("[FAILED] - No filter support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4359,7 +4018,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { - if (!CheckPostPixelShaderBlendingCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { TRACE("[FAILED] - No post pixelshader blending support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4369,7 +4028,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_SRGBREAD) { - if (!CheckSrgbReadCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_SRGB_READ)) { TRACE("[FAILED] - No sRGB read support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4379,7 +4038,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_SRGBWRITE) { - if (!CheckSrgbWriteCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_SRGB_WRITE)) { TRACE("[FAILED] - No sRGB write support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4389,7 +4048,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad if (usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { - if (!CheckVertexTextureCapability(adapter, format)) + if (!(format->flags & WINED3DFMT_FLAG_VTF)) { TRACE("[FAILED] - No vertex texture support.\n"); return WINED3DERR_NOTAVAILABLE; @@ -4398,14 +4057,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad } if (usage & WINED3DUSAGE_QUERY_WRAPANDMIP) - { - if (!CheckWrapAndMipCapability(adapter, format)) - { - TRACE("[FAILED] - No wrapping and mipmapping support.\n"); - return WINED3DERR_NOTAVAILABLE; - } usage_caps |= WINED3DUSAGE_QUERY_WRAPANDMIP; - } + break; default: @@ -4530,7 +4183,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap /* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */ hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format, - WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format, WINED3D_SURFACE_TYPE_OPENGL); + WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format); if (FAILED(hr)) TRACE("Unsupported display/backbuffer format combination %s / %s.\n", debug_d3dformat(display_format), debug_d3dformat(backbuffer_format)); @@ -4543,8 +4196,6 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte { const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx]; const struct wined3d_gl_info *gl_info = &adapter->gl_info; - int vs_selected_mode; - int ps_selected_mode; struct shader_caps shader_caps; struct fragment_caps fragment_caps; DWORD ckey_caps, blit_caps, fx_caps, pal_caps; @@ -4555,12 +4206,6 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - select_shader_mode(&adapter->gl_info, &ps_selected_mode, &vs_selected_mode); - - /* ------------------------------------------------ - The following fields apply to both d3d8 and d3d9 - ------------------------------------------------ */ - /* Not quite true, but use h/w supported by opengl I suppose */ caps->DeviceType = (device_type == WINED3D_DEVICE_TYPE_HAL) ? WINED3D_DEVICE_TYPE_HAL : WINED3D_DEVICE_TYPE_REF; caps->AdapterOrdinal = adapter_idx; @@ -4594,8 +4239,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DDEVCAPS_TEXTURESYSTEMMEMORY | WINED3DDEVCAPS_CANRENDERAFTERFLIP | WINED3DDEVCAPS_DRAWPRIMITIVES2 | - WINED3DDEVCAPS_DRAWPRIMITIVES2EX | - WINED3DDEVCAPS_RTPATCHES; + WINED3DDEVCAPS_DRAWPRIMITIVES2EX; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_CULLNONE | WINED3DPMISCCAPS_CULLCCW | @@ -4944,30 +4588,11 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */ caps->PrimitiveMiscCaps |= fragment_caps.PrimitiveMiscCaps; - /* This takes care for disabling vertex shader or pixel shader caps while leaving the other one enabled. - * Ignore shader model capabilities if disabled in config - */ - if (vs_selected_mode == SHADER_NONE) - { - TRACE("Vertex shader disabled in config, reporting version 0.0.\n"); - caps->VertexShaderVersion = 0; - caps->MaxVertexShaderConst = 0; - } - else - { - caps->VertexShaderVersion = shader_caps.VertexShaderVersion; - caps->MaxVertexShaderConst = shader_caps.MaxVertexShaderConst; - } + caps->VertexShaderVersion = shader_caps.vs_version; + caps->MaxVertexShaderConst = shader_caps.vs_uniform_count; - if (ps_selected_mode == SHADER_NONE) - { - TRACE("Pixel shader disabled in config, reporting version 0.0.\n"); - caps->PixelShaderVersion = 0; - caps->PixelShader1xMaxValue = 0.0f; - } else { - caps->PixelShaderVersion = shader_caps.PixelShaderVersion; - caps->PixelShader1xMaxValue = shader_caps.PixelShader1xMaxValue; - } + caps->PixelShaderVersion = shader_caps.ps_version; + caps->PixelShader1xMaxValue = shader_caps.ps_1x_max_value; caps->TextureOpCaps = fragment_caps.TextureOpCaps; caps->MaxTextureBlendStages = fragment_caps.MaxTextureBlendStages; @@ -5152,8 +4777,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINEDDSCAPS_VISIBLE; caps->ddraw_caps.stride_align = DDRAW_PITCH_ALIGNMENT; - /* Set D3D caps if OpenGL is available. */ - if (adapter->opengl) + if (!(wined3d->flags & WINED3D_NO3D)) { caps->ddraw_caps.dds_caps |= WINEDDSCAPS_3DDEVICE | WINEDDSCAPS_MIPMAP | @@ -5182,10 +4806,7 @@ HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, e object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate device memory.\n"); return E_OUTOFMEMORY; - } hr = device_init(object, wined3d, adapter_idx, device_type, focus_window, flags, surface_alignment, device_parent); @@ -5390,46 +5011,163 @@ static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info) } } -/* Do not call while under the GL lock. */ -static BOOL InitAdapters(struct wined3d *wined3d) +static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter *adapter, HDC dc) { - struct wined3d_adapter *adapter = &wined3d->adapters[0]; - struct wined3d_gl_info *gl_info = &adapter->gl_info; - static HMODULE mod_gl; - BOOL ret; - int ps_selected_mode, vs_selected_mode; + const struct wined3d_gl_info *gl_info = &adapter->gl_info; + unsigned int i; - /* No need to hold any lock. The calling library makes sure only one thread calls - * wined3d simultaneously - */ + if (gl_info->supported[WGL_ARB_PIXEL_FORMAT]) + { + UINT attrib_count = 0; + GLint cfg_count; + int attribs[11]; + int values[11]; + int attribute; - TRACE("Initializing adapters\n"); + attribute = WGL_NUMBER_PIXEL_FORMATS_ARB; + GL_EXTCALL(wglGetPixelFormatAttribivARB(dc, 0, 0, 1, &attribute, &cfg_count)); - if(!mod_gl) { - mod_gl = LoadLibraryA("opengl32.dll"); - if(!mod_gl) { - ERR("Can't load opengl32.dll!\n"); - goto nogl_adapter; + adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cfg_count * sizeof(*adapter->cfgs)); + attribs[attrib_count++] = WGL_RED_BITS_ARB; + attribs[attrib_count++] = WGL_GREEN_BITS_ARB; + attribs[attrib_count++] = WGL_BLUE_BITS_ARB; + attribs[attrib_count++] = WGL_ALPHA_BITS_ARB; + attribs[attrib_count++] = WGL_COLOR_BITS_ARB; + attribs[attrib_count++] = WGL_DEPTH_BITS_ARB; + attribs[attrib_count++] = WGL_STENCIL_BITS_ARB; + attribs[attrib_count++] = WGL_DRAW_TO_WINDOW_ARB; + attribs[attrib_count++] = WGL_PIXEL_TYPE_ARB; + attribs[attrib_count++] = WGL_DOUBLE_BUFFER_ARB; + attribs[attrib_count++] = WGL_AUX_BUFFERS_ARB; + + for (i = 0, adapter->cfg_count = 0; i < cfg_count; ++i) + { + struct wined3d_pixel_format *cfg = &adapter->cfgs[adapter->cfg_count]; + int format_id = i + 1; + + if (!GL_EXTCALL(wglGetPixelFormatAttribivARB(dc, format_id, 0, attrib_count, attribs, values))) + continue; + + cfg->iPixelFormat = format_id; + cfg->redSize = values[0]; + cfg->greenSize = values[1]; + cfg->blueSize = values[2]; + cfg->alphaSize = values[3]; + cfg->colorSize = values[4]; + cfg->depthSize = values[5]; + cfg->stencilSize = values[6]; + cfg->windowDrawable = values[7]; + cfg->iPixelType = values[8]; + cfg->doubleBuffer = values[9]; + cfg->auxBuffers = values[10]; + + cfg->numSamples = 0; + /* Check multisample support. */ + if (gl_info->supported[ARB_MULTISAMPLE]) + { + int attribs[2] = {WGL_SAMPLE_BUFFERS_ARB, WGL_SAMPLES_ARB}; + int values[2]; + + if (GL_EXTCALL(wglGetPixelFormatAttribivARB(dc, format_id, 0, 2, attribs, values))) + { + /* values[0] = WGL_SAMPLE_BUFFERS_ARB which tells whether + * multisampling is supported. values[1] = number of + * multisample buffers. */ + if (values[0]) + cfg->numSamples = values[1]; + } + } + + TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, " + "depth=%d, stencil=%d, samples=%d, windowDrawable=%d\n", + cfg->iPixelFormat, cfg->iPixelType, cfg->doubleBuffer, + cfg->redSize, cfg->greenSize, cfg->blueSize, cfg->alphaSize, + cfg->depthSize, cfg->stencilSize, cfg->numSamples, cfg->windowDrawable); + + ++adapter->cfg_count; } } + else + { + int cfg_count; -/* Load WGL core functions from opengl32.dll */ -#define USE_WGL_FUNC(pfn) p##pfn = (void*)GetProcAddress(mod_gl, #pfn); - WGL_FUNCS_GEN; -#undef USE_WGL_FUNC + cfg_count = DescribePixelFormat(dc, 0, 0, 0); + adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cfg_count * sizeof(*adapter->cfgs)); + + for (i = 0, adapter->cfg_count = 0; i < cfg_count; ++i) + { + struct wined3d_pixel_format *cfg = &adapter->cfgs[adapter->cfg_count]; + PIXELFORMATDESCRIPTOR pfd; + int format_id = i + 1; + + if (!DescribePixelFormat(dc, format_id, sizeof(pfd), &pfd)) + continue; + + /* We only want HW acceleration using an OpenGL ICD driver. + * PFD_GENERIC_FORMAT = slow opengl 1.1 gdi software rendering. + * PFD_GENERIC_ACCELERATED = partial hw acceleration using a MCD + * driver (e.g. 3dfx minigl). */ + if (pfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) + { + TRACE("Skipping format %d because it isn't ICD accelerated.\n", format_id); + continue; + } + + cfg->iPixelFormat = format_id; + cfg->redSize = pfd.cRedBits; + cfg->greenSize = pfd.cGreenBits; + cfg->blueSize = pfd.cBlueBits; + cfg->alphaSize = pfd.cAlphaBits; + cfg->colorSize = pfd.cColorBits; + cfg->depthSize = pfd.cDepthBits; + cfg->stencilSize = pfd.cStencilBits; + cfg->windowDrawable = (pfd.dwFlags & PFD_DRAW_TO_WINDOW) ? 1 : 0; + cfg->iPixelType = (pfd.iPixelType == PFD_TYPE_RGBA) ? WGL_TYPE_RGBA_ARB : WGL_TYPE_COLORINDEX_ARB; + cfg->doubleBuffer = (pfd.dwFlags & PFD_DOUBLEBUFFER) ? 1 : 0; + cfg->auxBuffers = pfd.cAuxBuffers; + cfg->numSamples = 0; + + TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, " + "depth=%d, stencil=%d, windowDrawable=%d\n", + cfg->iPixelFormat, cfg->iPixelType, cfg->doubleBuffer, + cfg->redSize, cfg->greenSize, cfg->blueSize, cfg->alphaSize, + cfg->depthSize, cfg->stencilSize, cfg->windowDrawable); + + ++adapter->cfg_count; + } + } +} + +/* Do not call while under the GL lock. */ +static BOOL wined3d_adapter_init(struct wined3d_adapter *adapter, UINT ordinal) +{ + struct wined3d_gl_info *gl_info = &adapter->gl_info; + struct wined3d_fake_gl_ctx fake_gl_ctx = {0}; + DISPLAY_DEVICEW display_device; + + TRACE("adapter %p, ordinal %u.\n", adapter, ordinal); + + adapter->ordinal = ordinal; + adapter->monitorPoint.x = -1; + adapter->monitorPoint.y = -1; /* Dynamically load all GL core functions */ #ifdef USE_WIN32_OPENGL + { + HMODULE mod_gl = GetModuleHandleA("opengl32.dll"); #define USE_GL_FUNC(f) gl_info->gl_ops.gl.p_##f = (void *)GetProcAddress(mod_gl, #f); - ALL_WGL_FUNCS + ALL_WGL_FUNCS #undef USE_GL_FUNC + gl_info->gl_ops.wgl.p_wglSwapBuffers = (void *)GetProcAddress(mod_gl, "wglSwapBuffers"); + } #else /* To bypass the opengl32 thunks retrieve functions from the WGL driver instead of opengl32 */ { HDC hdc = GetDC( 0 ); const struct opengl_funcs *wgl_driver = __wine_get_wgl_driver( hdc, WINE_WGL_DRIVER_VERSION ); ReleaseDC( 0, hdc ); - if (!wgl_driver || wgl_driver == (void *)-1) goto nogl_adapter; + if (!wgl_driver || wgl_driver == (void *)-1) return FALSE; + gl_info->gl_ops.wgl = wgl_driver->wgl; gl_info->gl_ops.gl = wgl_driver->gl; } #endif @@ -5437,220 +5175,81 @@ static BOOL InitAdapters(struct wined3d *wined3d) glEnableWINE = gl_info->gl_ops.gl.p_glEnable; glDisableWINE = gl_info->gl_ops.gl.p_glDisable; - /* For now only one default adapter */ + if (!AllocateLocallyUniqueId(&adapter->luid)) { - struct wined3d_fake_gl_ctx fake_gl_ctx = {0}; - struct wined3d_pixel_format *cfgs; - int iPixelFormat; - int res; - DISPLAY_DEVICEW DisplayDevice; - HDC hdc; - - TRACE("Initializing default adapter\n"); - adapter->ordinal = 0; - adapter->monitorPoint.x = -1; - adapter->monitorPoint.y = -1; - - if (!AllocateLocallyUniqueId(&adapter->luid)) - { - DWORD err = GetLastError(); - ERR("Failed to set adapter LUID (%#x).\n", err); - goto nogl_adapter; - } - TRACE("Allocated LUID %08x:%08x for adapter.\n", - adapter->luid.HighPart, adapter->luid.LowPart); - - if (!WineD3D_CreateFakeGLContext(&fake_gl_ctx)) - { - ERR("Failed to get a gl context for default adapter\n"); - goto nogl_adapter; - } - - ret = wined3d_adapter_init_gl_caps(adapter); - if(!ret) { - ERR("Failed to initialize gl caps for default adapter\n"); - WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); - goto nogl_adapter; - } - ret = initPixelFormats(&adapter->gl_info, adapter->driver_info.vendor); - if(!ret) { - ERR("Failed to init gl formats\n"); - WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); - goto nogl_adapter; - } - - hdc = fake_gl_ctx.dc; - - adapter->TextureRam = adapter->driver_info.vidmem; - adapter->UsedTextureRam = 0; - TRACE("Emulating %dMB of texture ram\n", adapter->TextureRam/(1024*1024)); - - /* Initialize the Adapter's DeviceName which is required for ChangeDisplaySettings and friends */ - DisplayDevice.cb = sizeof(DisplayDevice); - EnumDisplayDevicesW(NULL, 0 /* Adapter 0 = iDevNum 0 */, &DisplayDevice, 0); - TRACE("DeviceName: %s\n", debugstr_w(DisplayDevice.DeviceName)); - strcpyW(adapter->DeviceName, DisplayDevice.DeviceName); - - if (gl_info->supported[WGL_ARB_PIXEL_FORMAT]) - { - GLint cfg_count; - int attribute; - int attribs[11]; - int values[11]; - int nAttribs = 0; - - attribute = WGL_NUMBER_PIXEL_FORMATS_ARB; - GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &cfg_count)); - adapter->cfg_count = cfg_count; - - adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->cfg_count * sizeof(*adapter->cfgs)); - cfgs = adapter->cfgs; - attribs[nAttribs++] = WGL_RED_BITS_ARB; - attribs[nAttribs++] = WGL_GREEN_BITS_ARB; - attribs[nAttribs++] = WGL_BLUE_BITS_ARB; - attribs[nAttribs++] = WGL_ALPHA_BITS_ARB; - attribs[nAttribs++] = WGL_COLOR_BITS_ARB; - attribs[nAttribs++] = WGL_DEPTH_BITS_ARB; - attribs[nAttribs++] = WGL_STENCIL_BITS_ARB; - attribs[nAttribs++] = WGL_DRAW_TO_WINDOW_ARB; - attribs[nAttribs++] = WGL_PIXEL_TYPE_ARB; - attribs[nAttribs++] = WGL_DOUBLE_BUFFER_ARB; - attribs[nAttribs++] = WGL_AUX_BUFFERS_ARB; - - for (iPixelFormat=1; iPixelFormat <= adapter->cfg_count; ++iPixelFormat) - { - res = GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0, nAttribs, attribs, values)); - - if(!res) - continue; - - /* Cache the pixel format */ - cfgs->iPixelFormat = iPixelFormat; - cfgs->redSize = values[0]; - cfgs->greenSize = values[1]; - cfgs->blueSize = values[2]; - cfgs->alphaSize = values[3]; - cfgs->colorSize = values[4]; - cfgs->depthSize = values[5]; - cfgs->stencilSize = values[6]; - cfgs->windowDrawable = values[7]; - cfgs->iPixelType = values[8]; - cfgs->doubleBuffer = values[9]; - cfgs->auxBuffers = values[10]; - - cfgs->numSamples = 0; - /* Check multisample support */ - if (gl_info->supported[ARB_MULTISAMPLE]) - { - int attrib[2] = {WGL_SAMPLE_BUFFERS_ARB, WGL_SAMPLES_ARB}; - int value[2]; - if(GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0, 2, attrib, value))) { - /* value[0] = WGL_SAMPLE_BUFFERS_ARB which tells whether multisampling is supported. - * value[1] = number of multi sample buffers*/ - if(value[0]) - cfgs->numSamples = value[1]; - } - } - - TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, " - "depth=%d, stencil=%d, samples=%d, windowDrawable=%d\n", - cfgs->iPixelFormat, cfgs->iPixelType, cfgs->doubleBuffer, - cfgs->redSize, cfgs->greenSize, cfgs->blueSize, cfgs->alphaSize, - cfgs->depthSize, cfgs->stencilSize, cfgs->numSamples, cfgs->windowDrawable); - cfgs++; - } - } - else - { - int nCfgs = DescribePixelFormat(hdc, 0, 0, 0); - adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs * sizeof(*adapter->cfgs)); - adapter->cfg_count = 0; /* We won't accept all formats e.g. software accelerated ones will be skipped */ - - cfgs = adapter->cfgs; - for(iPixelFormat=1; iPixelFormat<=nCfgs; iPixelFormat++) - { - PIXELFORMATDESCRIPTOR ppfd; - - res = DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &ppfd); - if(!res) - continue; - - /* We only want HW acceleration using an OpenGL ICD driver. - * PFD_GENERIC_FORMAT = slow opengl 1.1 gdi software rendering - * PFD_GENERIC_ACCELERATED = partial hw acceleration using a MCD driver (e.g. 3dfx minigl) - */ - if(ppfd.dwFlags & (PFD_GENERIC_FORMAT | PFD_GENERIC_ACCELERATED)) - { - TRACE("Skipping iPixelFormat=%d because it isn't ICD accelerated\n", iPixelFormat); - continue; - } - - cfgs->iPixelFormat = iPixelFormat; - cfgs->redSize = ppfd.cRedBits; - cfgs->greenSize = ppfd.cGreenBits; - cfgs->blueSize = ppfd.cBlueBits; - cfgs->alphaSize = ppfd.cAlphaBits; - cfgs->colorSize = ppfd.cColorBits; - cfgs->depthSize = ppfd.cDepthBits; - cfgs->stencilSize = ppfd.cStencilBits; - cfgs->windowDrawable = (ppfd.dwFlags & PFD_DRAW_TO_WINDOW) ? 1 : 0; - cfgs->iPixelType = (ppfd.iPixelType == PFD_TYPE_RGBA) ? WGL_TYPE_RGBA_ARB : WGL_TYPE_COLORINDEX_ARB; - cfgs->doubleBuffer = (ppfd.dwFlags & PFD_DOUBLEBUFFER) ? 1 : 0; - cfgs->auxBuffers = ppfd.cAuxBuffers; - cfgs->numSamples = 0; - - TRACE("iPixelFormat=%d, iPixelType=%#x, doubleBuffer=%d, RGBA=%d/%d/%d/%d, " - "depth=%d, stencil=%d, windowDrawable=%d\n", - cfgs->iPixelFormat, cfgs->iPixelType, cfgs->doubleBuffer, - cfgs->redSize, cfgs->greenSize, cfgs->blueSize, cfgs->alphaSize, - cfgs->depthSize, cfgs->stencilSize, cfgs->windowDrawable); - cfgs++; - adapter->cfg_count++; - } - - /* We haven't found any suitable formats. This should only happen - * in case of GDI software rendering, which is pretty useless - * anyway. */ - if (!adapter->cfg_count) - { - ERR("Disabling Direct3D because no hardware accelerated pixel formats have been found!\n"); - - WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); - HeapFree(GetProcessHeap(), 0, adapter->cfgs); - goto nogl_adapter; - } - } - - WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); - - select_shader_mode(&adapter->gl_info, &ps_selected_mode, &vs_selected_mode); - fillGLAttribFuncs(&adapter->gl_info); - adapter->opengl = TRUE; + ERR("Failed to set adapter LUID (%#x).\n", GetLastError()); + return FALSE; } - wined3d->adapter_count = 1; - TRACE("%u adapters successfully initialized.\n", wined3d->adapter_count); + TRACE("Allocated LUID %08x:%08x for adapter %p.\n", + adapter->luid.HighPart, adapter->luid.LowPart, adapter); + + if (!WineD3D_CreateFakeGLContext(&fake_gl_ctx)) + { + ERR("Failed to get a GL context for adapter %p.\n", adapter); + return FALSE; + } + + if (!wined3d_adapter_init_gl_caps(adapter)) + { + ERR("Failed to initialize GL caps for adapter %p.\n", adapter); + WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); + return FALSE; + } + + wined3d_adapter_init_fb_cfgs(adapter, fake_gl_ctx.dc); + /* We haven't found any suitable formats. This should only happen in + * case of GDI software rendering, which is pretty useless anyway. */ + if (!adapter->cfg_count) + { + WARN("No suitable pixel formats found.\n"); + WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); + HeapFree(GetProcessHeap(), 0, adapter->cfgs); + return FALSE; + } + + if (!wined3d_adapter_init_format_info(adapter)) + { + ERR("Failed to initialize GL format info.\n"); + WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); + HeapFree(GetProcessHeap(), 0, adapter->cfgs); + return FALSE; + } + + adapter->TextureRam = adapter->driver_info.vidmem; + adapter->UsedTextureRam = 0; + TRACE("Emulating %u MB of texture ram.\n", adapter->TextureRam / (1024 * 1024)); + + display_device.cb = sizeof(display_device); + EnumDisplayDevicesW(NULL, ordinal, &display_device, 0); + TRACE("DeviceName: %s\n", debugstr_w(display_device.DeviceName)); + strcpyW(adapter->DeviceName, display_device.DeviceName); + + WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); + + fillGLAttribFuncs(&adapter->gl_info); return TRUE; +} -nogl_adapter: - /* Initialize an adapter for ddraw-only memory counting */ - memset(wined3d->adapters, 0, sizeof(wined3d->adapters)); - wined3d->adapters[0].ordinal = 0; - wined3d->adapters[0].opengl = FALSE; - wined3d->adapters[0].monitorPoint.x = -1; - wined3d->adapters[0].monitorPoint.y = -1; +static void wined3d_adapter_init_nogl(struct wined3d_adapter *adapter, UINT ordinal) +{ + memset(adapter, 0, sizeof(*adapter)); + adapter->ordinal = ordinal; + adapter->monitorPoint.x = -1; + adapter->monitorPoint.y = -1; - wined3d->adapters[0].driver_info.name = "Display"; - wined3d->adapters[0].driver_info.description = "WineD3D DirectDraw Emulation"; + adapter->driver_info.name = "Display"; + adapter->driver_info.description = "WineD3D DirectDraw Emulation"; if (wined3d_settings.emulated_textureram) - wined3d->adapters[0].TextureRam = wined3d_settings.emulated_textureram; + adapter->TextureRam = wined3d_settings.emulated_textureram; else - wined3d->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */ + adapter->TextureRam = 128 * 1024 * 1024; - initPixelFormatsNoGL(&wined3d->adapters[0].gl_info); + initPixelFormatsNoGL(&adapter->gl_info); - wined3d->adapter_count = 1; - return FALSE; + adapter->fragment_pipe = &none_fragment_pipe; + adapter->shader_backend = &none_shader_backend; + adapter->blitter = &cpu_blit; } static void STDMETHODCALLTYPE wined3d_null_wined3d_object_destroyed(void *parent) {} @@ -5667,15 +5266,21 @@ HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags) wined3d->ref = 1; wined3d->flags = flags; - if (!InitAdapters(wined3d)) + TRACE("Initializing adapters.\n"); + + if (flags & WINED3D_NO3D) { - WARN("Failed to initialize adapters.\n"); - if (version > 7) - { - MESSAGE("Direct3D%u is not available without OpenGL.\n", version); - return E_FAIL; - } + wined3d_adapter_init_nogl(&wined3d->adapters[0], 0); + wined3d->adapter_count = 1; + return WINED3D_OK; } + if (!wined3d_adapter_init(&wined3d->adapters[0], 0)) + { + WARN("Failed to initialize adapter.\n"); + return E_FAIL; + } + wined3d->adapter_count = 1; + return WINED3D_OK; } diff --git a/reactos/dll/directx/wine/wined3d/drawprim.c b/reactos/dll/directx/wine/wined3d/drawprim.c index 69625ffef7c..5fe1ac5a84c 100644 --- a/reactos/dll/directx/wine/wined3d/drawprim.c +++ b/reactos/dll/directx/wine/wined3d/drawprim.c @@ -24,24 +24,39 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw); -//#include -//#include +#include +#include -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void drawStridedFast(const struct wined3d_gl_info *gl_info, GLenum primitive_type, UINT count, UINT idx_size, - const void *idx_data, UINT start_idx, INT base_vertex_index) + const void *idx_data, UINT start_idx, INT base_vertex_index, UINT start_instance, UINT instance_count) { if (idx_size) { GLenum idxtype = idx_size == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT; - if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) + if (instance_count) + { + if (!gl_info->supported[ARB_DRAW_INSTANCED]) + { + FIXME("Instanced drawing not supported.\n"); + } + else + { + if (start_instance) + FIXME("Start instance (%u) not supported.\n", start_instance); + GL_EXTCALL(glDrawElementsInstancedBaseVertex(primitive_type, count, idxtype, + (const char *)idx_data + (idx_size * start_idx), instance_count, base_vertex_index)); + checkGLcall("glDrawElementsInstancedBaseVertex"); + } + } + else if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) { GL_EXTCALL(glDrawElementsBaseVertex(primitive_type, count, idxtype, (const char *)idx_data + (idx_size * start_idx), base_vertex_index)); @@ -66,7 +81,7 @@ static void drawStridedFast(const struct wined3d_gl_info *gl_info, GLenum primit * Slower GL version which extracts info about each vertex in turn */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void drawStridedSlow(const struct wined3d_device *device, const struct wined3d_context *context, const struct wined3d_stream_info *si, UINT NumVertexes, GLenum glPrimType, const void *idxData, UINT idxSize, UINT startIdx) @@ -310,7 +325,7 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi checkGLcall("glEnd and previous calls"); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static inline void send_attribute(const struct wined3d_gl_info *gl_info, enum wined3d_format_id format, const UINT index, const void *ptr) { @@ -420,7 +435,7 @@ static inline void send_attribute(const struct wined3d_gl_info *gl_info, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void drawStridedSlowVs(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, const struct wined3d_stream_info *si, UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, UINT idxSize, UINT startIdx) @@ -476,15 +491,15 @@ static void drawStridedSlowVs(const struct wined3d_gl_info *gl_info, const struc gl_info->gl_ops.gl.p_glEnd(); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void drawStridedInstanced(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, const struct wined3d_stream_info *si, UINT numberOfVertices, GLenum glPrimitiveType, - const void *idxData, UINT idxSize, UINT startIdx, UINT base_vertex_index) + const void *idxData, UINT idxSize, UINT startIdx, UINT base_vertex_index, UINT instance_count) { - UINT numInstances = 0, i; int numInstancedAttribs = 0, j; UINT instancedData[sizeof(si->elements) / sizeof(*si->elements) /* 16 */]; GLenum idxtype = idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT; + UINT i; if (!idxSize) { @@ -498,22 +513,6 @@ static void drawStridedInstanced(const struct wined3d_gl_info *gl_info, const st return; } - /* First, figure out how many instances we have to draw */ - for (i = 0; i < MAX_STREAMS; ++i) - { - /* Look at the streams and take the first one which matches */ - if (state->streams[i].buffer - && ((state->streams[i].flags & WINED3DSTREAMSOURCE_INSTANCEDATA) - || (state->streams[i].flags & WINED3DSTREAMSOURCE_INDEXEDDATA))) - { - /* Use the specified number of instances from the first matched - * stream. A streamFreq of 0 (with INSTANCEDATA or INDEXEDDATA) - * is handled as 1. See d3d9/tests/visual.c-> stream_test(). */ - numInstances = state->streams[i].frequency ? state->streams[i].frequency : 1; - break; - } - } - for (i = 0; i < sizeof(si->elements) / sizeof(*si->elements); ++i) { if (!(si->use_map & (1 << i))) continue; @@ -525,8 +524,8 @@ static void drawStridedInstanced(const struct wined3d_gl_info *gl_info, const st } } - /* now draw numInstances instances :-) */ - for(i = 0; i < numInstances; i++) { + for (i = 0; i < instance_count; ++i) + { /* Specify the instanced attributes using immediate mode calls */ for(j = 0; j < numInstancedAttribs; j++) { const BYTE *ptr = si->elements[instancedData[j]].data.addr @@ -577,11 +576,17 @@ static void remove_vbos(const struct wined3d_gl_info *gl_info, } /* Routine common to the draw primitive and draw indexed primitive routines */ -void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartIdx, BOOL indexed, const void *idxData) +void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count, + UINT start_instance, UINT instance_count, BOOL indexed, const void *idx_data) { const struct wined3d_state *state = &device->stateBlock->state; + const struct wined3d_stream_info *stream_info; + struct wined3d_event_query *ib_query = NULL; + struct wined3d_stream_info si_emulated; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; + BOOL emulation = FALSE; + UINT idx_size = 0; unsigned int i; if (!index_count) return; @@ -665,106 +670,98 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId FIXME("Point sprite coordinate origin switching not supported.\n"); } - /* Ok, we will be updating the screen from here onwards so grab the lock */ - ENTER_GL(); + stream_info = &device->strided_streams; + if (device->instance_count) + instance_count = device->instance_count; + + if (indexed) { - GLenum glPrimType = state->gl_primitive_type; - INT base_vertex_index = state->base_vertex_index; - BOOL emulation = FALSE; - const struct wined3d_stream_info *stream_info = &device->strided_streams; - struct wined3d_stream_info stridedlcl; - UINT idx_size = 0; - - if (indexed) - { - if (!state->user_stream) - { - struct wined3d_buffer *index_buffer = state->index_buffer; - if (!index_buffer->buffer_object || !stream_info->all_vbo) - idxData = index_buffer->resource.allocatedMemory; - else - idxData = NULL; - } - - if (state->index_format == WINED3DFMT_R16_UINT) - idx_size = 2; - else - idx_size = 4; - } - - if (!use_vs(state)) - { - if (!stream_info->position_transformed && context->num_untracked_materials - && state->render_states[WINED3D_RS_LIGHTING]) - { - static BOOL warned; - if (!warned) { - FIXME("Using software emulation because not all material properties could be tracked\n"); - warned = TRUE; - } else { - TRACE("Using software emulation because not all material properties could be tracked\n"); - } - emulation = TRUE; - } - else if (context->fog_coord && state->render_states[WINED3D_RS_FOGENABLE]) - { - /* Either write a pipeline replacement shader or convert the specular alpha from unsigned byte - * to a float in the vertex buffer - */ - static BOOL warned; - if (!warned) { - FIXME("Using software emulation because manual fog coordinates are provided\n"); - warned = TRUE; - } else { - TRACE("Using software emulation because manual fog coordinates are provided\n"); - } - emulation = TRUE; - } - - if(emulation) { - stream_info = &stridedlcl; - memcpy(&stridedlcl, &device->strided_streams, sizeof(stridedlcl)); - remove_vbos(gl_info, state, &stridedlcl); - } - } - - if (device->useDrawStridedSlow || emulation) - { - /* Immediate mode drawing */ - if (use_vs(state)) - { - static BOOL warned; - if (!warned) { - FIXME("Using immediate mode with vertex shaders for half float emulation\n"); - warned = TRUE; - } else { - TRACE("Using immediate mode with vertex shaders for half float emulation\n"); - } - drawStridedSlowVs(gl_info, state, stream_info, - index_count, glPrimType, idxData, idx_size, StartIdx); - } - else - { - drawStridedSlow(device, context, stream_info, index_count, - glPrimType, idxData, idx_size, StartIdx); - } - } - else if (device->instancedDraw) - { - /* Instancing emulation with mixing immediate mode and arrays */ - drawStridedInstanced(gl_info, state, stream_info, - index_count, glPrimType, idxData, idx_size, StartIdx, base_vertex_index); - } + struct wined3d_buffer *index_buffer = state->index_buffer; + if (!index_buffer->buffer_object || !stream_info->all_vbo) + idx_data = index_buffer->resource.allocatedMemory; else { - drawStridedFast(gl_info, glPrimType, index_count, idx_size, idxData, StartIdx, base_vertex_index); + ib_query = index_buffer->query; + idx_data = NULL; + } + + if (state->index_format == WINED3DFMT_R16_UINT) + idx_size = 2; + else + idx_size = 4; + } + + if (!use_vs(state)) + { + if (!stream_info->position_transformed && context->num_untracked_materials + && state->render_states[WINED3D_RS_LIGHTING]) + { + static BOOL warned; + + if (!warned++) + FIXME("Using software emulation because not all material properties could be tracked.\n"); + else + WARN("Using software emulation because not all material properties could be tracked.\n"); + emulation = TRUE; + } + else if (context->fog_coord && state->render_states[WINED3D_RS_FOGENABLE]) + { + static BOOL warned; + + /* Either write a pipeline replacement shader or convert the + * specular alpha from unsigned byte to a float in the vertex + * buffer. */ + if (!warned++) + FIXME("Using software emulation because manual fog coordinates are provided.\n"); + else + WARN("Using software emulation because manual fog coordinates are provided.\n"); + emulation = TRUE; + } + + if (emulation) + { + si_emulated = device->strided_streams; + remove_vbos(gl_info, state, &si_emulated); + stream_info = &si_emulated; } } - /* Finished updating the screen, restore lock */ - LEAVE_GL(); + if (device->useDrawStridedSlow || emulation) + { + /* Immediate mode drawing. */ + if (use_vs(state)) + { + static BOOL warned; - for(i = 0; i < device->num_buffer_queries; ++i) + if (!warned++) + FIXME("Using immediate mode with vertex shaders for half float emulation.\n"); + else + WARN("Using immediate mode with vertex shaders for half float emulation.\n"); + + drawStridedSlowVs(gl_info, state, stream_info, index_count, + state->gl_primitive_type, idx_data, idx_size, start_idx); + } + else + { + drawStridedSlow(device, context, stream_info, index_count, + state->gl_primitive_type, idx_data, idx_size, start_idx); + } + } + else if (!gl_info->supported[ARB_INSTANCED_ARRAYS] && instance_count) + { + /* Instancing emulation by mixing immediate mode and arrays. */ + drawStridedInstanced(gl_info, state, stream_info, index_count, state->gl_primitive_type, + idx_data, idx_size, start_idx, state->base_vertex_index, instance_count); + } + else + { + drawStridedFast(gl_info, state->gl_primitive_type, index_count, idx_size, idx_data, + start_idx, state->base_vertex_index, start_instance, instance_count); + } + + if (ib_query) + wined3d_event_query_issue(ib_query, device); + for (i = 0; i < device->num_buffer_queries; ++i) { wined3d_event_query_issue(device->buffer_queries[i], device); } @@ -779,404 +776,3 @@ void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartId /* Control goes back to the device, stateblock values may change again */ device->isInDraw = FALSE; } - -static void normalize_normal(float *n) { - float length = n[0] * n[0] + n[1] * n[1] + n[2] * n[2]; - if (length == 0.0f) return; - length = sqrtf(length); - n[0] = n[0] / length; - n[1] = n[1] / length; - n[2] = n[2] / length; -} - -/* Tesselates a high order rectangular patch into single triangles using gl evaluators - * - * The problem is that OpenGL does not offer a direct way to return the tesselated primitives, - * and they can't be sent off for rendering directly either. Tesselating is slow, so we want - * to cache the patches in a vertex buffer. But more importantly, gl can't bind generated - * attributes to numbered shader attributes, so we have to store them and rebind them as needed - * in drawprim. - * - * To read back, the opengl feedback mode is used. This creates a problem because we want - * untransformed, unlit vertices, but feedback runs everything through transform and lighting. - * Thus disable lighting and set identity matrices to get unmodified colors and positions. - * To overcome clipping find the biggest x, y and z values of the vertices in the patch and scale - * them to [-1.0;+1.0] and set the viewport up to scale them back. - * - * Normals are more tricky: Draw white vertices with 3 directional lights, and calculate the - * resulting colors back to the normals. - * - * NOTE: This function activates a context for blitting, modifies matrices & viewport, but - * does not restore it because normally a draw follows immediately afterwards. The caller is - * responsible of taking care that either the gl states are restored, or the context activated - * for drawing to reset the lastWasBlit flag. - */ -HRESULT tesselate_rectpatch(struct wined3d_device *This, struct wined3d_rect_patch *patch) -{ - unsigned int i, j, num_quads, out_vertex_size, buffer_size, d3d_out_vertex_size; - const struct wined3d_rect_patch_info *info = &patch->rect_patch_info; - float max_x = 0.0f, max_y = 0.0f, max_z = 0.0f, neg_z = 0.0f; - struct wined3d_state *state = &This->stateBlock->state; - struct wined3d_stream_info stream_info; - struct wined3d_stream_info_element *e; - const struct wined3d_gl_info *gl_info; - struct wined3d_context *context; - struct wined3d_shader *vs; - const BYTE *data; - DWORD vtxStride; - GLenum feedback_type; - GLfloat *feedbuffer; - - /* Simply activate the context for blitting. This disables all the things we don't want and - * takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the - * patch (as opposed to normal draws) will most likely need different changes anyway. */ - context = context_acquire(This, NULL); - gl_info = context->gl_info; - context_apply_blit_state(context, This); - - /* First, locate the position data. This is provided in a vertex buffer in - * the stateblock. Beware of VBOs. */ - vs = state->vertex_shader; - state->vertex_shader = NULL; - device_stream_info_from_declaration(This, &stream_info); - state->vertex_shader = vs; - - e = &stream_info.elements[WINED3D_FFP_POSITION]; - if (e->data.buffer_object) - { - struct wined3d_buffer *vb = state->streams[e->stream_idx].buffer; - e->data.addr = (BYTE *)((ULONG_PTR)e->data.addr + (ULONG_PTR)buffer_get_sysmem(vb, context->gl_info)); - } - vtxStride = e->stride; - data = e->data.addr - + vtxStride * info->stride * info->start_vertex_offset_height - + vtxStride * info->start_vertex_offset_width; - - /* Not entirely sure about what happens with transformed vertices */ - if (stream_info.position_transformed) FIXME("Transformed position in rectpatch generation\n"); - - if(vtxStride % sizeof(GLfloat)) { - /* glMap2f reads vertex sizes in GLfloats, the d3d stride is in bytes. - * I don't see how the stride could not be a multiple of 4, but make sure - * to check it - */ - ERR("Vertex stride is not a multiple of sizeof(GLfloat)\n"); - } - if (info->basis != WINED3D_BASIS_BEZIER) - FIXME("Basis is %s, how to handle this?\n", debug_d3dbasis(info->basis)); - if (info->degree != WINED3D_DEGREE_CUBIC) - FIXME("Degree is %s, how to handle this?\n", debug_d3ddegree(info->degree)); - - /* First, get the boundary cube of the input data */ - for (j = 0; j < info->height; ++j) - { - for (i = 0; i < info->width; ++i) - { - const float *v = (const float *)(data + vtxStride * i + vtxStride * info->stride * j); - if(fabs(v[0]) > max_x) max_x = fabsf(v[0]); - if(fabs(v[1]) > max_y) max_y = fabsf(v[1]); - if(fabs(v[2]) > max_z) max_z = fabsf(v[2]); - if(v[2] < neg_z) neg_z = v[2]; - } - } - - /* This needs some improvements in the vertex decl code */ - FIXME("Cannot find data to generate. Only generating position and normals\n"); - patch->has_normals = TRUE; - patch->has_texcoords = FALSE; - - ENTER_GL(); - - gl_info->gl_ops.gl.p_glMatrixMode(GL_PROJECTION); - checkGLcall("glMatrixMode(GL_PROJECTION)"); - gl_info->gl_ops.gl.p_glLoadIdentity(); - checkGLcall("glLoadIdentity()"); - gl_info->gl_ops.gl.p_glScalef(1.0f / (max_x), 1.0f / (max_y), max_z == 0.0f ? 1.0f : 1.0f / (2.0f * max_z)); - gl_info->gl_ops.gl.p_glTranslatef(0.0f, 0.0f, 0.5f); - checkGLcall("glScalef"); - gl_info->gl_ops.gl.p_glViewport(-max_x, -max_y, 2 * (max_x), 2 * (max_y)); - checkGLcall("glViewport"); - - /* Some states to take care of. If we're in wireframe opengl will produce lines, and confuse - * our feedback buffer parser - */ - gl_info->gl_ops.gl.p_glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)"); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_FILLMODE)); - if (patch->has_normals) - { - static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f}; - static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 0.0f}; - static const GLfloat green[] = {0.0f, 1.0f, 0.0f, 0.0f}; - static const GLfloat blue[] = {0.0f, 0.0f, 1.0f, 0.0f}; - static const GLfloat white[] = {1.0f, 1.0f, 1.0f, 1.0f}; - gl_info->gl_ops.gl.p_glEnable(GL_LIGHTING); - checkGLcall("glEnable(GL_LIGHTING)"); - gl_info->gl_ops.gl.p_glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black); - checkGLcall("glLightModel for MODEL_AMBIENT"); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_AMBIENT)); - - for (i = 3; i < context->gl_info->limits.lights; ++i) - { - gl_info->gl_ops.gl.p_glDisable(GL_LIGHT0 + i); - checkGLcall("glDisable(GL_LIGHT0 + i)"); - context_invalidate_state(context, STATE_ACTIVELIGHT(i)); - } - - context_invalidate_state(context, STATE_ACTIVELIGHT(0)); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0, GL_DIFFUSE, red); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0, GL_SPECULAR, black); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0, GL_AMBIENT, black); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0, GL_POSITION, red); - gl_info->gl_ops.gl.p_glEnable(GL_LIGHT0); - checkGLcall("Setting up light 1"); - context_invalidate_state(context, STATE_ACTIVELIGHT(1)); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT1, GL_DIFFUSE, green); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT1, GL_SPECULAR, black); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT1, GL_AMBIENT, black); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT1, GL_POSITION, green); - gl_info->gl_ops.gl.p_glEnable(GL_LIGHT1); - checkGLcall("Setting up light 2"); - context_invalidate_state(context, STATE_ACTIVELIGHT(2)); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT2, GL_DIFFUSE, blue); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT2, GL_SPECULAR, black); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT2, GL_AMBIENT, black); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT2, GL_POSITION, blue); - gl_info->gl_ops.gl.p_glEnable(GL_LIGHT2); - checkGLcall("Setting up light 3"); - - context_invalidate_state(context, STATE_MATERIAL); - context_invalidate_state(context, STATE_RENDER(WINED3D_RS_COLORVERTEX)); - gl_info->gl_ops.gl.p_glDisable(GL_COLOR_MATERIAL); - gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, black); - gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, black); - gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, white); - checkGLcall("Setting up materials"); - } - - /* Enable the needed maps. - * GL_MAP2_VERTEX_3 is needed for positional data. - * GL_AUTO_NORMAL to generate normals from the position. Do not use GL_MAP2_NORMAL. - * GL_MAP2_TEXTURE_COORD_4 for texture coords - */ - num_quads = ceilf(patch->numSegs[0]) * ceilf(patch->numSegs[1]); - out_vertex_size = 3 /* position */; - d3d_out_vertex_size = 3; - gl_info->gl_ops.gl.p_glEnable(GL_MAP2_VERTEX_3); - if (patch->has_normals && patch->has_texcoords) - { - FIXME("Texcoords not handled yet\n"); - feedback_type = GL_3D_COLOR_TEXTURE; - out_vertex_size += 8; - d3d_out_vertex_size += 7; - gl_info->gl_ops.gl.p_glEnable(GL_AUTO_NORMAL); - gl_info->gl_ops.gl.p_glEnable(GL_MAP2_TEXTURE_COORD_4); - } - else if (patch->has_texcoords) - { - FIXME("Texcoords not handled yet\n"); - feedback_type = GL_3D_COLOR_TEXTURE; - out_vertex_size += 7; - d3d_out_vertex_size += 4; - gl_info->gl_ops.gl.p_glEnable(GL_MAP2_TEXTURE_COORD_4); - } - else if (patch->has_normals) - { - feedback_type = GL_3D_COLOR; - out_vertex_size += 4; - d3d_out_vertex_size += 3; - gl_info->gl_ops.gl.p_glEnable(GL_AUTO_NORMAL); - } - else - { - feedback_type = GL_3D; - } - checkGLcall("glEnable vertex attrib generation"); - - buffer_size = num_quads * out_vertex_size * 2 /* triangle list */ * 3 /* verts per tri */ - + 4 * num_quads /* 2 triangle markers per quad + num verts in tri */; - feedbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buffer_size * sizeof(float) * 8); - - gl_info->gl_ops.gl.p_glMap2f(GL_MAP2_VERTEX_3, - 0.0f, 1.0f, vtxStride / sizeof(float), info->width, - 0.0f, 1.0f, info->stride * vtxStride / sizeof(float), info->height, - (const GLfloat *)data); - checkGLcall("glMap2f"); - if (patch->has_texcoords) - { - gl_info->gl_ops.gl.p_glMap2f(GL_MAP2_TEXTURE_COORD_4, - 0.0f, 1.0f, vtxStride / sizeof(float), info->width, - 0.0f, 1.0f, info->stride * vtxStride / sizeof(float), info->height, - (const GLfloat *)data); - checkGLcall("glMap2f"); - } - gl_info->gl_ops.gl.p_glMapGrid2f(ceilf(patch->numSegs[0]), 0.0f, 1.0f, ceilf(patch->numSegs[1]), 0.0f, 1.0f); - checkGLcall("glMapGrid2f"); - - gl_info->gl_ops.gl.p_glFeedbackBuffer(buffer_size * 2, feedback_type, feedbuffer); - checkGLcall("glFeedbackBuffer"); - gl_info->gl_ops.gl.p_glRenderMode(GL_FEEDBACK); - - gl_info->gl_ops.gl.p_glEvalMesh2(GL_FILL, 0, ceilf(patch->numSegs[0]), 0, ceilf(patch->numSegs[1])); - checkGLcall("glEvalMesh2"); - - i = gl_info->gl_ops.gl.p_glRenderMode(GL_RENDER); - if (i == -1) - { - LEAVE_GL(); - ERR("Feedback failed. Expected %d elements back\n", buffer_size); - HeapFree(GetProcessHeap(), 0, feedbuffer); - context_release(context); - return WINED3DERR_DRIVERINTERNALERROR; - } else if(i != buffer_size) { - LEAVE_GL(); - ERR("Unexpected amount of elements returned. Expected %d, got %d\n", buffer_size, i); - HeapFree(GetProcessHeap(), 0, feedbuffer); - context_release(context); - return WINED3DERR_DRIVERINTERNALERROR; - } else { - TRACE("Got %d elements as expected\n", i); - } - - HeapFree(GetProcessHeap(), 0, patch->mem); - patch->mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, num_quads * 6 * d3d_out_vertex_size * sizeof(float) * 8); - i = 0; - for(j = 0; j < buffer_size; j += (3 /* num verts */ * out_vertex_size + 2 /* tri marker */)) { - if(feedbuffer[j] != GL_POLYGON_TOKEN) { - ERR("Unexpected token: %f\n", feedbuffer[j]); - continue; - } - if(feedbuffer[j + 1] != 3) { - ERR("Unexpected polygon: %f corners\n", feedbuffer[j + 1]); - continue; - } - /* Somehow there are different ideas about back / front facing, so fix up the - * vertex order - */ - patch->mem[i + 0] = feedbuffer[j + out_vertex_size * 2 + 2]; /* x, triangle 2 */ - patch->mem[i + 1] = feedbuffer[j + out_vertex_size * 2 + 3]; /* y, triangle 2 */ - patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 2 + 4] - 0.5f) * 4.0f * max_z; /* z, triangle 3 */ - if(patch->has_normals) { - patch->mem[i + 3] = feedbuffer[j + out_vertex_size * 2 + 5]; - patch->mem[i + 4] = feedbuffer[j + out_vertex_size * 2 + 6]; - patch->mem[i + 5] = feedbuffer[j + out_vertex_size * 2 + 7]; - } - i += d3d_out_vertex_size; - - patch->mem[i + 0] = feedbuffer[j + out_vertex_size * 1 + 2]; /* x, triangle 2 */ - patch->mem[i + 1] = feedbuffer[j + out_vertex_size * 1 + 3]; /* y, triangle 2 */ - patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 1 + 4] - 0.5f) * 4.0f * max_z; /* z, triangle 2 */ - if(patch->has_normals) { - patch->mem[i + 3] = feedbuffer[j + out_vertex_size * 1 + 5]; - patch->mem[i + 4] = feedbuffer[j + out_vertex_size * 1 + 6]; - patch->mem[i + 5] = feedbuffer[j + out_vertex_size * 1 + 7]; - } - i += d3d_out_vertex_size; - - patch->mem[i + 0] = feedbuffer[j + out_vertex_size * 0 + 2]; /* x, triangle 1 */ - patch->mem[i + 1] = feedbuffer[j + out_vertex_size * 0 + 3]; /* y, triangle 1 */ - patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 0 + 4] - 0.5f) * 4.0f * max_z; /* z, triangle 1 */ - if(patch->has_normals) { - patch->mem[i + 3] = feedbuffer[j + out_vertex_size * 0 + 5]; - patch->mem[i + 4] = feedbuffer[j + out_vertex_size * 0 + 6]; - patch->mem[i + 5] = feedbuffer[j + out_vertex_size * 0 + 7]; - } - i += d3d_out_vertex_size; - } - - if(patch->has_normals) { - /* Now do the same with reverse light directions */ - static const GLfloat x[] = {-1.0f, 0.0f, 0.0f, 0.0f}; - static const GLfloat y[] = { 0.0f, -1.0f, 0.0f, 0.0f}; - static const GLfloat z[] = { 0.0f, 0.0f, -1.0f, 0.0f}; - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT0, GL_POSITION, x); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT1, GL_POSITION, y); - gl_info->gl_ops.gl.p_glLightfv(GL_LIGHT2, GL_POSITION, z); - checkGLcall("Setting up reverse light directions"); - - gl_info->gl_ops.gl.p_glRenderMode(GL_FEEDBACK); - checkGLcall("glRenderMode(GL_FEEDBACK)"); - gl_info->gl_ops.gl.p_glEvalMesh2(GL_FILL, 0, ceilf(patch->numSegs[0]), 0, ceilf(patch->numSegs[1])); - checkGLcall("glEvalMesh2"); - i = gl_info->gl_ops.gl.p_glRenderMode(GL_RENDER); - checkGLcall("glRenderMode(GL_RENDER)"); - - i = 0; - for(j = 0; j < buffer_size; j += (3 /* num verts */ * out_vertex_size + 2 /* tri marker */)) { - if(feedbuffer[j] != GL_POLYGON_TOKEN) { - ERR("Unexpected token: %f\n", feedbuffer[j]); - continue; - } - if(feedbuffer[j + 1] != 3) { - ERR("Unexpected polygon: %f corners\n", feedbuffer[j + 1]); - continue; - } - if(patch->mem[i + 3] == 0.0f) - patch->mem[i + 3] = -feedbuffer[j + out_vertex_size * 2 + 5]; - if(patch->mem[i + 4] == 0.0f) - patch->mem[i + 4] = -feedbuffer[j + out_vertex_size * 2 + 6]; - if(patch->mem[i + 5] == 0.0f) - patch->mem[i + 5] = -feedbuffer[j + out_vertex_size * 2 + 7]; - normalize_normal(patch->mem + i + 3); - i += d3d_out_vertex_size; - - if(patch->mem[i + 3] == 0.0f) - patch->mem[i + 3] = -feedbuffer[j + out_vertex_size * 1 + 5]; - if(patch->mem[i + 4] == 0.0f) - patch->mem[i + 4] = -feedbuffer[j + out_vertex_size * 1 + 6]; - if(patch->mem[i + 5] == 0.0f) - patch->mem[i + 5] = -feedbuffer[j + out_vertex_size * 1 + 7]; - normalize_normal(patch->mem + i + 3); - i += d3d_out_vertex_size; - - if(patch->mem[i + 3] == 0.0f) - patch->mem[i + 3] = -feedbuffer[j + out_vertex_size * 0 + 5]; - if(patch->mem[i + 4] == 0.0f) - patch->mem[i + 4] = -feedbuffer[j + out_vertex_size * 0 + 6]; - if(patch->mem[i + 5] == 0.0f) - patch->mem[i + 5] = -feedbuffer[j + out_vertex_size * 0 + 7]; - normalize_normal(patch->mem + i + 3); - i += d3d_out_vertex_size; - } - } - - gl_info->gl_ops.gl.p_glDisable(GL_MAP2_VERTEX_3); - gl_info->gl_ops.gl.p_glDisable(GL_AUTO_NORMAL); - gl_info->gl_ops.gl.p_glDisable(GL_MAP2_NORMAL); - gl_info->gl_ops.gl.p_glDisable(GL_MAP2_TEXTURE_COORD_4); - checkGLcall("glDisable vertex attrib generation"); - LEAVE_GL(); - - context_release(context); - - HeapFree(GetProcessHeap(), 0, feedbuffer); - - vtxStride = 3 * sizeof(float); - if(patch->has_normals) { - vtxStride += 3 * sizeof(float); - } - if(patch->has_texcoords) { - vtxStride += 4 * sizeof(float); - } - memset(&patch->strided, 0, sizeof(patch->strided)); - patch->strided.position.format = WINED3DFMT_R32G32B32_FLOAT; - patch->strided.position.data = (BYTE *)patch->mem; - patch->strided.position.stride = vtxStride; - - if (patch->has_normals) - { - patch->strided.normal.format = WINED3DFMT_R32G32B32_FLOAT; - patch->strided.normal.data = (BYTE *)patch->mem + 3 * sizeof(float) /* pos */; - patch->strided.normal.stride = vtxStride; - } - if (patch->has_texcoords) - { - patch->strided.tex_coords[0].format = WINED3DFMT_R32G32B32A32_FLOAT; - patch->strided.tex_coords[0].data = (BYTE *)patch->mem + 3 * sizeof(float) /* pos */; - if (patch->has_normals) - patch->strided.tex_coords[0].data += 3 * sizeof(float); - patch->strided.tex_coords[0].stride = vtxStride; - } - - return WINED3D_OK; -} diff --git a/reactos/dll/directx/wine/wined3d/gl_compat.c b/reactos/dll/directx/wine/wined3d/gl_compat.c index fb4e2b8785f..cd22097b6e6 100644 --- a/reactos/dll/directx/wine/wined3d/gl_compat.c +++ b/reactos/dll/directx/wine/wined3d/gl_compat.c @@ -18,10 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #ifdef HAVE_FLOAT_H # include #endif diff --git a/reactos/dll/directx/wine/wined3d/glsl_shader.c b/reactos/dll/directx/wine/wined3d/glsl_shader.c index ea0c0ee8d66..7d98487d4be 100644 --- a/reactos/dll/directx/wine/wined3d/glsl_shader.c +++ b/reactos/dll/directx/wine/wined3d/glsl_shader.c @@ -29,10 +29,10 @@ * mask for the destination parameter into account. */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #include #include "wined3d_private.h" @@ -96,39 +96,60 @@ struct shader_glsl_priv { GLhandleARB depth_blt_program_full[tex_type_count]; GLhandleARB depth_blt_program_masked[tex_type_count]; UINT next_constant_version; + + const struct fragment_pipeline *fragment_pipe; + struct wine_rb_tree ffp_fragment_shaders; + BOOL ffp_proj_control; +}; + +struct glsl_vs_program +{ + struct list shader_entry; + GLhandleARB id; + GLenum vertex_color_clamp; + GLint *uniform_f_locations; + GLint uniform_i_locations[MAX_CONST_I]; + GLint pos_fixup_location; +}; + +struct glsl_gs_program +{ + struct list shader_entry; + GLhandleARB id; +}; + +struct glsl_ps_program +{ + struct list shader_entry; + GLhandleARB id; + GLint *uniform_f_locations; + GLint uniform_i_locations[MAX_CONST_I]; + GLint bumpenv_mat_location[MAX_TEXTURES]; + GLint bumpenv_lum_scale_location[MAX_TEXTURES]; + GLint bumpenv_lum_offset_location[MAX_TEXTURES]; + GLint tex_factor_location; + GLint specular_enable_location; + GLint ycorrection_location; + GLint np2_fixup_location; + const struct ps_np2fixup_info *np2_fixup_info; }; /* Struct to maintain data about a linked GLSL program */ -struct glsl_shader_prog_link { - struct wine_rb_entry program_lookup_entry; - struct list vshader_entry; - struct list pshader_entry; - GLhandleARB programId; - GLint *vuniformF_locations; - GLint *puniformF_locations; - GLint vuniformI_locations[MAX_CONST_I]; - GLint puniformI_locations[MAX_CONST_I]; - GLint posFixup_location; - GLint np2Fixup_location; - GLint bumpenvmat_location[MAX_TEXTURES]; - GLint luminancescale_location[MAX_TEXTURES]; - GLint luminanceoffset_location[MAX_TEXTURES]; - GLint ycorrection_location; - GLenum vertex_color_clamp; - const struct wined3d_shader *vshader; - const struct wined3d_shader *pshader; - struct vs_compile_args vs_args; - struct ps_compile_args ps_args; - UINT constant_version; - const struct ps_np2fixup_info *np2Fixup_info; +struct glsl_shader_prog_link +{ + struct wine_rb_entry program_lookup_entry; + struct glsl_vs_program vs; + struct glsl_gs_program gs; + struct glsl_ps_program ps; + GLhandleARB programId; + UINT constant_version; }; struct glsl_program_key { - const struct wined3d_shader *vshader; - const struct wined3d_shader *pshader; - struct ps_compile_args ps_args; - struct vs_compile_args vs_args; + GLhandleARB vs_id; + GLhandleARB gs_id; + GLhandleARB ps_id; }; struct shader_glsl_ctx_priv { @@ -144,22 +165,33 @@ struct glsl_ps_compiled_shader GLhandleARB prgId; }; -struct glsl_pshader_private -{ - struct glsl_ps_compiled_shader *gl_shaders; - UINT num_gl_shaders, shader_array_size; -}; - struct glsl_vs_compiled_shader { struct vs_compile_args args; GLhandleARB prgId; }; -struct glsl_vshader_private +struct glsl_gs_compiled_shader { - struct glsl_vs_compiled_shader *gl_shaders; - UINT num_gl_shaders, shader_array_size; + GLhandleARB id; +}; + +struct glsl_shader_private +{ + union + { + struct glsl_vs_compiled_shader *vs; + struct glsl_gs_compiled_shader *gs; + struct glsl_ps_compiled_shader *ps; + } gl_shaders; + UINT num_gl_shaders, shader_array_size; +}; + +struct glsl_ffp_fragment_shader +{ + struct ffp_frag_desc entry; + GLhandleARB id; + struct list linked_programs; }; static const char *debug_gl_shader_type(GLenum type) @@ -176,6 +208,25 @@ static const char *debug_gl_shader_type(GLenum type) } } +static const char *shader_glsl_get_prefix(enum wined3d_shader_type type) +{ + switch (type) + { + case WINED3D_SHADER_TYPE_VERTEX: + return "vs"; + + case WINED3D_SHADER_TYPE_GEOMETRY: + return "gs"; + + case WINED3D_SHADER_TYPE_PIXEL: + return "ps"; + + default: + FIXME("Unhandled shader type %#x.\n", type); + return "unknown"; + } +} + /* Extract a line from the info log. * Note that this modifies the source string. */ static char *get_info_log_line(char **ptr) @@ -195,8 +246,7 @@ static char *get_info_log_line(char **ptr) return p; } -/** Prints the GLSL info log which will contain error messages if they exist */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLhandleARB obj) { int infologLength = 0; @@ -238,7 +288,7 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLhandleA } } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ static void shader_glsl_compile(const struct wined3d_gl_info *gl_info, GLhandleARB shader, const char *src) { TRACE("Compiling shader object %u.\n", shader); @@ -249,7 +299,7 @@ static void shader_glsl_compile(const struct wined3d_gl_info *gl_info, GLhandleA print_glsl_info_log(gl_info, shader); } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_info, GLhandleARB program) { GLint i, object_count, source_size = -1; @@ -303,7 +353,7 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf HeapFree(GetProcessHeap(), 0, objects); } -/* GL locking is done by the caller. */ +/* Context activation is done by the caller. */ static void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLhandleARB program) { GLint tmp; @@ -324,19 +374,17 @@ static void shader_glsl_validate_link(const struct wined3d_gl_info *gl_info, GLh print_glsl_info_log(gl_info, program); } -/** - * Loads (pixel shader) samplers - */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_load_psamplers(const struct wined3d_gl_info *gl_info, const DWORD *tex_unit_map, GLhandleARB programId) { GLint name_loc; - int i; char sampler_name[20]; + unsigned int i; - for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) { - snprintf(sampler_name, sizeof(sampler_name), "Psampler%d", i); + for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) + { + snprintf(sampler_name, sizeof(sampler_name), "ps_sampler%u", i); name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name)); if (name_loc != -1) { DWORD mapped_unit = tex_unit_map[i]; @@ -352,16 +400,17 @@ static void shader_glsl_load_psamplers(const struct wined3d_gl_info *gl_info, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_load_vsamplers(const struct wined3d_gl_info *gl_info, const DWORD *tex_unit_map, GLhandleARB programId) { GLint name_loc; char sampler_name[20]; - int i; + unsigned int i; - for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i) { - snprintf(sampler_name, sizeof(sampler_name), "Vsampler%d", i); + for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i) + { + snprintf(sampler_name, sizeof(sampler_name), "vs_sampler%u", i); name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name)); if (name_loc != -1) { DWORD mapped_unit = tex_unit_map[MAX_FRAGMENT_SAMPLERS + i]; @@ -377,7 +426,7 @@ static void shader_glsl_load_vsamplers(const struct wined3d_gl_info *gl_info, } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, const float *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { @@ -437,7 +486,7 @@ static inline void walk_constant_heap(const struct wined3d_gl_info *gl_info, con checkGLcall("walk_constant_heap()"); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info, GLint location, const GLfloat *data) { GLfloat clamped_constant[4]; @@ -452,7 +501,7 @@ static inline void apply_clamped_constant(const struct wined3d_gl_info *gl_info, GL_EXTCALL(glUniform4fvARB(location, 1, clamped_constant)); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_info, const float *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) { @@ -510,8 +559,7 @@ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_i checkGLcall("walk_constant_heap_clamped()"); } -/* Loads floating point constants (aka uniforms) into the currently set GLSL program. */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const float *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, UINT version) @@ -520,7 +568,7 @@ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, con /* 1.X pshaders have the constants clamped to [-1;1] implicitly. */ if (shader->reg_maps.shader_version.major == 1 - && shader_is_pshader_version(shader->reg_maps.shader_version.type)) + && shader->reg_maps.shader_version.type == WINED3D_SHADER_TYPE_PIXEL) walk_constant_heap_clamped(gl_info, constants, constant_locations, heap, stack, version); else walk_constant_heap(gl_info, constants, constant_locations, heap, stack, version); @@ -541,8 +589,7 @@ static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, con checkGLcall("glUniform4fvARB()"); } -/* Loads integer constants (aka uniforms) into the currently set GLSL program. */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const GLint locations[MAX_CONST_I], const int *constants, WORD constants_set) { @@ -579,37 +626,17 @@ static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, con } } -/* Loads boolean constants (aka uniforms) into the currently set GLSL program. */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, GLhandleARB programId, const BOOL *constants, WORD constants_set) { GLint tmp_loc; unsigned int i; - char tmp_name[8]; + char tmp_name[10]; const char *prefix; struct list* ptr; - switch (shader->reg_maps.shader_version.type) - { - case WINED3D_SHADER_TYPE_VERTEX: - prefix = "VB"; - break; - - case WINED3D_SHADER_TYPE_GEOMETRY: - prefix = "GB"; - break; - - case WINED3D_SHADER_TYPE_PIXEL: - prefix = "PB"; - break; - - default: - FIXME("Unknown shader type %#x.\n", - shader->reg_maps.shader_version.type); - prefix = "UB"; - break; - } + prefix = shader_glsl_get_prefix(shader->reg_maps.shader_version.type); /* TODO: Benchmark and see if it would be beneficial to store the * locations of the constants to avoid looking up each time */ @@ -621,7 +648,7 @@ static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, con /* TODO: Benchmark and see if it would be beneficial to store the * locations of the constants to avoid looking up each time */ - snprintf(tmp_name, sizeof(tmp_name), "%s[%i]", prefix, i); + snprintf(tmp_name, sizeof(tmp_name), "%s_b[%i]", prefix, i); tmp_loc = GL_EXTCALL(glGetUniformLocationARB(programId, tmp_name)); if (tmp_loc != -1) { @@ -641,7 +668,7 @@ static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, con TRACE_(d3d_constants)("Loading local constants %i: %i\n", idx, values[0]); - snprintf(tmp_name, sizeof(tmp_name), "%s[%i]", prefix, idx); + snprintf(tmp_name, sizeof(tmp_name), "%s_b[%i]", prefix, idx); tmp_loc = GL_EXTCALL(glGetUniformLocationARB(programId, tmp_name)); if (tmp_loc != -1) { /* We found this uniform name in the program - go ahead and send the data */ @@ -657,10 +684,7 @@ static void reset_program_constant_version(struct wine_rb_entry *entry, void *co WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry)->constant_version = 0; } -/** - * Loads the texture dimensions for NP2 fixup into the currently set GLSL program. - */ -/* GL locking is done by the caller (state handler) */ +/* Context activation is done by the caller (state handler). */ static void shader_glsl_load_np2fixup_constants(void *shader_priv, const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) { @@ -673,16 +697,16 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv, /* NP2 texcoord fixup is (currently) only done for pixelshaders. */ if (!use_ps(state)) return; - if (prog->ps_args.np2_fixup && prog->np2Fixup_location != -1) + if (prog->ps.np2_fixup_info && prog->ps.np2_fixup_location != -1) { UINT i; - UINT fixup = prog->ps_args.np2_fixup; + UINT fixup = prog->ps.np2_fixup_info->active; GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS]; for (i = 0; fixup; fixup >>= 1, ++i) { const struct wined3d_texture *tex = state->textures[i]; - const unsigned char idx = prog->np2Fixup_info->idx[i]; + const unsigned char idx = prog->ps.np2_fixup_info->idx[i]; GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4]; if (!tex) @@ -703,16 +727,14 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv, } } - GL_EXTCALL(glUniform4fvARB(prog->np2Fixup_location, prog->np2Fixup_info->num_consts, np2fixup_constants)); + GL_EXTCALL(glUniform4fvARB(prog->ps.np2_fixup_location, + prog->ps.np2_fixup_info->num_consts, np2fixup_constants)); } } -/** - * Loads the app-supplied constants into the currently set GLSL program. - */ -/* GL locking is done by the caller (state handler) */ +/* Context activation is done by the caller (state handler). */ static void shader_glsl_load_constants(const struct wined3d_context *context, - char usePixelShader, char useVertexShader) + BOOL usePixelShader, BOOL useVertexShader) { const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_device *device = context->swapchain->device; @@ -739,10 +761,10 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, /* Load DirectX 9 float constants/uniforms for vertex shader */ shader_glsl_load_constantsF(vshader, gl_info, state->vs_consts_f, - prog->vuniformF_locations, &priv->vconst_heap, priv->stack, constant_version); + prog->vs.uniform_f_locations, &priv->vconst_heap, priv->stack, constant_version); /* Load DirectX 9 integer constants/uniforms for vertex shader */ - shader_glsl_load_constantsI(vshader, gl_info, prog->vuniformI_locations, state->vs_consts_i, + shader_glsl_load_constantsI(vshader, gl_info, prog->vs.uniform_i_locations, state->vs_consts_i, stateBlock->changed.vertexShaderConstantsI & vshader->reg_maps.integer_constants); /* Load DirectX 9 boolean constants/uniforms for vertex shader */ @@ -751,7 +773,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, /* Upload the position fixup params */ shader_get_position_fixup(context, state, position_fixup); - GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, position_fixup)); + GL_EXTCALL(glUniform4fvARB(prog->vs.pos_fixup_location, 1, position_fixup)); checkGLcall("glUniform4fvARB"); } @@ -761,44 +783,46 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, /* Load DirectX 9 float constants/uniforms for pixel shader */ shader_glsl_load_constantsF(pshader, gl_info, state->ps_consts_f, - prog->puniformF_locations, &priv->pconst_heap, priv->stack, constant_version); + prog->ps.uniform_f_locations, &priv->pconst_heap, priv->stack, constant_version); /* Load DirectX 9 integer constants/uniforms for pixel shader */ - shader_glsl_load_constantsI(pshader, gl_info, prog->puniformI_locations, state->ps_consts_i, + shader_glsl_load_constantsI(pshader, gl_info, prog->ps.uniform_i_locations, state->ps_consts_i, stateBlock->changed.pixelShaderConstantsI & pshader->reg_maps.integer_constants); /* Load DirectX 9 boolean constants/uniforms for pixel shader */ shader_glsl_load_constantsB(pshader, gl_info, programId, state->ps_consts_b, stateBlock->changed.pixelShaderConstantsB & pshader->reg_maps.boolean_constants); - /* Upload the environment bump map matrix if needed. The needsbumpmat member specifies the texture stage to load the matrix from. - * It can't be 0 for a valid texbem instruction. - */ - for(i = 0; i < MAX_TEXTURES; i++) { + /* Upload the environment bump map matrix if needed. The needsbumpmat + * member specifies the texture stage to load the matrix from. It + * can't be 0 for a valid texbem instruction. */ + for (i = 0; i < MAX_TEXTURES; ++i) + { const float *data; - if(prog->bumpenvmat_location[i] == -1) continue; + if (prog->ps.bumpenv_mat_location[i] == -1) + continue; data = (const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00]; - GL_EXTCALL(glUniformMatrix2fvARB(prog->bumpenvmat_location[i], 1, 0, data)); + GL_EXTCALL(glUniformMatrix2fvARB(prog->ps.bumpenv_mat_location[i], 1, 0, data)); checkGLcall("glUniformMatrix2fvARB"); /* texbeml needs the luminance scale and offset too. If texbeml * is used, needsbumpmat is set too, so we can check that in the * needsbumpmat check. */ - if (prog->luminancescale_location[i] != -1) + if (prog->ps.bumpenv_lum_scale_location[i] != -1) { const GLfloat *scale = (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE]; const GLfloat *offset = (const GLfloat *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET]; - GL_EXTCALL(glUniform1fvARB(prog->luminancescale_location[i], 1, scale)); + GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_scale_location[i], 1, scale)); checkGLcall("glUniform1fvARB"); - GL_EXTCALL(glUniform1fvARB(prog->luminanceoffset_location[i], 1, offset)); + GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_offset_location[i], 1, offset)); checkGLcall("glUniform1fvARB"); } } - if (prog->ycorrection_location != -1) + if (prog->ps.ycorrection_location != -1) { float correction_params[4]; @@ -811,9 +835,33 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, correction_params[0] = (float) context->current_rt->resource.height; correction_params[1] = -1.0f; } - GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params)); + GL_EXTCALL(glUniform4fvARB(prog->ps.ycorrection_location, 1, correction_params)); } } + else if (priv->fragment_pipe == &glsl_fragment_pipe) + { + float col[4]; + + for (i = 0; i < MAX_TEXTURES; ++i) + { + GL_EXTCALL(glUniformMatrix2fvARB(prog->ps.bumpenv_mat_location[i], 1, 0, + (const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00])); + GL_EXTCALL(glUniform1fARB(prog->ps.bumpenv_lum_scale_location[i], + *(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE])); + GL_EXTCALL(glUniform1fARB(prog->ps.bumpenv_lum_offset_location[i], + *(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET])); + } + + D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col); + GL_EXTCALL(glUniform4fARB(prog->ps.tex_factor_location, col[0], col[1], col[2], col[3])); + + if (state->render_states[WINED3D_RS_SPECULARENABLE]) + GL_EXTCALL(glUniform4fARB(prog->ps.specular_enable_location, 1.0f, 1.0f, 1.0f, 0.0f)); + else + GL_EXTCALL(glUniform4fARB(prog->ps.specular_enable_location, 0.0f, 0.0f, 0.0f, 0.0f)); + + checkGLcall("fixed function uniforms"); + } if (priv->next_constant_version == UINT_MAX) { @@ -896,17 +944,17 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader, const struct wined3d_shader_reg_maps *reg_maps, const struct shader_glsl_ctx_priv *ctx_priv) { + const struct wined3d_shader_version *version = ®_maps->shader_version; const struct wined3d_state *state = &shader->device->stateBlock->state; const struct ps_compile_args *ps_args = ctx_priv->cur_ps_args; const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_fb_state *fb = &shader->device->fb; unsigned int i, extra_constants_needed = 0; const struct wined3d_shader_lconst *lconst; + const char *prefix; DWORD map; - /* There are some minor differences between pixel and vertex shaders */ - char pshader = shader_is_pshader_version(reg_maps->shader_version.type); - char prefix = pshader ? 'P' : 'V'; + prefix = shader_glsl_get_prefix(version->type); /* Prototype the subroutines */ for (i = 0, map = reg_maps->labels; map; map >>= 1, ++i) @@ -918,20 +966,25 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont if (shader->limits.constant_float > 0) { unsigned max_constantsF; - /* Unless the shader uses indirect addressing, always declare the maximum array size and ignore that we need some - * uniforms privately. E.g. if GL supports 256 uniforms, and we need 2 for the pos fixup and immediate values, still - * declare VC[256]. If the shader needs more uniforms than we have it won't work in any case. If it uses less, the - * compiler will figure out which uniforms are really used and strip them out. This allows a shader to use c255 on - * a dx9 card, as long as it doesn't also use all the other constants. + + /* Unless the shader uses indirect addressing, always declare the + * maximum array size and ignore that we need some uniforms privately. + * E.g. if GL supports 256 uniforms, and we need 2 for the pos fixup + * and immediate values, still declare VC[256]. If the shader needs + * more uniforms than we have it won't work in any case. If it uses + * less, the compiler will figure out which uniforms are really used + * and strip them out. This allows a shader to use c255 on a dx9 card, + * as long as it doesn't also use all the other constants. * - * If the shader uses indirect addressing the compiler must assume that all declared uniforms are used. In this case, - * declare only the amount that we're assured to have. + * If the shader uses indirect addressing the compiler must assume + * that all declared uniforms are used. In this case, declare only the + * amount that we're assured to have. * * Thus we run into problems in these two cases: - * 1) The shader really uses more uniforms than supported - * 2) The shader uses indirect addressing, less constants than supported, but uses a constant index > #supported consts - */ - if (pshader) + * 1) The shader really uses more uniforms than supported. + * 2) The shader uses indirect addressing, less constants than + * supported, but uses a constant index > #supported consts. */ + if (version->type == WINED3D_SHADER_TYPE_PIXEL) { /* No indirect addressing here. */ max_constantsF = gl_info->limits.glsl_ps_float_constants; @@ -981,35 +1034,166 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } } max_constantsF = min(shader->limits.constant_float, max_constantsF); - shader_addline(buffer, "uniform vec4 %cC[%u];\n", prefix, max_constantsF); + shader_addline(buffer, "uniform vec4 %s_c[%u];\n", prefix, max_constantsF); } /* Always declare the full set of constants, the compiler can remove the * unused ones because d3d doesn't (yet) support indirect int and bool * constant addressing. This avoids problems if the app uses e.g. i0 and i9. */ if (shader->limits.constant_int > 0 && reg_maps->integer_constants) - shader_addline(buffer, "uniform ivec4 %cI[%u];\n", prefix, shader->limits.constant_int); + shader_addline(buffer, "uniform ivec4 %s_i[%u];\n", prefix, shader->limits.constant_int); if (shader->limits.constant_bool > 0 && reg_maps->boolean_constants) - shader_addline(buffer, "uniform bool %cB[%u];\n", prefix, shader->limits.constant_bool); + shader_addline(buffer, "uniform bool %s_b[%u];\n", prefix, shader->limits.constant_bool); - if (!pshader) + for (i = 0; i < WINED3D_MAX_CBS; ++i) { - shader_addline(buffer, "uniform vec4 posFixup;\n"); - shader_addline(buffer, "void order_ps_input(in vec4[%u]);\n", MAX_REG_OUTPUT); + if (reg_maps->cb_sizes[i]) + shader_addline(buffer, "uniform vec4 %s_cb%u[%u];\n", prefix, i, reg_maps->cb_sizes[i]); } - else + + /* Declare texture samplers */ + for (i = 0; i < shader->limits.sampler; ++i) { + if (reg_maps->sampler_type[i]) + { + BOOL shadow_sampler = version->type == WINED3D_SHADER_TYPE_PIXEL && (ps_args->shadow & (1 << i)); + const struct wined3d_texture *texture; + + switch (reg_maps->sampler_type[i]) + { + case WINED3DSTT_1D: + if (shadow_sampler) + shader_addline(buffer, "uniform sampler1DShadow %s_sampler%u;\n", prefix, i); + else + shader_addline(buffer, "uniform sampler1D %s_sampler%u;\n", prefix, i); + break; + case WINED3DSTT_2D: + texture = state->textures[i]; + if (shadow_sampler) + { + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) + shader_addline(buffer, "uniform sampler2DRectShadow %s_sampler%u;\n", prefix, i); + else + shader_addline(buffer, "uniform sampler2DShadow %s_sampler%u;\n", prefix, i); + } + else + { + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) + shader_addline(buffer, "uniform sampler2DRect %s_sampler%u;\n", prefix, i); + else + shader_addline(buffer, "uniform sampler2D %s_sampler%u;\n", prefix, i); + } + break; + case WINED3DSTT_CUBE: + if (shadow_sampler) + FIXME("Unsupported Cube shadow sampler.\n"); + shader_addline(buffer, "uniform samplerCube %s_sampler%u;\n", prefix, i); + break; + case WINED3DSTT_VOLUME: + if (shadow_sampler) + FIXME("Unsupported 3D shadow sampler.\n"); + shader_addline(buffer, "uniform sampler3D %s_sampler%u;\n", prefix, i); + break; + default: + shader_addline(buffer, "uniform unsupported_sampler %s_sampler%u;\n", prefix, i); + FIXME("Unrecognized sampler type: %#x\n", reg_maps->sampler_type[i]); + break; + } + } + } + + /* Declare uniforms for NP2 texcoord fixup: + * This is NOT done inside the loop that declares the texture samplers + * since the NP2 fixup code is currently only used for the GeforceFX + * series and when forcing the ARB_npot extension off. Modern cards just + * skip the code anyway, so put it inside a separate loop. */ + if (version->type == WINED3D_SHADER_TYPE_PIXEL && ps_args->np2_fixup) + { + struct ps_np2fixup_info *fixup = ctx_priv->cur_np2fixup_info; + UINT cur = 0; + + /* NP2/RECT textures in OpenGL use texcoords in the range [0,width]x[0,height] + * while D3D has them in the (normalized) [0,1]x[0,1] range. + * samplerNP2Fixup stores texture dimensions and is updated through + * shader_glsl_load_np2fixup_constants when the sampler changes. */ + + for (i = 0; i < shader->limits.sampler; ++i) + { + if (reg_maps->sampler_type[i]) + { + if (!(ps_args->np2_fixup & (1 << i))) continue; + + if (WINED3DSTT_2D != reg_maps->sampler_type[i]) { + FIXME("Non-2D texture is flagged for NP2 texcoord fixup.\n"); + continue; + } + + fixup->idx[i] = cur++; + } + } + + fixup->num_consts = (cur + 1) >> 1; + fixup->active = ps_args->np2_fixup; + shader_addline(buffer, "uniform vec4 %s_samplerNP2Fixup[%u];\n", prefix, fixup->num_consts); + } + + /* Declare address variables */ + for (i = 0, map = reg_maps->address; map; map >>= 1, ++i) + { + if (map & 1) shader_addline(buffer, "ivec4 A%u;\n", i); + } + + /* Declare texture coordinate temporaries and initialize them */ + for (i = 0, map = reg_maps->texcoord; map; map >>= 1, ++i) + { + if (map & 1) shader_addline(buffer, "vec4 T%u = gl_TexCoord[%u];\n", i, i); + } + + if (version->type == WINED3D_SHADER_TYPE_VERTEX) + { + /* Declare attributes. */ + for (i = 0, map = reg_maps->input_registers; map; map >>= 1, ++i) + { + if (map & 1) + shader_addline(buffer, "attribute vec4 %s_in%u;\n", prefix, i); + } + + shader_addline(buffer, "uniform vec4 posFixup;\n"); + shader_addline(buffer, "void order_ps_input(in vec4[%u]);\n", shader->limits.packed_output); + } + else if (version->type == WINED3D_SHADER_TYPE_GEOMETRY) + { + shader_addline(buffer, "varying in vec4 gs_in[][%u];\n", shader->limits.packed_input); + } + else if (version->type == WINED3D_SHADER_TYPE_PIXEL) + { + if (version->major >= 3) + { + UINT in_count = min(vec4_varyings(version->major, gl_info), shader->limits.packed_input); + + if (use_vs(state)) + shader_addline(buffer, "varying vec4 %s_in[%u];\n", prefix, in_count); + else + /* TODO: Write a replacement shader for the fixed function + * vertex pipeline, so this isn't needed. For fixed function + * vertex processing + 3.0 pixel shader we need a separate + * function in the pixel shader that reads the fixed function + * color into the packed input registers. */ + shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count); + } + for (i = 0, map = reg_maps->bumpmat; map; map >>= 1, ++i) { - if (!(map & 1)) continue; + if (!(map & 1)) + continue; - shader_addline(buffer, "uniform mat2 bumpenvmat%d;\n", i); + shader_addline(buffer, "uniform mat2 bumpenv_mat%u;\n", i); if (reg_maps->luminanceparams & (1 << i)) { - shader_addline(buffer, "uniform float luminancescale%d;\n", i); - shader_addline(buffer, "uniform float luminanceoffset%d;\n", i); + shader_addline(buffer, "uniform float bumpenv_lum_scale%u;\n", i); + shader_addline(buffer, "uniform float bumpenv_lum_offset%u;\n", i); extra_constants_needed++; } @@ -1045,118 +1229,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } } - /* Declare texture samplers */ - for (i = 0; i < shader->limits.sampler; ++i) - { - if (reg_maps->sampler_type[i]) - { - const struct wined3d_texture *texture; - - switch (reg_maps->sampler_type[i]) - { - case WINED3DSTT_1D: - if (pshader && ps_args->shadow & (1 << i)) - shader_addline(buffer, "uniform sampler1DShadow %csampler%u;\n", prefix, i); - else - shader_addline(buffer, "uniform sampler1D %csampler%u;\n", prefix, i); - break; - case WINED3DSTT_2D: - texture = state->textures[i]; - if (pshader && ps_args->shadow & (1 << i)) - { - if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) - shader_addline(buffer, "uniform sampler2DRectShadow %csampler%u;\n", prefix, i); - else - shader_addline(buffer, "uniform sampler2DShadow %csampler%u;\n", prefix, i); - } - else - { - if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) - shader_addline(buffer, "uniform sampler2DRect %csampler%u;\n", prefix, i); - else - shader_addline(buffer, "uniform sampler2D %csampler%u;\n", prefix, i); - } - break; - case WINED3DSTT_CUBE: - if (pshader && ps_args->shadow & (1 << i)) FIXME("Unsupported Cube shadow sampler.\n"); - shader_addline(buffer, "uniform samplerCube %csampler%u;\n", prefix, i); - break; - case WINED3DSTT_VOLUME: - if (pshader && ps_args->shadow & (1 << i)) FIXME("Unsupported 3D shadow sampler.\n"); - shader_addline(buffer, "uniform sampler3D %csampler%u;\n", prefix, i); - break; - default: - shader_addline(buffer, "uniform unsupported_sampler %csampler%u;\n", prefix, i); - FIXME("Unrecognized sampler type: %#x\n", reg_maps->sampler_type[i]); - break; - } - } - } - - /* Declare uniforms for NP2 texcoord fixup: - * This is NOT done inside the loop that declares the texture samplers since the NP2 fixup code - * is currently only used for the GeforceFX series and when forcing the ARB_npot extension off. - * Modern cards just skip the code anyway, so put it inside a separate loop. */ - if (pshader && ps_args->np2_fixup) { - - struct ps_np2fixup_info* const fixup = ctx_priv->cur_np2fixup_info; - UINT cur = 0; - - /* NP2/RECT textures in OpenGL use texcoords in the range [0,width]x[0,height] - * while D3D has them in the (normalized) [0,1]x[0,1] range. - * samplerNP2Fixup stores texture dimensions and is updated through - * shader_glsl_load_np2fixup_constants when the sampler changes. */ - - for (i = 0; i < shader->limits.sampler; ++i) - { - if (reg_maps->sampler_type[i]) - { - if (!(ps_args->np2_fixup & (1 << i))) continue; - - if (WINED3DSTT_2D != reg_maps->sampler_type[i]) { - FIXME("Non-2D texture is flagged for NP2 texcoord fixup.\n"); - continue; - } - - fixup->idx[i] = cur++; - } - } - - fixup->num_consts = (cur + 1) >> 1; - shader_addline(buffer, "uniform vec4 %csamplerNP2Fixup[%u];\n", prefix, fixup->num_consts); - } - - /* Declare address variables */ - for (i = 0, map = reg_maps->address; map; map >>= 1, ++i) - { - if (map & 1) shader_addline(buffer, "ivec4 A%u;\n", i); - } - - /* Declare texture coordinate temporaries and initialize them */ - for (i = 0, map = reg_maps->texcoord; map; map >>= 1, ++i) - { - if (map & 1) shader_addline(buffer, "vec4 T%u = gl_TexCoord[%u];\n", i, i); - } - - /* Declare input register varyings. Only pixel shader, vertex shaders have that declared in the - * helper function shader that is linked in at link time - */ - if (pshader && reg_maps->shader_version.major >= 3) - { - UINT in_count = min(vec4_varyings(reg_maps->shader_version.major, gl_info), shader->limits.packed_input); - - if (use_vs(state)) - shader_addline(buffer, "varying vec4 IN[%u];\n", in_count); - else - /* TODO: Write a replacement shader for the fixed function vertex pipeline, so this isn't needed. - * For fixed function vertex processing + 3.0 pixel shader we need a separate function in the - * pixel shader that reads the fixed function color into the packed input registers. */ - shader_addline(buffer, "vec4 IN[%u];\n", in_count); - } - /* Declare output register temporaries */ if (shader->limits.packed_output) - shader_addline(buffer, "vec4 OUT[%u];\n", shader->limits.packed_output); + shader_addline(buffer, "vec4 %s_out[%u];\n", prefix, shader->limits.packed_output); /* Declare temporary variables */ for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i) @@ -1164,19 +1239,14 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont if (map & 1) shader_addline(buffer, "vec4 R%u;\n", i); } - /* Declare attributes */ - if (reg_maps->shader_version.type == WINED3D_SHADER_TYPE_VERTEX) - { - for (i = 0, map = reg_maps->input_registers; map; map >>= 1, ++i) - { - if (map & 1) shader_addline(buffer, "attribute vec4 attrib%i;\n", i); - } - } - /* Declare loop registers aLx */ - for (i = 0; i < reg_maps->loop_depth; i++) { - shader_addline(buffer, "int aL%u;\n", i); - shader_addline(buffer, "int tmpInt%u;\n", i); + if (version->major < 4) + { + for (i = 0; i < reg_maps->loop_depth; ++i) + { + shader_addline(buffer, "int aL%u;\n", i); + shader_addline(buffer, "int tmpInt%u;\n", i); + } } /* Temporary variables for matrix operations */ @@ -1191,29 +1261,32 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont { LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry) { - shader_addline(buffer, "uniform vec4 %cLC%u;\n", prefix, lconst->idx); + shader_addline(buffer, "uniform vec4 %s_lc%u;\n", prefix, lconst->idx); } } - /* Start the main program */ - shader_addline(buffer, "void main() {\n"); - if(pshader && reg_maps->vpos) { - /* DirectX apps expect integer values, while OpenGL drivers add approximately 0.5. This causes - * off-by-one problems as spotted by the vPos d3d9 visual test. Unfortunately the ATI cards do - * not add exactly 0.5, but rather something like 0.49999999 or 0.50000001, which still causes - * precision troubles when we just subtract 0.5. - * - * To deal with that just floor() the position. This will eliminate the fraction on all cards. - * - * TODO: Test how that behaves with multisampling once we can enable multisampling in winex11. - * - * An advantage of floor is that it works even if the driver doesn't add 1/2. It is somewhat - * questionable if 1.5, 2.5, ... are the proper values to return in gl_FragCoord, even though - * coordinates specify the pixel centers instead of the pixel corners. This code will behave - * correctly on drivers that returns integer values. - */ - shader_addline(buffer, "vpos = floor(vec4(0, ycorrection[0], 0, 0) + gl_FragCoord * vec4(1, ycorrection[1], 1, 1));\n"); - } + /* Start the main program. */ + shader_addline(buffer, "void main()\n{\n"); + + /* Direct3D applications expect integer vPos values, while OpenGL drivers + * add approximately 0.5. This causes off-by-one problems as spotted by + * the vPos d3d9 visual test. Unfortunately ATI cards do not add exactly + * 0.5, but rather something like 0.49999999 or 0.50000001, which still + * causes precision troubles when we just subtract 0.5. + * + * To deal with that, just floor() the position. This will eliminate the + * fraction on all cards. + * + * TODO: Test how this behaves with multisampling. + * + * An advantage of floor is that it works even if the driver doesn't add + * 0.5. It is somewhat questionable if 1.5, 2.5, ... are the proper values + * to return in gl_FragCoord, even though coordinates specify the pixel + * centers instead of the pixel corners. This code will behave correctly + * on drivers that returns integer values. */ + if (version->type == WINED3D_SHADER_TYPE_PIXEL && reg_maps->vpos) + shader_addline(buffer, + "vpos = floor(vec4(0, ycorrection[0], 0, 0) + gl_FragCoord * vec4(1, ycorrection[1], 1, 1));\n"); } /***************************************************************************** @@ -1304,70 +1377,92 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * char *register_name, BOOL *is_color, const struct wined3d_shader_instruction *ins) { /* oPos, oFog and oPts in D3D */ - static const char * const hwrastout_reg_names[] = {"OUT[10]", "OUT[11].x", "OUT[11].y"}; + static const char * const hwrastout_reg_names[] = {"vs_out[10]", "vs_out[11].x", "vs_out[11].y"}; const struct wined3d_shader *shader = ins->ctx->shader; const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; + const struct wined3d_shader_version *version = ®_maps->shader_version; const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; - char pshader = shader_is_pshader_version(reg_maps->shader_version.type); + const char *prefix = shader_glsl_get_prefix(version->type); + struct glsl_src_param rel_param0, rel_param1; + if (reg->idx[0].offset != ~0U && reg->idx[0].rel_addr) + shader_glsl_add_src_param(ins, reg->idx[0].rel_addr, WINED3DSP_WRITEMASK_0, &rel_param0); + if (reg->idx[1].offset != ~0U && reg->idx[1].rel_addr) + shader_glsl_add_src_param(ins, reg->idx[1].rel_addr, WINED3DSP_WRITEMASK_0, &rel_param1); *is_color = FALSE; switch (reg->type) { case WINED3DSPR_TEMP: - sprintf(register_name, "R%u", reg->idx); + sprintf(register_name, "R%u", reg->idx[0].offset); break; case WINED3DSPR_INPUT: /* vertex shaders */ - if (!pshader) + if (version->type == WINED3D_SHADER_TYPE_VERTEX) { struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; - if (priv->cur_vs_args->swizzle_map & (1 << reg->idx)) *is_color = TRUE; - sprintf(register_name, "attrib%u", reg->idx); + if (priv->cur_vs_args->swizzle_map & (1 << reg->idx[0].offset)) + *is_color = TRUE; + sprintf(register_name, "%s_in%u", prefix, reg->idx[0].offset); + break; + } + + if (version->type == WINED3D_SHADER_TYPE_GEOMETRY) + { + if (reg->idx[0].rel_addr) + { + if (reg->idx[1].rel_addr) + sprintf(register_name, "gs_in[%s + %u][%s + %u]", + rel_param0.param_str, reg->idx[0].offset, rel_param1.param_str, reg->idx[1].offset); + else + sprintf(register_name, "gs_in[%s + %u][%u]", + rel_param0.param_str, reg->idx[0].offset, reg->idx[1].offset); + } + else if (reg->idx[1].rel_addr) + sprintf(register_name, "gs_in[%u][%s + %u]", + reg->idx[0].offset, rel_param1.param_str, reg->idx[1].offset); + else + sprintf(register_name, "gs_in[%u][%u]", reg->idx[0].offset, reg->idx[1].offset); break; } /* pixel shaders >= 3.0 */ - if (reg_maps->shader_version.major >= 3) + if (version->major >= 3) { - DWORD idx = shader->u.ps.input_reg_map[reg->idx]; - unsigned int in_count = vec4_varyings(reg_maps->shader_version.major, gl_info); + DWORD idx = shader->u.ps.input_reg_map[reg->idx[0].offset]; + unsigned int in_count = vec4_varyings(version->major, gl_info); - if (reg->rel_addr) + if (reg->idx[0].rel_addr) { - struct glsl_src_param rel_param; - - shader_glsl_add_src_param(ins, reg->rel_addr, WINED3DSP_WRITEMASK_0, &rel_param); - - /* Removing a + 0 would be an obvious optimization, but macos doesn't see the NOP - * operation there */ + /* Removing a + 0 would be an obvious optimization, but + * OS X doesn't see the NOP operation there. */ if (idx) { if (shader->u.ps.declared_in_count > in_count) { sprintf(register_name, - "((%s + %u) > %d ? (%s + %u) > %d ? gl_SecondaryColor : gl_Color : IN[%s + %u])", - rel_param.param_str, idx, in_count - 1, rel_param.param_str, idx, in_count, - rel_param.param_str, idx); + "((%s + %u) > %u ? (%s + %u) > %u ? gl_SecondaryColor : gl_Color : %s_in[%s + %u])", + rel_param0.param_str, idx, in_count - 1, rel_param0.param_str, idx, in_count, + prefix, rel_param0.param_str, idx); } else { - sprintf(register_name, "IN[%s + %u]", rel_param.param_str, idx); + sprintf(register_name, "%s_in[%s + %u]", prefix, rel_param0.param_str, idx); } } else { if (shader->u.ps.declared_in_count > in_count) { - sprintf(register_name, "((%s) > %d ? (%s) > %d ? gl_SecondaryColor : gl_Color : IN[%s])", - rel_param.param_str, in_count - 1, rel_param.param_str, in_count, - rel_param.param_str); + sprintf(register_name, "((%s) > %u ? (%s) > %u ? gl_SecondaryColor : gl_Color : %s_in[%s])", + rel_param0.param_str, in_count - 1, rel_param0.param_str, in_count, + prefix, rel_param0.param_str); } else { - sprintf(register_name, "IN[%s]", rel_param.param_str); + sprintf(register_name, "%s_in[%s]", prefix, rel_param0.param_str); } } } @@ -1375,52 +1470,52 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * { if (idx == in_count) sprintf(register_name, "gl_Color"); else if (idx == in_count + 1) sprintf(register_name, "gl_SecondaryColor"); - else sprintf(register_name, "IN[%u]", idx); + else sprintf(register_name, "%s_in[%u]", prefix, idx); } } else { - if (!reg->idx) strcpy(register_name, "gl_Color"); - else strcpy(register_name, "gl_SecondaryColor"); + if (!reg->idx[0].offset) + strcpy(register_name, "gl_Color"); + else + strcpy(register_name, "gl_SecondaryColor"); break; } break; case WINED3DSPR_CONST: { - const char prefix = pshader ? 'P' : 'V'; - /* Relative addressing */ - if (reg->rel_addr) + if (reg->idx[0].rel_addr) { - struct glsl_src_param rel_param; - shader_glsl_add_src_param(ins, reg->rel_addr, WINED3DSP_WRITEMASK_0, &rel_param); - if (reg->idx) sprintf(register_name, "%cC[%s + %u]", prefix, rel_param.param_str, reg->idx); - else sprintf(register_name, "%cC[%s]", prefix, rel_param.param_str); + if (reg->idx[0].offset) + sprintf(register_name, "%s_c[%s + %u]", prefix, rel_param0.param_str, reg->idx[0].offset); + else + sprintf(register_name, "%s_c[%s]", prefix, rel_param0.param_str); } else { - if (shader_constant_is_local(shader, reg->idx)) - sprintf(register_name, "%cLC%u", prefix, reg->idx); + if (shader_constant_is_local(shader, reg->idx[0].offset)) + sprintf(register_name, "%s_lc%u", prefix, reg->idx[0].offset); else - sprintf(register_name, "%cC[%u]", prefix, reg->idx); + sprintf(register_name, "%s_c[%u]", prefix, reg->idx[0].offset); } } break; case WINED3DSPR_CONSTINT: - if (pshader) sprintf(register_name, "PI[%u]", reg->idx); - else sprintf(register_name, "VI[%u]", reg->idx); + sprintf(register_name, "%s_i[%u]", prefix, reg->idx[0].offset); break; case WINED3DSPR_CONSTBOOL: - if (pshader) sprintf(register_name, "PB[%u]", reg->idx); - else sprintf(register_name, "VB[%u]", reg->idx); + sprintf(register_name, "%s_b[%u]", prefix, reg->idx[0].offset); break; case WINED3DSPR_TEXTURE: /* case WINED3DSPR_ADDR: */ - if (pshader) sprintf(register_name, "T%u", reg->idx); - else sprintf(register_name, "A%u", reg->idx); + if (version->type == WINED3D_SHADER_TYPE_PIXEL) + sprintf(register_name, "T%u", reg->idx[0].offset); + else + sprintf(register_name, "A%u", reg->idx[0].offset); break; case WINED3DSPR_LOOP: @@ -1428,19 +1523,19 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * break; case WINED3DSPR_SAMPLER: - if (pshader) sprintf(register_name, "Psampler%u", reg->idx); - else sprintf(register_name, "Vsampler%u", reg->idx); + sprintf(register_name, "%s_sampler%u", prefix, reg->idx[0].offset); break; case WINED3DSPR_COLOROUT: - if (reg->idx >= gl_info->limits.buffers) - WARN("Write to render target %u, only %d supported.\n", reg->idx, gl_info->limits.buffers); + if (reg->idx[0].offset >= gl_info->limits.buffers) + WARN("Write to render target %u, only %d supported.\n", + reg->idx[0].offset, gl_info->limits.buffers); - sprintf(register_name, "gl_FragData[%u]", reg->idx); + sprintf(register_name, "gl_FragData[%u]", reg->idx[0].offset); break; case WINED3DSPR_RASTOUT: - sprintf(register_name, "%s", hwrastout_reg_names[reg->idx]); + sprintf(register_name, "%s", hwrastout_reg_names[reg->idx[0].offset]); break; case WINED3DSPR_DEPTHOUT: @@ -1448,22 +1543,24 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * break; case WINED3DSPR_ATTROUT: - if (!reg->idx) sprintf(register_name, "OUT[8]"); - else sprintf(register_name, "OUT[9]"); + if (!reg->idx[0].offset) + sprintf(register_name, "%s_out[8]", prefix); + else + sprintf(register_name, "%s_out[9]", prefix); break; case WINED3DSPR_TEXCRDOUT: /* Vertex shaders >= 3.0: WINED3DSPR_OUTPUT */ - sprintf(register_name, "OUT[%u]", reg->idx); + sprintf(register_name, "%s_out[%u]", prefix, reg->idx[0].offset); break; case WINED3DSPR_MISCTYPE: - if (!reg->idx) + if (!reg->idx[0].offset) { /* vPos */ sprintf(register_name, "vpos"); } - else if (reg->idx == 1) + else if (reg->idx[0].offset == 1) { /* Note that gl_FrontFacing is a bool, while vFace is * a float for which the sign determines front/back */ @@ -1471,7 +1568,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * } else { - FIXME("Unhandled misctype register %d\n", reg->idx); + FIXME("Unhandled misctype register %u.\n", reg->idx[0].offset); sprintf(register_name, "unrecognized_register"); } break; @@ -1480,13 +1577,49 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * switch (reg->immconst_type) { case WINED3D_IMMCONST_SCALAR: - sprintf(register_name, "%.8e", *(const float *)reg->immconst_data); + switch (reg->data_type) + { + case WINED3D_DATA_FLOAT: + sprintf(register_name, "%.8e", *(const float *)reg->immconst_data); + break; + case WINED3D_DATA_INT: + sprintf(register_name, "%#x", reg->immconst_data[0]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + sprintf(register_name, "%#xu", reg->immconst_data[0]); + break; + default: + sprintf(register_name, "", reg->data_type); + break; + } break; case WINED3D_IMMCONST_VEC4: - sprintf(register_name, "vec4(%.8e, %.8e, %.8e, %.8e)", - *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], - *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); + switch (reg->data_type) + { + case WINED3D_DATA_FLOAT: + sprintf(register_name, "vec4(%.8e, %.8e, %.8e, %.8e)", + *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], + *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); + break; + case WINED3D_DATA_INT: + sprintf(register_name, "ivec4(%#x, %#x, %#x, %#x)", + reg->immconst_data[0], reg->immconst_data[1], + reg->immconst_data[2], reg->immconst_data[3]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + sprintf(register_name, "uvec4(%#xu, %#xu, %#xu, %#xu)", + reg->immconst_data[0], reg->immconst_data[1], + reg->immconst_data[2], reg->immconst_data[3]); + break; + default: + sprintf(register_name, "", reg->data_type); + break; + } break; default: @@ -1495,8 +1628,20 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * } break; + case WINED3DSPR_CONSTBUFFER: + if (reg->idx[1].rel_addr) + sprintf(register_name, "%s_cb%u[%s + %u]", + prefix, reg->idx[0].offset, rel_param1.param_str, reg->idx[1].offset); + else + sprintf(register_name, "%s_cb%u[%u]", prefix, reg->idx[0].offset, reg->idx[1].offset); + break; + + case WINED3DSPR_PRIMID: + sprintf(register_name, "uint(gl_PrimitiveIDIn)"); + break; + default: - FIXME("Unhandled register name Type(%d)\n", reg->type); + FIXME("Unhandled register type %#x.\n", reg->type); sprintf(register_name, "unrecognized_register"); break; } @@ -1581,7 +1726,36 @@ static void shader_glsl_add_src_param(const struct wined3d_shader_instruction *i shader_glsl_get_register_name(&wined3d_src->reg, glsl_src->reg_name, &is_color, ins); shader_glsl_get_swizzle(wined3d_src, is_color, mask, swizzle_str); - shader_glsl_gen_modifier(wined3d_src->modifiers, glsl_src->reg_name, swizzle_str, glsl_src->param_str); + + if (wined3d_src->reg.type == WINED3DSPR_IMMCONST || wined3d_src->reg.type == WINED3DSPR_PRIMID) + { + shader_glsl_gen_modifier(wined3d_src->modifiers, glsl_src->reg_name, swizzle_str, glsl_src->param_str); + } + else + { + char param_str[200]; + + shader_glsl_gen_modifier(wined3d_src->modifiers, glsl_src->reg_name, swizzle_str, param_str); + + switch (wined3d_src->reg.data_type) + { + case WINED3D_DATA_FLOAT: + sprintf(glsl_src->param_str, "%s", param_str); + break; + case WINED3D_DATA_INT: + sprintf(glsl_src->param_str, "floatBitsToInt(%s)", param_str); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + sprintf(glsl_src->param_str, "floatBitsToUint(%s)", param_str); + break; + default: + FIXME("Unhandled data type %#x.\n", wined3d_src->reg.data_type); + sprintf(glsl_src->param_str, "%s", param_str); + break; + } + } } /* From a given parameter token, generate the corresponding GLSL string. @@ -1606,8 +1780,31 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_shader_buffer *buffer, struct glsl_dst_param glsl_dst; DWORD mask; - mask = shader_glsl_add_dst_param(ins, dst, &glsl_dst); - if (mask) shader_addline(buffer, "%s%s = %s(", glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]); + if ((mask = shader_glsl_add_dst_param(ins, dst, &glsl_dst))) + { + switch (dst->reg.data_type) + { + case WINED3D_DATA_FLOAT: + shader_addline(buffer, "%s%s = %s(", + glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]); + break; + case WINED3D_DATA_INT: + shader_addline(buffer, "%s%s = %sintBitsToFloat(", + glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + shader_addline(buffer, "%s%s = %suintBitsToFloat(", + glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]); + break; + default: + FIXME("Unhandled data type %#x.\n", dst->reg.data_type); + shader_addline(buffer, "%s%s = %s(", + glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]); + break; + } + } return mask; } @@ -1670,7 +1867,7 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context { enum wined3d_sampler_texture_type sampler_type = ctx->reg_maps->sampler_type[sampler_idx]; const struct wined3d_gl_info *gl_info = ctx->gl_info; - BOOL shadow = shader_is_pshader_version(ctx->reg_maps->shader_version.type) + BOOL shadow = ctx->reg_maps->shader_version.type == WINED3D_SHADER_TYPE_PIXEL && (((const struct shader_glsl_ctx_priv *)ctx->backend_data)->cur_ps_args->shadow & (1 << sampler_idx)); BOOL projected = flags & WINED3D_GLSL_SAMPLE_PROJECTED; BOOL texrect = flags & WINED3D_GLSL_SAMPLE_RECT; @@ -1949,22 +2146,20 @@ static void shader_glsl_append_fixup_arg(char *arguments, const char *reg_name, if (sign_fixup) strcat(arguments, " * 2.0 - 1.0"); } -static void shader_glsl_color_correction(const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup) +static void shader_glsl_color_correction_ext(struct wined3d_shader_buffer *buffer, + const char *reg_name, DWORD mask, struct color_fixup_desc fixup) { - struct wined3d_shader_dst_param dst; unsigned int mask_size, remaining; - struct glsl_dst_param dst_param; + DWORD fixup_mask = 0; char arguments[256]; - DWORD mask; + char mask_str[6]; - mask = 0; - if (fixup.x_sign_fixup || fixup.x_source != CHANNEL_SOURCE_X) mask |= WINED3DSP_WRITEMASK_0; - if (fixup.y_sign_fixup || fixup.y_source != CHANNEL_SOURCE_Y) mask |= WINED3DSP_WRITEMASK_1; - if (fixup.z_sign_fixup || fixup.z_source != CHANNEL_SOURCE_Z) mask |= WINED3DSP_WRITEMASK_2; - if (fixup.w_sign_fixup || fixup.w_source != CHANNEL_SOURCE_W) mask |= WINED3DSP_WRITEMASK_3; - mask &= ins->dst[0].write_mask; - - if (!mask) return; /* Nothing to do */ + if (fixup.x_sign_fixup || fixup.x_source != CHANNEL_SOURCE_X) fixup_mask |= WINED3DSP_WRITEMASK_0; + if (fixup.y_sign_fixup || fixup.y_source != CHANNEL_SOURCE_Y) fixup_mask |= WINED3DSP_WRITEMASK_1; + if (fixup.z_sign_fixup || fixup.z_source != CHANNEL_SOURCE_Z) fixup_mask |= WINED3DSP_WRITEMASK_2; + if (fixup.w_sign_fixup || fixup.w_source != CHANNEL_SOURCE_W) fixup_mask |= WINED3DSP_WRITEMASK_3; + if (!(mask &= fixup_mask)) + return; if (is_complex_fixup(fixup)) { @@ -1973,51 +2168,52 @@ static void shader_glsl_color_correction(const struct wined3d_shader_instruction return; } + shader_glsl_write_mask_to_str(mask, mask_str); mask_size = shader_glsl_get_write_mask_size(mask); - dst = ins->dst[0]; - dst.write_mask = mask; - shader_glsl_add_dst_param(ins, &dst, &dst_param); - arguments[0] = '\0'; remaining = mask_size; if (mask & WINED3DSP_WRITEMASK_0) { - shader_glsl_append_fixup_arg(arguments, dst_param.reg_name, fixup.x_sign_fixup, fixup.x_source); + shader_glsl_append_fixup_arg(arguments, reg_name, fixup.x_sign_fixup, fixup.x_source); if (--remaining) strcat(arguments, ", "); } if (mask & WINED3DSP_WRITEMASK_1) { - shader_glsl_append_fixup_arg(arguments, dst_param.reg_name, fixup.y_sign_fixup, fixup.y_source); + shader_glsl_append_fixup_arg(arguments, reg_name, fixup.y_sign_fixup, fixup.y_source); if (--remaining) strcat(arguments, ", "); } if (mask & WINED3DSP_WRITEMASK_2) { - shader_glsl_append_fixup_arg(arguments, dst_param.reg_name, fixup.z_sign_fixup, fixup.z_source); + shader_glsl_append_fixup_arg(arguments, reg_name, fixup.z_sign_fixup, fixup.z_source); if (--remaining) strcat(arguments, ", "); } if (mask & WINED3DSP_WRITEMASK_3) { - shader_glsl_append_fixup_arg(arguments, dst_param.reg_name, fixup.w_sign_fixup, fixup.w_source); + shader_glsl_append_fixup_arg(arguments, reg_name, fixup.w_sign_fixup, fixup.w_source); if (--remaining) strcat(arguments, ", "); } if (mask_size > 1) - { - shader_addline(ins->ctx->buffer, "%s%s = vec%u(%s);\n", - dst_param.reg_name, dst_param.mask_str, mask_size, arguments); - } + shader_addline(buffer, "%s%s = vec%u(%s);\n", reg_name, mask_str, mask_size, arguments); else - { - shader_addline(ins->ctx->buffer, "%s%s = %s;\n", dst_param.reg_name, dst_param.mask_str, arguments); - } + shader_addline(buffer, "%s%s = %s;\n", reg_name, mask_str, arguments); +} + +static void shader_glsl_color_correction(const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup) +{ + char reg_name[256]; + BOOL is_color; + + shader_glsl_get_register_name(&ins->dst[0].reg, reg_name, &is_color, ins); + shader_glsl_color_correction_ext(ins->ctx->buffer, reg_name, ins->dst[0].write_mask, fixup); } static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_shader_instruction *ins, DWORD sampler, const struct glsl_sample_function *sample_function, DWORD swizzle, const char *dx, const char *dy, const char *bias, const char *coord_reg_fmt, ...) { - const char *sampler_base; + const struct wined3d_shader_version *version = &ins->ctx->reg_maps->shader_version; char dst_swizzle[6]; struct color_fixup_desc fixup; BOOL np2_fixup = FALSE; @@ -2025,11 +2221,10 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s shader_glsl_swizzle_to_str(swizzle, FALSE, ins->dst[0].write_mask, dst_swizzle); - if (shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)) + if (version->type == WINED3D_SHADER_TYPE_PIXEL) { const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; fixup = priv->cur_ps_args->color_fixup[sampler]; - sampler_base = "Psampler"; if(priv->cur_ps_args->np2_fixup & (1 << sampler)) { if(bias) { @@ -2038,14 +2233,16 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s np2_fixup = TRUE; } } - } else { - sampler_base = "Vsampler"; + } + else + { fixup = COLOR_FIXUP_IDENTITY; /* FIXME: Vshader color fixup */ } shader_glsl_append_dst(ins->ctx->buffer, ins); - shader_addline(ins->ctx->buffer, "%s(%s%u, ", sample_function->name, sampler_base, sampler); + shader_addline(ins->ctx->buffer, "%s(%s_sampler%u, ", + sample_function->name, shader_glsl_get_prefix(version->type), sampler); va_start(args, coord_reg_fmt); shader_vaddline(ins->ctx->buffer, coord_reg_fmt, args); @@ -2058,7 +2255,7 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s const struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data; const unsigned char idx = priv->cur_np2fixup_info->idx[sampler]; - shader_addline(ins->ctx->buffer, " * PsamplerNP2Fixup[%u].%s)%s);\n", idx >> 1, + shader_addline(ins->ctx->buffer, " * ps_samplerNP2Fixup[%u].%s)%s);\n", idx >> 1, (idx % 2) ? "zw" : "xy", dst_swizzle); } else if(dx && dy) { shader_addline(ins->ctx->buffer, ", %s, %s)%s);\n", dx, dy, dst_swizzle); @@ -2076,23 +2273,27 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s * Begin processing individual instruction opcodes ****************************************************************************/ -/* Generate GLSL arithmetic functions (dst = src1 + src2) */ -static void shader_glsl_arith(const struct wined3d_shader_instruction *ins) +static void shader_glsl_binop(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; struct glsl_src_param src1_param; DWORD write_mask; - char op; + const char *op; /* Determine the GLSL operator to use based on the opcode */ switch (ins->handler_idx) { - case WINED3DSIH_MUL: op = '*'; break; - case WINED3DSIH_ADD: op = '+'; break; - case WINED3DSIH_SUB: op = '-'; break; + case WINED3DSIH_ADD: op = "+"; break; + case WINED3DSIH_AND: op = "&"; break; + case WINED3DSIH_DIV: op = "/"; break; + case WINED3DSIH_IADD: op = "+"; break; + case WINED3DSIH_MUL: op = "*"; break; + case WINED3DSIH_SUB: op = "-"; break; + case WINED3DSIH_USHR: op = ">>"; break; + case WINED3DSIH_XOR: op = "^"; break; default: - op = ' '; + op = ""; FIXME("Opcode %#x not yet handled in GLSL\n", ins->handler_idx); break; } @@ -2100,7 +2301,124 @@ static void shader_glsl_arith(const struct wined3d_shader_instruction *ins) write_mask = shader_glsl_append_dst(buffer, ins); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); - shader_addline(buffer, "%s %c %s);\n", src0_param.param_str, op, src1_param.param_str); + shader_addline(buffer, "%s %s %s);\n", src0_param.param_str, op, src1_param.param_str); +} + +static void shader_glsl_relop(const struct wined3d_shader_instruction *ins) +{ + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct glsl_src_param src0_param; + struct glsl_src_param src1_param; + unsigned int mask_size; + DWORD write_mask; + const char *op; + + write_mask = shader_glsl_append_dst(buffer, ins); + mask_size = shader_glsl_get_write_mask_size(write_mask); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + + if (mask_size > 1) + { + switch (ins->handler_idx) + { + case WINED3DSIH_EQ: op = "equal"; break; + case WINED3DSIH_GE: op = "greaterThanEqual"; break; + case WINED3DSIH_IGE: op = "greaterThanEqual"; break; + case WINED3DSIH_LT: op = "lessThan"; break; + default: + op = ""; + ERR("Unhandled opcode %#x.\n", ins->handler_idx); + break; + } + + shader_addline(buffer, "uvec%u(%s(%s, %s)) * 0xffffffffu);\n", + mask_size, op, src0_param.param_str, src1_param.param_str); + } + else + { + switch (ins->handler_idx) + { + case WINED3DSIH_EQ: op = "=="; break; + case WINED3DSIH_GE: op = ">="; break; + case WINED3DSIH_IGE: op = ">="; break; + case WINED3DSIH_LT: op = "<"; break; + default: + op = ""; + ERR("Unhandled opcode %#x.\n", ins->handler_idx); + break; + } + + shader_addline(buffer, "%s %s %s ? 0xffffffffu : 0u);\n", + src0_param.param_str, op, src1_param.param_str); + } +} + +static void shader_glsl_imul(const struct wined3d_shader_instruction *ins) +{ + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct glsl_src_param src0_param; + struct glsl_src_param src1_param; + DWORD write_mask; + + /* If we have ARB_gpu_shader5 or GLSL 4.0, we can use imulExtended(). If + * not, we can emulate it. */ + if (ins->dst[0].reg.type != WINED3DSPR_NULL) + FIXME("64-bit integer multiplies not implemented.\n"); + + if (ins->dst[1].reg.type != WINED3DSPR_NULL) + { + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + + shader_addline(ins->ctx->buffer, "%s * %s);\n", + src0_param.param_str, src1_param.param_str); + } +} + +static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins) +{ + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct glsl_src_param src0_param, src1_param; + DWORD write_mask; + + if (ins->dst[0].reg.type != WINED3DSPR_NULL) + { + + if (ins->dst[1].reg.type != WINED3DSPR_NULL) + { + char dst_mask[6]; + + write_mask = shader_glsl_get_write_mask(&ins->dst[0], dst_mask); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + shader_addline(buffer, "tmp0%s = %s / %s;\n", + dst_mask, src0_param.param_str, src1_param.param_str); + + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + shader_addline(buffer, "%s %% %s));\n", src0_param.param_str, src1_param.param_str); + + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0]); + shader_addline(buffer, "tmp0%s);\n", dst_mask); + } + else + { + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + shader_addline(buffer, "%s / %s);\n", src0_param.param_str, src1_param.param_str); + } + } + else if (ins->dst[1].reg.type != WINED3DSPR_NULL) + { + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + shader_addline(buffer, "%s %% %s);\n", src0_param.param_str, src1_param.param_str); + } } /* Process the WINED3DSIO_MOV opcode using GLSL (dst = src) */ @@ -2117,7 +2435,7 @@ static void shader_glsl_mov(const struct wined3d_shader_instruction *ins) /* In vs_1_1 WINED3DSIO_MOV can write to the address register. In later * shader versions WINED3DSIO_MOVA is used for this. */ if (ins->ctx->reg_maps->shader_version.major == 1 - && !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type) + && ins->ctx->reg_maps->shader_version.type == WINED3D_SHADER_TYPE_VERTEX && ins->dst[0].reg.type == WINED3DSPR_ADDR) { /* This is a simple floor() */ @@ -2202,6 +2520,11 @@ static void shader_glsl_cross(const struct wined3d_shader_instruction *ins) shader_addline(ins->ctx->buffer, "cross(%s, %s)%s);\n", src0_param.param_str, src1_param.param_str, dst_mask); } +static void shader_glsl_cut(const struct wined3d_shader_instruction *ins) +{ + shader_addline(ins->ctx->buffer, "EndPrimitive();\n"); +} + /* Process the WINED3DSIO_POW instruction in GLSL (dst = |src0|^src1) * Src0 and src1 are scalars. Note that D3D uses the absolute of src0, while * GLSL uses the value as-is. */ @@ -2278,6 +2601,7 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins) case WINED3DSIH_EXP: instruction = "exp2"; break; case WINED3DSIH_DSX: instruction = "dFdx"; break; case WINED3DSIH_DSY: instruction = "ycorrection.y * dFdy"; break; + case WINED3DSIH_ROUND_NI: instruction = "floor"; break; default: instruction = ""; FIXME("Opcode %#x not yet handled in GLSL\n", ins->handler_idx); break; @@ -2301,6 +2625,8 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "));\n"); } +static void shader_glsl_nop(const struct wined3d_shader_instruction *ins) {} + static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -2371,6 +2697,40 @@ static void shader_glsl_expp(const struct wined3d_shader_instruction *ins) } } +static void shader_glsl_to_int(const struct wined3d_shader_instruction *ins) +{ + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct glsl_src_param src_param; + unsigned int mask_size; + DWORD write_mask; + + write_mask = shader_glsl_append_dst(buffer, ins); + mask_size = shader_glsl_get_write_mask_size(write_mask); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src_param); + + if (mask_size > 1) + shader_addline(buffer, "ivec%u(%s));\n", mask_size, src_param.param_str); + else + shader_addline(buffer, "int(%s));\n", src_param.param_str); +} + +static void shader_glsl_to_float(const struct wined3d_shader_instruction *ins) +{ + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + struct glsl_src_param src_param; + unsigned int mask_size; + DWORD write_mask; + + write_mask = shader_glsl_append_dst(buffer, ins); + mask_size = shader_glsl_get_write_mask_size(write_mask); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src_param); + + if (mask_size > 1) + shader_addline(buffer, "vec%u(%s));\n", mask_size, src_param.param_str); + else + shader_addline(buffer, "float(%s));\n", src_param.param_str); +} + /** Process the RCP (reciprocal or inverse) opcode in GLSL (dst = 1 / src) */ static void shader_glsl_rcp(const struct wined3d_shader_instruction *ins) { @@ -2469,79 +2829,108 @@ static void shader_glsl_compare(const struct wined3d_shader_instruction *ins) } } -/** Process CMP instruction in GLSL (dst = src0 >= 0.0 ? src1 : src2), per channel */ -static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) +static void shader_glsl_conditional_move(const struct wined3d_shader_instruction *ins) { + const char *condition_prefix, *condition_suffix; + struct wined3d_shader_dst_param dst; struct glsl_src_param src0_param; struct glsl_src_param src1_param; struct glsl_src_param src2_param; - DWORD write_mask, cmp_channel = 0; + BOOL temp_destination = FALSE; + DWORD cmp_channel = 0; unsigned int i, j; char mask_char[6]; - BOOL temp_destination = FALSE; + DWORD write_mask; - if (shader_is_scalar(&ins->src[0].reg)) + switch (ins->handler_idx) + { + case WINED3DSIH_CMP: + condition_prefix = ""; + condition_suffix = " >= 0.0"; + break; + + case WINED3DSIH_CND: + condition_prefix = ""; + condition_suffix = " > 0.5"; + break; + + case WINED3DSIH_MOVC: + condition_prefix = "bool("; + condition_suffix = ")"; + break; + + default: + FIXME("Unhandled instruction %#x.\n", ins->handler_idx); + condition_prefix = ""; + condition_suffix = ""; + break; + } + + if (shader_is_scalar(&ins->dst[0].reg) || shader_is_scalar(&ins->src[0].reg)) { write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins); - - shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_ALL, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param); - shader_addline(ins->ctx->buffer, "%s >= 0.0 ? %s : %s);\n", - src0_param.param_str, src1_param.param_str, src2_param.param_str); - } else { - DWORD dst_mask = ins->dst[0].write_mask; - struct wined3d_shader_dst_param dst = ins->dst[0]; - - /* Cycle through all source0 channels */ - for (i=0; i<4; i++) { - write_mask = 0; - /* Find the destination channels which use the current source0 channel */ - for (j=0; j<4; j++) { - if (((ins->src[0].swizzle >> (2 * j)) & 0x3) == i) - { - write_mask |= WINED3DSP_WRITEMASK_0 << j; - cmp_channel = WINED3DSP_WRITEMASK_0 << j; - } - } - dst.write_mask = dst_mask & write_mask; - - /* Splitting the cmp instruction up in multiple lines imposes a problem: - * The first lines may overwrite source parameters of the following lines. - * Deal with that by using a temporary destination register if needed - */ - if ((ins->src[0].reg.idx == ins->dst[0].reg.idx - && ins->src[0].reg.type == ins->dst[0].reg.type) - || (ins->src[1].reg.idx == ins->dst[0].reg.idx - && ins->src[1].reg.type == ins->dst[0].reg.type) - || (ins->src[2].reg.idx == ins->dst[0].reg.idx - && ins->src[2].reg.type == ins->dst[0].reg.type)) - { - write_mask = shader_glsl_get_write_mask(&dst, mask_char); - if (!write_mask) continue; - shader_addline(ins->ctx->buffer, "tmp0%s = (", mask_char); - temp_destination = TRUE; - } else { - write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst); - if (!write_mask) continue; - } - - shader_glsl_add_src_param(ins, &ins->src[0], cmp_channel, &src0_param); - shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); - shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param); - - shader_addline(ins->ctx->buffer, "%s >= 0.0 ? %s : %s);\n", - src0_param.param_str, src1_param.param_str, src2_param.param_str); - } - - if(temp_destination) { - shader_glsl_get_write_mask(&ins->dst[0], mask_char); - shader_glsl_append_dst(ins->ctx->buffer, ins); - shader_addline(ins->ctx->buffer, "tmp0%s);\n", mask_char); - } + shader_addline(ins->ctx->buffer, "%s%s%s ? %s : %s);\n", + condition_prefix, src0_param.param_str, condition_suffix, + src1_param.param_str, src2_param.param_str); + return; } + dst = ins->dst[0]; + + /* Splitting the instruction up in multiple lines imposes a problem: + * The first lines may overwrite source parameters of the following lines. + * Deal with that by using a temporary destination register if needed. */ + if ((ins->src[0].reg.idx[0].offset == dst.reg.idx[0].offset + && ins->src[0].reg.type == dst.reg.type) + || (ins->src[1].reg.idx[0].offset == dst.reg.idx[0].offset + && ins->src[1].reg.type == dst.reg.type) + || (ins->src[2].reg.idx[0].offset == dst.reg.idx[0].offset + && ins->src[2].reg.type == dst.reg.type)) + temp_destination = TRUE; + + /* Cycle through all source0 channels. */ + for (i = 0; i < 4; ++i) + { + write_mask = 0; + /* Find the destination channels which use the current source0 channel. */ + for (j = 0; j < 4; ++j) + { + if (((ins->src[0].swizzle >> (2 * j)) & 0x3) == i) + { + write_mask |= WINED3DSP_WRITEMASK_0 << j; + cmp_channel = WINED3DSP_WRITEMASK_0 << j; + } + } + dst.write_mask = ins->dst[0].write_mask & write_mask; + + if (temp_destination) + { + if (!(write_mask = shader_glsl_get_write_mask(&dst, mask_char))) + continue; + shader_addline(ins->ctx->buffer, "tmp0%s = (", mask_char); + } + else if (!(write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst))) + continue; + + shader_glsl_add_src_param(ins, &ins->src[0], cmp_channel, &src0_param); + shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); + shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param); + + shader_addline(ins->ctx->buffer, "%s%s%s ? %s : %s);\n", + condition_prefix, src0_param.param_str, condition_suffix, + src1_param.param_str, src2_param.param_str); + } + + if (temp_destination) + { + shader_glsl_get_write_mask(&ins->dst[0], mask_char); + shader_glsl_append_dst(ins->ctx->buffer, ins); + shader_addline(ins->ctx->buffer, "tmp0%s);\n", mask_char); + } } /** Process the CND opcode in GLSL (dst = (src0 > 0.5) ? src1 : src2) */ @@ -2549,13 +2938,10 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) * the compare is done per component of src0. */ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins) { - struct wined3d_shader_dst_param dst; struct glsl_src_param src0_param; struct glsl_src_param src1_param; struct glsl_src_param src2_param; - DWORD write_mask, cmp_channel = 0; - unsigned int i, j; - DWORD dst_mask; + DWORD write_mask; DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major, ins->ctx->reg_maps->shader_version.minor); @@ -2576,31 +2962,8 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins) } return; } - /* Cycle through all source0 channels */ - dst_mask = ins->dst[0].write_mask; - dst = ins->dst[0]; - for (i=0; i<4; i++) { - write_mask = 0; - /* Find the destination channels which use the current source0 channel */ - for (j=0; j<4; j++) { - if (((ins->src[0].swizzle >> (2 * j)) & 0x3) == i) - { - write_mask |= WINED3DSP_WRITEMASK_0 << j; - cmp_channel = WINED3DSP_WRITEMASK_0 << j; - } - } - dst.write_mask = dst_mask & write_mask; - write_mask = shader_glsl_append_dst_ext(ins->ctx->buffer, ins, &dst); - if (!write_mask) continue; - - shader_glsl_add_src_param(ins, &ins->src[0], cmp_channel, &src0_param); - shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param); - shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param); - - shader_addline(ins->ctx->buffer, "%s > 0.5 ? %s : %s);\n", - src0_param.param_str, src1_param.param_str, src2_param.param_str); - } + shader_glsl_conditional_move(ins); } /** GLSL code generation for WINED3DSIO_MAD: Multiply the first 2 opcodes, then add the last */ @@ -2671,7 +3034,7 @@ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins) { tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i; shader_glsl_dot(&tmp_ins); - ++tmp_src[1].reg.idx; + ++tmp_src[1].reg.idx[0].offset; } } @@ -2788,28 +3151,68 @@ static void shader_glsl_dst(const struct wined3d_shader_instruction *ins) */ static void shader_glsl_sincos(const struct wined3d_shader_instruction *ins) { + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; DWORD write_mask; - write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins); - shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param); + if (ins->ctx->reg_maps->shader_version.major < 4) + { + shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param); - switch (write_mask) { - case WINED3DSP_WRITEMASK_0: - shader_addline(ins->ctx->buffer, "cos(%s));\n", src0_param.param_str); - break; + write_mask = shader_glsl_append_dst(buffer, ins); + switch (write_mask) + { + case WINED3DSP_WRITEMASK_0: + shader_addline(buffer, "cos(%s));\n", src0_param.param_str); + break; - case WINED3DSP_WRITEMASK_1: - shader_addline(ins->ctx->buffer, "sin(%s));\n", src0_param.param_str); - break; + case WINED3DSP_WRITEMASK_1: + shader_addline(buffer, "sin(%s));\n", src0_param.param_str); + break; - case (WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1): - shader_addline(ins->ctx->buffer, "vec2(cos(%s), sin(%s)));\n", src0_param.param_str, src0_param.param_str); - break; + case (WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1): + shader_addline(buffer, "vec2(cos(%s), sin(%s)));\n", + src0_param.param_str, src0_param.param_str); + break; - default: - ERR("Write mask should be .x, .y or .xy\n"); - break; + default: + ERR("Write mask should be .x, .y or .xy\n"); + break; + } + + return; + } + + if (ins->dst[0].reg.type != WINED3DSPR_NULL) + { + + if (ins->dst[1].reg.type != WINED3DSPR_NULL) + { + char dst_mask[6]; + + write_mask = shader_glsl_get_write_mask(&ins->dst[0], dst_mask); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_addline(buffer, "tmp0%s = sin(%s);\n", dst_mask, src0_param.param_str); + + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_addline(buffer, "cos(%s));\n", src0_param.param_str); + + shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0]); + shader_addline(buffer, "tmp0%s);\n", dst_mask); + } + else + { + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_addline(buffer, "sin(%s));\n", src0_param.param_str); + } + } + else if (ins->dst[1].reg.type != WINED3DSPR_NULL) + { + write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[1]); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + shader_addline(buffer, "cos(%s));\n", src0_param.param_str); } } @@ -2837,68 +3240,78 @@ static void shader_glsl_sgn(const struct wined3d_shader_instruction *ins) static void shader_glsl_loop(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state; + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; const struct wined3d_shader *shader = ins->ctx->shader; const struct wined3d_shader_lconst *constant; struct glsl_src_param src1_param; const DWORD *control_values = NULL; - shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_ALL, &src1_param); - - /* Try to hardcode the loop control parameters if possible. Direct3D 9 class hardware doesn't support real - * varying indexing, but Microsoft designed this feature for Shader model 2.x+. If the loop control is - * known at compile time, the GLSL compiler can unroll the loop, and replace indirect addressing with direct - * addressing. - */ - if (ins->src[1].reg.type == WINED3DSPR_CONSTINT) + if (ins->ctx->reg_maps->shader_version.major < 4) { - LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry) + shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_ALL, &src1_param); + + /* Try to hardcode the loop control parameters if possible. Direct3D 9 + * class hardware doesn't support real varying indexing, but Microsoft + * designed this feature for Shader model 2.x+. If the loop control is + * known at compile time, the GLSL compiler can unroll the loop, and + * replace indirect addressing with direct addressing. */ + if (ins->src[1].reg.type == WINED3DSPR_CONSTINT) { - if (constant->idx == ins->src[1].reg.idx) + LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry) { - control_values = constant->value; - break; + if (constant->idx == ins->src[1].reg.idx[0].offset) + { + control_values = constant->value; + break; + } } } - } - if (control_values) - { - struct wined3d_shader_loop_control loop_control; - loop_control.count = control_values[0]; - loop_control.start = control_values[1]; - loop_control.step = (int)control_values[2]; + if (control_values) + { + struct wined3d_shader_loop_control loop_control; + loop_control.count = control_values[0]; + loop_control.start = control_values[1]; + loop_control.step = (int)control_values[2]; - if (loop_control.step > 0) - { - shader_addline(ins->ctx->buffer, "for (aL%u = %u; aL%u < (%u * %d + %u); aL%u += %d) {\n", - loop_state->current_depth, loop_control.start, - loop_state->current_depth, loop_control.count, loop_control.step, loop_control.start, - loop_state->current_depth, loop_control.step); - } - else if (loop_control.step < 0) - { - shader_addline(ins->ctx->buffer, "for (aL%u = %u; aL%u > (%u * %d + %u); aL%u += %d) {\n", - loop_state->current_depth, loop_control.start, - loop_state->current_depth, loop_control.count, loop_control.step, loop_control.start, - loop_state->current_depth, loop_control.step); + if (loop_control.step > 0) + { + shader_addline(buffer, "for (aL%u = %u; aL%u < (%u * %d + %u); aL%u += %d)\n{\n", + loop_state->current_depth, loop_control.start, + loop_state->current_depth, loop_control.count, loop_control.step, loop_control.start, + loop_state->current_depth, loop_control.step); + } + else if (loop_control.step < 0) + { + shader_addline(buffer, "for (aL%u = %u; aL%u > (%u * %d + %u); aL%u += %d)\n{\n", + loop_state->current_depth, loop_control.start, + loop_state->current_depth, loop_control.count, loop_control.step, loop_control.start, + loop_state->current_depth, loop_control.step); + } + else + { + shader_addline(buffer, "for (aL%u = %u, tmpInt%u = 0; tmpInt%u < %u; tmpInt%u++)\n{\n", + loop_state->current_depth, loop_control.start, loop_state->current_depth, + loop_state->current_depth, loop_control.count, + loop_state->current_depth); + } } else { - shader_addline(ins->ctx->buffer, "for (aL%u = %u, tmpInt%u = 0; tmpInt%u < %u; tmpInt%u++) {\n", - loop_state->current_depth, loop_control.start, loop_state->current_depth, - loop_state->current_depth, loop_control.count, - loop_state->current_depth); + shader_addline(buffer, "for (tmpInt%u = 0, aL%u = %s.y; tmpInt%u < %s.x; tmpInt%u++, aL%u += %s.z)\n{\n", + loop_state->current_depth, loop_state->current_reg, + src1_param.reg_name, loop_state->current_depth, src1_param.reg_name, + loop_state->current_depth, loop_state->current_reg, src1_param.reg_name); } - } else { - shader_addline(ins->ctx->buffer, - "for (tmpInt%u = 0, aL%u = %s.y; tmpInt%u < %s.x; tmpInt%u++, aL%u += %s.z) {\n", - loop_state->current_depth, loop_state->current_reg, - src1_param.reg_name, loop_state->current_depth, src1_param.reg_name, - loop_state->current_depth, loop_state->current_reg, src1_param.reg_name); + + ++loop_state->current_reg; + } + else + { + shader_addline(buffer, "for (;;)\n{\n"); } ++loop_state->current_depth; - ++loop_state->current_reg; } static void shader_glsl_end(const struct wined3d_shader_instruction *ins) @@ -2932,7 +3345,7 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins) { LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, struct wined3d_shader_lconst, entry) { - if (constant->idx == ins->src[0].reg.idx) + if (constant->idx == ins->src[0].reg.idx[0].offset) { control_values = constant->value; break; @@ -2982,6 +3395,11 @@ static void shader_glsl_else(const struct wined3d_shader_instruction *ins) shader_addline(ins->ctx->buffer, "} else {\n"); } +static void shader_glsl_emit(const struct wined3d_shader_instruction *ins) +{ + shader_addline(ins->ctx->buffer, "EmitVertex();\n"); +} + static void shader_glsl_break(const struct wined3d_shader_instruction *ins) { shader_addline(ins->ctx->buffer, "break;\n"); @@ -3000,15 +3418,23 @@ static void shader_glsl_breakc(const struct wined3d_shader_instruction *ins) src0_param.param_str, shader_glsl_get_rel_op(ins->flags), src1_param.param_str); } +static void shader_glsl_breakp(const struct wined3d_shader_instruction *ins) +{ + struct glsl_src_param src_param; + + shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src_param); + shader_addline(ins->ctx->buffer, "if (bool(%s)) break;\n", src_param.param_str); +} + static void shader_glsl_label(const struct wined3d_shader_instruction *ins) { shader_addline(ins->ctx->buffer, "}\n"); - shader_addline(ins->ctx->buffer, "void subroutine%u () {\n", ins->src[0].reg.idx); + shader_addline(ins->ctx->buffer, "void subroutine%u()\n{\n", ins->src[0].reg.idx[0].offset); } static void shader_glsl_call(const struct wined3d_shader_instruction *ins) { - shader_addline(ins->ctx->buffer, "subroutine%u();\n", ins->src[0].reg.idx); + shader_addline(ins->ctx->buffer, "subroutine%u();\n", ins->src[0].reg.idx[0].offset); } static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins) @@ -3016,7 +3442,8 @@ static void shader_glsl_callnz(const struct wined3d_shader_instruction *ins) struct glsl_src_param src1_param; shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_0, &src1_param); - shader_addline(ins->ctx->buffer, "if (%s) subroutine%u();\n", src1_param.param_str, ins->src[0].reg.idx); + shader_addline(ins->ctx->buffer, "if (%s) subroutine%u();\n", + src1_param.param_str, ins->src[0].reg.idx[0].offset); } static void shader_glsl_ret(const struct wined3d_shader_instruction *ins) @@ -3043,8 +3470,10 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins) /* 1.0-1.4: Use destination register as sampler source. * 2.0+: Use provided sampler source. */ - if (shader_version < WINED3D_SHADER_VERSION(2,0)) sampler_idx = ins->dst[0].reg.idx; - else sampler_idx = ins->src[1].reg.idx; + if (shader_version < WINED3D_SHADER_VERSION(2,0)) + sampler_idx = ins->dst[0].reg.idx[0].offset; + else + sampler_idx = ins->src[1].reg.idx[0].offset; texture = device->stateBlock->state.textures[sampler_idx]; if (shader_version < WINED3D_SHADER_VERSION(1,4)) @@ -3150,7 +3579,7 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins) return; } - sampler_idx = ins->src[1].reg.idx; + sampler_idx = ins->src[1].reg.idx[0].offset; texture = device->stateBlock->state.textures[sampler_idx]; if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) sample_flags |= WINED3D_GLSL_SAMPLE_RECT; @@ -3176,7 +3605,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins) DWORD swizzle = ins->src[1].swizzle; const struct wined3d_texture *texture; - sampler_idx = ins->src[1].reg.idx; + sampler_idx = ins->src[1].reg.idx[0].offset; texture = device->stateBlock->state.textures[sampler_idx]; if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) sample_flags |= WINED3D_GLSL_SAMPLE_RECT; @@ -3187,7 +3616,7 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &lod_param); if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD] && !gl_info->supported[EXT_GPU_SHADER4] - && shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type)) + && ins->ctx->reg_maps->shader_version.type == WINED3D_SHADER_TYPE_PIXEL) { /* Plain GLSL only supports Lod sampling functions in vertex shaders. * However, the NVIDIA drivers allow them in fragment shaders as well, @@ -3210,12 +3639,12 @@ static void shader_glsl_texcoord(const struct wined3d_shader_instruction *ins) shader_glsl_get_write_mask(&ins->dst[0], dst_mask); shader_addline(buffer, "clamp(gl_TexCoord[%u], 0.0, 1.0)%s);\n", - ins->dst[0].reg.idx, dst_mask); + ins->dst[0].reg.idx[0].offset, dst_mask); } else { enum wined3d_shader_src_modifier src_mod = ins->src[0].modifiers; - DWORD reg = ins->src[0].reg.idx; + DWORD reg = ins->src[0].reg.idx[0].offset; char dst_swizzle[6]; shader_glsl_get_swizzle(&ins->src[0], FALSE, write_mask, dst_swizzle); @@ -3256,8 +3685,8 @@ static void shader_glsl_texcoord(const struct wined3d_shader_instruction *ins) * then perform a 1D texture lookup from stage dstregnum, place into dst. */ static void shader_glsl_texdp3tex(const struct wined3d_shader_instruction *ins) { - DWORD sampler_idx = ins->dst[0].reg.idx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; + DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; struct glsl_sample_function sample_function; struct glsl_src_param src0_param; UINT mask_size; @@ -3299,8 +3728,8 @@ static void shader_glsl_texdp3tex(const struct wined3d_shader_instruction *ins) * Take a 3-component dot product of the TexCoord[dstreg] and src. */ static void shader_glsl_texdp3(const struct wined3d_shader_instruction *ins) { - DWORD dstreg = ins->dst[0].reg.idx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; + DWORD dstreg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; DWORD dst_mask; unsigned int mask_size; @@ -3342,7 +3771,7 @@ static void shader_glsl_texdepth(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x2depth(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - DWORD dstreg = ins->dst[0].reg.idx; + DWORD dstreg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); @@ -3356,7 +3785,7 @@ static void shader_glsl_texm3x2depth(const struct wined3d_shader_instruction *in static void shader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - DWORD reg = ins->dst[0].reg.idx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct glsl_src_param src0_param; @@ -3369,9 +3798,9 @@ static void shader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); @@ -3382,9 +3811,9 @@ static void shader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct glsl_sample_function sample_function; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); @@ -3403,8 +3832,8 @@ static void shader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins) DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; struct glsl_sample_function sample_function; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; - DWORD reg = ins->dst[0].reg.idx; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); shader_addline(ins->ctx->buffer, "tmp0.z = dot(T%u.xyz, %s);\n", reg, src0_param.param_str); @@ -3424,9 +3853,9 @@ static void shader_glsl_texm3x3(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; char dst_mask[6]; - DWORD reg = ins->dst[0].reg.idx; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); @@ -3443,11 +3872,11 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins { struct glsl_src_param src0_param; struct glsl_src_param src1_param; - DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; struct glsl_sample_function sample_function; + DWORD reg = ins->dst[0].reg.idx[0].offset; char coord_mask[6]; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); @@ -3473,11 +3902,11 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins * Perform the final texture lookup based on the previous 2 3x3 matrix multiplies */ static void shader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *ins) { - DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; struct glsl_sample_function sample_function; + DWORD reg = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param; char coord_mask[6]; @@ -3516,7 +3945,7 @@ static void shader_glsl_texbem(const struct wined3d_shader_instruction *ins) DWORD flags; char coord_mask[6]; - sampler_idx = ins->dst[0].reg.idx; + sampler_idx = ins->dst[0].reg.idx[0].offset; flags = (priv->cur_ps_args->tex_transform >> sampler_idx * WINED3D_PSARGS_TEXTRANSFORM_SHIFT) & WINED3D_PSARGS_TEXTRANSFORM_MASK; @@ -3555,7 +3984,7 @@ static void shader_glsl_texbem(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &coord_param); shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE, NULL, NULL, NULL, - "T%u%s + vec4(bumpenvmat%d * %s, 0.0, 0.0)%s", sampler_idx, coord_mask, sampler_idx, + "T%u%s + vec4(bumpenv_mat%u * %s, 0.0, 0.0)%s", sampler_idx, coord_mask, sampler_idx, coord_param.param_str, coord_mask); if (ins->handler_idx == WINED3DSIH_TEXBEML) @@ -3566,7 +3995,7 @@ static void shader_glsl_texbem(const struct wined3d_shader_instruction *ins) shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_2, &luminance_param); shader_glsl_add_dst_param(ins, &ins->dst[0], &dst_param); - shader_addline(ins->ctx->buffer, "%s%s *= (%s * luminancescale%d + luminanceoffset%d);\n", + shader_addline(ins->ctx->buffer, "%s%s *= (%s * bumpenv_lum_scale%u + bumpenv_lum_offset%u);\n", dst_param.reg_name, dst_param.mask_str, luminance_param.param_str, sampler_idx, sampler_idx); } @@ -3574,14 +4003,14 @@ static void shader_glsl_texbem(const struct wined3d_shader_instruction *ins) static void shader_glsl_bem(const struct wined3d_shader_instruction *ins) { + DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; struct glsl_src_param src0_param, src1_param; - DWORD sampler_idx = ins->dst[0].reg.idx; shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &src0_param); shader_glsl_add_src_param(ins, &ins->src[1], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &src1_param); shader_glsl_append_dst(ins->ctx->buffer, ins); - shader_addline(ins->ctx->buffer, "%s + bumpenvmat%d * %s);\n", + shader_addline(ins->ctx->buffer, "%s + bumpenv_mat%u * %s);\n", src0_param.param_str, sampler_idx, src1_param.param_str); } @@ -3589,9 +4018,9 @@ static void shader_glsl_bem(const struct wined3d_shader_instruction *ins) * Sample 2D texture at dst using the alpha & red (wx) components of src as texture coordinates */ static void shader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins) { + DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; struct glsl_sample_function sample_function; struct glsl_src_param src0_param; - DWORD sampler_idx = ins->dst[0].reg.idx; shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_ALL, &src0_param); @@ -3604,9 +4033,9 @@ static void shader_glsl_texreg2ar(const struct wined3d_shader_instruction *ins) * Sample 2D texture at dst using the green & blue (yz) components of src as texture coordinates */ static void shader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins) { + DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; struct glsl_sample_function sample_function; struct glsl_src_param src0_param; - DWORD sampler_idx = ins->dst[0].reg.idx; shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_ALL, &src0_param); @@ -3619,9 +4048,9 @@ static void shader_glsl_texreg2gb(const struct wined3d_shader_instruction *ins) * Sample texture at dst using the rgb (xyz) components of src as texture coordinates */ static void shader_glsl_texreg2rgb(const struct wined3d_shader_instruction *ins) { + DWORD sampler_idx = ins->dst[0].reg.idx[0].offset; struct glsl_sample_function sample_function; struct glsl_src_param src0_param; - DWORD sampler_idx = ins->dst[0].reg.idx; /* Dependent read, not valid with conditional NP2 */ shader_glsl_get_sample_function(ins->ctx, sampler_idx, 0, &sample_function); @@ -3702,27 +4131,27 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD)) { if (semantic_idx < 8 && vertexprocessing == pretransformed) - shader_addline(buffer, "IN[%u]%s = gl_TexCoord[%u]%s;\n", + shader_addline(buffer, "ps_in[%u]%s = gl_TexCoord[%u]%s;\n", shader->u.ps.input_reg_map[i], reg_mask, semantic_idx, reg_mask); else - shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", + shader_addline(buffer, "ps_in[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", shader->u.ps.input_reg_map[i], reg_mask, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR)) { if (!semantic_idx) - shader_addline(buffer, "IN[%u]%s = vec4(gl_Color)%s;\n", + shader_addline(buffer, "ps_in[%u]%s = vec4(gl_Color)%s;\n", shader->u.ps.input_reg_map[i], reg_mask, reg_mask); else if (semantic_idx == 1) - shader_addline(buffer, "IN[%u]%s = vec4(gl_SecondaryColor)%s;\n", + shader_addline(buffer, "ps_in[%u]%s = vec4(gl_SecondaryColor)%s;\n", shader->u.ps.input_reg_map[i], reg_mask, reg_mask); else - shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", + shader_addline(buffer, "ps_in[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", shader->u.ps.input_reg_map[i], reg_mask, reg_mask); } else { - shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", + shader_addline(buffer, "ps_in[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", shader->u.ps.input_reg_map[i], reg_mask, reg_mask); } } @@ -3736,10 +4165,9 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh { struct glsl_program_key key; - key.vshader = entry->vshader; - key.pshader = entry->pshader; - key.vs_args = entry->vs_args; - key.ps_args = entry->ps_args; + key.vs_id = entry->vs.id; + key.gs_id = entry->gs.id; + key.ps_id = entry->ps.id; if (wine_rb_put(&priv->program_lookup, &key, &entry->program_lookup_entry) == -1) { @@ -3748,38 +4176,39 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh } static struct glsl_shader_prog_link *get_glsl_program_entry(const struct shader_glsl_priv *priv, - const struct wined3d_shader *vshader, const struct wined3d_shader *pshader, - const struct vs_compile_args *vs_args, const struct ps_compile_args *ps_args) + GLhandleARB vs_id, GLhandleARB gs_id, GLhandleARB ps_id) { struct wine_rb_entry *entry; struct glsl_program_key key; - key.vshader = vshader; - key.pshader = pshader; - key.vs_args = *vs_args; - key.ps_args = *ps_args; + key.vs_id = vs_id; + key.gs_id = gs_id; + key.ps_id = ps_id; entry = wine_rb_get(&priv->program_lookup, &key); return entry ? WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry) : NULL; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, struct glsl_shader_prog_link *entry) { struct glsl_program_key key; - key.vshader = entry->vshader; - key.pshader = entry->pshader; - key.vs_args = entry->vs_args; - key.ps_args = entry->ps_args; + key.vs_id = entry->vs.id; + key.gs_id = entry->gs.id; + key.ps_id = entry->ps.id; wine_rb_remove(&priv->program_lookup, &key); GL_EXTCALL(glDeleteObjectARB(entry->programId)); - if (entry->vshader) list_remove(&entry->vshader_entry); - if (entry->pshader) list_remove(&entry->pshader_entry); - HeapFree(GetProcessHeap(), 0, entry->vuniformF_locations); - HeapFree(GetProcessHeap(), 0, entry->puniformF_locations); + if (entry->vs.id) + list_remove(&entry->vs.shader_entry); + if (entry->gs.id) + list_remove(&entry->gs.shader_entry); + if (entry->ps.id) + list_remove(&entry->ps.shader_entry); + HeapFree(GetProcessHeap(), 0, entry->vs.uniform_f_locations); + HeapFree(GetProcessHeap(), 0, entry->ps.uniform_f_locations); HeapFree(GetProcessHeap(), 0, entry); } @@ -3816,13 +4245,12 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, continue; } - if (in_idx == in_count) { + if (in_idx == in_count) sprintf(destination, "gl_FrontColor"); - } else if (in_idx == in_count + 1) { + else if (in_idx == in_count + 1) sprintf(destination, "gl_FrontSecondaryColor"); - } else { - sprintf(destination, "IN[%u]", in_idx); - } + else + sprintf(destination, "ps_in[%u]", in_idx); semantic_name_in = input_signature[i].semantic_name; semantic_idx_in = input_signature[i].semantic_idx; @@ -3842,7 +4270,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, set[in_idx] = mask; shader_glsl_write_mask_to_str(mask, reg_mask); - shader_addline(buffer, "%s%s = OUT[%u]%s;\n", + shader_addline(buffer, "%s%s = vs_out[%u]%s;\n", destination, reg_mask, j, reg_mask); } } @@ -3863,9 +4291,12 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, if (!(set[i] & WINED3DSP_WRITEMASK_3)) reg_mask[size++] = 'w'; reg_mask[size] = '\0'; - if (i == in_count) sprintf(destination, "gl_FrontColor"); - else if (i == in_count + 1) sprintf(destination, "gl_FrontSecondaryColor"); - else sprintf(destination, "IN[%u]", i); + if (i == in_count) + sprintf(destination, "gl_FrontColor"); + else if (i == in_count + 1) + sprintf(destination, "gl_FrontSecondaryColor"); + else + sprintf(destination, "ps_in[%u]", i); if (size == 1) shader_addline(buffer, "%s.%s = 0.0;\n", destination, reg_mask); else shader_addline(buffer, "%s.%s = vec%u(0.0);\n", destination, reg_mask, size); @@ -3874,7 +4305,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, HeapFree(GetProcessHeap(), 0, set); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer, const struct wined3d_shader *vs, const struct wined3d_shader *ps, const struct wined3d_gl_info *gl_info) @@ -3894,7 +4325,7 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (ps_major < 3) { - shader_addline(buffer, "void order_ps_input(in vec4 OUT[%u]) {\n", MAX_REG_OUTPUT); + shader_addline(buffer, "void order_ps_input(in vec4 vs_out[%u])\n{\n", vs->limits.packed_output); for (i = 0; map; map >>= 1, ++i) { @@ -3910,15 +4341,15 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR)) { if (!semantic_idx) - shader_addline(buffer, "gl_FrontColor%s = OUT[%u]%s;\n", + shader_addline(buffer, "gl_FrontColor%s = vs_out[%u]%s;\n", reg_mask, i, reg_mask); else if (semantic_idx == 1) - shader_addline(buffer, "gl_FrontSecondaryColor%s = OUT[%u]%s;\n", + shader_addline(buffer, "gl_FrontSecondaryColor%s = vs_out[%u]%s;\n", reg_mask, i, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION)) { - shader_addline(buffer, "gl_Position%s = OUT[%u]%s;\n", + shader_addline(buffer, "gl_Position%s = vs_out[%u]%s;\n", reg_mask, i, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD)) @@ -3928,7 +4359,7 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (!(gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) || ps_major > 0) write_mask |= WINED3DSP_WRITEMASK_3; - shader_addline(buffer, "gl_TexCoord[%u]%s = OUT[%u]%s;\n", + shader_addline(buffer, "gl_TexCoord[%u]%s = vs_out[%u]%s;\n", semantic_idx, reg_mask, i, reg_mask); if (!(write_mask & WINED3DSP_WRITEMASK_3)) shader_addline(buffer, "gl_TexCoord[%u].w = 1.0;\n", semantic_idx); @@ -3936,11 +4367,11 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer } else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_PSIZE)) { - shader_addline(buffer, "gl_PointSize = OUT[%u].%c;\n", i, reg_mask[1]); + shader_addline(buffer, "gl_PointSize = vs_out[%u].%c;\n", i, reg_mask[1]); } else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG)) { - shader_addline(buffer, "gl_FogFragCoord = clamp(OUT[%u].%c, 0.0, 1.0);\n", i, reg_mask[1]); + shader_addline(buffer, "gl_FogFragCoord = clamp(vs_out[%u].%c, 0.0, 1.0);\n", i, reg_mask[1]); } } shader_addline(buffer, "}\n"); @@ -3949,8 +4380,8 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer { UINT in_count = min(vec4_varyings(ps_major, gl_info), ps->limits.packed_input); /* This one is tricky: a 3.0 pixel shader reads from a 3.0 vertex shader */ - shader_addline(buffer, "varying vec4 IN[%u];\n", in_count); - shader_addline(buffer, "void order_ps_input(in vec4 OUT[%u]) {\n", MAX_REG_OUTPUT); + shader_addline(buffer, "varying vec4 ps_in[%u];\n", in_count); + shader_addline(buffer, "void order_ps_input(in vec4 vs_out[%u])\n{\n", vs->limits.packed_output); /* First, sort out position and point size. Those are not passed to the pixel shader */ for (i = 0; map; map >>= 1, ++i) @@ -3962,12 +4393,12 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION)) { - shader_addline(buffer, "gl_Position%s = OUT[%u]%s;\n", + shader_addline(buffer, "gl_Position%s = vs_out[%u]%s;\n", reg_mask, i, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_PSIZE)) { - shader_addline(buffer, "gl_PointSize = OUT[%u].%c;\n", i, reg_mask[1]); + shader_addline(buffer, "gl_PointSize = vs_out[%u].%c;\n", i, reg_mask[1]); } } @@ -3985,26 +4416,66 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer return ret; } -/* GL locking is done by the caller */ +static void shader_glsl_generate_srgb_write_correction(struct wined3d_shader_buffer *buffer) +{ + shader_addline(buffer, "tmp0.xyz = pow(gl_FragData[0].xyz, vec3(srgb_const0.x));\n"); + shader_addline(buffer, "tmp0.xyz = tmp0.xyz * vec3(srgb_const0.y) - vec3(srgb_const0.z);\n"); + shader_addline(buffer, "tmp1.xyz = gl_FragData[0].xyz * vec3(srgb_const0.w);\n"); + shader_addline(buffer, "bvec3 srgb_compare = lessThan(gl_FragData[0].xyz, vec3(srgb_const1.x));\n"); + shader_addline(buffer, "gl_FragData[0].xyz = mix(tmp0.xyz, tmp1.xyz, vec3(srgb_compare));\n"); + shader_addline(buffer, "gl_FragData[0] = clamp(gl_FragData[0], 0.0, 1.0);\n"); +} + +static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer, enum fogmode mode) +{ + switch (mode) + { + case FOG_OFF: + return; + + case FOG_LINEAR: + /* Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start) */ + shader_addline(buffer, "float Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start);\n"); + break; + + case FOG_EXP: + /* Fog = e^-(gl_Fog.density * gl_FogFragCoord) */ + shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_FogFragCoord);\n"); + break; + + case FOG_EXP2: + /* Fog = e^-((gl_Fog.density * gl_FogFragCoord)^2) */ + shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);\n"); + break; + + default: + ERR("Invalid fog mode %#x.\n", mode); + return; + } + + shader_addline(buffer, "gl_FragData[0].xyz = mix(gl_Fog.color.xyz, gl_FragData[0].xyz, clamp(Fog, 0.0, 1.0));\n"); +} + +/* Context activation is done by the caller. */ static void hardcode_local_constants(const struct wined3d_shader *shader, - const struct wined3d_gl_info *gl_info, GLhandleARB programId, char prefix) + const struct wined3d_gl_info *gl_info, GLhandleARB programId, const char *prefix) { const struct wined3d_shader_lconst *lconst; GLint tmp_loc; const float *value; - char glsl_name[8]; + char glsl_name[10]; LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry) { value = (const float *)lconst->value; - snprintf(glsl_name, sizeof(glsl_name), "%cLC%u", prefix, lconst->idx); + snprintf(glsl_name, sizeof(glsl_name), "%s_lc%u", prefix, lconst->idx); tmp_loc = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); GL_EXTCALL(glUniform4fvARB(tmp_loc, 1, value)); } checkGLcall("Hardcoding local constants"); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context, struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader, const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info) @@ -4023,21 +4494,16 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context shader_addline(buffer, "#version 120\n"); + if (gl_info->supported[ARB_SHADER_BIT_ENCODING]) + shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n"); if (gl_info->supported[ARB_SHADER_TEXTURE_LOD]) - { shader_addline(buffer, "#extension GL_ARB_shader_texture_lod : enable\n"); - } + /* The spec says that it doesn't have to be explicitly enabled, but the + * nvidia drivers write a warning if we don't do so. */ if (gl_info->supported[ARB_TEXTURE_RECTANGLE]) - { - /* The spec says that it doesn't have to be explicitly enabled, but the nvidia - * drivers write a warning if we don't do so - */ shader_addline(buffer, "#extension GL_ARB_texture_rectangle : enable\n"); - } if (gl_info->supported[EXT_GPU_SHADER4]) - { shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n"); - } /* Base Declarations */ shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx); @@ -4057,44 +4523,11 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context } if (args->srgb_correction) - { - shader_addline(buffer, "tmp0.xyz = pow(gl_FragData[0].xyz, vec3(srgb_const0.x));\n"); - shader_addline(buffer, "tmp0.xyz = tmp0.xyz * vec3(srgb_const0.y) - vec3(srgb_const0.z);\n"); - shader_addline(buffer, "tmp1.xyz = gl_FragData[0].xyz * vec3(srgb_const0.w);\n"); - shader_addline(buffer, "bvec3 srgb_compare = lessThan(gl_FragData[0].xyz, vec3(srgb_const1.x));\n"); - shader_addline(buffer, "gl_FragData[0].xyz = mix(tmp0.xyz, tmp1.xyz, vec3(srgb_compare));\n"); - shader_addline(buffer, "gl_FragData[0] = clamp(gl_FragData[0], 0.0, 1.0);\n"); - } - /* Pixel shader < 3.0 do not replace the fog stage. - * This implements linear fog computation and blending. - * TODO: non linear fog - * NOTE: gl_Fog.start and gl_Fog.end don't hold fog start s and end e but - * -1/(e-s) and e/(e-s) respectively. - */ + shader_glsl_generate_srgb_write_correction(buffer); + + /* SM < 3 does not replace the fog stage. */ if (reg_maps->shader_version.major < 3) - { - switch(args->fog) { - case FOG_OFF: break; - case FOG_LINEAR: - shader_addline(buffer, "float fogstart = -1.0 / (gl_Fog.end - gl_Fog.start);\n"); - shader_addline(buffer, "float fogend = gl_Fog.end * -fogstart;\n"); - shader_addline(buffer, "float Fog = clamp(gl_FogFragCoord * fogstart + fogend, 0.0, 1.0);\n"); - shader_addline(buffer, "gl_FragData[0].xyz = mix(gl_Fog.color.xyz, gl_FragData[0].xyz, Fog);\n"); - break; - case FOG_EXP: - /* Fog = e^(-gl_Fog.density * gl_FogFragCoord) */ - shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_FogFragCoord);\n"); - shader_addline(buffer, "Fog = clamp(Fog, 0.0, 1.0);\n"); - shader_addline(buffer, "gl_FragData[0].xyz = mix(gl_Fog.color.xyz, gl_FragData[0].xyz, Fog);\n"); - break; - case FOG_EXP2: - /* Fog = e^(-(gl_Fog.density * gl_FogFragCoord)^2) */ - shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);\n"); - shader_addline(buffer, "Fog = clamp(Fog, 0.0, 1.0);\n"); - shader_addline(buffer, "gl_FragData[0].xyz = mix(gl_Fog.color.xyz, gl_FragData[0].xyz, Fog);\n"); - break; - } - } + shader_glsl_generate_fog_code(buffer, args->fog); shader_addline(buffer, "}\n"); @@ -4105,7 +4538,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context return shader_obj; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context, struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader, const struct vs_compile_args *args) @@ -4120,6 +4553,8 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context shader_addline(buffer, "#version 120\n"); + if (gl_info->supported[ARB_SHADER_BIT_ENCODING]) + shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n"); if (gl_info->supported[EXT_GPU_SHADER4]) shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n"); @@ -4133,7 +4568,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx); /* Unpack outputs */ - shader_addline(buffer, "order_ps_input(OUT);\n"); + shader_addline(buffer, "order_ps_input(vs_out);\n"); /* The D3DRS_FOGTABLEMODE render state defines if the shader-generated fog coord is used * or if the fragment depth is used. If the fragment depth is used(FOGTABLEMODE != NONE), @@ -4175,16 +4610,48 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context return shader_obj; } +/* Context activation is done by the caller. */ +static GLhandleARB shader_glsl_generate_geometry_shader(const struct wined3d_context *context, + struct wined3d_shader_buffer *buffer, const struct wined3d_shader *shader) +{ + const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; + const struct wined3d_gl_info *gl_info = context->gl_info; + const DWORD *function = shader->function; + struct shader_glsl_ctx_priv priv_ctx; + GLhandleARB shader_id; + + shader_id = GL_EXTCALL(glCreateShaderObjectARB(GL_GEOMETRY_SHADER_ARB)); + + shader_addline(buffer, "#version 120\n"); + + if (gl_info->supported[ARB_GEOMETRY_SHADER4]) + shader_addline(buffer, "#extension GL_ARB_geometry_shader4 : enable\n"); + if (gl_info->supported[ARB_SHADER_BIT_ENCODING]) + shader_addline(buffer, "#extension GL_ARB_shader_bit_encoding : enable\n"); + if (gl_info->supported[EXT_GPU_SHADER4]) + shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n"); + + memset(&priv_ctx, 0, sizeof(priv_ctx)); + shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx); + shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx); + shader_addline(buffer, "}\n"); + + TRACE("Compiling shader object %u.\n", shader_id); + shader_glsl_compile(gl_info, shader_id, buffer->buffer); + + return shader_id; +} + static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info) { struct wined3d_state *state = &shader->device->stateBlock->state; + struct glsl_ps_compiled_shader *gl_shaders, *new_array; + struct glsl_shader_private *shader_data; + struct ps_np2fixup_info *np2fixup; UINT i; DWORD new_size; - struct glsl_ps_compiled_shader *new_array; - struct glsl_pshader_private *shader_data; - struct ps_np2fixup_info *np2fixup = NULL; GLhandleARB ret; if (!shader->backend_data) @@ -4197,6 +4664,7 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, } } shader_data = shader->backend_data; + gl_shaders = shader_data->gl_shaders.ps; /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2), * so a linear search is more performant than a hashmap or a binary search @@ -4204,10 +4672,11 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, */ for (i = 0; i < shader_data->num_gl_shaders; ++i) { - if (!memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args))) + if (!memcmp(&gl_shaders[i].args, args, sizeof(*args))) { - if (args->np2_fixup) *np2fixup_info = &shader_data->gl_shaders[i].np2fixup; - return shader_data->gl_shaders[i].prgId; + if (args->np2_fixup) + *np2fixup_info = &gl_shaders[i].np2fixup; + return gl_shaders[i].prgId; } } @@ -4216,10 +4685,12 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, if (shader_data->num_gl_shaders) { new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2); - new_array = HeapReAlloc(GetProcessHeap(), 0, shader_data->gl_shaders, - new_size * sizeof(*shader_data->gl_shaders)); - } else { - new_array = HeapAlloc(GetProcessHeap(), 0, sizeof(*shader_data->gl_shaders)); + new_array = HeapReAlloc(GetProcessHeap(), 0, shader_data->gl_shaders.ps, + new_size * sizeof(*gl_shaders)); + } + else + { + new_array = HeapAlloc(GetProcessHeap(), 0, sizeof(*gl_shaders)); new_size = 1; } @@ -4227,21 +4698,22 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, ERR("Out of memory\n"); return 0; } - shader_data->gl_shaders = new_array; + shader_data->gl_shaders.ps = new_array; shader_data->shader_array_size = new_size; + gl_shaders = new_array; } - shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; + gl_shaders[shader_data->num_gl_shaders].args = *args; - memset(&shader_data->gl_shaders[shader_data->num_gl_shaders].np2fixup, 0, sizeof(struct ps_np2fixup_info)); - if (args->np2_fixup) np2fixup = &shader_data->gl_shaders[shader_data->num_gl_shaders].np2fixup; + np2fixup = &gl_shaders[shader_data->num_gl_shaders].np2fixup; + memset(np2fixup, 0, sizeof(*np2fixup)); + *np2fixup_info = args->np2_fixup ? np2fixup : NULL; pixelshader_update_samplers(&shader->reg_maps, state->textures); shader_buffer_clear(buffer); ret = shader_glsl_generate_pshader(context, buffer, shader, args, np2fixup); - shader_data->gl_shaders[shader_data->num_gl_shaders++].prgId = ret; - *np2fixup_info = np2fixup; + gl_shaders[shader_data->num_gl_shaders++].prgId = ret; return ret; } @@ -4259,9 +4731,9 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, { UINT i; DWORD new_size; - struct glsl_vs_compiled_shader *new_array; DWORD use_map = shader->device->strided_streams.use_map; - struct glsl_vshader_private *shader_data; + struct glsl_vs_compiled_shader *gl_shaders, *new_array; + struct glsl_shader_private *shader_data; GLhandleARB ret; if (!shader->backend_data) @@ -4274,15 +4746,16 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, } } shader_data = shader->backend_data; + gl_shaders = shader_data->gl_shaders.vs; /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2), * so a linear search is more performant than a hashmap or a binary search * (cache coherency etc) */ - for(i = 0; i < shader_data->num_gl_shaders; i++) { - if(vs_args_equal(&shader_data->gl_shaders[i].args, args, use_map)) { - return shader_data->gl_shaders[i].prgId; - } + for (i = 0; i < shader_data->num_gl_shaders; ++i) + { + if (vs_args_equal(&gl_shaders[i].args, args, use_map)) + return gl_shaders[i].prgId; } TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader); @@ -4291,10 +4764,12 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, if (shader_data->num_gl_shaders) { new_size = shader_data->shader_array_size + max(1, shader_data->shader_array_size / 2); - new_array = HeapReAlloc(GetProcessHeap(), 0, shader_data->gl_shaders, - new_size * sizeof(*shader_data->gl_shaders)); - } else { - new_array = HeapAlloc(GetProcessHeap(), 0, sizeof(*shader_data->gl_shaders)); + new_array = HeapReAlloc(GetProcessHeap(), 0, shader_data->gl_shaders.vs, + new_size * sizeof(*gl_shaders)); + } + else + { + new_array = HeapAlloc(GetProcessHeap(), 0, sizeof(*gl_shaders)); new_size = 1; } @@ -4302,50 +4777,806 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, ERR("Out of memory\n"); return 0; } - shader_data->gl_shaders = new_array; + shader_data->gl_shaders.vs = new_array; shader_data->shader_array_size = new_size; + gl_shaders = new_array; } - shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; + gl_shaders[shader_data->num_gl_shaders].args = *args; shader_buffer_clear(buffer); ret = shader_glsl_generate_vshader(context, buffer, shader, args); - shader_data->gl_shaders[shader_data->num_gl_shaders++].prgId = ret; + gl_shaders[shader_data->num_gl_shaders++].prgId = ret; return ret; } -/** Sets the GLSL program ID for the given pixel and vertex shader combination. - * It sets the programId on the current StateBlock (because it should be called - * inside of the DrawPrimitive() part of the render loop). - * - * If a program for the given combination does not exist, create one, and store - * the program in the hash table. If it creates a program, it will link the - * given objects, too. - */ +static GLhandleARB find_glsl_geometry_shader(const struct wined3d_context *context, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader) +{ + struct glsl_gs_compiled_shader *gl_shaders; + struct glsl_shader_private *shader_data; + GLhandleARB ret; -/* GL locking is done by the caller */ -static void set_glsl_shader_program(const struct wined3d_context *context, - struct wined3d_device *device, BOOL use_ps, BOOL use_vs) + if (!shader->backend_data) + { + if (!(shader->backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)))) + { + ERR("Failed to allocate backend data.\n"); + return 0; + } + } + shader_data = shader->backend_data; + gl_shaders = shader_data->gl_shaders.gs; + + if (shader_data->num_gl_shaders) + return gl_shaders[0].id; + + TRACE("No matching GL shader found for shader %p, compiling a new shader.\n", shader); + + if (!(shader_data->gl_shaders.gs = HeapAlloc(GetProcessHeap(), 0, sizeof(*gl_shaders)))) + { + ERR("Failed to allocate GL shader array.\n"); + return 0; + } + shader_data->shader_array_size = 1; + gl_shaders = shader_data->gl_shaders.gs; + + shader_buffer_clear(buffer); + ret = shader_glsl_generate_geometry_shader(context, buffer, shader); + gl_shaders[shader_data->num_gl_shaders++].id = ret; + + return ret; +} + +static const char *shader_glsl_get_ffp_fragment_op_arg(struct wined3d_shader_buffer *buffer, + DWORD argnum, unsigned int stage, DWORD arg) +{ + const char *ret; + + if (arg == ARG_UNUSED) + return ""; + + switch (arg & WINED3DTA_SELECTMASK) + { + case WINED3DTA_DIFFUSE: + ret = "gl_Color"; + break; + + case WINED3DTA_CURRENT: + if (!stage) + ret = "gl_Color"; + else + ret = "ret"; + break; + + case WINED3DTA_TEXTURE: + switch (stage) + { + case 0: ret = "tex0"; break; + case 1: ret = "tex1"; break; + case 2: ret = "tex2"; break; + case 3: ret = "tex3"; break; + case 4: ret = "tex4"; break; + case 5: ret = "tex5"; break; + case 6: ret = "tex6"; break; + case 7: ret = "tex7"; break; + default: + ret = ""; + break; + } + break; + + case WINED3DTA_TFACTOR: + ret = "tex_factor"; + break; + + case WINED3DTA_SPECULAR: + ret = "gl_SecondaryColor"; + break; + + case WINED3DTA_TEMP: + ret = "temp_reg"; + break; + + case WINED3DTA_CONSTANT: + FIXME("Per-stage constants not implemented.\n"); + switch (stage) + { + case 0: ret = "const0"; break; + case 1: ret = "const1"; break; + case 2: ret = "const2"; break; + case 3: ret = "const3"; break; + case 4: ret = "const4"; break; + case 5: ret = "const5"; break; + case 6: ret = "const6"; break; + case 7: ret = "const7"; break; + default: + ret = ""; + break; + } + break; + + default: + return ""; + } + + if (arg & WINED3DTA_COMPLEMENT) + { + shader_addline(buffer, "arg%u = vec4(1.0) - %s;\n", argnum, ret); + if (argnum == 0) + ret = "arg0"; + else if (argnum == 1) + ret = "arg1"; + else if (argnum == 2) + ret = "arg2"; + } + + if (arg & WINED3DTA_ALPHAREPLICATE) + { + shader_addline(buffer, "arg%u = vec4(%s.w);\n", argnum, ret); + if (argnum == 0) + ret = "arg0"; + else if (argnum == 1) + ret = "arg1"; + else if (argnum == 2) + ret = "arg2"; + } + + return ret; +} + +static void shader_glsl_ffp_fragment_op(struct wined3d_shader_buffer *buffer, unsigned int stage, BOOL color, + BOOL alpha, DWORD dst, DWORD op, DWORD dw_arg0, DWORD dw_arg1, DWORD dw_arg2) +{ + const char *dstmask, *dstreg, *arg0, *arg1, *arg2; + + if (color && alpha) + dstmask = ""; + else if (color) + dstmask = ".xyz"; + else + dstmask = ".w"; + + if (dst == tempreg) + dstreg = "temp_reg"; + else + dstreg = "ret"; + + arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, dw_arg0); + arg1 = shader_glsl_get_ffp_fragment_op_arg(buffer, 1, stage, dw_arg1); + arg2 = shader_glsl_get_ffp_fragment_op_arg(buffer, 2, stage, dw_arg2); + + switch (op) + { + case WINED3D_TOP_DISABLE: + if (!stage) + shader_addline(buffer, "%s%s = gl_Color%s;\n", dstreg, dstmask, dstmask); + break; + + case WINED3D_TOP_SELECT_ARG1: + shader_addline(buffer, "%s%s = %s%s;\n", dstreg, dstmask, arg1, dstmask); + break; + + case WINED3D_TOP_SELECT_ARG2: + shader_addline(buffer, "%s%s = %s%s;\n", dstreg, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_MODULATE: + shader_addline(buffer, "%s%s = %s%s * %s%s;\n", dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_MODULATE_4X: + shader_addline(buffer, "%s%s = clamp(%s%s * %s%s * 4.0, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_MODULATE_2X: + shader_addline(buffer, "%s%s = clamp(%s%s * %s%s * 2.0, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_ADD: + shader_addline(buffer, "%s%s = clamp(%s%s + %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_ADD_SIGNED: + shader_addline(buffer, "%s%s = clamp(%s%s + (%s - vec4(0.5))%s, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_ADD_SIGNED_2X: + shader_addline(buffer, "%s%s = clamp((%s%s + (%s - vec4(0.5))%s) * 2.0, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_SUBTRACT: + shader_addline(buffer, "%s%s = clamp(%s%s - %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask); + break; + + case WINED3D_TOP_ADD_SMOOTH: + shader_addline(buffer, "%s%s = clamp((vec4(1.0) - %s)%s * %s%s + %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask, arg1, dstmask); + break; + + case WINED3D_TOP_BLEND_DIFFUSE_ALPHA: + arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, WINED3DTA_DIFFUSE); + shader_addline(buffer, "%s%s = mix(%s%s, %s%s, %s.w);\n", + dstreg, dstmask, arg2, dstmask, arg1, dstmask, arg0); + break; + + case WINED3D_TOP_BLEND_TEXTURE_ALPHA: + arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, WINED3DTA_TEXTURE); + shader_addline(buffer, "%s%s = mix(%s%s, %s%s, %s.w);\n", + dstreg, dstmask, arg2, dstmask, arg1, dstmask, arg0); + break; + + case WINED3D_TOP_BLEND_FACTOR_ALPHA: + arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, WINED3DTA_TFACTOR); + shader_addline(buffer, "%s%s = mix(%s%s, %s%s, %s.w);\n", + dstreg, dstmask, arg2, dstmask, arg1, dstmask, arg0); + break; + + case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM: + arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, WINED3DTA_TEXTURE); + shader_addline(buffer, "%s%s = clamp(%s%s * (1.0 - %s.w) + %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg2, dstmask, arg0, arg1, dstmask); + break; + + case WINED3D_TOP_BLEND_CURRENT_ALPHA: + arg0 = shader_glsl_get_ffp_fragment_op_arg(buffer, 0, stage, WINED3DTA_CURRENT); + shader_addline(buffer, "%s%s = mix(%s%s, %s%s, %s.w);\n", + dstreg, dstmask, arg2, dstmask, arg1, dstmask, arg0); + break; + + case WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR: + shader_addline(buffer, "%s%s = clamp(%s%s * %s.w + %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg2, dstmask, arg1, arg1, dstmask); + break; + + case WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA: + shader_addline(buffer, "%s%s = clamp(%s%s * %s%s + %s.w, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask, arg1); + break; + + case WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR: + shader_addline(buffer, "%s%s = clamp(%s%s * (1.0 - %s.w) + %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg2, dstmask, arg1, arg1, dstmask); + break; + case WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA: + shader_addline(buffer, "%s%s = clamp((vec4(1.0) - %s)%s * %s%s + %s.w, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask, arg1); + break; + + case WINED3D_TOP_BUMPENVMAP: + case WINED3D_TOP_BUMPENVMAP_LUMINANCE: + /* These are handled in the first pass, nothing to do. */ + break; + + case WINED3D_TOP_DOTPRODUCT3: + shader_addline(buffer, "%s%s = vec4(clamp(dot(%s.xyz - 0.5, %s.xyz - 0.5) * 4.0, 0.0, 1.0))%s;\n", + dstreg, dstmask, arg1, arg2, dstmask); + break; + + case WINED3D_TOP_MULTIPLY_ADD: + shader_addline(buffer, "%s%s = clamp(%s%s * %s%s + %s%s, 0.0, 1.0);\n", + dstreg, dstmask, arg1, dstmask, arg2, dstmask, arg0, dstmask); + break; + + case WINED3D_TOP_LERP: + /* MSDN isn't quite right here. */ + shader_addline(buffer, "%s%s = mix(%s%s, %s%s, %s%s);\n", + dstreg, dstmask, arg2, dstmask, arg1, dstmask, arg0, dstmask); + break; + + default: + FIXME("Unhandled operation %#x.\n", op); + break; + } +} + +/* Context activation is done by the caller. */ +static GLuint shader_glsl_generate_ffp_fragment_shader(struct wined3d_shader_buffer *buffer, + const struct ffp_frag_settings *settings, const struct wined3d_gl_info *gl_info) +{ + BOOL tempreg_used = FALSE, tfactor_used = FALSE; + BYTE lum_map = 0, bump_map = 0, tex_map = 0; + const char *final_combiner_src = "ret"; + UINT lowest_disabled_stage; + GLhandleARB shader_obj; + DWORD arg0, arg1, arg2; + unsigned int stage; + + shader_buffer_clear(buffer); + + /* Find out which textures are read */ + for (stage = 0; stage < MAX_TEXTURES; ++stage) + { + if (settings->op[stage].cop == WINED3D_TOP_DISABLE) + break; + + arg0 = settings->op[stage].carg0 & WINED3DTA_SELECTMASK; + arg1 = settings->op[stage].carg1 & WINED3DTA_SELECTMASK; + arg2 = settings->op[stage].carg2 & WINED3DTA_SELECTMASK; + + if (arg0 == WINED3DTA_TEXTURE || arg1 == WINED3DTA_TEXTURE || arg2 == WINED3DTA_TEXTURE) + tex_map |= 1 << stage; + if (arg0 == WINED3DTA_TFACTOR || arg1 == WINED3DTA_TFACTOR || arg2 == WINED3DTA_TFACTOR) + tfactor_used = TRUE; + if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP) + tempreg_used = TRUE; + if (settings->op[stage].dst == tempreg) + tempreg_used = TRUE; + + switch (settings->op[stage].cop) + { + case WINED3D_TOP_BUMPENVMAP_LUMINANCE: + lum_map |= 1 << stage; + /* fall through */ + case WINED3D_TOP_BUMPENVMAP: + bump_map |= 1 << stage; + /* fall through */ + case WINED3D_TOP_BLEND_TEXTURE_ALPHA: + case WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM: + tex_map |= 1 << stage; + break; + + case WINED3D_TOP_BLEND_FACTOR_ALPHA: + tfactor_used = TRUE; + break; + + default: + break; + } + + if (settings->op[stage].aop == WINED3D_TOP_DISABLE) + continue; + + arg0 = settings->op[stage].aarg0 & WINED3DTA_SELECTMASK; + arg1 = settings->op[stage].aarg1 & WINED3DTA_SELECTMASK; + arg2 = settings->op[stage].aarg2 & WINED3DTA_SELECTMASK; + + if (arg0 == WINED3DTA_TEXTURE || arg1 == WINED3DTA_TEXTURE || arg2 == WINED3DTA_TEXTURE) + tex_map |= 1 << stage; + if (arg0 == WINED3DTA_TFACTOR || arg1 == WINED3DTA_TFACTOR || arg2 == WINED3DTA_TFACTOR) + tfactor_used = TRUE; + if (arg0 == WINED3DTA_TEMP || arg1 == WINED3DTA_TEMP || arg2 == WINED3DTA_TEMP) + tempreg_used = TRUE; + } + lowest_disabled_stage = stage; + + shader_addline(buffer, "#version 120\n"); + + shader_addline(buffer, "vec4 tmp0, tmp1;\n"); + shader_addline(buffer, "vec4 ret;\n"); + if (tempreg_used || settings->sRGB_write) + shader_addline(buffer, "vec4 temp_reg;\n"); + shader_addline(buffer, "vec4 arg0, arg1, arg2;\n"); + + for (stage = 0; stage < MAX_TEXTURES; ++stage) + { + if (!(tex_map & (1 << stage))) + continue; + + switch (settings->op[stage].tex_type) + { + case tex_1d: + shader_addline(buffer, "uniform sampler1D ps_sampler%u;\n", stage); + break; + case tex_2d: + shader_addline(buffer, "uniform sampler2D ps_sampler%u;\n", stage); + break; + case tex_3d: + shader_addline(buffer, "uniform sampler3D ps_sampler%u;\n", stage); + break; + case tex_cube: + shader_addline(buffer, "uniform samplerCube ps_sampler%u;\n", stage); + break; + case tex_rect: + shader_addline(buffer, "uniform sampler2DRect ps_sampler%u;\n", stage); + break; + default: + FIXME("Unhandled sampler type %#x.\n", settings->op[stage].tex_type); + break; + } + + shader_addline(buffer, "vec4 tex%u;\n", stage); + + if (!(bump_map & (1 << stage))) + continue; + shader_addline(buffer, "uniform mat2 bumpenv_mat%u;\n", stage); + + if (!(lum_map & (1 << stage))) + continue; + shader_addline(buffer, "uniform float bumpenv_lum_scale%u;\n", stage); + shader_addline(buffer, "uniform float bumpenv_lum_offset%u;\n", stage); + } + if (tfactor_used) + shader_addline(buffer, "uniform vec4 tex_factor;\n"); + shader_addline(buffer, "uniform vec4 specular_enable;\n"); + + if (settings->sRGB_write) + { + shader_addline(buffer, "const vec4 srgb_const0 = vec4(%.8e, %.8e, %.8e, %.8e);\n", + srgb_pow, srgb_mul_high, srgb_sub_high, srgb_mul_low); + shader_addline(buffer, "const vec4 srgb_const1 = vec4(%.8e, 0.0, 0.0, 0.0);\n", + srgb_cmp); + } + + shader_addline(buffer, "void main()\n{\n"); + + if (lowest_disabled_stage < 7 && settings->emul_clipplanes) + shader_addline(buffer, "if (any(lessThan(gl_texCoord[7], vec4(0.0)))) discard;\n"); + + /* Generate texture sampling instructions) */ + for (stage = 0; stage < MAX_TEXTURES && settings->op[stage].cop != WINED3D_TOP_DISABLE; ++stage) + { + const char *texture_function, *coord_mask; + char tex_reg_name[8]; + BOOL proj, clamp; + + if (!(tex_map & (1 << stage))) + continue; + + if (settings->op[stage].projected == proj_none) + { + proj = FALSE; + } + else if (settings->op[stage].projected == proj_count4 + || settings->op[stage].projected == proj_count3) + { + proj = TRUE; + } + else + { + FIXME("Unexpected projection mode %d\n", settings->op[stage].projected); + proj = TRUE; + } + + if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP + || settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE) + clamp = FALSE; + else + clamp = TRUE; + + switch (settings->op[stage].tex_type) + { + case tex_1d: + if (proj) + { + texture_function = "texture1DProj"; + coord_mask = "xw"; + } + else + { + texture_function = "texture1D"; + coord_mask = "x"; + } + break; + case tex_2d: + if (proj) + { + texture_function = "texture2DProj"; + coord_mask = "xyw"; + } + else + { + texture_function = "texture2D"; + coord_mask = "xy"; + } + break; + case tex_3d: + if (proj) + { + texture_function = "texture3DProj"; + coord_mask = "xyzw"; + } + else + { + texture_function = "texture3D"; + coord_mask = "xyz"; + } + break; + case tex_cube: + texture_function = "textureCube"; + coord_mask = "xyz"; + break; + case tex_rect: + if (proj) + { + texture_function = "texture2DRectProj"; + coord_mask = "xyw"; + } + else + { + texture_function = "texture2DRect"; + coord_mask = "xy"; + } + break; + default: + FIXME("Unhandled texture type %#x.\n", settings->op[stage].tex_type); + texture_function = ""; + coord_mask = "xyzw"; + break; + } + + if (stage > 0 + && (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP + || settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)) + { + shader_addline(buffer, "ret.xy = bumpenv_mat%u * tex%u.xy;\n", stage - 1, stage - 1); + + /* With projective textures, texbem only divides the static + * texture coord, not the displacement, so multiply the + * displacement with the dividing parameter before passing it to + * TXP. */ + if (settings->op[stage].projected != proj_none) + { + if (settings->op[stage].projected == proj_count4) + { + shader_addline(buffer, "ret.xy = (ret.xy * gl_TexCoord[%u].w) + gl_TexCoord[%u].xy;\n", + stage, stage); + shader_addline(buffer, "ret.zw = gl_TexCoord[%u].ww;\n", stage); + } + else + { + shader_addline(buffer, "ret.xy = (ret.xy * gl_TexCoord[%u].z) + gl_TexCoord[%u].xy;\n", + stage, stage); + shader_addline(buffer, "ret.zw = gl_TexCoord[%u].zz;\n", stage); + } + } + else + { + shader_addline(buffer, "ret = gl_TexCoord[%u] + ret.xyxy;\n", stage); + } + + if (clamp) + shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, ret.%s), 0.0, 1.0);\n", + stage, texture_function, stage, coord_mask); + else + shader_addline(buffer, "tex%u = %s(ps_sampler%u, ret.%s);\n", + stage, texture_function, stage, coord_mask); + + if (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE) + shader_addline(buffer, "tex%u *= clamp(tex%u.z * bumpenv_lum_scale%u + bumpenv_lum_offset%u, 0.0, 1.0);\n", + stage, stage - 1, stage - 1, stage - 1); + } + else if (settings->op[stage].projected == proj_count3) + { + if (clamp) + shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, gl_TexCoord[%u].xyz), 0.0, 1.0);\n", + stage, texture_function, stage, stage); + else + shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].xyz);\n", + stage, texture_function, stage, stage); + } + else + { + if (clamp) + shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, gl_TexCoord[%u].%s), 0.0, 1.0);\n", + stage, texture_function, stage, stage, coord_mask); + else + shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].%s);\n", + stage, texture_function, stage, stage, coord_mask); + } + + sprintf(tex_reg_name, "tex%u", stage); + shader_glsl_color_correction_ext(buffer, tex_reg_name, WINED3DSP_WRITEMASK_ALL, + settings->op[stage].color_fixup); + } + + /* Generate the main shader */ + for (stage = 0; stage < MAX_TEXTURES; ++stage) + { + BOOL op_equal; + + if (settings->op[stage].cop == WINED3D_TOP_DISABLE) + { + if (!stage) + final_combiner_src = "gl_Color"; + break; + } + + if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG1 + && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG1) + op_equal = settings->op[stage].carg1 == settings->op[stage].aarg1; + else if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG1 + && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG2) + op_equal = settings->op[stage].carg1 == settings->op[stage].aarg2; + else if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG2 + && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG1) + op_equal = settings->op[stage].carg2 == settings->op[stage].aarg1; + else if (settings->op[stage].cop == WINED3D_TOP_SELECT_ARG2 + && settings->op[stage].aop == WINED3D_TOP_SELECT_ARG2) + op_equal = settings->op[stage].carg2 == settings->op[stage].aarg2; + else + op_equal = settings->op[stage].aop == settings->op[stage].cop + && settings->op[stage].carg0 == settings->op[stage].aarg0 + && settings->op[stage].carg1 == settings->op[stage].aarg1 + && settings->op[stage].carg2 == settings->op[stage].aarg2; + + if (settings->op[stage].aop == WINED3D_TOP_DISABLE) + { + shader_glsl_ffp_fragment_op(buffer, stage, TRUE, FALSE, settings->op[stage].dst, + settings->op[stage].cop, settings->op[stage].carg0, + settings->op[stage].carg1, settings->op[stage].carg2); + if (!stage) + shader_addline(buffer, "ret.w = gl_Color.w;\n"); + } + else if (op_equal) + { + shader_glsl_ffp_fragment_op(buffer, stage, TRUE, TRUE, settings->op[stage].dst, + settings->op[stage].cop, settings->op[stage].carg0, + settings->op[stage].carg1, settings->op[stage].carg2); + } + else + { + shader_glsl_ffp_fragment_op(buffer, stage, TRUE, FALSE, settings->op[stage].dst, + settings->op[stage].cop, settings->op[stage].carg0, + settings->op[stage].carg1, settings->op[stage].carg2); + shader_glsl_ffp_fragment_op(buffer, stage, FALSE, TRUE, settings->op[stage].dst, + settings->op[stage].aop, settings->op[stage].aarg0, + settings->op[stage].aarg1, settings->op[stage].aarg2); + } + } + + shader_addline(buffer, "gl_FragData[0] = gl_SecondaryColor * specular_enable + %s;\n", final_combiner_src); + + if (settings->sRGB_write) + shader_glsl_generate_srgb_write_correction(buffer); + + shader_glsl_generate_fog_code(buffer, settings->fog); + + shader_addline(buffer, "}\n"); + + shader_obj = GL_EXTCALL(glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB)); + shader_glsl_compile(gl_info, shader_obj, buffer->buffer); + return shader_obj; +} + +static struct glsl_ffp_fragment_shader *shader_glsl_find_ffp_fragment_shader(struct shader_glsl_priv *priv, + const struct wined3d_gl_info *gl_info, const struct ffp_frag_settings *args) +{ + struct glsl_ffp_fragment_shader *glsl_desc; + const struct ffp_frag_desc *desc; + + if ((desc = find_ffp_frag_shader(&priv->ffp_fragment_shaders, args))) + return CONTAINING_RECORD(desc, struct glsl_ffp_fragment_shader, entry); + + if (!(glsl_desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*glsl_desc)))) + return NULL; + + glsl_desc->entry.settings = *args; + glsl_desc->id = shader_glsl_generate_ffp_fragment_shader(&priv->shader_buffer, args, gl_info); + list_init(&glsl_desc->linked_programs); + add_ffp_frag_shader(&priv->ffp_fragment_shaders, &glsl_desc->entry); + + return glsl_desc; +} + + +static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info *gl_info, + GLhandleARB program_id, struct glsl_vs_program *vs) +{ + unsigned int i; + char name[32]; + + vs->uniform_f_locations = HeapAlloc(GetProcessHeap(), 0, + sizeof(GLhandleARB) * gl_info->limits.glsl_vs_float_constants); + for (i = 0; i < gl_info->limits.glsl_vs_float_constants; ++i) + { + snprintf(name, sizeof(name), "vs_c[%u]", i); + vs->uniform_f_locations[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + } + + for (i = 0; i < MAX_CONST_I; ++i) + { + snprintf(name, sizeof(name), "vs_i[%u]", i); + vs->uniform_i_locations[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + } + + vs->pos_fixup_location = GL_EXTCALL(glGetUniformLocationARB(program_id, "posFixup")); +} + +static void shader_glsl_init_ps_uniform_locations(const struct wined3d_gl_info *gl_info, + GLhandleARB program_id, struct glsl_ps_program *ps) +{ + unsigned int i; + char name[32]; + + ps->uniform_f_locations = HeapAlloc(GetProcessHeap(), 0, + sizeof(GLhandleARB) * gl_info->limits.glsl_ps_float_constants); + for (i = 0; i < gl_info->limits.glsl_ps_float_constants; ++i) + { + snprintf(name, sizeof(name), "ps_c[%u]", i); + ps->uniform_f_locations[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + } + + for (i = 0; i < MAX_CONST_I; ++i) + { + snprintf(name, sizeof(name), "ps_i[%u]", i); + ps->uniform_i_locations[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + } + + for (i = 0; i < MAX_TEXTURES; ++i) + { + snprintf(name, sizeof(name), "bumpenv_mat%u", i); + ps->bumpenv_mat_location[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + snprintf(name, sizeof(name), "bumpenv_lum_scale%u", i); + ps->bumpenv_lum_scale_location[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + snprintf(name, sizeof(name), "bumpenv_lum_offset%u", i); + ps->bumpenv_lum_offset_location[i] = GL_EXTCALL(glGetUniformLocationARB(program_id, name)); + } + + ps->tex_factor_location = GL_EXTCALL(glGetUniformLocationARB(program_id, "tex_factor")); + ps->specular_enable_location = GL_EXTCALL(glGetUniformLocationARB(program_id, "specular_enable")); + ps->np2_fixup_location = GL_EXTCALL(glGetUniformLocationARB(program_id, "ps_samplerNP2Fixup")); + ps->ycorrection_location = GL_EXTCALL(glGetUniformLocationARB(program_id, "ycorrection")); +} + +/* Context activation is done by the caller. */ +static void set_glsl_shader_program(const struct wined3d_context *context, struct wined3d_device *device, + enum wined3d_shader_mode vertex_mode, enum wined3d_shader_mode fragment_mode) { const struct wined3d_state *state = &device->stateBlock->state; - struct wined3d_shader *vshader = use_vs ? state->vertex_shader : NULL; - struct wined3d_shader *pshader = use_ps ? state->pixel_shader : NULL; const struct wined3d_gl_info *gl_info = context->gl_info; + const struct ps_np2fixup_info *np2fixup_info = NULL; struct shader_glsl_priv *priv = device->shader_priv; - struct glsl_shader_prog_link *entry = NULL; + struct glsl_shader_prog_link *entry = NULL; + struct wined3d_shader *vshader = NULL; + struct wined3d_shader *gshader = NULL; + struct wined3d_shader *pshader = NULL; GLhandleARB programId = 0; GLhandleARB reorder_shader_id = 0; unsigned int i; - char glsl_name[8]; struct ps_compile_args ps_compile_args; struct vs_compile_args vs_compile_args; + GLhandleARB vs_id, gs_id, ps_id; + struct list *ps_list; - if (vshader) find_vs_compile_args(state, vshader, &vs_compile_args); - if (pshader) find_ps_compile_args(state, pshader, &ps_compile_args); + if (vertex_mode == WINED3D_SHADER_MODE_SHADER) + { + vshader = state->vertex_shader; + find_vs_compile_args(state, vshader, &vs_compile_args); + vs_id = find_glsl_vshader(context, &priv->shader_buffer, vshader, &vs_compile_args); - entry = get_glsl_program_entry(priv, vshader, pshader, &vs_compile_args, &ps_compile_args); - if (entry) + if ((gshader = state->geometry_shader)) + gs_id = find_glsl_geometry_shader(context, &priv->shader_buffer, gshader); + else + gs_id = 0; + } + else + { + vs_id = 0; + gs_id = 0; + } + + if (fragment_mode == WINED3D_SHADER_MODE_SHADER) + { + pshader = state->pixel_shader; + find_ps_compile_args(state, pshader, &ps_compile_args); + ps_id = find_glsl_pshader(context, &priv->shader_buffer, + pshader, &ps_compile_args, &np2fixup_info); + ps_list = &pshader->linked_programs; + } + else if (fragment_mode == WINED3D_SHADER_MODE_FFP && priv->fragment_pipe == &glsl_fragment_pipe) + { + struct glsl_ffp_fragment_shader *ffp_shader; + struct ffp_frag_settings settings; + + gen_ffp_frag_op(device, state, &settings, FALSE); + ffp_shader = shader_glsl_find_ffp_fragment_shader(priv, gl_info, &settings); + ps_id = ffp_shader->id; + ps_list = &ffp_shader->linked_programs; + } + else + { + ps_id = 0; + } + + if ((!vs_id && !gs_id && !ps_id) || (entry = get_glsl_program_entry(priv, vs_id, gs_id, ps_id))) { priv->glsl_program = entry; return; @@ -4358,12 +5589,11 @@ static void set_glsl_shader_program(const struct wined3d_context *context, /* Create the entry */ entry = HeapAlloc(GetProcessHeap(), 0, sizeof(struct glsl_shader_prog_link)); entry->programId = programId; - entry->vshader = vshader; - entry->pshader = pshader; - entry->vs_args = vs_compile_args; - entry->ps_args = ps_compile_args; + entry->vs.id = vs_id; + entry->gs.id = gs_id; + entry->ps.id = ps_id; entry->constant_version = 0; - entry->np2Fixup_info = NULL; + entry->ps.np2_fixup_info = np2fixup_info; /* Add the hash table entry */ add_glsl_program_entry(priv, entry); @@ -4373,7 +5603,6 @@ static void set_glsl_shader_program(const struct wined3d_context *context, /* Attach GLSL vshader */ if (vshader) { - GLhandleARB vshader_id = find_glsl_vshader(context, &priv->shader_buffer, vshader, &vs_compile_args); WORD map = vshader->reg_maps.input_registers; char tmp_name[10]; @@ -4386,8 +5615,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context, */ GL_EXTCALL(glDeleteObjectARB(reorder_shader_id)); - TRACE("Attaching GLSL shader object %u to program %u\n", vshader_id, programId); - GL_EXTCALL(glAttachObjectARB(programId, vshader_id)); + TRACE("Attaching GLSL shader object %u to program %u.\n", vs_id, programId); + GL_EXTCALL(glAttachObjectARB(programId, vs_id)); checkGLcall("glAttachObjectARB"); /* Bind vertex attributes to a corresponding index number to match @@ -4403,24 +5632,43 @@ static void set_glsl_shader_program(const struct wined3d_context *context, { if (!(map & 1)) continue; - snprintf(tmp_name, sizeof(tmp_name), "attrib%u", i); + snprintf(tmp_name, sizeof(tmp_name), "vs_in%u", i); GL_EXTCALL(glBindAttribLocationARB(programId, i, tmp_name)); } checkGLcall("glBindAttribLocationARB"); - list_add_head(&vshader->linked_programs, &entry->vshader_entry); + list_add_head(&vshader->linked_programs, &entry->vs.shader_entry); + } + + if (gshader) + { + TRACE("Attaching GLSL geometry shader object %u to program %u.\n", gs_id, programId); + GL_EXTCALL(glAttachObjectARB(programId, gs_id)); + checkGLcall("glAttachObjectARB"); + + TRACE("input type %s, output type %s, vertices out %u.\n", + debug_d3dprimitivetype(gshader->u.gs.input_type), + debug_d3dprimitivetype(gshader->u.gs.output_type), + gshader->u.gs.vertices_out); + GL_EXTCALL(glProgramParameteriARB(programId, GL_GEOMETRY_INPUT_TYPE_ARB, + gl_primitive_type_from_d3d(gshader->u.gs.input_type))); + GL_EXTCALL(glProgramParameteriARB(programId, GL_GEOMETRY_OUTPUT_TYPE_ARB, + gl_primitive_type_from_d3d(gshader->u.gs.output_type))); + GL_EXTCALL(glProgramParameteriARB(programId, GL_GEOMETRY_VERTICES_OUT_ARB, + gshader->u.gs.vertices_out)); + checkGLcall("glProgramParameteriARB"); + + list_add_head(&gshader->linked_programs, &entry->gs.shader_entry); } /* Attach GLSL pshader */ - if (pshader) + if (ps_id) { - GLhandleARB pshader_id = find_glsl_pshader(context, &priv->shader_buffer, - pshader, &ps_compile_args, &entry->np2Fixup_info); - TRACE("Attaching GLSL shader object %u to program %u\n", pshader_id, programId); - GL_EXTCALL(glAttachObjectARB(programId, pshader_id)); + TRACE("Attaching GLSL shader object %u to program %u.\n", ps_id, programId); + GL_EXTCALL(glAttachObjectARB(programId, ps_id)); checkGLcall("glAttachObjectARB"); - list_add_head(&pshader->linked_programs, &entry->pshader_entry); + list_add_head(ps_list, &entry->ps.shader_entry); } /* Link the program */ @@ -4428,63 +5676,19 @@ static void set_glsl_shader_program(const struct wined3d_context *context, GL_EXTCALL(glLinkProgramARB(programId)); shader_glsl_validate_link(gl_info, programId); - entry->vuniformF_locations = HeapAlloc(GetProcessHeap(), 0, - sizeof(GLhandleARB) * gl_info->limits.glsl_vs_float_constants); - for (i = 0; i < gl_info->limits.glsl_vs_float_constants; ++i) - { - snprintf(glsl_name, sizeof(glsl_name), "VC[%i]", i); - entry->vuniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); - } - for (i = 0; i < MAX_CONST_I; ++i) - { - snprintf(glsl_name, sizeof(glsl_name), "VI[%i]", i); - entry->vuniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); - } - entry->puniformF_locations = HeapAlloc(GetProcessHeap(), 0, - sizeof(GLhandleARB) * gl_info->limits.glsl_ps_float_constants); - for (i = 0; i < gl_info->limits.glsl_ps_float_constants; ++i) - { - snprintf(glsl_name, sizeof(glsl_name), "PC[%i]", i); - entry->puniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); - } - for (i = 0; i < MAX_CONST_I; ++i) - { - snprintf(glsl_name, sizeof(glsl_name), "PI[%i]", i); - entry->puniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); - } - - if(pshader) { - char name[32]; - - for(i = 0; i < MAX_TEXTURES; i++) { - sprintf(name, "bumpenvmat%u", i); - entry->bumpenvmat_location[i] = GL_EXTCALL(glGetUniformLocationARB(programId, name)); - sprintf(name, "luminancescale%u", i); - entry->luminancescale_location[i] = GL_EXTCALL(glGetUniformLocationARB(programId, name)); - sprintf(name, "luminanceoffset%u", i); - entry->luminanceoffset_location[i] = GL_EXTCALL(glGetUniformLocationARB(programId, name)); - } - - if (ps_compile_args.np2_fixup) { - if (entry->np2Fixup_info) { - entry->np2Fixup_location = GL_EXTCALL(glGetUniformLocationARB(programId, "PsamplerNP2Fixup")); - } else { - FIXME("NP2 texcoord fixup needed for this pixelshader, but no fixup uniform found.\n"); - } - } - } - - entry->posFixup_location = GL_EXTCALL(glGetUniformLocationARB(programId, "posFixup")); - entry->ycorrection_location = GL_EXTCALL(glGetUniformLocationARB(programId, "ycorrection")); + shader_glsl_init_vs_uniform_locations(gl_info, programId, &entry->vs); + shader_glsl_init_ps_uniform_locations(gl_info, programId, &entry->ps); checkGLcall("Find glsl program uniform locations"); if (pshader && pshader->reg_maps.shader_version.major >= 3 && pshader->u.ps.declared_in_count > vec4_varyings(3, gl_info)) { TRACE("Shader %d needs vertex color clamping disabled\n", programId); - entry->vertex_color_clamp = GL_FALSE; - } else { - entry->vertex_color_clamp = GL_FIXED_ONLY_ARB; + entry->vs.vertex_color_clamp = GL_FALSE; + } + else + { + entry->vs.vertex_color_clamp = GL_FIXED_ONLY_ARB; } /* Set the shader to allow uniform loading on it */ @@ -4499,20 +5703,20 @@ static void set_glsl_shader_program(const struct wined3d_context *context, * fixed function fragment processing setups. So once the program is linked these samplers * won't change. */ - if (vshader) shader_glsl_load_vsamplers(gl_info, device->texUnitMap, programId); - if (pshader) shader_glsl_load_psamplers(gl_info, device->texUnitMap, programId); + shader_glsl_load_vsamplers(gl_info, device->texUnitMap, programId); + shader_glsl_load_psamplers(gl_info, device->texUnitMap, programId); /* If the local constants do not have to be loaded with the environment constants, * load them now to have them hardcoded in the GLSL program. This saves some CPU cycles * later */ if (pshader && !pshader->load_local_constsF) - hardcode_local_constants(pshader, gl_info, programId, 'P'); + hardcode_local_constants(pshader, gl_info, programId, "ps"); if (vshader && !vshader->load_local_constsF) - hardcode_local_constants(vshader, gl_info, programId, 'V'); + hardcode_local_constants(vshader, gl_info, programId, "vs"); } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info, enum tex_types tex_type, BOOL masked) { GLhandleARB program_id; @@ -4622,8 +5826,9 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info, return program_id; } -/* GL locking is done by the caller */ -static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) +/* Context activation is done by the caller. */ +static void shader_glsl_select(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode, + enum wined3d_shader_mode fragment_mode) { const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_device *device = context->swapchain->device; @@ -4631,13 +5836,9 @@ static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS GLhandleARB program_id = 0; GLenum old_vertex_color_clamp, current_vertex_color_clamp; - old_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vertex_color_clamp : GL_FIXED_ONLY_ARB; - - if (useVS || usePS) set_glsl_shader_program(context, device, usePS, useVS); - else priv->glsl_program = NULL; - - current_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vertex_color_clamp : GL_FIXED_ONLY_ARB; - + old_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vs.vertex_color_clamp : GL_FIXED_ONLY_ARB; + set_glsl_shader_program(context, device, vertex_mode, fragment_mode); + current_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vs.vertex_color_clamp : GL_FIXED_ONLY_ARB; if (old_vertex_color_clamp != current_vertex_color_clamp) { if (gl_info->supported[ARB_COLOR_BUFFER_FLOAT]) @@ -4659,13 +5860,13 @@ static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS /* In case that NP2 texcoord fixup data is found for the selected program, trigger a reload of the * constants. This has to be done because it can't be guaranteed that sampler() (from state.c) is * called between selecting the shader and using it, which results in wrong fixup for some frames. */ - if (priv->glsl_program && priv->glsl_program->np2Fixup_info) + if (priv->glsl_program && priv->glsl_program->ps.np2_fixup_info) { shader_glsl_load_np2fixup_constants(priv, gl_info, &device->stateBlock->state); } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info, enum tex_types tex_type, const SIZE *ds_mask_size) { @@ -4694,7 +5895,7 @@ static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d } } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void shader_glsl_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) { struct shader_glsl_priv *priv = shader_priv; @@ -4709,103 +5910,105 @@ static void shader_glsl_deselect_depth_blt(void *shader_priv, const struct wined static void shader_glsl_destroy(struct wined3d_shader *shader) { + struct glsl_shader_private *shader_data = shader->backend_data; struct wined3d_device *device = shader->device; struct shader_glsl_priv *priv = device->shader_priv; const struct wined3d_gl_info *gl_info; const struct list *linked_programs; struct wined3d_context *context; - char pshader = shader_is_pshader_version(shader->reg_maps.shader_version.type); - - if (pshader) + if (!shader_data || !shader_data->num_gl_shaders) { - struct glsl_pshader_private *shader_data = shader->backend_data; - - if (!shader_data || !shader_data->num_gl_shaders) - { - HeapFree(GetProcessHeap(), 0, shader_data); - shader->backend_data = NULL; - return; - } - - context = context_acquire(device, NULL); - gl_info = context->gl_info; - - if (priv->glsl_program && priv->glsl_program->pshader == shader) - { - ENTER_GL(); - shader_glsl_select(context, FALSE, FALSE); - LEAVE_GL(); - } - } - else - { - struct glsl_vshader_private *shader_data = shader->backend_data; - - if (!shader_data || !shader_data->num_gl_shaders) - { - HeapFree(GetProcessHeap(), 0, shader_data); - shader->backend_data = NULL; - return; - } - - context = context_acquire(device, NULL); - gl_info = context->gl_info; - - if (priv->glsl_program && priv->glsl_program->vshader == shader) - { - ENTER_GL(); - shader_glsl_select(context, FALSE, FALSE); - LEAVE_GL(); - } + HeapFree(GetProcessHeap(), 0, shader_data); + shader->backend_data = NULL; + return; } + context = context_acquire(device, NULL); + gl_info = context->gl_info; + + TRACE("Deleting linked programs.\n"); linked_programs = &shader->linked_programs; - - TRACE("Deleting linked programs\n"); - if (linked_programs->next) { + if (linked_programs->next) + { struct glsl_shader_prog_link *entry, *entry2; - - ENTER_GL(); - if(pshader) { - LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs, struct glsl_shader_prog_link, pshader_entry) { - delete_glsl_program_entry(priv, gl_info, entry); - } - } else { - LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs, struct glsl_shader_prog_link, vshader_entry) { - delete_glsl_program_entry(priv, gl_info, entry); - } - } - LEAVE_GL(); - } - - if (pshader) - { - struct glsl_pshader_private *shader_data = shader->backend_data; UINT i; - ENTER_GL(); - for(i = 0; i < shader_data->num_gl_shaders; i++) { - TRACE("deleting pshader %u\n", shader_data->gl_shaders[i].prgId); - GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId)); - checkGLcall("glDeleteObjectARB"); - } - LEAVE_GL(); - HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders); - } - else - { - struct glsl_vshader_private *shader_data = shader->backend_data; - UINT i; + switch (shader->reg_maps.shader_version.type) + { + case WINED3D_SHADER_TYPE_PIXEL: + { + struct glsl_ps_compiled_shader *gl_shaders = shader_data->gl_shaders.ps; - ENTER_GL(); - for(i = 0; i < shader_data->num_gl_shaders; i++) { - TRACE("deleting vshader %u\n", shader_data->gl_shaders[i].prgId); - GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId)); - checkGLcall("glDeleteObjectARB"); + LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs, + struct glsl_shader_prog_link, ps.shader_entry) + { + delete_glsl_program_entry(priv, gl_info, entry); + } + + for (i = 0; i < shader_data->num_gl_shaders; ++i) + { + TRACE("Deleting pixel shader %u.\n", gl_shaders[i].prgId); + if (priv->glsl_program && priv->glsl_program->ps.id == gl_shaders[i].prgId) + shader_glsl_select(context, WINED3D_SHADER_MODE_NONE, WINED3D_SHADER_MODE_NONE); + GL_EXTCALL(glDeleteObjectARB(gl_shaders[i].prgId)); + checkGLcall("glDeleteObjectARB"); + } + HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders.ps); + + break; + } + + case WINED3D_SHADER_TYPE_VERTEX: + { + struct glsl_vs_compiled_shader *gl_shaders = shader_data->gl_shaders.vs; + + LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs, + struct glsl_shader_prog_link, vs.shader_entry) + { + delete_glsl_program_entry(priv, gl_info, entry); + } + + for (i = 0; i < shader_data->num_gl_shaders; ++i) + { + TRACE("Deleting vertex shader %u.\n", gl_shaders[i].prgId); + if (priv->glsl_program && priv->glsl_program->vs.id == gl_shaders[i].prgId) + shader_glsl_select(context, WINED3D_SHADER_MODE_NONE, WINED3D_SHADER_MODE_NONE); + GL_EXTCALL(glDeleteObjectARB(gl_shaders[i].prgId)); + checkGLcall("glDeleteObjectARB"); + } + HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders.vs); + + break; + } + + case WINED3D_SHADER_TYPE_GEOMETRY: + { + struct glsl_gs_compiled_shader *gl_shaders = shader_data->gl_shaders.gs; + + LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, linked_programs, + struct glsl_shader_prog_link, gs.shader_entry) + { + delete_glsl_program_entry(priv, gl_info, entry); + } + + for (i = 0; i < shader_data->num_gl_shaders; ++i) + { + TRACE("Deleting geometry shader %u.\n", gl_shaders[i].id); + if (priv->glsl_program && priv->glsl_program->gs.id == gl_shaders[i].id) + shader_glsl_select(context, WINED3D_SHADER_MODE_NONE, WINED3D_SHADER_MODE_NONE); + GL_EXTCALL(glDeleteObjectARB(gl_shaders[i].id)); + checkGLcall("glDeleteObjectARB"); + } + HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders.gs); + + break; + } + + default: + ERR("Unhandled shader type %#x.\n", shader->reg_maps.shader_version.type); + break; } - LEAVE_GL(); - HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders); } HeapFree(GetProcessHeap(), 0, shader->backend_data); @@ -4819,16 +6022,15 @@ static int glsl_program_key_compare(const void *key, const struct wine_rb_entry const struct glsl_program_key *k = key; const struct glsl_shader_prog_link *prog = WINE_RB_ENTRY_VALUE(entry, const struct glsl_shader_prog_link, program_lookup_entry); - int cmp; - if (k->vshader > prog->vshader) return 1; - else if (k->vshader < prog->vshader) return -1; + if (k->vs_id > prog->vs.id) return 1; + else if (k->vs_id < prog->vs.id) return -1; - if (k->pshader > prog->pshader) return 1; - else if (k->pshader < prog->pshader) return -1; + if (k->gs_id > prog->gs.id) return 1; + else if (k->gs_id < prog->gs.id) return -1; - if (k->vshader && (cmp = memcmp(&k->vs_args, &prog->vs_args, sizeof(prog->vs_args)))) return cmp; - if (k->pshader && (cmp = memcmp(&k->ps_args, &prog->ps_args, sizeof(prog->ps_args)))) return cmp; + if (k->ps_id > prog->ps.id) return 1; + else if (k->ps_id < prog->ps.id) return -1; return 0; } @@ -4865,12 +6067,21 @@ static const struct wine_rb_functions wined3d_glsl_program_rb_functions = glsl_program_key_compare, }; -static HRESULT shader_glsl_alloc(struct wined3d_device *device) +static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct fragment_pipeline *fragment_pipe) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct shader_glsl_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_glsl_priv)); SIZE_T stack_size = wined3d_log2i(max(gl_info->limits.glsl_vs_float_constants, gl_info->limits.glsl_ps_float_constants)) + 1; + struct fragment_caps fragment_caps; + void *fragment_priv; + + if (!(fragment_priv = fragment_pipe->alloc_private(&glsl_shader_backend, priv))) + { + ERR("Failed to initialize fragment pipe.\n"); + HeapFree(GetProcessHeap(), 0, priv); + return E_FAIL; + } if (!shader_buffer_init(&priv->shader_buffer)) { @@ -4904,6 +6115,10 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device) } priv->next_constant_version = 1; + fragment_pipe->get_caps(gl_info, &fragment_caps); + priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL; + device->fragment_priv = fragment_priv; + priv->fragment_pipe = fragment_pipe; device->shader_priv = priv; return WINED3D_OK; @@ -4913,6 +6128,7 @@ fail: constant_heap_free(&priv->vconst_heap); HeapFree(GetProcessHeap(), 0, priv->stack); shader_buffer_free(&priv->shader_buffer); + fragment_pipe->free_private(device); HeapFree(GetProcessHeap(), 0, priv); return E_OUTOFMEMORY; } @@ -4924,7 +6140,6 @@ static void shader_glsl_free(struct wined3d_device *device) struct shader_glsl_priv *priv = device->shader_priv; int i; - ENTER_GL(); for (i = 0; i < tex_type_count; ++i) { if (priv->depth_blt_program_full[i]) @@ -4936,13 +6151,13 @@ static void shader_glsl_free(struct wined3d_device *device) GL_EXTCALL(glDeleteObjectARB(priv->depth_blt_program_masked[i])); } } - LEAVE_GL(); wine_rb_destroy(&priv->program_lookup, NULL, NULL); constant_heap_free(&priv->pconst_heap); constant_heap_free(&priv->vconst_heap); HeapFree(GetProcessHeap(), 0, priv->stack); shader_buffer_free(&priv->shader_buffer); + priv->fragment_pipe->free_private(device); HeapFree(GetProcessHeap(), 0, device->shader_priv); device->shader_priv = NULL; @@ -4952,27 +6167,26 @@ static void shader_glsl_context_destroyed(void *shader_priv, const struct wined3 static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps) { - if (gl_info->supported[EXT_GPU_SHADER4] && gl_info->supported[ARB_GEOMETRY_SHADER4] - && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50)) - { - caps->VertexShaderVersion = 4; - caps->PixelShaderVersion = 4; - } + UINT shader_model; + + if (gl_info->supported[EXT_GPU_SHADER4] && gl_info->supported[ARB_SHADER_BIT_ENCODING] + && gl_info->supported[ARB_GEOMETRY_SHADER4] && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 50) + && gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX] && gl_info->supported[ARB_DRAW_INSTANCED]) + shader_model = 4; /* ARB_shader_texture_lod or EXT_gpu_shader4 is required for the SM3 * texldd and texldl instructions. */ else if (gl_info->supported[ARB_SHADER_TEXTURE_LOD] || gl_info->supported[EXT_GPU_SHADER4]) - { - caps->VertexShaderVersion = 3; - caps->PixelShaderVersion = 3; - } + shader_model = 3; else - { - caps->VertexShaderVersion = 2; - caps->PixelShaderVersion = 2; - } + shader_model = 2; + TRACE("Shader model %u.\n", shader_model); - caps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants; - caps->MaxPixelShaderConst = gl_info->limits.glsl_ps_float_constants; + caps->vs_version = min(wined3d_settings.max_sm_vs, shader_model); + caps->gs_version = min(wined3d_settings.max_sm_gs, shader_model); + caps->ps_version = min(wined3d_settings.max_sm_ps, shader_model); + + caps->vs_uniform_count = gl_info->limits.glsl_vs_float_constants; + caps->ps_uniform_count = gl_info->limits.glsl_ps_float_constants; /* FIXME: The following line is card dependent. -8.0 to 8.0 is the * Direct3D minimum requirement. @@ -4986,12 +6200,13 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s * the shader will generate incorrect results too. Unfortunately, GL deliberately doesn't * offer a way to query this. */ - caps->PixelShader1xMaxValue = 8.0; + caps->ps_1x_max_value = 8.0; - caps->VSClipping = TRUE; - - TRACE("Hardware vertex shader version %u enabled (GLSL).\n", caps->VertexShaderVersion); - TRACE("Hardware pixel shader version %u enabled (GLSL).\n", caps->PixelShaderVersion); + /* Ideally we'd only set caps like sRGB writes here if supported by both + * the shader backend and the fragment pipe, but we can get called before + * shader_glsl_alloc(). */ + caps->wined3d_caps = WINED3D_SHADER_CAP_VS_CLIPPING + | WINED3D_SHADER_CAP_SRGB_WRITE; } static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup) @@ -5015,113 +6230,117 @@ static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup) static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TABLE_SIZE] = { - /* WINED3DSIH_ABS */ shader_glsl_map2gl, - /* WINED3DSIH_ADD */ shader_glsl_arith, - /* WINED3DSIH_AND */ NULL, - /* WINED3DSIH_BEM */ shader_glsl_bem, - /* WINED3DSIH_BREAK */ shader_glsl_break, - /* WINED3DSIH_BREAKC */ shader_glsl_breakc, - /* WINED3DSIH_BREAKP */ NULL, - /* WINED3DSIH_CALL */ shader_glsl_call, - /* WINED3DSIH_CALLNZ */ shader_glsl_callnz, - /* WINED3DSIH_CMP */ shader_glsl_cmp, - /* WINED3DSIH_CND */ shader_glsl_cnd, - /* WINED3DSIH_CRS */ shader_glsl_cross, - /* WINED3DSIH_CUT */ NULL, - /* WINED3DSIH_DCL */ NULL, - /* WINED3DSIH_DEF */ NULL, - /* WINED3DSIH_DEFB */ NULL, - /* WINED3DSIH_DEFI */ NULL, - /* WINED3DSIH_DIV */ NULL, - /* WINED3DSIH_DP2ADD */ shader_glsl_dp2add, - /* WINED3DSIH_DP3 */ shader_glsl_dot, - /* WINED3DSIH_DP4 */ shader_glsl_dot, - /* WINED3DSIH_DST */ shader_glsl_dst, - /* WINED3DSIH_DSX */ shader_glsl_map2gl, - /* WINED3DSIH_DSY */ shader_glsl_map2gl, - /* WINED3DSIH_ELSE */ shader_glsl_else, - /* WINED3DSIH_EMIT */ NULL, - /* WINED3DSIH_ENDIF */ shader_glsl_end, - /* WINED3DSIH_ENDLOOP */ shader_glsl_end, - /* WINED3DSIH_ENDREP */ shader_glsl_end, - /* WINED3DSIH_EQ */ NULL, - /* WINED3DSIH_EXP */ shader_glsl_map2gl, - /* WINED3DSIH_EXPP */ shader_glsl_expp, - /* WINED3DSIH_FRC */ shader_glsl_map2gl, - /* WINED3DSIH_FTOI */ NULL, - /* WINED3DSIH_GE */ NULL, - /* WINED3DSIH_IADD */ NULL, - /* WINED3DSIH_IEQ */ NULL, - /* WINED3DSIH_IF */ shader_glsl_if, - /* WINED3DSIH_IFC */ shader_glsl_ifc, - /* WINED3DSIH_IGE */ NULL, - /* WINED3DSIH_IMUL */ NULL, - /* WINED3DSIH_ITOF */ NULL, - /* WINED3DSIH_LABEL */ shader_glsl_label, - /* WINED3DSIH_LD */ NULL, - /* WINED3DSIH_LIT */ shader_glsl_lit, - /* WINED3DSIH_LOG */ shader_glsl_log, - /* WINED3DSIH_LOGP */ shader_glsl_log, - /* WINED3DSIH_LOOP */ shader_glsl_loop, - /* WINED3DSIH_LRP */ shader_glsl_lrp, - /* WINED3DSIH_LT */ NULL, - /* WINED3DSIH_M3x2 */ shader_glsl_mnxn, - /* WINED3DSIH_M3x3 */ shader_glsl_mnxn, - /* WINED3DSIH_M3x4 */ shader_glsl_mnxn, - /* WINED3DSIH_M4x3 */ shader_glsl_mnxn, - /* WINED3DSIH_M4x4 */ shader_glsl_mnxn, - /* WINED3DSIH_MAD */ shader_glsl_mad, - /* WINED3DSIH_MAX */ shader_glsl_map2gl, - /* WINED3DSIH_MIN */ shader_glsl_map2gl, - /* WINED3DSIH_MOV */ shader_glsl_mov, - /* WINED3DSIH_MOVA */ shader_glsl_mov, - /* WINED3DSIH_MOVC */ NULL, - /* WINED3DSIH_MUL */ shader_glsl_arith, - /* WINED3DSIH_NOP */ NULL, - /* WINED3DSIH_NRM */ shader_glsl_nrm, - /* WINED3DSIH_PHASE */ NULL, - /* WINED3DSIH_POW */ shader_glsl_pow, - /* WINED3DSIH_RCP */ shader_glsl_rcp, - /* WINED3DSIH_REP */ shader_glsl_rep, - /* WINED3DSIH_RET */ shader_glsl_ret, - /* WINED3DSIH_ROUND_NI */ NULL, - /* WINED3DSIH_RSQ */ shader_glsl_rsq, - /* WINED3DSIH_SAMPLE */ NULL, - /* WINED3DSIH_SAMPLE_GRAD */ NULL, - /* WINED3DSIH_SAMPLE_LOD */ NULL, - /* WINED3DSIH_SETP */ NULL, - /* WINED3DSIH_SGE */ shader_glsl_compare, - /* WINED3DSIH_SGN */ shader_glsl_sgn, - /* WINED3DSIH_SINCOS */ shader_glsl_sincos, - /* WINED3DSIH_SLT */ shader_glsl_compare, - /* WINED3DSIH_SQRT */ NULL, - /* WINED3DSIH_SUB */ shader_glsl_arith, - /* WINED3DSIH_TEX */ shader_glsl_tex, - /* WINED3DSIH_TEXBEM */ shader_glsl_texbem, - /* WINED3DSIH_TEXBEML */ shader_glsl_texbem, - /* WINED3DSIH_TEXCOORD */ shader_glsl_texcoord, - /* WINED3DSIH_TEXDEPTH */ shader_glsl_texdepth, - /* WINED3DSIH_TEXDP3 */ shader_glsl_texdp3, - /* WINED3DSIH_TEXDP3TEX */ shader_glsl_texdp3tex, - /* WINED3DSIH_TEXKILL */ shader_glsl_texkill, - /* WINED3DSIH_TEXLDD */ shader_glsl_texldd, - /* WINED3DSIH_TEXLDL */ shader_glsl_texldl, - /* WINED3DSIH_TEXM3x2DEPTH */ shader_glsl_texm3x2depth, - /* WINED3DSIH_TEXM3x2PAD */ shader_glsl_texm3x2pad, - /* WINED3DSIH_TEXM3x2TEX */ shader_glsl_texm3x2tex, - /* WINED3DSIH_TEXM3x3 */ shader_glsl_texm3x3, - /* WINED3DSIH_TEXM3x3DIFF */ NULL, - /* WINED3DSIH_TEXM3x3PAD */ shader_glsl_texm3x3pad, - /* WINED3DSIH_TEXM3x3SPEC */ shader_glsl_texm3x3spec, - /* WINED3DSIH_TEXM3x3TEX */ shader_glsl_texm3x3tex, - /* WINED3DSIH_TEXM3x3VSPEC */ shader_glsl_texm3x3vspec, - /* WINED3DSIH_TEXREG2AR */ shader_glsl_texreg2ar, - /* WINED3DSIH_TEXREG2GB */ shader_glsl_texreg2gb, - /* WINED3DSIH_TEXREG2RGB */ shader_glsl_texreg2rgb, - /* WINED3DSIH_UDIV */ NULL, - /* WINED3DSIH_USHR */ NULL, - /* WINED3DSIH_UTOF */ NULL, - /* WINED3DSIH_XOR */ NULL, + /* WINED3DSIH_ABS */ shader_glsl_map2gl, + /* WINED3DSIH_ADD */ shader_glsl_binop, + /* WINED3DSIH_AND */ shader_glsl_binop, + /* WINED3DSIH_BEM */ shader_glsl_bem, + /* WINED3DSIH_BREAK */ shader_glsl_break, + /* WINED3DSIH_BREAKC */ shader_glsl_breakc, + /* WINED3DSIH_BREAKP */ shader_glsl_breakp, + /* WINED3DSIH_CALL */ shader_glsl_call, + /* WINED3DSIH_CALLNZ */ shader_glsl_callnz, + /* WINED3DSIH_CMP */ shader_glsl_conditional_move, + /* WINED3DSIH_CND */ shader_glsl_cnd, + /* WINED3DSIH_CRS */ shader_glsl_cross, + /* WINED3DSIH_CUT */ shader_glsl_cut, + /* WINED3DSIH_DCL */ shader_glsl_nop, + /* WINED3DSIH_DCL_CONSTANT_BUFFER */ shader_glsl_nop, + /* WINED3DSIH_DCL_INPUT_PRIMITIVE */ shader_glsl_nop, + /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ shader_glsl_nop, + /* WINED3DSIH_DCL_VERTICES_OUT */ shader_glsl_nop, + /* WINED3DSIH_DEF */ shader_glsl_nop, + /* WINED3DSIH_DEFB */ shader_glsl_nop, + /* WINED3DSIH_DEFI */ shader_glsl_nop, + /* WINED3DSIH_DIV */ shader_glsl_binop, + /* WINED3DSIH_DP2ADD */ shader_glsl_dp2add, + /* WINED3DSIH_DP3 */ shader_glsl_dot, + /* WINED3DSIH_DP4 */ shader_glsl_dot, + /* WINED3DSIH_DST */ shader_glsl_dst, + /* WINED3DSIH_DSX */ shader_glsl_map2gl, + /* WINED3DSIH_DSY */ shader_glsl_map2gl, + /* WINED3DSIH_ELSE */ shader_glsl_else, + /* WINED3DSIH_EMIT */ shader_glsl_emit, + /* WINED3DSIH_ENDIF */ shader_glsl_end, + /* WINED3DSIH_ENDLOOP */ shader_glsl_end, + /* WINED3DSIH_ENDREP */ shader_glsl_end, + /* WINED3DSIH_EQ */ shader_glsl_relop, + /* WINED3DSIH_EXP */ shader_glsl_map2gl, + /* WINED3DSIH_EXPP */ shader_glsl_expp, + /* WINED3DSIH_FRC */ shader_glsl_map2gl, + /* WINED3DSIH_FTOI */ shader_glsl_to_int, + /* WINED3DSIH_GE */ shader_glsl_relop, + /* WINED3DSIH_IADD */ shader_glsl_binop, + /* WINED3DSIH_IEQ */ NULL, + /* WINED3DSIH_IF */ shader_glsl_if, + /* WINED3DSIH_IFC */ shader_glsl_ifc, + /* WINED3DSIH_IGE */ shader_glsl_relop, + /* WINED3DSIH_IMUL */ shader_glsl_imul, + /* WINED3DSIH_ITOF */ shader_glsl_to_float, + /* WINED3DSIH_LABEL */ shader_glsl_label, + /* WINED3DSIH_LD */ NULL, + /* WINED3DSIH_LIT */ shader_glsl_lit, + /* WINED3DSIH_LOG */ shader_glsl_log, + /* WINED3DSIH_LOGP */ shader_glsl_log, + /* WINED3DSIH_LOOP */ shader_glsl_loop, + /* WINED3DSIH_LRP */ shader_glsl_lrp, + /* WINED3DSIH_LT */ shader_glsl_relop, + /* WINED3DSIH_M3x2 */ shader_glsl_mnxn, + /* WINED3DSIH_M3x3 */ shader_glsl_mnxn, + /* WINED3DSIH_M3x4 */ shader_glsl_mnxn, + /* WINED3DSIH_M4x3 */ shader_glsl_mnxn, + /* WINED3DSIH_M4x4 */ shader_glsl_mnxn, + /* WINED3DSIH_MAD */ shader_glsl_mad, + /* WINED3DSIH_MAX */ shader_glsl_map2gl, + /* WINED3DSIH_MIN */ shader_glsl_map2gl, + /* WINED3DSIH_MOV */ shader_glsl_mov, + /* WINED3DSIH_MOVA */ shader_glsl_mov, + /* WINED3DSIH_MOVC */ shader_glsl_conditional_move, + /* WINED3DSIH_MUL */ shader_glsl_binop, + /* WINED3DSIH_NOP */ shader_glsl_nop, + /* WINED3DSIH_NRM */ shader_glsl_nrm, + /* WINED3DSIH_PHASE */ shader_glsl_nop, + /* WINED3DSIH_POW */ shader_glsl_pow, + /* WINED3DSIH_RCP */ shader_glsl_rcp, + /* WINED3DSIH_REP */ shader_glsl_rep, + /* WINED3DSIH_RET */ shader_glsl_ret, + /* WINED3DSIH_ROUND_NI */ shader_glsl_map2gl, + /* WINED3DSIH_RSQ */ shader_glsl_rsq, + /* WINED3DSIH_SAMPLE */ NULL, + /* WINED3DSIH_SAMPLE_GRAD */ NULL, + /* WINED3DSIH_SAMPLE_LOD */ NULL, + /* WINED3DSIH_SETP */ NULL, + /* WINED3DSIH_SGE */ shader_glsl_compare, + /* WINED3DSIH_SGN */ shader_glsl_sgn, + /* WINED3DSIH_SINCOS */ shader_glsl_sincos, + /* WINED3DSIH_SLT */ shader_glsl_compare, + /* WINED3DSIH_SQRT */ NULL, + /* WINED3DSIH_SUB */ shader_glsl_binop, + /* WINED3DSIH_TEX */ shader_glsl_tex, + /* WINED3DSIH_TEXBEM */ shader_glsl_texbem, + /* WINED3DSIH_TEXBEML */ shader_glsl_texbem, + /* WINED3DSIH_TEXCOORD */ shader_glsl_texcoord, + /* WINED3DSIH_TEXDEPTH */ shader_glsl_texdepth, + /* WINED3DSIH_TEXDP3 */ shader_glsl_texdp3, + /* WINED3DSIH_TEXDP3TEX */ shader_glsl_texdp3tex, + /* WINED3DSIH_TEXKILL */ shader_glsl_texkill, + /* WINED3DSIH_TEXLDD */ shader_glsl_texldd, + /* WINED3DSIH_TEXLDL */ shader_glsl_texldl, + /* WINED3DSIH_TEXM3x2DEPTH */ shader_glsl_texm3x2depth, + /* WINED3DSIH_TEXM3x2PAD */ shader_glsl_texm3x2pad, + /* WINED3DSIH_TEXM3x2TEX */ shader_glsl_texm3x2tex, + /* WINED3DSIH_TEXM3x3 */ shader_glsl_texm3x3, + /* WINED3DSIH_TEXM3x3DIFF */ NULL, + /* WINED3DSIH_TEXM3x3PAD */ shader_glsl_texm3x3pad, + /* WINED3DSIH_TEXM3x3SPEC */ shader_glsl_texm3x3spec, + /* WINED3DSIH_TEXM3x3TEX */ shader_glsl_texm3x3tex, + /* WINED3DSIH_TEXM3x3VSPEC */ shader_glsl_texm3x3vspec, + /* WINED3DSIH_TEXREG2AR */ shader_glsl_texreg2ar, + /* WINED3DSIH_TEXREG2GB */ shader_glsl_texreg2gb, + /* WINED3DSIH_TEXREG2RGB */ shader_glsl_texreg2rgb, + /* WINED3DSIH_UDIV */ shader_glsl_udiv, + /* WINED3DSIH_USHR */ shader_glsl_binop, + /* WINED3DSIH_UTOF */ shader_glsl_to_float, + /* WINED3DSIH_XOR */ shader_glsl_binop, }; static void shader_glsl_handle_instruction(const struct wined3d_shader_instruction *ins) { @@ -5141,6 +6360,13 @@ static void shader_glsl_handle_instruction(const struct wined3d_shader_instructi shader_glsl_add_instruction_modifiers(ins); } +static BOOL shader_glsl_has_ffp_proj_control(void *shader_priv) +{ + struct shader_glsl_priv *priv = shader_priv; + + return priv->ffp_proj_control; +} + const struct wined3d_shader_backend_ops glsl_shader_backend = { shader_glsl_handle_instruction, @@ -5157,4 +6383,309 @@ const struct wined3d_shader_backend_ops glsl_shader_backend = shader_glsl_context_destroyed, shader_glsl_get_caps, shader_glsl_color_fixup_supported, + shader_glsl_has_ffp_proj_control, +}; + +static void glsl_fragment_pipe_enable(const struct wined3d_gl_info *gl_info, BOOL enable) +{ + /* Nothing to do. */ +} + +static void glsl_fragment_pipe_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) +{ + caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL + | WINED3D_FRAGMENT_CAP_SRGB_WRITE; + caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; + caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE + | WINED3DTEXOPCAPS_SELECTARG1 + | WINED3DTEXOPCAPS_SELECTARG2 + | WINED3DTEXOPCAPS_MODULATE4X + | WINED3DTEXOPCAPS_MODULATE2X + | WINED3DTEXOPCAPS_MODULATE + | WINED3DTEXOPCAPS_ADDSIGNED2X + | WINED3DTEXOPCAPS_ADDSIGNED + | WINED3DTEXOPCAPS_ADD + | WINED3DTEXOPCAPS_SUBTRACT + | WINED3DTEXOPCAPS_ADDSMOOTH + | WINED3DTEXOPCAPS_BLENDCURRENTALPHA + | WINED3DTEXOPCAPS_BLENDFACTORALPHA + | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA + | WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA + | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM + | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR + | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA + | WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA + | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR + | WINED3DTEXOPCAPS_DOTPRODUCT3 + | WINED3DTEXOPCAPS_MULTIPLYADD + | WINED3DTEXOPCAPS_LERP + | WINED3DTEXOPCAPS_BUMPENVMAP + | WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE; + caps->MaxTextureBlendStages = 8; + caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8); +} + +static void *glsl_fragment_pipe_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) +{ + struct shader_glsl_priv *priv; + + if (shader_backend == &glsl_shader_backend) + { + priv = shader_priv; + + if (wine_rb_init(&priv->ffp_fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1) + { + ERR("Failed to initialize rbtree.\n"); + return NULL; + } + + return priv; + } + + FIXME("GLSL fragment pipe without GLSL shader backend not implemented.\n"); + + return NULL; +} + +struct glsl_ffp_destroy_ctx +{ + struct shader_glsl_priv *priv; + const struct wined3d_gl_info *gl_info; +}; + +static void shader_glsl_free_ffp_fragment_shader(struct wine_rb_entry *entry, void *context) +{ + struct glsl_ffp_fragment_shader *shader = WINE_RB_ENTRY_VALUE(entry, + struct glsl_ffp_fragment_shader, entry.entry); + struct glsl_shader_prog_link *program, *program2; + struct glsl_ffp_destroy_ctx *ctx = context; + + LIST_FOR_EACH_ENTRY_SAFE(program, program2, &shader->linked_programs, + struct glsl_shader_prog_link, ps.shader_entry) + { + delete_glsl_program_entry(ctx->priv, ctx->gl_info, program); + } + ctx->gl_info->gl_ops.ext.p_glDeleteObjectARB(shader->id); + HeapFree(GetProcessHeap(), 0, shader); +} + +/* Context activation is done by the caller. */ +static void glsl_fragment_pipe_free(struct wined3d_device *device) +{ + struct shader_glsl_priv *priv = device->fragment_priv; + struct glsl_ffp_destroy_ctx ctx; + + ctx.priv = priv; + ctx.gl_info = &device->adapter->gl_info; + wine_rb_destroy(&priv->ffp_fragment_shaders, shader_glsl_free_ffp_fragment_shader, &ctx); +} + +static void glsl_fragment_pipe_shader(struct wined3d_context *context, + const struct wined3d_state *state, DWORD state_id) +{ + context->last_was_pshader = use_ps(state); + + context->select_shader = 1; + context->load_constants = 1; +} + +static void glsl_fragment_pipe_fog(struct wined3d_context *context, + const struct wined3d_state *state, DWORD state_id) +{ + BOOL use_vshader = use_vs(state); + enum fogsource new_source; + + context->select_shader = 1; + context->load_constants = 1; + + if (!state->render_states[WINED3D_RS_FOGENABLE]) + return; + + if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) + { + if (use_vshader) + new_source = FOGSOURCE_VS; + else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE || context->last_was_rhw) + new_source = FOGSOURCE_COORD; + else + new_source = FOGSOURCE_FFP; + } + else + { + new_source = FOGSOURCE_FFP; + } + + if (new_source != context->fog_source) + { + context->fog_source = new_source; + state_fogstartend(context, state, STATE_RENDER(WINED3D_RS_FOGSTART)); + } +} + +static void glsl_fragment_pipe_tex_transform(struct wined3d_context *context, + const struct wined3d_state *state, DWORD state_id) +{ + context->select_shader = 1; + context->load_constants = 1; +} + +static void glsl_fragment_pipe_invalidate_constants(struct wined3d_context *context, + const struct wined3d_state *state, DWORD state_id) +{ + context->load_constants = 1; +} + +static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] = +{ + {STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), {STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(0, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(1, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(2, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(3, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(4, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(5, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(6, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG1), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG2), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT01), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT10), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT11), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_MAT00), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LOFFSET), {STATE_TEXTURESTAGE(7, WINED3D_TSS_BUMPENV_LSCALE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_PIXELSHADER, {STATE_PIXELSHADER, glsl_fragment_pipe_shader }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), glsl_fragment_pipe_fog }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGSTART), {STATE_RENDER(WINED3D_RS_FOGSTART), state_fogstartend }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGEND), {STATE_RENDER(WINED3D_RS_FOGSTART), NULL }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), state_srgbwrite }, ARB_FRAMEBUFFER_SRGB}, + {STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), {STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGCOLOR), {STATE_RENDER(WINED3D_RS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_FOGDENSITY), {STATE_RENDER(WINED3D_RS_FOGDENSITY), state_fogdensity }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(0,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(1,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(2,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(3,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(3, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(4,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(4, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(5,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(5, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(6,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(6, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_TEXTURESTAGE(7,WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), {STATE_TEXTURESTAGE(7, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), glsl_fragment_pipe_tex_transform }, WINED3D_GL_EXT_NONE }, + {STATE_RENDER(WINED3D_RS_SPECULARENABLE), {STATE_RENDER(WINED3D_RS_SPECULARENABLE), glsl_fragment_pipe_invalidate_constants}, WINED3D_GL_EXT_NONE }, + {0 /* Terminate */, {0, 0 }, WINED3D_GL_EXT_NONE }, +}; + +const struct fragment_pipeline glsl_fragment_pipe = +{ + glsl_fragment_pipe_enable, + glsl_fragment_pipe_get_caps, + glsl_fragment_pipe_alloc, + glsl_fragment_pipe_free, + shader_glsl_color_fixup_supported, + glsl_fragment_pipe_state_template, }; diff --git a/reactos/dll/directx/wine/wined3d/nvidia_texture_shader.c b/reactos/dll/directx/wine/wined3d/nvidia_texture_shader.c index 015e3684892..648b1e3ec8b 100644 --- a/reactos/dll/directx/wine/wined3d/nvidia_texture_shader.c +++ b/reactos/dll/directx/wine/wined3d/nvidia_texture_shader.c @@ -19,17 +19,17 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include -//#include +#include +#include #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); -/* GL locking for state handlers is done by the caller. */ +/* Context activation for state handlers is done by the caller. */ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD stage, struct wined3d_context *context) { @@ -446,23 +446,26 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d case WINED3D_TOP_BUMPENVMAP_LUMINANCE: case WINED3D_TOP_BUMPENVMAP: - if (gl_info->supported[NV_TEXTURE_SHADER]) + if (!gl_info->supported[NV_TEXTURE_SHADER]) { - /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to - * perform bump mapping and source from the current stage. Pretty much a SELECTARG2. - * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1 - * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the next stage - */ - GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, - tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1])); - GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV, - GL_ZERO, GL_UNSIGNED_INVERT_NV, portion)); - /* Always pass through to CURRENT, ignore temp arg */ - GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV, - GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); + WARN("BUMPENVMAP requires GL_NV_texture_shader in this codepath\n"); break; } + /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to + * perform bump mapping and source from the current stage. Pretty much a SELECTARG2. + * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1 + * (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the + * next stage */ + GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV, + tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1])); + GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV, + GL_ZERO, GL_UNSIGNED_INVERT_NV, portion)); + /* Always pass through to CURRENT, ignore temp arg */ + GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV, + GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE)); + break; + default: FIXME("Unhandled texture op: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d.\n", stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx); @@ -649,7 +652,7 @@ static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable) } } -/* Context activation and GL locking are done by the caller. */ +/* Context activation is done by the caller. */ static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable) { nvrc_enable(gl_info, enable); @@ -667,6 +670,7 @@ static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable) static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { + caps->wined3d_caps = 0; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; /* The caps below can be supported but aren't handled yet in utils.c @@ -720,7 +724,11 @@ static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct caps->MaxSimultaneousTextures = gl_info->limits.textures; } -static HRESULT nvrc_fragment_alloc(struct wined3d_device *device) { return WINED3D_OK; } +static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) +{ + return shader_priv; +} + /* Context activation is done by the caller. */ static void nvrc_fragment_free(struct wined3d_device *device) {} @@ -891,7 +899,6 @@ const struct fragment_pipeline nvts_fragment_pipeline = { nvrc_fragment_free, nvts_color_fixup_supported, nvrc_fragmentstate_template, - FALSE /* we cannot disable projected textures. The vertex pipe has to do it */ }; const struct fragment_pipeline nvrc_fragment_pipeline = { @@ -901,5 +908,4 @@ const struct fragment_pipeline nvrc_fragment_pipeline = { nvrc_fragment_free, nvts_color_fixup_supported, nvrc_fragmentstate_template, - FALSE /* we cannot disable projected textures. The vertex pipe has to do it */ }; diff --git a/reactos/dll/directx/wine/wined3d/palette.c b/reactos/dll/directx/wine/wined3d/palette.c index 1d1220380f7..417b3acc0aa 100644 --- a/reactos/dll/directx/wine/wined3d/palette.c +++ b/reactos/dll/directx/wine/wined3d/palette.c @@ -18,12 +18,12 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -//#include "winerror.h" -//#include "wine/debug.h" +#include "config.h" +#include "wine/port.h" +#include "winerror.h" +#include "wine/debug.h" -//#include +#include #include "wined3d_private.h" @@ -199,10 +199,7 @@ HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, DWORD flags, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate palette memory.\n"); return E_OUTOFMEMORY; - } hr = wined3d_palette_init(object, device, flags, entries, parent); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/wined3d/query.c b/reactos/dll/directx/wine/wined3d/query.c index 25a67f48b65..a3a92464dfb 100644 --- a/reactos/dll/directx/wine/wined3d/query.c +++ b/reactos/dll/directx/wine/wined3d/query.c @@ -19,8 +19,8 @@ */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -61,8 +61,6 @@ static enum wined3d_event_query_result wined3d_event_query_test(const struct win context = context_acquire(device, query->context->current_rt); gl_info = context->gl_info; - ENTER_GL(); - if (gl_info->supported[ARB_SYNC]) { GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, 0, 0)); @@ -105,8 +103,6 @@ static enum wined3d_event_query_result wined3d_event_query_test(const struct win ret = WINED3D_EVENT_QUERY_ERROR; } - LEAVE_GL(); - context_release(context); return ret; } @@ -138,10 +134,12 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_ context = context_acquire(device, query->context->current_rt); - ENTER_GL(); if (gl_info->supported[ARB_SYNC]) { - GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, 0, ~(GLuint64)0)); + /* Apple seems to be into arbitrary limits, and timeouts larger than + * 0xfffffffffffffbff immediately return GL_TIMEOUT_EXPIRED. We don't + * really care and can live with waiting a few μs less. (OS X 10.7.4). */ + GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, GL_SYNC_FLUSH_COMMANDS_BIT, ~(GLuint64)0xffff)); checkGLcall("glClientWaitSync"); switch (gl_ret) @@ -174,7 +172,6 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_ ERR("Event query created without GL support\n"); ret = WINED3D_EVENT_QUERY_ERROR; } - LEAVE_GL(); context_release(context); return ret; @@ -206,8 +203,6 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, const struct w gl_info = context->gl_info; - ENTER_GL(); - if (gl_info->supported[ARB_SYNC]) { if (query->object.sync) GL_EXTCALL(glDeleteSync(query->object.sync)); @@ -226,8 +221,6 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, const struct w checkGLcall("glSetFenceNV"); } - LEAVE_GL(); - context_release(context); } @@ -342,8 +335,6 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, context = context_acquire(query->device, oq->context->current_rt); - ENTER_GL(); - GL_EXTCALL(glGetQueryObjectuivARB(oq->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)"); TRACE("available %#x.\n", available); @@ -364,8 +355,6 @@ static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, res = S_FALSE; } - LEAVE_GL(); - context_release(context); return res; @@ -477,10 +466,8 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW { context = context_acquire(query->device, oq->context->current_rt); - ENTER_GL(); GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB)); checkGLcall("glEndQuery()"); - LEAVE_GL(); } } else @@ -490,10 +477,8 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW context_alloc_occlusion_query(context, oq); } - ENTER_GL(); GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, oq->id)); checkGLcall("glBeginQuery()"); - LEAVE_GL(); context_release(context); } @@ -513,10 +498,8 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW { context = context_acquire(query->device, oq->context->current_rt); - ENTER_GL(); GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB)); checkGLcall("glEndQuery()"); - LEAVE_GL(); context_release(context); } @@ -627,10 +610,7 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate query memory.\n"); return E_OUTOFMEMORY; - } hr = query_init(object, device, type); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/wined3d/resource.c b/reactos/dll/directx/wine/wined3d/resource.c index 7059ca551f9..d7846224a89 100644 --- a/reactos/dll/directx/wine/wined3d/resource.c +++ b/reactos/dll/directx/wine/wined3d/resource.c @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); diff --git a/reactos/dll/directx/wine/wined3d/sampler.c b/reactos/dll/directx/wine/wined3d/sampler.c new file mode 100644 index 00000000000..d5c44c9266f --- /dev/null +++ b/reactos/dll/directx/wine/wined3d/sampler.c @@ -0,0 +1,76 @@ +/* + * Copyright 2012 Henri Verbeet for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include "config.h" +#include "wine/port.h" + +#include "wined3d_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(d3d); + +ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler) +{ + ULONG refcount = InterlockedIncrement(&sampler->refcount); + + TRACE("%p increasing refcount to %u.\n", sampler, refcount); + + return refcount; +} + +ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler) +{ + ULONG refcount = InterlockedDecrement(&sampler->refcount); + + TRACE("%p decreasing refcount to %u.\n", sampler, refcount); + + if (!refcount) + HeapFree(GetProcessHeap(), 0, sampler); + + return refcount; +} + +void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler) +{ + TRACE("sampler %p.\n", sampler); + + return sampler->parent; +} + +static void wined3d_sampler_init(struct wined3d_sampler *sampler, void *parent) +{ + sampler->refcount = 1; + sampler->parent = parent; +} + +HRESULT CDECL wined3d_sampler_create(void *parent, struct wined3d_sampler **sampler) +{ + struct wined3d_sampler *object; + + TRACE("parent %p, sampler %p.\n", parent, sampler); + + if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) + return E_OUTOFMEMORY; + + wined3d_sampler_init(object, parent); + + TRACE("Created sampler %p.\n", object); + *sampler = object; + + return WINED3D_OK; +} diff --git a/reactos/dll/directx/wine/wined3d/shader.c b/reactos/dll/directx/wine/wined3d/shader.c index 78afef43f3d..2c65e710186 100644 --- a/reactos/dll/directx/wine/wined3d/shader.c +++ b/reactos/dll/directx/wine/wined3d/shader.c @@ -22,127 +22,130 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #include -//#include +#include #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); -WINE_DECLARE_DEBUG_CHANNEL(d3d); static const char * const shader_opcode_names[] = { - /* WINED3DSIH_ABS */ "abs", - /* WINED3DSIH_ADD */ "add", - /* WINED3DSIH_AND */ "and", - /* WINED3DSIH_BEM */ "bem", - /* WINED3DSIH_BREAK */ "break", - /* WINED3DSIH_BREAKC */ "breakc", - /* WINED3DSIH_BREAKP */ "breakp", - /* WINED3DSIH_CALL */ "call", - /* WINED3DSIH_CALLNZ */ "callnz", - /* WINED3DSIH_CMP */ "cmp", - /* WINED3DSIH_CND */ "cnd", - /* WINED3DSIH_CRS */ "crs", - /* WINED3DSIH_CUT */ "cut", - /* WINED3DSIH_DCL */ "dcl", - /* WINED3DSIH_DEF */ "def", - /* WINED3DSIH_DEFB */ "defb", - /* WINED3DSIH_DEFI */ "defi", - /* WINED3DSIH_DIV */ "div", - /* WINED3DSIH_DP2ADD */ "dp2add", - /* WINED3DSIH_DP3 */ "dp3", - /* WINED3DSIH_DP4 */ "dp4", - /* WINED3DSIH_DST */ "dst", - /* WINED3DSIH_DSX */ "dsx", - /* WINED3DSIH_DSY */ "dsy", - /* WINED3DSIH_ELSE */ "else", - /* WINED3DSIH_EMIT */ "emit", - /* WINED3DSIH_ENDIF */ "endif", - /* WINED3DSIH_ENDLOOP */ "endloop", - /* WINED3DSIH_ENDREP */ "endrep", - /* WINED3DSIH_EQ */ "eq", - /* WINED3DSIH_EXP */ "exp", - /* WINED3DSIH_EXPP */ "expp", - /* WINED3DSIH_FRC */ "frc", - /* WINED3DSIH_FTOI */ "ftoi", - /* WINED3DSIH_GE */ "ge", - /* WINED3DSIH_IADD */ "iadd", - /* WINED3DSIH_IEQ */ "ieq", - /* WINED3DSIH_IF */ "if", - /* WINED3DSIH_IFC */ "ifc", - /* WINED3DSIH_IGE */ "ige", - /* WINED3DSIH_IMUL */ "imul", - /* WINED3DSIH_ITOF */ "itof", - /* WINED3DSIH_LABEL */ "label", - /* WINED3DSIH_LD */ "ld", - /* WINED3DSIH_LIT */ "lit", - /* WINED3DSIH_LOG */ "log", - /* WINED3DSIH_LOGP */ "logp", - /* WINED3DSIH_LOOP */ "loop", - /* WINED3DSIH_LRP */ "lrp", - /* WINED3DSIH_LT */ "lt", - /* WINED3DSIH_M3x2 */ "m3x2", - /* WINED3DSIH_M3x3 */ "m3x3", - /* WINED3DSIH_M3x4 */ "m3x4", - /* WINED3DSIH_M4x3 */ "m4x3", - /* WINED3DSIH_M4x4 */ "m4x4", - /* WINED3DSIH_MAD */ "mad", - /* WINED3DSIH_MAX */ "max", - /* WINED3DSIH_MIN */ "min", - /* WINED3DSIH_MOV */ "mov", - /* WINED3DSIH_MOVA */ "mova", - /* WINED3DSIH_MOVC */ "movc", - /* WINED3DSIH_MUL */ "mul", - /* WINED3DSIH_NOP */ "nop", - /* WINED3DSIH_NRM */ "nrm", - /* WINED3DSIH_PHASE */ "phase", - /* WINED3DSIH_POW */ "pow", - /* WINED3DSIH_RCP */ "rcp", - /* WINED3DSIH_REP */ "rep", - /* WINED3DSIH_RET */ "ret", - /* WINED3DSIH_ROUND_NI */ "round_ni", - /* WINED3DSIH_RSQ */ "rsq", - /* WINED3DSIH_SAMPLE */ "sample", - /* WINED3DSIH_SAMPLE_GRAD */ "sample_d", - /* WINED3DSIH_SAMPLE_LOD */ "sample_l", - /* WINED3DSIH_SETP */ "setp", - /* WINED3DSIH_SGE */ "sge", - /* WINED3DSIH_SGN */ "sgn", - /* WINED3DSIH_SINCOS */ "sincos", - /* WINED3DSIH_SLT */ "slt", - /* WINED3DSIH_SQRT */ "sqrt", - /* WINED3DSIH_SUB */ "sub", - /* WINED3DSIH_TEX */ "texld", - /* WINED3DSIH_TEXBEM */ "texbem", - /* WINED3DSIH_TEXBEML */ "texbeml", - /* WINED3DSIH_TEXCOORD */ "texcrd", - /* WINED3DSIH_TEXDEPTH */ "texdepth", - /* WINED3DSIH_TEXDP3 */ "texdp3", - /* WINED3DSIH_TEXDP3TEX */ "texdp3tex", - /* WINED3DSIH_TEXKILL */ "texkill", - /* WINED3DSIH_TEXLDD */ "texldd", - /* WINED3DSIH_TEXLDL */ "texldl", - /* WINED3DSIH_TEXM3x2DEPTH */ "texm3x2depth", - /* WINED3DSIH_TEXM3x2PAD */ "texm3x2pad", - /* WINED3DSIH_TEXM3x2TEX */ "texm3x2tex", - /* WINED3DSIH_TEXM3x3 */ "texm3x3", - /* WINED3DSIH_TEXM3x3DIFF */ "texm3x3diff", - /* WINED3DSIH_TEXM3x3PAD */ "texm3x3pad", - /* WINED3DSIH_TEXM3x3SPEC */ "texm3x3spec", - /* WINED3DSIH_TEXM3x3TEX */ "texm3x3tex", - /* WINED3DSIH_TEXM3x3VSPEC */ "texm3x3vspec", - /* WINED3DSIH_TEXREG2AR */ "texreg2ar", - /* WINED3DSIH_TEXREG2GB */ "texreg2gb", - /* WINED3DSIH_TEXREG2RGB */ "texreg2rgb", - /* WINED3DSIH_UDIV */ "udiv", - /* WINED3DSIH_USHR */ "ushr", - /* WINED3DSIH_UTOF */ "utof", - /* WINED3DSIH_XOR */ "xor", + /* WINED3DSIH_ABS */ "abs", + /* WINED3DSIH_ADD */ "add", + /* WINED3DSIH_AND */ "and", + /* WINED3DSIH_BEM */ "bem", + /* WINED3DSIH_BREAK */ "break", + /* WINED3DSIH_BREAKC */ "breakc", + /* WINED3DSIH_BREAKP */ "breakp", + /* WINED3DSIH_CALL */ "call", + /* WINED3DSIH_CALLNZ */ "callnz", + /* WINED3DSIH_CMP */ "cmp", + /* WINED3DSIH_CND */ "cnd", + /* WINED3DSIH_CRS */ "crs", + /* WINED3DSIH_CUT */ "cut", + /* WINED3DSIH_DCL */ "dcl", + /* WINED3DSIH_DCL_CONSTANT_BUFFER */ "dcl_constantBuffer", + /* WINED3DSIH_DCL_INPUT_PRIMITIVE */ "dcl_inputPrimitive", + /* WINED3DSIH_DCL_OUTPUT_TOPOLOGY */ "dcl_outputTopology", + /* WINED3DSIH_DCL_VERTICES_OUT */ "dcl_maxOutputVertexCount", + /* WINED3DSIH_DEF */ "def", + /* WINED3DSIH_DEFB */ "defb", + /* WINED3DSIH_DEFI */ "defi", + /* WINED3DSIH_DIV */ "div", + /* WINED3DSIH_DP2ADD */ "dp2add", + /* WINED3DSIH_DP3 */ "dp3", + /* WINED3DSIH_DP4 */ "dp4", + /* WINED3DSIH_DST */ "dst", + /* WINED3DSIH_DSX */ "dsx", + /* WINED3DSIH_DSY */ "dsy", + /* WINED3DSIH_ELSE */ "else", + /* WINED3DSIH_EMIT */ "emit", + /* WINED3DSIH_ENDIF */ "endif", + /* WINED3DSIH_ENDLOOP */ "endloop", + /* WINED3DSIH_ENDREP */ "endrep", + /* WINED3DSIH_EQ */ "eq", + /* WINED3DSIH_EXP */ "exp", + /* WINED3DSIH_EXPP */ "expp", + /* WINED3DSIH_FRC */ "frc", + /* WINED3DSIH_FTOI */ "ftoi", + /* WINED3DSIH_GE */ "ge", + /* WINED3DSIH_IADD */ "iadd", + /* WINED3DSIH_IEQ */ "ieq", + /* WINED3DSIH_IF */ "if", + /* WINED3DSIH_IFC */ "ifc", + /* WINED3DSIH_IGE */ "ige", + /* WINED3DSIH_IMUL */ "imul", + /* WINED3DSIH_ITOF */ "itof", + /* WINED3DSIH_LABEL */ "label", + /* WINED3DSIH_LD */ "ld", + /* WINED3DSIH_LIT */ "lit", + /* WINED3DSIH_LOG */ "log", + /* WINED3DSIH_LOGP */ "logp", + /* WINED3DSIH_LOOP */ "loop", + /* WINED3DSIH_LRP */ "lrp", + /* WINED3DSIH_LT */ "lt", + /* WINED3DSIH_M3x2 */ "m3x2", + /* WINED3DSIH_M3x3 */ "m3x3", + /* WINED3DSIH_M3x4 */ "m3x4", + /* WINED3DSIH_M4x3 */ "m4x3", + /* WINED3DSIH_M4x4 */ "m4x4", + /* WINED3DSIH_MAD */ "mad", + /* WINED3DSIH_MAX */ "max", + /* WINED3DSIH_MIN */ "min", + /* WINED3DSIH_MOV */ "mov", + /* WINED3DSIH_MOVA */ "mova", + /* WINED3DSIH_MOVC */ "movc", + /* WINED3DSIH_MUL */ "mul", + /* WINED3DSIH_NOP */ "nop", + /* WINED3DSIH_NRM */ "nrm", + /* WINED3DSIH_PHASE */ "phase", + /* WINED3DSIH_POW */ "pow", + /* WINED3DSIH_RCP */ "rcp", + /* WINED3DSIH_REP */ "rep", + /* WINED3DSIH_RET */ "ret", + /* WINED3DSIH_ROUND_NI */ "round_ni", + /* WINED3DSIH_RSQ */ "rsq", + /* WINED3DSIH_SAMPLE */ "sample", + /* WINED3DSIH_SAMPLE_GRAD */ "sample_d", + /* WINED3DSIH_SAMPLE_LOD */ "sample_l", + /* WINED3DSIH_SETP */ "setp", + /* WINED3DSIH_SGE */ "sge", + /* WINED3DSIH_SGN */ "sgn", + /* WINED3DSIH_SINCOS */ "sincos", + /* WINED3DSIH_SLT */ "slt", + /* WINED3DSIH_SQRT */ "sqrt", + /* WINED3DSIH_SUB */ "sub", + /* WINED3DSIH_TEX */ "texld", + /* WINED3DSIH_TEXBEM */ "texbem", + /* WINED3DSIH_TEXBEML */ "texbeml", + /* WINED3DSIH_TEXCOORD */ "texcrd", + /* WINED3DSIH_TEXDEPTH */ "texdepth", + /* WINED3DSIH_TEXDP3 */ "texdp3", + /* WINED3DSIH_TEXDP3TEX */ "texdp3tex", + /* WINED3DSIH_TEXKILL */ "texkill", + /* WINED3DSIH_TEXLDD */ "texldd", + /* WINED3DSIH_TEXLDL */ "texldl", + /* WINED3DSIH_TEXM3x2DEPTH */ "texm3x2depth", + /* WINED3DSIH_TEXM3x2PAD */ "texm3x2pad", + /* WINED3DSIH_TEXM3x2TEX */ "texm3x2tex", + /* WINED3DSIH_TEXM3x3 */ "texm3x3", + /* WINED3DSIH_TEXM3x3DIFF */ "texm3x3diff", + /* WINED3DSIH_TEXM3x3PAD */ "texm3x3pad", + /* WINED3DSIH_TEXM3x3SPEC */ "texm3x3spec", + /* WINED3DSIH_TEXM3x3TEX */ "texm3x3tex", + /* WINED3DSIH_TEXM3x3VSPEC */ "texm3x3vspec", + /* WINED3DSIH_TEXREG2AR */ "texreg2ar", + /* WINED3DSIH_TEXREG2GB */ "texreg2gb", + /* WINED3DSIH_TEXREG2RGB */ "texreg2rgb", + /* WINED3DSIH_UDIV */ "udiv", + /* WINED3DSIH_USHR */ "ushr", + /* WINED3DSIH_UTOF */ "utof", + /* WINED3DSIH_XOR */ "xor", }; static const char * const semantic_names[] = @@ -198,7 +201,7 @@ static void shader_signature_from_semantic(struct wined3d_shader_signature_eleme e->semantic_idx = s->usage_idx; e->sysval_semantic = 0; e->component_type = 0; - e->register_idx = s->reg.reg.idx; + e->register_idx = s->reg.reg.idx[0].offset; e->mask = s->reg.write_mask; } @@ -361,18 +364,20 @@ static void shader_record_register_usage(struct wined3d_shader *shader, struct w switch (reg->type) { case WINED3DSPR_TEXTURE: /* WINED3DSPR_ADDR */ - if (shader_type == WINED3D_SHADER_TYPE_PIXEL) reg_maps->texcoord |= 1 << reg->idx; - else reg_maps->address |= 1 << reg->idx; + if (shader_type == WINED3D_SHADER_TYPE_PIXEL) + reg_maps->texcoord |= 1 << reg->idx[0].offset; + else + reg_maps->address |= 1 << reg->idx[0].offset; break; case WINED3DSPR_TEMP: - reg_maps->temporary |= 1 << reg->idx; + reg_maps->temporary |= 1 << reg->idx[0].offset; break; case WINED3DSPR_INPUT: if (shader_type == WINED3D_SHADER_TYPE_PIXEL) { - if (reg->rel_addr) + if (reg->idx[0].rel_addr) { /* If relative addressing is used, we must assume that all registers * are used. Even if it is a construct like v3[aL], we can't assume @@ -385,51 +390,58 @@ static void shader_record_register_usage(struct wined3d_shader *shader, struct w } else { - shader->u.ps.input_reg_used[reg->idx] = TRUE; + shader->u.ps.input_reg_used[reg->idx[0].offset] = TRUE; } } - else reg_maps->input_registers |= 1 << reg->idx; + else + reg_maps->input_registers |= 1 << reg->idx[0].offset; break; case WINED3DSPR_RASTOUT: - if (reg->idx == 1) reg_maps->fog = 1; + if (reg->idx[0].offset == 1) + reg_maps->fog = 1; break; case WINED3DSPR_MISCTYPE: if (shader_type == WINED3D_SHADER_TYPE_PIXEL) { - if (!reg->idx) reg_maps->vpos = 1; - else if (reg->idx == 1) reg_maps->usesfacing = 1; + if (!reg->idx[0].offset) + reg_maps->vpos = 1; + else if (reg->idx[0].offset == 1) + reg_maps->usesfacing = 1; } break; case WINED3DSPR_CONST: - if (reg->rel_addr) + if (reg->idx[0].rel_addr) { - if (reg->idx < reg_maps->min_rel_offset) reg_maps->min_rel_offset = reg->idx; - if (reg->idx > reg_maps->max_rel_offset) reg_maps->max_rel_offset = reg->idx; + if (reg->idx[0].offset < reg_maps->min_rel_offset) + reg_maps->min_rel_offset = reg->idx[0].offset; + if (reg->idx[0].offset > reg_maps->max_rel_offset) + reg_maps->max_rel_offset = reg->idx[0].offset; reg_maps->usesrelconstF = TRUE; } else { - set_bitmap_bit(reg_maps->constf, reg->idx); + set_bitmap_bit(reg_maps->constf, reg->idx[0].offset); } break; case WINED3DSPR_CONSTINT: - reg_maps->integer_constants |= (1 << reg->idx); + reg_maps->integer_constants |= (1 << reg->idx[0].offset); break; case WINED3DSPR_CONSTBOOL: - reg_maps->boolean_constants |= (1 << reg->idx); + reg_maps->boolean_constants |= (1 << reg->idx[0].offset); break; case WINED3DSPR_COLOROUT: - reg_maps->rt_mask |= (1 << reg->idx); + reg_maps->rt_mask |= (1 << reg->idx[0].offset); break; default: - TRACE("Not recording register of type %#x and idx %u\n", reg->type, reg->idx); + TRACE("Not recording register of type %#x and [%#x][%#x].\n", + reg->type, reg->idx[0].offset, reg->idx[1].offset); break; } } @@ -481,71 +493,87 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st while (!fe->shader_is_end(fe_data, &ptr)) { struct wined3d_shader_instruction ins; - const char *comment; - UINT comment_size; - UINT param_size; - - /* Skip comments. */ - fe->shader_read_comment(&ptr, &comment, &comment_size); - if (comment) continue; /* Fetch opcode. */ - fe->shader_read_opcode(fe_data, &ptr, &ins, ¶m_size); + fe->shader_read_instruction(fe_data, &ptr, &ins); /* Unhandled opcode, and its parameters. */ if (ins.handler_idx == WINED3DSIH_TABLE_SIZE) { TRACE("Skipping unrecognized instruction.\n"); - ptr += param_size; continue; } /* Handle declarations. */ if (ins.handler_idx == WINED3DSIH_DCL) { - struct wined3d_shader_semantic semantic; + struct wined3d_shader_semantic *semantic = &ins.declaration.semantic; - fe->shader_read_semantic(&ptr, &semantic); - - switch (semantic.reg.reg.type) + switch (semantic->reg.reg.type) { /* Mark input registers used. */ case WINED3DSPR_INPUT: - reg_maps->input_registers |= 1 << semantic.reg.reg.idx; - shader_signature_from_semantic(&input_signature[semantic.reg.reg.idx], &semantic); + reg_maps->input_registers |= 1 << semantic->reg.reg.idx[0].offset; + shader_signature_from_semantic(&input_signature[semantic->reg.reg.idx[0].offset], semantic); break; /* Vertex shader: mark 3.0 output registers used, save token. */ case WINED3DSPR_OUTPUT: - reg_maps->output_registers |= 1 << semantic.reg.reg.idx; - shader_signature_from_semantic(&output_signature[semantic.reg.reg.idx], &semantic); - if (semantic.usage == WINED3D_DECL_USAGE_FOG) + reg_maps->output_registers |= 1 << semantic->reg.reg.idx[0].offset; + shader_signature_from_semantic(&output_signature[semantic->reg.reg.idx[0].offset], semantic); + if (semantic->usage == WINED3D_DECL_USAGE_FOG) reg_maps->fog = 1; break; /* Save sampler usage token. */ case WINED3DSPR_SAMPLER: - reg_maps->sampler_type[semantic.reg.reg.idx] = semantic.sampler_type; + reg_maps->sampler_type[semantic->reg.reg.idx[0].offset] = semantic->sampler_type; break; default: - TRACE("Not recording DCL register type %#x.\n", semantic.reg.reg.type); + TRACE("Not recording DCL register type %#x.\n", semantic->reg.reg.type); break; } } + else if (ins.handler_idx == WINED3DSIH_DCL_CONSTANT_BUFFER) + { + struct wined3d_shader_register *reg = &ins.declaration.src.reg; + if (reg->idx[0].offset >= WINED3D_MAX_CBS) + ERR("Invalid CB index %u.\n", reg->idx[0].offset); + else + reg_maps->cb_sizes[reg->idx[0].offset] = reg->idx[1].offset; + } + else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE) + { + if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY) + shader->u.gs.input_type = ins.declaration.primitive_type; + else + FIXME("Invalid instruction %#x for shader type %#x.\n", + ins.handler_idx, shader_version.type); + } + else if (ins.handler_idx == WINED3DSIH_DCL_OUTPUT_TOPOLOGY) + { + if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY) + shader->u.gs.output_type = ins.declaration.primitive_type; + else + FIXME("Invalid instruction %#x for shader type %#x.\n", + ins.handler_idx, shader_version.type); + } + else if (ins.handler_idx == WINED3DSIH_DCL_VERTICES_OUT) + { + if (shader_version.type == WINED3D_SHADER_TYPE_GEOMETRY) + shader->u.gs.vertices_out = ins.declaration.count; + else + FIXME("Invalid instruction %#x for shader type %#x.\n", + ins.handler_idx, shader_version.type); + } else if (ins.handler_idx == WINED3DSIH_DEF) { - struct wined3d_shader_src_param rel_addr; - struct wined3d_shader_dst_param dst; - struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst)); if (!lconst) return E_OUTOFMEMORY; - fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr); - lconst->idx = dst.reg.idx; - - memcpy(lconst->value, ptr, 4 * sizeof(DWORD)); - ptr += 4; + lconst->idx = ins.dst[0].reg.idx[0].offset; + memcpy(lconst->value, ins.src[0].reg.immconst_data, 4 * sizeof(DWORD)); /* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */ if (shader_version.major == 1 && shader_version.type == WINED3D_SHADER_TYPE_PIXEL) @@ -565,51 +593,36 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st } else if (ins.handler_idx == WINED3DSIH_DEFI) { - struct wined3d_shader_src_param rel_addr; - struct wined3d_shader_dst_param dst; - struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst)); if (!lconst) return E_OUTOFMEMORY; - fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr); - lconst->idx = dst.reg.idx; - - memcpy(lconst->value, ptr, 4 * sizeof(DWORD)); - ptr += 4; + lconst->idx = ins.dst[0].reg.idx[0].offset; + memcpy(lconst->value, ins.src[0].reg.immconst_data, 4 * sizeof(DWORD)); list_add_head(&shader->constantsI, &lconst->entry); - reg_maps->local_int_consts |= (1 << dst.reg.idx); + reg_maps->local_int_consts |= (1 << lconst->idx); } else if (ins.handler_idx == WINED3DSIH_DEFB) { - struct wined3d_shader_src_param rel_addr; - struct wined3d_shader_dst_param dst; - struct wined3d_shader_lconst *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(*lconst)); if (!lconst) return E_OUTOFMEMORY; - fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr); - lconst->idx = dst.reg.idx; - - memcpy(lconst->value, ptr, sizeof(DWORD)); - ++ptr; + lconst->idx = ins.dst[0].reg.idx[0].offset; + memcpy(lconst->value, ins.src[0].reg.immconst_data, sizeof(DWORD)); list_add_head(&shader->constantsB, &lconst->entry); - reg_maps->local_bool_consts |= (1 << dst.reg.idx); + reg_maps->local_bool_consts |= (1 << lconst->idx); } /* For subroutine prototypes. */ else if (ins.handler_idx == WINED3DSIH_LABEL) { - struct wined3d_shader_src_param src, rel_addr; - - fe->shader_read_src_param(fe_data, &ptr, &src, &rel_addr); - reg_maps->labels |= 1 << src.reg.idx; + reg_maps->labels |= 1 << ins.src[0].reg.idx[0].offset; } /* Set texture, address, temporary registers. */ else { BOOL color0_mov = FALSE; - unsigned int i, limit; + unsigned int i; /* This will loop over all the registers and try to * make a bitmask of the ones we're interested in. @@ -619,21 +632,16 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st * they are initialized (required by spec). */ for (i = 0; i < ins.dst_count; ++i) { - struct wined3d_shader_src_param dst_rel_addr; - struct wined3d_shader_dst_param dst_param; - - fe->shader_read_dst_param(fe_data, &ptr, &dst_param, &dst_rel_addr); - - shader_record_register_usage(shader, reg_maps, &dst_param.reg, shader_version.type); + shader_record_register_usage(shader, reg_maps, &ins.dst[i].reg, shader_version.type); /* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and * is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel * shaders because TECRDOUT isn't used in them, but future register types might cause issues */ if (shader_version.type == WINED3D_SHADER_TYPE_VERTEX && shader_version.major < 3) { - UINT idx = dst_param.reg.idx; + UINT idx = ins.dst[i].reg.idx[0].offset; - switch (dst_param.reg.type) + switch (ins.dst[i].reg.type) { case WINED3DSPR_RASTOUT: switch (idx) @@ -664,29 +672,29 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st idx += 8; if (reg_maps->output_registers & (1 << idx)) { - output_signature[idx].mask |= dst_param.write_mask; + output_signature[idx].mask |= ins.dst[i].write_mask; } else { reg_maps->output_registers |= 1 << idx; shader_signature_from_usage(&output_signature[idx], - WINED3D_DECL_USAGE_COLOR, idx - 8, idx, dst_param.write_mask); + WINED3D_DECL_USAGE_COLOR, idx - 8, idx, ins.dst[i].write_mask); } } break; case WINED3DSPR_TEXCRDOUT: - reg_maps->texcoord_mask[idx] |= dst_param.write_mask; + reg_maps->texcoord_mask[idx] |= ins.dst[i].write_mask; if (reg_maps->output_registers & (1 << idx)) { - output_signature[idx].mask |= dst_param.write_mask; + output_signature[idx].mask |= ins.dst[i].write_mask; } else { reg_maps->output_registers |= 1 << idx; shader_signature_from_usage(&output_signature[idx], - WINED3D_DECL_USAGE_TEXCOORD, idx, idx, dst_param.write_mask); + WINED3D_DECL_USAGE_TEXCOORD, idx, idx, ins.dst[i].write_mask); } break; @@ -697,7 +705,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL) { - if (dst_param.reg.type == WINED3DSPR_COLOROUT && !dst_param.reg.idx) + if (ins.dst[i].reg.type == WINED3DSPR_COLOROUT && !ins.dst[i].reg.idx[0].offset) { /* Many 2.0 and 3.0 pixel shaders end with a MOV from a temp register to * COLOROUT 0. If we know this in advance, the ARB shader backend can skip @@ -708,7 +716,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st * COLOROUT 0 is overwritten partially later, the marker is dropped again. */ shader->u.ps.color0_mov = FALSE; if (ins.handler_idx == WINED3DSIH_MOV - && dst_param.write_mask == WINED3DSP_WRITEMASK_ALL) + && ins.dst[i].write_mask == WINED3DSP_WRITEMASK_ALL) { /* Used later when the source register is read. */ color0_mov = TRUE; @@ -717,8 +725,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st /* Also drop the MOV marker if the source register is overwritten prior to the shader * end */ - else if (dst_param.reg.type == WINED3DSPR_TEMP - && dst_param.reg.idx == shader->u.ps.color0_reg) + else if (ins.dst[i].reg.type == WINED3DSPR_TEMP + && ins.dst[i].reg.idx[0].offset == shader->u.ps.color0_reg) { shader->u.ps.color0_mov = FALSE; } @@ -739,7 +747,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st || ins.handler_idx == WINED3DSIH_TEXREG2RGB)) { /* Fake sampler usage, only set reserved bit and type. */ - DWORD sampler_code = dst_param.reg.idx; + DWORD sampler_code = ins.dst[i].reg.idx[0].offset; TRACE("Setting fake 2D sampler for 1.x pixelshader.\n"); reg_maps->sampler_type[sampler_code] = WINED3DSTT_2D; @@ -748,16 +756,16 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st if (ins.handler_idx == WINED3DSIH_TEXBEM || ins.handler_idx == WINED3DSIH_TEXBEML) { - reg_maps->bumpmat |= 1 << dst_param.reg.idx; + reg_maps->bumpmat |= 1 << ins.dst[i].reg.idx[0].offset; if (ins.handler_idx == WINED3DSIH_TEXBEML) { - reg_maps->luminanceparams |= 1 << dst_param.reg.idx; + reg_maps->luminanceparams |= 1 << ins.dst[i].reg.idx[0].offset; } } } else if (ins.handler_idx == WINED3DSIH_BEM) { - reg_maps->bumpmat |= 1 << dst_param.reg.idx; + reg_maps->bumpmat |= 1 << ins.dst[i].reg.idx[0].offset; } } @@ -781,30 +789,29 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st || ins.handler_idx == WINED3DSIH_ENDREP) --cur_loop_depth; - limit = ins.src_count + (ins.predicate ? 1 : 0); - for (i = 0; i < limit; ++i) + if (ins.predicate) + shader_record_register_usage(shader, reg_maps, &ins.predicate->reg, shader_version.type); + + for (i = 0; i < ins.src_count; ++i) { - struct wined3d_shader_src_param src_param, src_rel_addr; - unsigned int count; + unsigned int count = get_instr_extra_regcount(ins.handler_idx, i); + struct wined3d_shader_register reg = ins.src[i].reg; - fe->shader_read_src_param(fe_data, &ptr, &src_param, &src_rel_addr); - count = get_instr_extra_regcount(ins.handler_idx, i); - - shader_record_register_usage(shader, reg_maps, &src_param.reg, shader_version.type); + shader_record_register_usage(shader, reg_maps, &ins.src[i].reg, shader_version.type); while (count) { - ++src_param.reg.idx; - shader_record_register_usage(shader, reg_maps, &src_param.reg, shader_version.type); + ++reg.idx[0].offset; + shader_record_register_usage(shader, reg_maps, ®, shader_version.type); --count; } if (color0_mov) { - if (src_param.reg.type == WINED3DSPR_TEMP - && src_param.swizzle == WINED3DSP_NOSWIZZLE) + if (ins.src[i].reg.type == WINED3DSPR_TEMP + && ins.src[i].swizzle == WINED3DSP_NOSWIZZLE) { shader->u.ps.color0_mov = TRUE; - shader->u.ps.color0_reg = src_param.reg.idx; + shader->u.ps.color0_reg = ins.src[i].reg.idx[0].offset; } } } @@ -922,7 +929,7 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, { static const char * const rastout_reg_names[] = {"oPos", "oFog", "oPts"}; static const char * const misctype_reg_names[] = {"vPos", "vFace"}; - UINT offset = reg->idx; + UINT offset = reg->idx[0].offset; switch (reg->type) { @@ -939,7 +946,7 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, case WINED3DSPR_CONST3: case WINED3DSPR_CONST4: TRACE("c"); - offset = shader_get_float_offset(reg->type, reg->idx); + offset = shader_get_float_offset(reg->type, offset); break; case WINED3DSPR_TEXTURE: /* vs: case WINED3DSPR_ADDR */ @@ -947,7 +954,7 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, break; case WINED3DSPR_RASTOUT: - TRACE("%s", rastout_reg_names[reg->idx]); + TRACE("%s", rastout_reg_names[offset]); break; case WINED3DSPR_COLOROUT: @@ -990,8 +997,10 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, break; case WINED3DSPR_MISCTYPE: - if (reg->idx > 1) FIXME("Unhandled misctype register %u.\n", reg->idx); - else TRACE("%s", misctype_reg_names[reg->idx]); + if (offset > 1) + FIXME("Unhandled misctype register %u.\n", offset); + else + TRACE("%s", misctype_reg_names[offset]); break; case WINED3DSPR_PREDICATE: @@ -1006,6 +1015,10 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, TRACE("cb"); break; + case WINED3DSPR_PRIMID: + TRACE("primID"); + break; + case WINED3DSPR_NULL: TRACE("null"); break; @@ -1025,13 +1038,49 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, switch (reg->immconst_type) { case WINED3D_IMMCONST_SCALAR: - TRACE("%.8e", *(const float *)reg->immconst_data); + switch (reg->data_type) + { + case WINED3D_DATA_FLOAT: + TRACE("%.8e", *(const float *)reg->immconst_data); + break; + case WINED3D_DATA_INT: + TRACE("%d", reg->immconst_data[0]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + TRACE("%u", reg->immconst_data[0]); + break; + default: + TRACE("", reg->data_type); + break; + } break; case WINED3D_IMMCONST_VEC4: - TRACE("%.8e, %.8e, %.8e, %.8e", - *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], - *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); + switch (reg->data_type) + { + case WINED3D_DATA_FLOAT: + TRACE("%.8e, %.8e, %.8e, %.8e", + *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], + *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); + break; + case WINED3D_DATA_INT: + TRACE("%d, %d, %d, %d", + reg->immconst_data[0], reg->immconst_data[1], + reg->immconst_data[2], reg->immconst_data[3]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + TRACE("%u, %u, %u, %u", + reg->immconst_data[0], reg->immconst_data[1], + reg->immconst_data[2], reg->immconst_data[3]); + break; + default: + TRACE("", reg->data_type); + break; + } break; default: @@ -1044,26 +1093,26 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, && reg->type != WINED3DSPR_MISCTYPE && reg->type != WINED3DSPR_NULL) { - if (reg->array_idx != ~0U) + if (offset != ~0U) { - TRACE("%u[%u", offset, reg->array_idx); - if (reg->rel_addr) + TRACE("["); + if (reg->idx[0].rel_addr) { + shader_dump_src_param(reg->idx[0].rel_addr, shader_version); TRACE(" + "); - shader_dump_src_param(reg->rel_addr, shader_version); } - TRACE("]"); - } - else - { - if (reg->rel_addr) + TRACE("%u]", offset); + + if (reg->idx[1].offset != ~0U) { TRACE("["); - shader_dump_src_param(reg->rel_addr, shader_version); - TRACE(" + "); + if (reg->idx[1].rel_addr) + { + shader_dump_src_param(reg->idx[1].rel_addr, shader_version); + TRACE(" + "); + } + TRACE("%u]", reg->idx[1].offset); } - TRACE("%u", offset); - if (reg->rel_addr) TRACE("]"); } } } @@ -1161,17 +1210,12 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_sh struct wined3d_device *device = shader->device; const struct wined3d_shader_frontend *fe = shader->frontend; void *fe_data = shader->frontend_data; - struct wined3d_shader_src_param dst_rel_addr[2]; - struct wined3d_shader_src_param src_rel_addr[4]; - struct wined3d_shader_dst_param dst_param[2]; - struct wined3d_shader_src_param src_param[4]; struct wined3d_shader_version shader_version; struct wined3d_shader_loop_state loop_state; struct wined3d_shader_instruction ins; struct wined3d_shader_tex_mx tex_mx; struct wined3d_shader_context ctx; const DWORD *ptr = byte_code; - DWORD i; /* Initialize current parsing state. */ tex_mx.current_row = 0; @@ -1185,64 +1229,24 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_sh ctx.tex_mx = &tex_mx; ctx.loop_state = &loop_state; ctx.backend_data = backend_ctx; - ins.ctx = &ctx; - ins.dst = dst_param; - ins.src = src_param; fe->shader_read_header(fe_data, &ptr, &shader_version); while (!fe->shader_is_end(fe_data, &ptr)) { - const char *comment; - UINT comment_size; - UINT param_size; - - /* Skip comment tokens. */ - fe->shader_read_comment(&ptr, &comment, &comment_size); - if (comment) continue; - /* Read opcode. */ - fe->shader_read_opcode(fe_data, &ptr, &ins, ¶m_size); + fe->shader_read_instruction(fe_data, &ptr, &ins); /* Unknown opcode and its parameters. */ if (ins.handler_idx == WINED3DSIH_TABLE_SIZE) { TRACE("Skipping unrecognized instruction.\n"); - ptr += param_size; continue; } - /* Nothing to do. */ - if (ins.handler_idx == WINED3DSIH_DCL - || ins.handler_idx == WINED3DSIH_NOP - || ins.handler_idx == WINED3DSIH_DEF - || ins.handler_idx == WINED3DSIH_DEFI - || ins.handler_idx == WINED3DSIH_DEFB - || ins.handler_idx == WINED3DSIH_PHASE) - { - ptr += param_size; - continue; - } - - /* Destination tokens */ - for (i = 0; i < ins.dst_count; ++i) - { - fe->shader_read_dst_param(fe_data, &ptr, &dst_param[i], &dst_rel_addr[i]); - } - - /* Predication token */ if (ins.predicate) - { FIXME("Predicates not implemented.\n"); - ins.predicate = *ptr++; - } - - /* Other source tokens */ - for (i = 0; i < ins.src_count; ++i) - { - fe->shader_read_src_param(fe_data, &ptr, &src_param[i], &src_rel_addr[i]); - } /* Call appropriate function for output target */ device->shader_backend->shader_handle_instruction(&ins); @@ -1273,6 +1277,49 @@ static void shader_dump_ins_modifiers(const struct wined3d_shader_dst_param *dst if (mmask) FIXME("_unrecognized_modifier(%#x)", mmask); } +static void shader_dump_primitive_type(enum wined3d_primitive_type primitive_type) +{ + switch (primitive_type) + { + case WINED3D_PT_UNDEFINED: + TRACE("undefined"); + break; + case WINED3D_PT_POINTLIST: + TRACE("pointlist"); + break; + case WINED3D_PT_LINELIST: + TRACE("linelist"); + break; + case WINED3D_PT_LINESTRIP: + TRACE("linestrip"); + break; + case WINED3D_PT_TRIANGLELIST: + TRACE("trianglelist"); + break; + case WINED3D_PT_TRIANGLESTRIP: + TRACE("trianglestrip"); + break; + case WINED3D_PT_TRIANGLEFAN: + TRACE("trianglefan"); + break; + case WINED3D_PT_LINELIST_ADJ: + TRACE("linelist_adj"); + break; + case WINED3D_PT_LINESTRIP_ADJ: + TRACE("linestrip_adj"); + break; + case WINED3D_PT_TRIANGLELIST_ADJ: + TRACE("trianglelist_adj"); + break; + case WINED3D_PT_TRIANGLESTRIP_ADJ: + TRACE("trianglestrip_adj"); + break; + default: + TRACE("", primitive_type); + break; + } +} + static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe_data, const DWORD *byte_code) { struct wined3d_shader_version shader_version; @@ -1309,114 +1356,64 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe while (!fe->shader_is_end(fe_data, &ptr)) { struct wined3d_shader_instruction ins; - const char *comment; - UINT comment_size; - UINT param_size; - /* comment */ - fe->shader_read_comment(&ptr, &comment, &comment_size); - if (comment) - { - if (comment_size > 4 && *(const DWORD *)comment == WINEMAKEFOURCC('T', 'E', 'X', 'T')) - { - const char *end = comment + comment_size; - const char *ptr = comment + 4; - const char *line = ptr; - - TRACE("// TEXT\n"); - while (ptr != end) - { - if (*ptr == '\n') - { - UINT len = ptr - line; - if (len && *(ptr - 1) == '\r') --len; - TRACE("// %s\n", debugstr_an(line, len)); - line = ++ptr; - } - else ++ptr; - } - if (line != ptr) TRACE("// %s\n", debugstr_an(line, ptr - line)); - } - else TRACE("// %s\n", debugstr_an(comment, comment_size)); - continue; - } - - fe->shader_read_opcode(fe_data, &ptr, &ins, ¶m_size); + fe->shader_read_instruction(fe_data, &ptr, &ins); if (ins.handler_idx == WINED3DSIH_TABLE_SIZE) { TRACE("Skipping unrecognized instruction.\n"); - ptr += param_size; continue; } if (ins.handler_idx == WINED3DSIH_DCL) { - struct wined3d_shader_semantic semantic; - - fe->shader_read_semantic(&ptr, &semantic); - - shader_dump_decl_usage(&semantic, &shader_version); - shader_dump_ins_modifiers(&semantic.reg); + shader_dump_decl_usage(&ins.declaration.semantic, &shader_version); + shader_dump_ins_modifiers(&ins.declaration.semantic.reg); TRACE(" "); - shader_dump_dst_param(&semantic.reg, &shader_version); + shader_dump_dst_param(&ins.declaration.semantic.reg, &shader_version); + } + else if (ins.handler_idx == WINED3DSIH_DCL_CONSTANT_BUFFER) + { + TRACE("%s ", shader_opcode_names[ins.handler_idx]); + shader_dump_src_param(&ins.declaration.src, &shader_version); + TRACE(", %s", ins.flags & WINED3DSI_INDEXED_DYNAMIC ? "dynamicIndexed" : "immediateIndexed"); + } + else if (ins.handler_idx == WINED3DSIH_DCL_INPUT_PRIMITIVE + || ins.handler_idx == WINED3DSIH_DCL_OUTPUT_TOPOLOGY) + { + TRACE("%s ", shader_opcode_names[ins.handler_idx]); + shader_dump_primitive_type(ins.declaration.primitive_type); + } + else if (ins.handler_idx == WINED3DSIH_DCL_VERTICES_OUT) + { + TRACE("%s %u", shader_opcode_names[ins.handler_idx], ins.declaration.count); } else if (ins.handler_idx == WINED3DSIH_DEF) { - struct wined3d_shader_src_param rel_addr; - struct wined3d_shader_dst_param dst; - - fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr); - - TRACE("def c%u = %f, %f, %f, %f", shader_get_float_offset(dst.reg.type, dst.reg.idx), - *(const float *)(ptr), - *(const float *)(ptr + 1), - *(const float *)(ptr + 2), - *(const float *)(ptr + 3)); - ptr += 4; + TRACE("def c%u = %f, %f, %f, %f", shader_get_float_offset(ins.dst[0].reg.type, + ins.dst[0].reg.idx[0].offset), + *(const float *)&ins.src[0].reg.immconst_data[0], + *(const float *)&ins.src[0].reg.immconst_data[1], + *(const float *)&ins.src[0].reg.immconst_data[2], + *(const float *)&ins.src[0].reg.immconst_data[3]); } else if (ins.handler_idx == WINED3DSIH_DEFI) { - struct wined3d_shader_src_param rel_addr; - struct wined3d_shader_dst_param dst; - - fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr); - - TRACE("defi i%u = %d, %d, %d, %d", dst.reg.idx, - *(ptr), - *(ptr + 1), - *(ptr + 2), - *(ptr + 3)); - ptr += 4; + TRACE("defi i%u = %d, %d, %d, %d", ins.dst[0].reg.idx[0].offset, + ins.src[0].reg.immconst_data[0], + ins.src[0].reg.immconst_data[1], + ins.src[0].reg.immconst_data[2], + ins.src[0].reg.immconst_data[3]); } else if (ins.handler_idx == WINED3DSIH_DEFB) { - struct wined3d_shader_src_param rel_addr; - struct wined3d_shader_dst_param dst; - - fe->shader_read_dst_param(fe_data, &ptr, &dst, &rel_addr); - - TRACE("defb b%u = %s", dst.reg.idx, *ptr ? "true" : "false"); - ++ptr; + TRACE("defb b%u = %s", ins.dst[0].reg.idx[0].offset, ins.src[0].reg.immconst_data[0] ? "true" : "false"); } else { - struct wined3d_shader_src_param dst_rel_addr[2]; - struct wined3d_shader_src_param src_rel_addr; - struct wined3d_shader_dst_param dst_param[2]; - struct wined3d_shader_src_param src_param; - - for (i = 0; i < ins.dst_count; ++i) - { - fe->shader_read_dst_param(fe_data, &ptr, &dst_param[i], &dst_rel_addr[i]); - } - - /* Print out predication source token first - it follows - * the destination token. */ if (ins.predicate) { - fe->shader_read_src_param(fe_data, &ptr, &src_param, &src_rel_addr); TRACE("("); - shader_dump_src_param(&src_param, &shader_version); + shader_dump_src_param(ins.predicate, &shader_version); TRACE(") "); } @@ -1446,20 +1443,18 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe TRACE("p"); } - /* We already read the destination tokens, print them. */ for (i = 0; i < ins.dst_count; ++i) { - shader_dump_ins_modifiers(&dst_param[i]); + shader_dump_ins_modifiers(&ins.dst[i]); TRACE(!i ? " " : ", "); - shader_dump_dst_param(&dst_param[i], &shader_version); + shader_dump_dst_param(&ins.dst[i], &shader_version); } /* Other source tokens */ for (i = ins.dst_count; i < (ins.dst_count + ins.src_count); ++i) { - fe->shader_read_src_param(fe_data, &ptr, &src_param, &src_rel_addr); TRACE(!i ? " " : ", "); - shader_dump_src_param(&src_param, &shader_version); + shader_dump_src_param(&ins.src[i - ins.dst_count], &shader_version); } } TRACE("\n"); @@ -1480,49 +1475,91 @@ static void shader_cleanup(struct wined3d_shader *shader) shader->frontend->shader_free(shader->frontend_data); } +struct shader_none_priv +{ + const struct fragment_pipeline *fragment_pipe; + BOOL ffp_proj_control; +}; + static void shader_none_handle_instruction(const struct wined3d_shader_instruction *ins) {} -static void shader_none_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) {} static void shader_none_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info, enum tex_types tex_type, const SIZE *ds_mask_size) {} static void shader_none_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) {} static void shader_none_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) {} static void shader_none_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) {} -static void shader_none_load_constants(const struct wined3d_context *context, char usePS, char useVS) {} +static void shader_none_load_constants(const struct wined3d_context *context, BOOL usePS, BOOL useVS) {} static void shader_none_load_np2fixup_constants(void *shader_priv, const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {} static void shader_none_destroy(struct wined3d_shader *shader) {} -static HRESULT shader_none_alloc(struct wined3d_device *device) {return WINED3D_OK;} -static void shader_none_free(struct wined3d_device *device) {} static void shader_none_context_destroyed(void *shader_priv, const struct wined3d_context *context) {} +static void shader_none_select(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode, + enum wined3d_shader_mode fragment_mode) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + struct wined3d_device *device = context->swapchain->device; + struct shader_none_priv *priv = device->shader_priv; + + priv->fragment_pipe->enable_extension(gl_info, fragment_mode == WINED3D_SHADER_MODE_FFP); +} + +static HRESULT shader_none_alloc(struct wined3d_device *device, const struct fragment_pipeline *fragment_pipe) +{ + struct fragment_caps fragment_caps; + struct shader_none_priv *priv; + void *fragment_priv; + + if (!(priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)))) + return E_OUTOFMEMORY; + + if (!(fragment_priv = fragment_pipe->alloc_private(&none_shader_backend, priv))) + { + ERR("Failed to initialize fragment pipe.\n"); + HeapFree(GetProcessHeap(), 0, priv); + return E_FAIL; + } + + fragment_pipe->get_caps(&device->adapter->gl_info, &fragment_caps); + priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL; + device->fragment_priv = fragment_priv; + priv->fragment_pipe = fragment_pipe; + device->shader_priv = priv; + + return WINED3D_OK; +} + +static void shader_none_free(struct wined3d_device *device) +{ + struct shader_none_priv *priv = device->shader_priv; + + priv->fragment_pipe->free_private(device); + HeapFree(GetProcessHeap(), 0, priv); +} + static void shader_none_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps) { /* Set the shader caps to 0 for the none shader backend */ - caps->VertexShaderVersion = 0; - caps->MaxVertexShaderConst = 0; - caps->PixelShaderVersion = 0; - caps->PixelShader1xMaxValue = 0.0f; - caps->MaxPixelShaderConst = 0; - caps->VSClipping = FALSE; + caps->vs_version = 0; + caps->gs_version = 0; + caps->ps_version = 0; + caps->vs_uniform_count = 0; + caps->ps_uniform_count = 0; + caps->ps_1x_max_value = 0.0f; + caps->wined3d_caps = 0; } static BOOL shader_none_color_fixup_supported(struct color_fixup_desc fixup) { - if (TRACE_ON(d3d_shader) && TRACE_ON(d3d)) - { - TRACE("Checking support for fixup:\n"); - dump_color_fixup_desc(fixup); - } + /* We "support" every possible fixup, since we don't support any shader + * model, and will never have to actually sample a texture. */ + return TRUE; +} - /* Faked to make some apps happy. */ - if (!is_complex_fixup(fixup)) - { - TRACE("[OK]\n"); - return TRUE; - } +static BOOL shader_none_has_ffp_proj_control(void *shader_priv) +{ + struct shader_none_priv *priv = shader_priv; - TRACE("[FAILED]\n"); - return FALSE; + return priv->ffp_proj_control; } const struct wined3d_shader_backend_ops none_shader_backend = @@ -1541,6 +1578,7 @@ const struct wined3d_shader_backend_ops none_shader_backend = shader_none_context_destroyed, shader_none_get_caps, shader_none_color_fixup_supported, + shader_none_has_ffp_proj_control, }; static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *byte_code, @@ -1597,10 +1635,13 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b switch (type) { case WINED3D_SHADER_TYPE_VERTEX: - backend_version = shader->device->vshader_version; + backend_version = shader->device->vs_version; + break; + case WINED3D_SHADER_TYPE_GEOMETRY: + backend_version = shader->device->gs_version; break; case WINED3D_SHADER_TYPE_PIXEL: - backend_version = shader->device->pshader_version; + backend_version = shader->device->ps_version; break; default: FIXME("No backend version-checking for this shader type\n"); @@ -1758,21 +1799,16 @@ static void vertexshader_set_limits(struct wined3d_shader *shader) shader->reg_maps.shader_version.minor); struct wined3d_device *device = shader->device; - shader->limits.texcoord = 0; - shader->limits.attributes = 16; shader->limits.packed_input = 0; switch (shader_version) { case WINED3D_SHADER_VERSION(1, 0): case WINED3D_SHADER_VERSION(1, 1): - shader->limits.temporary = 12; shader->limits.constant_bool = 0; shader->limits.constant_int = 0; - shader->limits.address = 1; shader->limits.packed_output = 12; shader->limits.sampler = 0; - shader->limits.label = 0; /* TODO: vs_1_1 has a minimum of 96 constants. What happens when * a vs_1_1 shader is used on a vs_3_0 capable card that has 256 * constants? */ @@ -1781,28 +1817,18 @@ static void vertexshader_set_limits(struct wined3d_shader *shader) case WINED3D_SHADER_VERSION(2, 0): case WINED3D_SHADER_VERSION(2, 1): - shader->limits.temporary = 12; shader->limits.constant_bool = 16; shader->limits.constant_int = 16; - shader->limits.address = 1; shader->limits.packed_output = 12; shader->limits.sampler = 0; - shader->limits.label = 16; shader->limits.constant_float = min(256, device->d3d_vshader_constantF); break; - case WINED3D_SHADER_VERSION(4, 0): - FIXME("Using 3.0 limits for 4.0 shader.\n"); - /* Fall through. */ - case WINED3D_SHADER_VERSION(3, 0): - shader->limits.temporary = 32; - shader->limits.constant_bool = 32; - shader->limits.constant_int = 32; - shader->limits.address = 1; + shader->limits.constant_bool = 16; + shader->limits.constant_int = 16; shader->limits.packed_output = 12; shader->limits.sampler = 4; - shader->limits.label = 16; /* FIXME: 2048 */ /* DX10 cards on Windows advertise a d3d9 constant limit of 256 * even though they are capable of supporting much more (GL * drivers advertise 1024). d3d9.dll and d3d8.dll clamp the @@ -1811,14 +1837,20 @@ static void vertexshader_set_limits(struct wined3d_shader *shader) shader->limits.constant_float = min(256, device->d3d_vshader_constantF); break; + case WINED3D_SHADER_VERSION(4, 0): + shader->limits.sampler = 16; /* FIXME: 128 resources, 16 sampler states */ + shader->limits.constant_int = 0; + shader->limits.constant_float = 0; + shader->limits.constant_bool = 0; + shader->limits.packed_output = 16; + shader->limits.packed_input = 0; + break; + default: - shader->limits.temporary = 12; shader->limits.constant_bool = 16; shader->limits.constant_int = 16; - shader->limits.address = 1; shader->limits.packed_output = 12; shader->limits.sampler = 0; - shader->limits.label = 16; shader->limits.constant_float = min(256, device->d3d_vshader_constantF); FIXME("Unrecognized vertex shader version \"%u.%u\".\n", shader->reg_maps.shader_version.major, @@ -1876,6 +1908,30 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d return WINED3D_OK; } +static void geometryshader_set_limits(struct wined3d_shader *shader) +{ + DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major, + shader->reg_maps.shader_version.minor); + + switch (shader_version) + { + case WINED3D_SHADER_VERSION(4, 0): + shader->limits.sampler = 16; /* FIXME: 128 resources, 16 sampler states */ + shader->limits.constant_int = 0; + shader->limits.constant_float = 0; + shader->limits.constant_bool = 0; + shader->limits.packed_output = 32; + shader->limits.packed_input = 16; + break; + + default: + memset(&shader->limits, 0, sizeof(shader->limits)); + FIXME("Unhandled geometry shader version \"%u.%u\".\n", + shader->reg_maps.shader_version.major, + shader->reg_maps.shader_version.minor); + } +} + static HRESULT geometryshader_init(struct wined3d_shader *shader, struct wined3d_device *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops, unsigned int max_version) @@ -1892,6 +1948,8 @@ static HRESULT geometryshader_init(struct wined3d_shader *shader, struct wined3d return hr; } + geometryshader_set_limits(shader); + shader->load_local_constsF = FALSE; return WINED3D_OK; @@ -2051,8 +2109,6 @@ static void pixelshader_set_limits(struct wined3d_shader *shader) DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major, shader->reg_maps.shader_version.minor); - shader->limits.attributes = 0; - shader->limits.address = 0; shader->limits.packed_output = 0; switch (shader_version) @@ -2061,73 +2117,60 @@ static void pixelshader_set_limits(struct wined3d_shader *shader) case WINED3D_SHADER_VERSION(1, 1): case WINED3D_SHADER_VERSION(1, 2): case WINED3D_SHADER_VERSION(1, 3): - shader->limits.temporary = 2; shader->limits.constant_float = 8; shader->limits.constant_int = 0; shader->limits.constant_bool = 0; - shader->limits.texcoord = 4; shader->limits.sampler = 4; shader->limits.packed_input = 0; - shader->limits.label = 0; break; case WINED3D_SHADER_VERSION(1, 4): - shader->limits.temporary = 6; shader->limits.constant_float = 8; shader->limits.constant_int = 0; shader->limits.constant_bool = 0; - shader->limits.texcoord = 6; shader->limits.sampler = 6; shader->limits.packed_input = 0; - shader->limits.label = 0; break; /* FIXME: Temporaries must match D3DPSHADERCAPS2_0.NumTemps. */ case WINED3D_SHADER_VERSION(2, 0): - shader->limits.temporary = 32; shader->limits.constant_float = 32; shader->limits.constant_int = 16; shader->limits.constant_bool = 16; - shader->limits.texcoord = 8; shader->limits.sampler = 16; shader->limits.packed_input = 0; break; case WINED3D_SHADER_VERSION(2, 1): - shader->limits.temporary = 32; shader->limits.constant_float = 32; shader->limits.constant_int = 16; shader->limits.constant_bool = 16; - shader->limits.texcoord = 8; shader->limits.sampler = 16; shader->limits.packed_input = 0; - shader->limits.label = 16; break; - case WINED3D_SHADER_VERSION(4, 0): - FIXME("Using 3.0 limits for 4.0 shader.\n"); - /* Fall through. */ - case WINED3D_SHADER_VERSION(3, 0): - shader->limits.temporary = 32; shader->limits.constant_float = 224; shader->limits.constant_int = 16; shader->limits.constant_bool = 16; - shader->limits.texcoord = 0; shader->limits.sampler = 16; shader->limits.packed_input = 12; - shader->limits.label = 16; /* FIXME: 2048 */ + break; + + case WINED3D_SHADER_VERSION(4, 0): + shader->limits.sampler = 16; /* FIXME: 128 resources, 16 sampler states */ + shader->limits.constant_int = 0; + shader->limits.constant_float = 0; + shader->limits.constant_bool = 0; + shader->limits.packed_input = 32; break; default: - shader->limits.temporary = 32; shader->limits.constant_float = 32; shader->limits.constant_int = 16; shader->limits.constant_bool = 16; - shader->limits.texcoord = 8; shader->limits.sampler = 16; shader->limits.packed_input = 0; - shader->limits.label = 0; FIXME("Unrecognized pixel shader version %u.%u\n", shader->reg_maps.shader_version.major, shader->reg_maps.shader_version.minor); @@ -2257,10 +2300,7 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const DWOR object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate shader memory.\n"); return E_OUTOFMEMORY; - } hr = geometryshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version); if (FAILED(hr)) @@ -2286,15 +2326,9 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const DWOR TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", device, byte_code, output_signature, parent, parent_ops, shader); - if (device->ps_selected_mode == SHADER_NONE) - return WINED3DERR_INVALIDCALL; - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate shader memory.\n"); return E_OUTOFMEMORY; - } hr = pixelshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version); if (FAILED(hr)) @@ -2320,15 +2354,9 @@ HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const DWOR TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", device, byte_code, output_signature, parent, parent_ops, shader); - if (device->vs_selected_mode == SHADER_NONE) - return WINED3DERR_INVALIDCALL; - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate shader memory.\n"); return E_OUTOFMEMORY; - } hr = vertexshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/wined3d/shader_sm1.c b/reactos/dll/directx/wine/wined3d/shader_sm1.c index 350f540b64f..34e0f8cc9ad 100644 --- a/reactos/dll/directx/wine/wined3d/shader_sm1.c +++ b/reactos/dll/directx/wine/wined3d/shader_sm1.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" @@ -204,6 +204,13 @@ struct wined3d_sm1_data { struct wined3d_shader_version shader_version; const struct wined3d_sm1_opcode_info *opcode_table; + + struct wined3d_shader_src_param src_rel_addr[4]; + struct wined3d_shader_src_param pred_rel_addr; + struct wined3d_shader_src_param dst_rel_addr; + struct wined3d_shader_src_param src_param[4]; + struct wined3d_shader_src_param pred_param; + struct wined3d_shader_dst_param dst_param; }; /* This table is not order or position dependent. */ @@ -440,11 +447,13 @@ static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_ { src->reg.type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); - src->reg.idx = param & WINED3DSP_REGNUM_MASK; - src->reg.array_idx = ~0U; + src->reg.data_type = WINED3D_DATA_FLOAT; + src->reg.idx[0].offset = param & WINED3DSP_REGNUM_MASK; + src->reg.idx[0].rel_addr = rel_addr; + src->reg.idx[1].offset = ~0U; + src->reg.idx[1].rel_addr = NULL; src->swizzle = (param & WINED3DSP_SWIZZLE_MASK) >> WINED3DSP_SWIZZLE_SHIFT; src->modifiers = (param & WINED3DSP_SRCMOD_MASK) >> WINED3DSP_SRCMOD_SHIFT; - src->reg.rel_addr = rel_addr; } static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_param *rel_addr, @@ -452,12 +461,14 @@ static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_ { dst->reg.type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) | ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); - dst->reg.idx = param & WINED3DSP_REGNUM_MASK; - dst->reg.array_idx = ~0U; + dst->reg.data_type = WINED3D_DATA_FLOAT; + dst->reg.idx[0].offset = param & WINED3DSP_REGNUM_MASK; + dst->reg.idx[0].rel_addr = rel_addr; + dst->reg.idx[1].offset = ~0U; + dst->reg.idx[1].rel_addr = NULL; dst->write_mask = (param & WINED3D_SM1_WRITEMASK_MASK) >> WINED3D_SM1_WRITEMASK_SHIFT; dst->modifiers = (param & WINED3DSP_DSTMOD_MASK) >> WINED3DSP_DSTMOD_SHIFT; dst->shift = (param & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT; - dst->reg.rel_addr = rel_addr; } /* Read the parameters of an unrecognized opcode from the input stream @@ -519,10 +530,7 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)); if (!priv) - { - ERR("Failed to allocate private data\n"); return NULL; - } if (output_signature) { @@ -568,36 +576,9 @@ static void shader_sm1_read_header(void *data, const DWORD **ptr, struct wined3d *shader_version = priv->shader_version; } -static void shader_sm1_read_opcode(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins, - UINT *param_size) +static void shader_sm1_read_src_param(struct wined3d_sm1_data *priv, const DWORD **ptr, + struct wined3d_shader_src_param *src_param, struct wined3d_shader_src_param *src_rel_addr) { - struct wined3d_sm1_data *priv = data; - const struct wined3d_sm1_opcode_info *opcode_info; - DWORD opcode_token; - - opcode_token = *(*ptr)++; - opcode_info = shader_get_opcode(priv, opcode_token); - if (!opcode_info) - { - FIXME("Unrecognized opcode: token=0x%08x\n", opcode_token); - ins->handler_idx = WINED3DSIH_TABLE_SIZE; - *param_size = shader_skip_unrecognized(priv, *ptr); - return; - } - - ins->handler_idx = opcode_info->handler_idx; - ins->flags = (opcode_token & WINED3D_OPCODESPECIFICCONTROL_MASK) >> WINED3D_OPCODESPECIFICCONTROL_SHIFT; - ins->coissue = opcode_token & WINED3DSI_COISSUE; - ins->predicate = opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED; - ins->dst_count = opcode_info->dst_count ? 1 : 0; - ins->src_count = opcode_info->param_count - opcode_info->dst_count; - *param_size = shader_skip_opcode(priv, opcode_info, opcode_token); -} - -static void shader_sm1_read_src_param(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param, - struct wined3d_shader_src_param *src_rel_addr) -{ - struct wined3d_sm1_data *priv = data; DWORD token, addr_token; *ptr += shader_get_param(priv, *ptr, &token, &addr_token); @@ -612,10 +593,9 @@ static void shader_sm1_read_src_param(void *data, const DWORD **ptr, struct wine } } -static void shader_sm1_read_dst_param(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param, - struct wined3d_shader_src_param *dst_rel_addr) +static void shader_sm1_read_dst_param(struct wined3d_sm1_data *priv, const DWORD **ptr, + struct wined3d_shader_dst_param *dst_param, struct wined3d_shader_src_param *dst_rel_addr) { - struct wined3d_sm1_data *priv = data; DWORD token, addr_token; *ptr += shader_get_param(priv, *ptr, &token, &addr_token); @@ -641,25 +621,138 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se shader_parse_dst_param(dst_token, NULL, &semantic->reg); } -static void shader_sm1_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size) +static void shader_sm1_read_immconst(const DWORD **ptr, struct wined3d_shader_src_param *src_param, + enum wined3d_immconst_type type, enum wined3d_data_type data_type) +{ + UINT count = type == WINED3D_IMMCONST_VEC4 ? 4 : 1; + src_param->reg.type = WINED3DSPR_IMMCONST; + src_param->reg.data_type = data_type; + src_param->reg.idx[0].offset = ~0U; + src_param->reg.idx[0].rel_addr = NULL; + src_param->reg.idx[1].offset = ~0U; + src_param->reg.idx[1].rel_addr = NULL; + src_param->reg.immconst_type = type; + memcpy(src_param->reg.immconst_data, *ptr, count * sizeof(DWORD)); + src_param->swizzle = WINED3DSP_NOSWIZZLE; + src_param->modifiers = 0; + + *ptr += count; +} + +static void shader_sm1_read_comment(const DWORD **ptr) { DWORD token = **ptr; + const char *comment; UINT size; - if ((token & WINED3DSI_OPCODE_MASK) != WINED3D_SM1_OP_COMMENT) + while ((token & WINED3DSI_OPCODE_MASK) == WINED3D_SM1_OP_COMMENT) { - *comment = NULL; + size = (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT; + comment = (const char *)++(*ptr); + *ptr += size; + + if (size > 1 && *(const DWORD *)comment == WINEMAKEFOURCC('T', 'E', 'X', 'T')) + { + const char *end = comment + size * sizeof(token); + const char *p = comment + sizeof(token); + const char *line = p; + + TRACE("// TEXT\n"); + while (p != end) + { + if (*p == '\n') + { + UINT len = p - line; + if (len && *(p - 1) == '\r') --len; + TRACE("// %s\n", debugstr_an(line, len)); + line = ++p; + } + else ++p; + } + if (line != p) + TRACE("// %s\n", debugstr_an(line, p - line)); + } + else if (size) + TRACE("// %s\n", debugstr_an(comment, size * sizeof(token))); + else + break; + + token = **ptr; + } +} + +static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins) +{ + const struct wined3d_sm1_opcode_info *opcode_info; + struct wined3d_sm1_data *priv = data; + DWORD opcode_token; + unsigned int i; + const DWORD *p; + + shader_sm1_read_comment(ptr); + + opcode_token = *(*ptr)++; + if (!(opcode_info = shader_get_opcode(priv, opcode_token))) + { + FIXME("Unrecognized opcode: token=0x%08x.\n", opcode_token); + ins->handler_idx = WINED3DSIH_TABLE_SIZE; + *ptr += shader_skip_unrecognized(priv, *ptr); return; } - size = (token & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT; - *comment = (const char *)++(*ptr); - *comment_size = size * sizeof(DWORD); - *ptr += size; + ins->handler_idx = opcode_info->handler_idx; + ins->flags = (opcode_token & WINED3D_OPCODESPECIFICCONTROL_MASK) >> WINED3D_OPCODESPECIFICCONTROL_SHIFT; + ins->coissue = opcode_token & WINED3DSI_COISSUE; + ins->predicate = opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED ? &priv->pred_param : NULL; + ins->dst_count = opcode_info->dst_count ? 1 : 0; + ins->dst = &priv->dst_param; + ins->src_count = opcode_info->param_count - opcode_info->dst_count; + ins->src = priv->src_param; + + p = *ptr; + *ptr += shader_skip_opcode(priv, opcode_info, opcode_token); + + if (ins->handler_idx == WINED3DSIH_DCL) + { + shader_sm1_read_semantic(&p, &ins->declaration.semantic); + } + else if (ins->handler_idx == WINED3DSIH_DEF) + { + shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr); + shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_DATA_FLOAT); + } + else if (ins->handler_idx == WINED3DSIH_DEFI) + { + shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr); + shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_DATA_INT); + } + else if (ins->handler_idx == WINED3DSIH_DEFB) + { + shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr); + shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_SCALAR, WINED3D_DATA_UINT); + } + else + { + /* Destination token */ + if (ins->dst_count) + shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr); + + /* Predication token */ + if (ins->predicate) + shader_sm1_read_src_param(priv, &p, &priv->pred_param, &priv->pred_rel_addr); + + /* Other source tokens */ + for (i = 0; i < ins->src_count; ++i) + { + shader_sm1_read_src_param(priv, &p, &priv->src_param[i], &priv->src_rel_addr[i]); + } + } } static BOOL shader_sm1_is_end(void *data, const DWORD **ptr) { + shader_sm1_read_comment(ptr); + if (**ptr == WINED3DSP_END) { ++(*ptr); @@ -674,10 +767,6 @@ const struct wined3d_shader_frontend sm1_shader_frontend = shader_sm1_init, shader_sm1_free, shader_sm1_read_header, - shader_sm1_read_opcode, - shader_sm1_read_src_param, - shader_sm1_read_dst_param, - shader_sm1_read_semantic, - shader_sm1_read_comment, + shader_sm1_read_instruction, shader_sm1_is_end, }; diff --git a/reactos/dll/directx/wine/wined3d/shader_sm4.c b/reactos/dll/directx/wine/wined3d/shader_sm4.c index 5285ae95bbb..1159d6ea708 100644 --- a/reactos/dll/directx/wine/wined3d/shader_sm4.c +++ b/reactos/dll/directx/wine/wined3d/shader_sm4.c @@ -16,28 +16,44 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); +WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode); #define WINED3D_SM4_INSTRUCTION_MODIFIER (1 << 31) #define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT 24 #define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0xf << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) +#define WINED3D_SM4_PRIMITIVE_TYPE_SHIFT 11 +#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7 << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT) + +#define WINED3D_SM4_INDEX_TYPE_SHIFT 11 +#define WINED3D_SM4_INDEX_TYPE_MASK (0x1 << WINED3D_SM4_INDEX_TYPE_SHIFT) + #define WINED3D_SM4_OPCODE_MASK 0xff #define WINED3D_SM4_REGISTER_MODIFIER (1 << 31) +#define WINED3D_SM4_ADDRESSING_SHIFT1 25 +#define WINED3D_SM4_ADDRESSING_MASK1 (0x3 << WINED3D_SM4_ADDRESSING_SHIFT1) + +#define WINED3D_SM4_ADDRESSING_SHIFT0 22 +#define WINED3D_SM4_ADDRESSING_MASK0 (0x3 << WINED3D_SM4_ADDRESSING_SHIFT0) + #define WINED3D_SM4_REGISTER_ORDER_SHIFT 20 #define WINED3D_SM4_REGISTER_ORDER_MASK (0x3 << WINED3D_SM4_REGISTER_ORDER_SHIFT) #define WINED3D_SM4_REGISTER_TYPE_SHIFT 12 #define WINED3D_SM4_REGISTER_TYPE_MASK (0xf << WINED3D_SM4_REGISTER_TYPE_SHIFT) +#define WINED3D_SM4_SWIZZLE_TYPE_SHIFT 2 +#define WINED3D_SM4_SWIZZLE_TYPE_MASK (0x3 << WINED3D_SM4_SWIZZLE_TYPE_SHIFT) + #define WINED3D_SM4_IMMCONST_TYPE_SHIFT 0 #define WINED3D_SM4_IMMCONST_TYPE_MASK (0x3 << WINED3D_SM4_IMMCONST_TYPE_SHIFT) @@ -50,54 +66,61 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); #define WINED3D_SM4_VERSION_MAJOR(version) (((version) >> 4) & 0xf) #define WINED3D_SM4_VERSION_MINOR(version) (((version) >> 0) & 0xf) +#define WINED3D_SM4_ADDRESSING_RELATIVE 0x2 +#define WINED3D_SM4_ADDRESSING_OFFSET 0x1 + enum wined3d_sm4_opcode { - WINED3D_SM4_OP_ADD = 0x00, - WINED3D_SM4_OP_AND = 0x01, - WINED3D_SM4_OP_BREAK = 0x02, - WINED3D_SM4_OP_BREAKC = 0x03, - WINED3D_SM4_OP_CUT = 0x09, - WINED3D_SM4_OP_DERIV_RTX = 0x0b, - WINED3D_SM4_OP_DERIV_RTY = 0x0c, - WINED3D_SM4_OP_DIV = 0x0e, - WINED3D_SM4_OP_DP3 = 0x10, - WINED3D_SM4_OP_DP4 = 0x11, - WINED3D_SM4_OP_EMIT = 0x13, - WINED3D_SM4_OP_ENDIF = 0x15, - WINED3D_SM4_OP_ENDLOOP = 0x16, - WINED3D_SM4_OP_EQ = 0x18, - WINED3D_SM4_OP_EXP = 0x19, - WINED3D_SM4_OP_FRC = 0x1a, - WINED3D_SM4_OP_FTOI = 0x1b, - WINED3D_SM4_OP_GE = 0x1d, - WINED3D_SM4_OP_IADD = 0x1e, - WINED3D_SM4_OP_IF = 0x1f, - WINED3D_SM4_OP_IEQ = 0x20, - WINED3D_SM4_OP_IGE = 0x21, - WINED3D_SM4_OP_IMUL = 0x26, - WINED3D_SM4_OP_ITOF = 0x2b, - WINED3D_SM4_OP_LD = 0x2d, - WINED3D_SM4_OP_LOG = 0x2f, - WINED3D_SM4_OP_LOOP = 0x30, - WINED3D_SM4_OP_LT = 0x31, - WINED3D_SM4_OP_MAD = 0x32, - WINED3D_SM4_OP_MIN = 0x33, - WINED3D_SM4_OP_MAX = 0x34, - WINED3D_SM4_OP_MOV = 0x36, - WINED3D_SM4_OP_MOVC = 0x37, - WINED3D_SM4_OP_MUL = 0x38, - WINED3D_SM4_OP_RET = 0x3e, - WINED3D_SM4_OP_ROUND_NI = 0x41, - WINED3D_SM4_OP_RSQ = 0x44, - WINED3D_SM4_OP_SAMPLE = 0x45, - WINED3D_SM4_OP_SAMPLE_LOD = 0x48, - WINED3D_SM4_OP_SAMPLE_GRAD = 0x49, - WINED3D_SM4_OP_SQRT = 0x4b, - WINED3D_SM4_OP_SINCOS = 0x4d, - WINED3D_SM4_OP_UDIV = 0x4e, - WINED3D_SM4_OP_USHR = 0x55, - WINED3D_SM4_OP_UTOF = 0x56, - WINED3D_SM4_OP_XOR = 0x57, + WINED3D_SM4_OP_ADD = 0x00, + WINED3D_SM4_OP_AND = 0x01, + WINED3D_SM4_OP_BREAK = 0x02, + WINED3D_SM4_OP_BREAKC = 0x03, + WINED3D_SM4_OP_CUT = 0x09, + WINED3D_SM4_OP_DERIV_RTX = 0x0b, + WINED3D_SM4_OP_DERIV_RTY = 0x0c, + WINED3D_SM4_OP_DIV = 0x0e, + WINED3D_SM4_OP_DP3 = 0x10, + WINED3D_SM4_OP_DP4 = 0x11, + WINED3D_SM4_OP_EMIT = 0x13, + WINED3D_SM4_OP_ENDIF = 0x15, + WINED3D_SM4_OP_ENDLOOP = 0x16, + WINED3D_SM4_OP_EQ = 0x18, + WINED3D_SM4_OP_EXP = 0x19, + WINED3D_SM4_OP_FRC = 0x1a, + WINED3D_SM4_OP_FTOI = 0x1b, + WINED3D_SM4_OP_GE = 0x1d, + WINED3D_SM4_OP_IADD = 0x1e, + WINED3D_SM4_OP_IF = 0x1f, + WINED3D_SM4_OP_IEQ = 0x20, + WINED3D_SM4_OP_IGE = 0x21, + WINED3D_SM4_OP_IMUL = 0x26, + WINED3D_SM4_OP_ITOF = 0x2b, + WINED3D_SM4_OP_LD = 0x2d, + WINED3D_SM4_OP_LOG = 0x2f, + WINED3D_SM4_OP_LOOP = 0x30, + WINED3D_SM4_OP_LT = 0x31, + WINED3D_SM4_OP_MAD = 0x32, + WINED3D_SM4_OP_MIN = 0x33, + WINED3D_SM4_OP_MAX = 0x34, + WINED3D_SM4_OP_MOV = 0x36, + WINED3D_SM4_OP_MOVC = 0x37, + WINED3D_SM4_OP_MUL = 0x38, + WINED3D_SM4_OP_RET = 0x3e, + WINED3D_SM4_OP_ROUND_NI = 0x41, + WINED3D_SM4_OP_RSQ = 0x44, + WINED3D_SM4_OP_SAMPLE = 0x45, + WINED3D_SM4_OP_SAMPLE_LOD = 0x48, + WINED3D_SM4_OP_SAMPLE_GRAD = 0x49, + WINED3D_SM4_OP_SQRT = 0x4b, + WINED3D_SM4_OP_SINCOS = 0x4d, + WINED3D_SM4_OP_UDIV = 0x4e, + WINED3D_SM4_OP_USHR = 0x55, + WINED3D_SM4_OP_UTOF = 0x56, + WINED3D_SM4_OP_XOR = 0x57, + WINED3D_SM4_OP_DCL_CONSTANT_BUFFER = 0x59, + WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY = 0x5c, + WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE = 0x5d, + WINED3D_SM4_OP_DCL_VERTICES_OUT = 0x5e, }; enum wined3d_sm4_register_type @@ -108,28 +131,62 @@ enum wined3d_sm4_register_type WINED3D_SM4_RT_IMMCONST = 0x4, WINED3D_SM4_RT_SAMPLER = 0x6, WINED3D_SM4_RT_CONSTBUFFER = 0x8, + WINED3D_SM4_RT_PRIMID = 0xb, WINED3D_SM4_RT_NULL = 0xd, }; +enum wined3d_sm4_output_primitive_type +{ + WINED3D_SM4_OUTPUT_PT_POINTLIST = 0x1, + WINED3D_SM4_OUTPUT_PT_LINELIST = 0x3, + WINED3D_SM4_OUTPUT_PT_TRIANGLESTRIP = 0x5, +}; + +enum wined3d_sm4_input_primitive_type +{ + WINED3D_SM4_INPUT_PT_POINT = 0x1, + WINED3D_SM4_INPUT_PT_LINE = 0x2, + WINED3D_SM4_INPUT_PT_TRIANGLE = 0x3, + WINED3D_SM4_INPUT_PT_LINEADJ = 0x6, + WINED3D_SM4_INPUT_PT_TRIANGLEADJ = 0x7, +}; + +enum wined3d_sm4_swizzle_type +{ + WINED3D_SM4_SWIZZLE_VEC4 = 0x1, + WINED3D_SM4_SWIZZLE_SCALAR = 0x2, +}; + enum wined3d_sm4_immconst_type { WINED3D_SM4_IMMCONST_SCALAR = 0x1, WINED3D_SM4_IMMCONST_VEC4 = 0x2, }; +struct wined3d_shader_src_param_entry +{ + struct list entry; + struct wined3d_shader_src_param param; +}; + struct wined3d_sm4_data { struct wined3d_shader_version shader_version; const DWORD *end; const struct wined3d_shader_signature *output_signature; + + struct wined3d_shader_src_param src_param[5]; + struct wined3d_shader_dst_param dst_param[2]; + struct list src_free; + struct list src; }; struct wined3d_sm4_opcode_info { enum wined3d_sm4_opcode opcode; enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; - UINT dst_count; - UINT src_count; + const char *dst_info; + const char *src_info; }; struct sysval_map @@ -139,54 +196,65 @@ struct sysval_map UINT register_idx; }; +/* + * F -> WINED3D_DATA_FLOAT + * I -> WINED3D_DATA_INT + * R -> WINED3D_DATA_RESOURCE + * S -> WINED3D_DATA_SAMPLER + * U -> WINED3D_DATA_UINT + */ static const struct wined3d_sm4_opcode_info opcode_table[] = { - {WINED3D_SM4_OP_ADD, WINED3DSIH_ADD, 1, 2}, - {WINED3D_SM4_OP_AND, WINED3DSIH_AND, 1, 2}, - {WINED3D_SM4_OP_BREAK, WINED3DSIH_BREAK, 0, 0}, - {WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, 0, 1}, - {WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, 0, 0}, - {WINED3D_SM4_OP_DERIV_RTX, WINED3DSIH_DSX, 1, 1}, - {WINED3D_SM4_OP_DERIV_RTY, WINED3DSIH_DSY, 1, 1}, - {WINED3D_SM4_OP_DIV, WINED3DSIH_DIV, 1, 2}, - {WINED3D_SM4_OP_DP3, WINED3DSIH_DP3, 1, 2}, - {WINED3D_SM4_OP_DP4, WINED3DSIH_DP4, 1, 2}, - {WINED3D_SM4_OP_EMIT, WINED3DSIH_EMIT, 0, 0}, - {WINED3D_SM4_OP_ENDIF, WINED3DSIH_ENDIF, 0, 0}, - {WINED3D_SM4_OP_ENDLOOP, WINED3DSIH_ENDLOOP, 0, 0}, - {WINED3D_SM4_OP_EQ, WINED3DSIH_EQ, 1, 2}, - {WINED3D_SM4_OP_EXP, WINED3DSIH_EXP, 1, 1}, - {WINED3D_SM4_OP_FRC, WINED3DSIH_FRC, 1, 1}, - {WINED3D_SM4_OP_FTOI, WINED3DSIH_FTOI, 1, 1}, - {WINED3D_SM4_OP_GE, WINED3DSIH_GE, 1, 2}, - {WINED3D_SM4_OP_IADD, WINED3DSIH_IADD, 1, 2}, - {WINED3D_SM4_OP_IF, WINED3DSIH_IF, 0, 1}, - {WINED3D_SM4_OP_IEQ, WINED3DSIH_IEQ, 1, 2}, - {WINED3D_SM4_OP_IGE, WINED3DSIH_IGE, 1, 2}, - {WINED3D_SM4_OP_IMUL, WINED3DSIH_IMUL, 2, 2}, - {WINED3D_SM4_OP_ITOF, WINED3DSIH_ITOF, 1, 1}, - {WINED3D_SM4_OP_LD, WINED3DSIH_LD, 1, 2}, - {WINED3D_SM4_OP_LOG, WINED3DSIH_LOG, 1, 1}, - {WINED3D_SM4_OP_LOOP, WINED3DSIH_LOOP, 0, 0}, - {WINED3D_SM4_OP_LT, WINED3DSIH_LT, 1, 2}, - {WINED3D_SM4_OP_MAD, WINED3DSIH_MAD, 1, 3}, - {WINED3D_SM4_OP_MIN, WINED3DSIH_MIN, 1, 2}, - {WINED3D_SM4_OP_MAX, WINED3DSIH_MAX, 1, 2}, - {WINED3D_SM4_OP_MOV, WINED3DSIH_MOV, 1, 1}, - {WINED3D_SM4_OP_MOVC, WINED3DSIH_MOVC, 1, 3}, - {WINED3D_SM4_OP_MUL, WINED3DSIH_MUL, 1, 2}, - {WINED3D_SM4_OP_RET, WINED3DSIH_RET, 0, 0}, - {WINED3D_SM4_OP_ROUND_NI, WINED3DSIH_ROUND_NI, 1, 1}, - {WINED3D_SM4_OP_RSQ, WINED3DSIH_RSQ, 1, 1}, - {WINED3D_SM4_OP_SAMPLE, WINED3DSIH_SAMPLE, 1, 3}, - {WINED3D_SM4_OP_SAMPLE_LOD, WINED3DSIH_SAMPLE_LOD, 1, 4}, - {WINED3D_SM4_OP_SAMPLE_GRAD,WINED3DSIH_SAMPLE_GRAD, 1, 5}, - {WINED3D_SM4_OP_SQRT, WINED3DSIH_SQRT, 1, 1}, - {WINED3D_SM4_OP_SINCOS, WINED3DSIH_SINCOS, 2, 1}, - {WINED3D_SM4_OP_UDIV, WINED3DSIH_UDIV, 2, 2}, - {WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, 1, 2}, - {WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, 1, 1}, - {WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, 1, 2}, + {WINED3D_SM4_OP_ADD, WINED3DSIH_ADD, "F", "FF"}, + {WINED3D_SM4_OP_AND, WINED3DSIH_AND, "U", "UU"}, + {WINED3D_SM4_OP_BREAK, WINED3DSIH_BREAK, "", ""}, + {WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, "", "U"}, + {WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, "", ""}, + {WINED3D_SM4_OP_DERIV_RTX, WINED3DSIH_DSX, "F", "F"}, + {WINED3D_SM4_OP_DERIV_RTY, WINED3DSIH_DSY, "F", "F"}, + {WINED3D_SM4_OP_DIV, WINED3DSIH_DIV, "F", "FF"}, + {WINED3D_SM4_OP_DP3, WINED3DSIH_DP3, "F", "FF"}, + {WINED3D_SM4_OP_DP4, WINED3DSIH_DP4, "F", "FF"}, + {WINED3D_SM4_OP_EMIT, WINED3DSIH_EMIT, "", ""}, + {WINED3D_SM4_OP_ENDIF, WINED3DSIH_ENDIF, "", ""}, + {WINED3D_SM4_OP_ENDLOOP, WINED3DSIH_ENDLOOP, "", ""}, + {WINED3D_SM4_OP_EQ, WINED3DSIH_EQ, "U", "FF"}, + {WINED3D_SM4_OP_EXP, WINED3DSIH_EXP, "F", "F"}, + {WINED3D_SM4_OP_FRC, WINED3DSIH_FRC, "F", "F"}, + {WINED3D_SM4_OP_FTOI, WINED3DSIH_FTOI, "I", "F"}, + {WINED3D_SM4_OP_GE, WINED3DSIH_GE, "U", "FF"}, + {WINED3D_SM4_OP_IADD, WINED3DSIH_IADD, "I", "II"}, + {WINED3D_SM4_OP_IF, WINED3DSIH_IF, "", "U"}, + {WINED3D_SM4_OP_IEQ, WINED3DSIH_IEQ, "U", "II"}, + {WINED3D_SM4_OP_IGE, WINED3DSIH_IGE, "U", "II"}, + {WINED3D_SM4_OP_IMUL, WINED3DSIH_IMUL, "II", "II"}, + {WINED3D_SM4_OP_ITOF, WINED3DSIH_ITOF, "F", "I"}, + {WINED3D_SM4_OP_LD, WINED3DSIH_LD, "U", "FR"}, + {WINED3D_SM4_OP_LOG, WINED3DSIH_LOG, "F", "F"}, + {WINED3D_SM4_OP_LOOP, WINED3DSIH_LOOP, "", ""}, + {WINED3D_SM4_OP_LT, WINED3DSIH_LT, "U", "FF"}, + {WINED3D_SM4_OP_MAD, WINED3DSIH_MAD, "F", "FFF"}, + {WINED3D_SM4_OP_MIN, WINED3DSIH_MIN, "F", "FF"}, + {WINED3D_SM4_OP_MAX, WINED3DSIH_MAX, "F", "FF"}, + {WINED3D_SM4_OP_MOV, WINED3DSIH_MOV, "F", "F"}, + {WINED3D_SM4_OP_MOVC, WINED3DSIH_MOVC, "F", "UFF"}, + {WINED3D_SM4_OP_MUL, WINED3DSIH_MUL, "F", "FF"}, + {WINED3D_SM4_OP_RET, WINED3DSIH_RET, "", ""}, + {WINED3D_SM4_OP_ROUND_NI, WINED3DSIH_ROUND_NI, "F", "F"}, + {WINED3D_SM4_OP_RSQ, WINED3DSIH_RSQ, "F", "F"}, + {WINED3D_SM4_OP_SAMPLE, WINED3DSIH_SAMPLE, "U", "FRS"}, + {WINED3D_SM4_OP_SAMPLE_LOD, WINED3DSIH_SAMPLE_LOD, "U", "FRSF"}, + {WINED3D_SM4_OP_SAMPLE_GRAD, WINED3DSIH_SAMPLE_GRAD, "U", "FRSFF"}, + {WINED3D_SM4_OP_SQRT, WINED3DSIH_SQRT, "F", "F"}, + {WINED3D_SM4_OP_SINCOS, WINED3DSIH_SINCOS, "FF", "F"}, + {WINED3D_SM4_OP_UDIV, WINED3DSIH_UDIV, "UU", "UU"}, + {WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, "U", "UU"}, + {WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, "F", "U"}, + {WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, "U", "UU"}, + {WINED3D_SM4_OP_DCL_CONSTANT_BUFFER, WINED3DSIH_DCL_CONSTANT_BUFFER, "", ""}, + {WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY, WINED3DSIH_DCL_OUTPUT_TOPOLOGY, "", ""}, + {WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE, WINED3DSIH_DCL_INPUT_PRIMITIVE, "", ""}, + {WINED3D_SM4_OP_DCL_VERTICES_OUT, WINED3DSIH_DCL_VERTICES_OUT, "", ""}, }; static const enum wined3d_shader_register_type register_type_table[] = @@ -202,11 +270,33 @@ static const enum wined3d_shader_register_type register_type_table[] = /* WINED3D_SM4_RT_CONSTBUFFER */ WINED3DSPR_CONSTBUFFER, /* UNKNOWN */ 0, /* UNKNOWN */ 0, - /* UNKNOWN */ 0, + /* WINED3D_SM4_RT_PRIMID */ WINED3DSPR_PRIMID, /* UNKNOWN */ 0, /* WINED3D_SM4_RT_NULL */ WINED3DSPR_NULL, }; +static const enum wined3d_primitive_type output_primitive_type_table[] = +{ + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_OUTPUT_PT_POINTLIST */ WINED3D_PT_POINTLIST, + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_OUTPUT_PT_LINELIST */ WINED3D_PT_LINELIST, + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_OUTPUT_PT_TRIANGLESTRIP */ WINED3D_PT_TRIANGLESTRIP, +}; + +static const enum wined3d_primitive_type input_primitive_type_table[] = +{ + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_INPUT_PT_POINT */ WINED3D_PT_POINTLIST, + /* WINED3D_SM4_INPUT_PT_LINE */ WINED3D_PT_LINELIST, + /* WINED3D_SM4_INPUT_PT_TRIANGLE */ WINED3D_PT_TRIANGLELIST, + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* UNKNOWN */ WINED3D_PT_UNDEFINED, + /* WINED3D_SM4_INPUT_PT_LINEADJ */ WINED3D_PT_LINELIST_ADJ, + /* WINED3D_SM4_INPUT_PT_TRIANGLEADJ */ WINED3D_PT_TRIANGLELIST_ADJ, +}; + static const struct sysval_map sysval_map[] = { {WINED3D_SV_DEPTH, WINED3DSPR_DEPTHOUT, 0}, @@ -220,6 +310,9 @@ static const struct sysval_map sysval_map[] = {WINED3D_SV_TARGET7, WINED3DSPR_COLOROUT, 7}, }; +static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr, + enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param); + static const struct wined3d_sm4_opcode_info *get_opcode_info(enum wined3d_sm4_opcode opcode) { unsigned int i; @@ -241,7 +334,7 @@ static void map_sysval(enum wined3d_sysval_semantic sysval, struct wined3d_shade if (sysval == sysval_map[i].sysval) { reg->type = sysval_map[i].register_type; - reg->idx = sysval_map[i].register_idx; + reg->idx[0].offset = sysval_map[i].register_idx; } } } @@ -264,7 +357,7 @@ static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_sha for (i = 0; i < s->element_count; ++i) { - if (s->elements[i].register_idx == reg->idx) + if (s->elements[i].register_idx == reg->idx[0].offset) { map_sysval(s->elements[i].sysval_semantic, reg); break; @@ -278,6 +371,26 @@ static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_sha } } +static enum wined3d_data_type map_data_type(char t) +{ + switch (t) + { + case 'F': + return WINED3D_DATA_FLOAT; + case 'I': + return WINED3D_DATA_INT; + case 'R': + return WINED3D_DATA_RESOURCE; + case 'S': + return WINED3D_DATA_SAMPLER; + case 'U': + return WINED3D_DATA_UINT; + default: + ERR("Invalid data type '%c'.\n", t); + return WINED3D_DATA_FLOAT; + } +} + static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature) { struct wined3d_sm4_data *priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)); @@ -288,13 +401,45 @@ static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader } priv->output_signature = output_signature; + list_init(&priv->src_free); + list_init(&priv->src); return priv; } static void shader_sm4_free(void *data) { - HeapFree(GetProcessHeap(), 0, data); + struct wined3d_shader_src_param_entry *e1, *e2; + struct wined3d_sm4_data *priv = data; + + list_move_head(&priv->src_free, &priv->src); + LIST_FOR_EACH_ENTRY_SAFE(e1, e2, &priv->src_free, struct wined3d_shader_src_param_entry, entry) + { + HeapFree(GetProcessHeap(), 0, e1); + } + HeapFree(GetProcessHeap(), 0, priv); +} + +static struct wined3d_shader_src_param *get_src_param(struct wined3d_sm4_data *priv) +{ + struct wined3d_shader_src_param_entry *e; + struct list *elem; + + if (!list_empty(&priv->src_free)) + { + elem = list_head(&priv->src_free); + list_remove(elem); + } + else + { + if (!(e = HeapAlloc(GetProcessHeap(), 0, sizeof(*e)))) + return NULL; + elem = &e->entry; + } + + list_add_tail(&priv->src, elem); + e = LIST_ENTRY(elem, struct wined3d_shader_src_param_entry, entry); + return &e->param; } static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version) @@ -333,175 +478,316 @@ static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d *shader_version = priv->shader_version; } -static void shader_sm4_read_opcode(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins, - UINT *param_size) +static BOOL shader_sm4_read_reg_idx(struct wined3d_sm4_data *priv, const DWORD **ptr, + DWORD addressing, struct wined3d_shader_register_index *reg_idx) +{ + if (addressing & WINED3D_SM4_ADDRESSING_RELATIVE) + { + struct wined3d_shader_src_param *rel_addr = get_src_param(priv); + + if (!(reg_idx->rel_addr = rel_addr)) + { + ERR("Failed to get src param for relative addressing.\n"); + return FALSE; + } + + if (addressing & WINED3D_SM4_ADDRESSING_OFFSET) + reg_idx->offset = *(*ptr)++; + else + reg_idx->offset = 0; + shader_sm4_read_src_param(priv, ptr, WINED3D_DATA_INT, rel_addr); + } + else + { + reg_idx->rel_addr = NULL; + reg_idx->offset = *(*ptr)++; + } + + return TRUE; +} + +static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **ptr, + enum wined3d_data_type data_type, struct wined3d_shader_register *param, + enum wined3d_shader_src_modifier *modifier) +{ + enum wined3d_sm4_register_type register_type; + DWORD token = *(*ptr)++; + DWORD order; + + register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT; + if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) + { + FIXME("Unhandled register type %#x.\n", register_type); + param->type = WINED3DSPR_TEMP; + } + else + { + param->type = register_type_table[register_type]; + } + param->data_type = data_type; + + if (token & WINED3D_SM4_REGISTER_MODIFIER) + { + DWORD m = *(*ptr)++; + + /* FIXME: This will probably break down at some point. The SM4 + * modifiers look like flags, while wined3d currently has an enum + * with possible combinations, e.g. WINED3DSPSM_ABSNEG. */ + switch (m) + { + case 0x41: + *modifier = WINED3DSPSM_NEG; + break; + + case 0x81: + *modifier = WINED3DSPSM_ABS; + break; + + default: + FIXME("Skipping modifier 0x%08x.\n", m); + *modifier = WINED3DSPSM_NONE; + break; + } + } + else + { + *modifier = WINED3DSPSM_NONE; + } + + order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT; + + if (order < 1) + param->idx[0].offset = ~0U; + else + { + DWORD addressing = (token & WINED3D_SM4_ADDRESSING_MASK0) >> WINED3D_SM4_ADDRESSING_SHIFT0; + if (!(shader_sm4_read_reg_idx(priv, ptr, addressing, ¶m->idx[0]))) + { + ERR("Failed to read register index.\n"); + return FALSE; + } + } + + if (order < 2) + param->idx[1].offset = ~0U; + else + { + DWORD addressing = (token & WINED3D_SM4_ADDRESSING_MASK1) >> WINED3D_SM4_ADDRESSING_SHIFT1; + if (!(shader_sm4_read_reg_idx(priv, ptr, addressing, ¶m->idx[1]))) + { + ERR("Failed to read register index.\n"); + return FALSE; + } + } + + if (order > 2) + FIXME("Unhandled order %u.\n", order); + + if (register_type == WINED3D_SM4_RT_IMMCONST) + { + enum wined3d_sm4_immconst_type immconst_type = + (token & WINED3D_SM4_IMMCONST_TYPE_MASK) >> WINED3D_SM4_IMMCONST_TYPE_SHIFT; + + switch (immconst_type) + { + case WINED3D_SM4_IMMCONST_SCALAR: + param->immconst_type = WINED3D_IMMCONST_SCALAR; + memcpy(param->immconst_data, *ptr, 1 * sizeof(DWORD)); + *ptr += 1; + break; + + case WINED3D_SM4_IMMCONST_VEC4: + param->immconst_type = WINED3D_IMMCONST_VEC4; + memcpy(param->immconst_data, *ptr, 4 * sizeof(DWORD)); + *ptr += 4; + break; + + default: + FIXME("Unhandled immediate constant type %#x.\n", immconst_type); + break; + } + } + + map_register(priv, param); + + return TRUE; +} + +static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr, + enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param) +{ + DWORD token = **ptr; + + if (!shader_sm4_read_param(priv, ptr, data_type, &src_param->reg, &src_param->modifiers)) + { + ERR("Failed to read parameter.\n"); + return FALSE; + } + + if (src_param->reg.type == WINED3DSPR_IMMCONST) + { + src_param->swizzle = WINED3DSP_NOSWIZZLE; + } + else + { + enum wined3d_sm4_swizzle_type swizzle_type = + (token & WINED3D_SM4_SWIZZLE_TYPE_MASK) >> WINED3D_SM4_SWIZZLE_TYPE_SHIFT; + + switch (swizzle_type) + { + case WINED3D_SM4_SWIZZLE_SCALAR: + src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT; + src_param->swizzle = (src_param->swizzle & 0x3) * 0x55; + break; + + case WINED3D_SM4_SWIZZLE_VEC4: + src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT; + break; + + default: + FIXME("Unhandled swizzle type %#x.\n", swizzle_type); + break; + } + } + + return TRUE; +} + +static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD **ptr, + enum wined3d_data_type data_type, struct wined3d_shader_dst_param *dst_param) +{ + enum wined3d_shader_src_modifier modifier; + DWORD token = **ptr; + + if (!shader_sm4_read_param(priv, ptr, data_type, &dst_param->reg, &modifier)) + { + ERR("Failed to read parameter.\n"); + return FALSE; + } + + if (modifier != WINED3DSPSM_NONE) + { + ERR("Invalid source modifier %#x on destination register.\n", modifier); + return FALSE; + } + + dst_param->write_mask = (token & WINED3D_SM4_WRITEMASK_MASK) >> WINED3D_SM4_WRITEMASK_SHIFT; + dst_param->modifiers = 0; + dst_param->shift = 0; + + return TRUE; +} + +static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins) { const struct wined3d_sm4_opcode_info *opcode_info; - DWORD token = *(*ptr)++; - DWORD opcode = token & WINED3D_SM4_OPCODE_MASK; + struct wined3d_sm4_data *priv = data; + DWORD opcode_token, opcode; + const DWORD *p; + UINT i, len; - *param_size = ((token & WINED3D_SM4_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) - 1; + list_move_head(&priv->src_free, &priv->src); - opcode_info = get_opcode_info(opcode); - if (!opcode_info) + opcode_token = *(*ptr)++; + opcode = opcode_token & WINED3D_SM4_OPCODE_MASK; + len = ((opcode_token & WINED3D_SM4_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) - 1; + + if (TRACE_ON(d3d_bytecode)) { - FIXME("Unrecognized opcode %#x, token 0x%08x\n", opcode, token); + TRACE_(d3d_bytecode)("[ %08x ", opcode_token); + for (i = 0; i < len; ++i) + { + TRACE_(d3d_bytecode)("%08x ", (*ptr)[i]); + } + TRACE_(d3d_bytecode)("]\n"); + } + + if (!(opcode_info = get_opcode_info(opcode))) + { + FIXME("Unrecognized opcode %#x, opcode_token 0x%08x.\n", opcode, opcode_token); ins->handler_idx = WINED3DSIH_TABLE_SIZE; + *ptr += len; return; } ins->handler_idx = opcode_info->handler_idx; ins->flags = 0; ins->coissue = 0; - ins->predicate = 0; - ins->dst_count = opcode_info->dst_count; - ins->src_count = opcode_info->src_count; + ins->predicate = NULL; + ins->dst_count = strlen(opcode_info->dst_info); + ins->dst = priv->dst_param; + ins->src_count = strlen(opcode_info->src_info); + ins->src = priv->src_param; - if (token & WINED3D_SM4_INSTRUCTION_MODIFIER) + p = *ptr; + *ptr += len; + + if (opcode_token & WINED3D_SM4_INSTRUCTION_MODIFIER) { - DWORD modifier = *(*ptr)++; + DWORD modifier = *p++; FIXME("Skipping modifier 0x%08x.\n", modifier); } -} -static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param, - struct wined3d_shader_src_param *src_rel_addr) -{ - struct wined3d_sm4_data *priv = data; - DWORD token = *(*ptr)++; - enum wined3d_sm4_register_type register_type; - DWORD order; - - register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT; - if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) + if (opcode == WINED3D_SM4_OP_DCL_CONSTANT_BUFFER) { - FIXME("Unhandled register type %#x\n", register_type); - src_param->reg.type = WINED3DSPR_TEMP; + shader_sm4_read_src_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.src); + if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK) + ins->flags |= WINED3DSI_INDEXED_DYNAMIC; } - else + else if (opcode == WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY) { - src_param->reg.type = register_type_table[register_type]; - } + enum wined3d_sm4_output_primitive_type primitive_type; - if (token & WINED3D_SM4_REGISTER_MODIFIER) - { - DWORD modifier = *(*ptr)++; - - /* FIXME: This will probably break down at some point. The SM4 - * modifiers look like flags, while wined3d currently has an enum - * with possible combinations, e.g. WINED3DSPSM_ABSNEG. */ - switch (modifier) + primitive_type = (opcode_token & WINED3D_SM4_PRIMITIVE_TYPE_MASK) >> WINED3D_SM4_PRIMITIVE_TYPE_SHIFT; + if (primitive_type >= sizeof(output_primitive_type_table) / sizeof(*output_primitive_type_table)) { - case 0x41: - src_param->modifiers = WINED3DSPSM_NEG; - break; - - case 0x81: - src_param->modifiers = WINED3DSPSM_ABS; - break; - - default: - FIXME("Skipping modifier 0x%08x.\n", modifier); - src_param->modifiers = WINED3DSPSM_NONE; - break; + FIXME("Unhandled output primitive type %#x.\n", primitive_type); + ins->declaration.primitive_type = WINED3D_PT_UNDEFINED; + } + else + { + ins->declaration.primitive_type = output_primitive_type_table[primitive_type]; } } - else + else if (opcode == WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE) { - src_param->modifiers = WINED3DSPSM_NONE; - } + enum wined3d_sm4_input_primitive_type primitive_type; - order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT; - - if (order < 1) src_param->reg.idx = ~0U; - else src_param->reg.idx = *(*ptr)++; - - if (order < 2) src_param->reg.array_idx = ~0U; - else src_param->reg.array_idx = *(*ptr)++; - - if (order > 2) FIXME("Unhandled order %u.\n", order); - - if (register_type == WINED3D_SM4_RT_IMMCONST) - { - enum wined3d_sm4_immconst_type immconst_type = - (token & WINED3D_SM4_IMMCONST_TYPE_MASK) >> WINED3D_SM4_IMMCONST_TYPE_SHIFT; - src_param->swizzle = WINED3DSP_NOSWIZZLE; - - switch(immconst_type) + primitive_type = (opcode_token & WINED3D_SM4_PRIMITIVE_TYPE_MASK) >> WINED3D_SM4_PRIMITIVE_TYPE_SHIFT; + if (primitive_type >= sizeof(input_primitive_type_table) / sizeof(*input_primitive_type_table)) { - case WINED3D_SM4_IMMCONST_SCALAR: - src_param->reg.immconst_type = WINED3D_IMMCONST_SCALAR; - memcpy(src_param->reg.immconst_data, *ptr, 1 * sizeof(DWORD)); - *ptr += 1; - break; - - case WINED3D_SM4_IMMCONST_VEC4: - src_param->reg.immconst_type = WINED3D_IMMCONST_VEC4; - memcpy(src_param->reg.immconst_data, *ptr, 4 * sizeof(DWORD)); - *ptr += 4; - break; - - default: - FIXME("Unhandled immediate constant type %#x\n", immconst_type); - break; + FIXME("Unhandled input primitive type %#x.\n", primitive_type); + ins->declaration.primitive_type = WINED3D_PT_UNDEFINED; + } + else + { + ins->declaration.primitive_type = input_primitive_type_table[primitive_type]; } } - else + else if (opcode == WINED3D_SM4_OP_DCL_VERTICES_OUT) { - src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT; - } - - src_param->reg.rel_addr = NULL; - - map_register(priv, &src_param->reg); -} - -static void shader_sm4_read_dst_param(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param, - struct wined3d_shader_src_param *dst_rel_addr) -{ - struct wined3d_sm4_data *priv = data; - DWORD token = *(*ptr)++; - enum wined3d_sm4_register_type register_type; - DWORD order; - - register_type = (token & WINED3D_SM4_REGISTER_TYPE_MASK) >> WINED3D_SM4_REGISTER_TYPE_SHIFT; - if (register_type >= sizeof(register_type_table) / sizeof(*register_type_table)) - { - FIXME("Unhandled register type %#x\n", register_type); - dst_param->reg.type = WINED3DSPR_TEMP; + ins->declaration.count = *p++; } else { - dst_param->reg.type = register_type_table[register_type]; + for (i = 0; i < ins->dst_count; ++i) + { + if (!(shader_sm4_read_dst_param(priv, &p, map_data_type(opcode_info->dst_info[i]), &priv->dst_param[i]))) + { + ins->handler_idx = WINED3DSIH_TABLE_SIZE; + return; + } + } + + for (i = 0; i < ins->src_count; ++i) + { + if (!(shader_sm4_read_src_param(priv, &p, map_data_type(opcode_info->src_info[i]), &priv->src_param[i]))) + { + ins->handler_idx = WINED3DSIH_TABLE_SIZE; + return; + } + } } - - order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT; - - if (order < 1) dst_param->reg.idx = ~0U; - else dst_param->reg.idx = *(*ptr)++; - - if (order < 2) dst_param->reg.array_idx = ~0U; - else dst_param->reg.array_idx = *(*ptr)++; - - if (order > 2) FIXME("Unhandled order %u.\n", order); - - dst_param->write_mask = (token & WINED3D_SM4_WRITEMASK_MASK) >> WINED3D_SM4_WRITEMASK_SHIFT; - dst_param->modifiers = 0; - dst_param->shift = 0; - dst_param->reg.rel_addr = NULL; - - map_register(priv, &dst_param->reg); -} - -static void shader_sm4_read_semantic(const DWORD **ptr, struct wined3d_shader_semantic *semantic) -{ - FIXME("ptr %p, semantic %p stub!\n", ptr, semantic); -} - -static void shader_sm4_read_comment(const DWORD **ptr, const char **comment, UINT *comment_size) -{ - FIXME("ptr %p, comment %p, comment_size %p stub!\n", ptr, comment, comment_size); - *comment = NULL; } static BOOL shader_sm4_is_end(void *data, const DWORD **ptr) @@ -515,10 +801,6 @@ const struct wined3d_shader_frontend sm4_shader_frontend = shader_sm4_init, shader_sm4_free, shader_sm4_read_header, - shader_sm4_read_opcode, - shader_sm4_read_src_param, - shader_sm4_read_dst_param, - shader_sm4_read_semantic, - shader_sm4_read_comment, + shader_sm4_read_instruction, shader_sm4_is_end, }; diff --git a/reactos/dll/directx/wine/wined3d/state.c b/reactos/dll/directx/wine/wined3d/state.c index 310388fb8bf..ef86a1dd590 100644 --- a/reactos/dll/directx/wine/wined3d/state.c +++ b/reactos/dll/directx/wine/wined3d/state.c @@ -25,10 +25,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include +#include #ifdef HAVE_FLOAT_H # include #endif @@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DECLARE_DEBUG_CHANNEL(d3d_shader); -/* GL locking for state handlers is done by the caller. */ +/* Context activation for state handler is done by the caller. */ static void state_undefined(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -599,15 +599,7 @@ static void state_alpha(struct wined3d_context *context, const struct wined3d_st static void shaderconstant(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_device *device = context->swapchain->device; - - /* Vertex and pixel shader states will call a shader upload, don't do - * anything as long one of them has an update pending. */ - if (isStateDirty(context, STATE_VDECL) - || isStateDirty(context, STATE_PIXELSHADER)) - return; - - device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state)); + context->load_constants = 1; } static void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -640,12 +632,8 @@ static void state_clipping(struct wined3d_context *context, const struct wined3d /* glEnable(GL_CLIP_PLANEx) doesn't apply to vertex shaders. The enabled / disabled planes are * hardcoded into the shader. Update the shader to update the enabled clipplanes */ - if (!isStateDirty(context, context->state_table[STATE_VSHADER].representative)) - { - device->shader_backend->shader_select(context, use_ps(state), TRUE); - if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT)) - shaderconstant(context, state, STATE_VERTEXSHADERCONSTANT); - } + context->select_shader = 1; + context->load_constants = 1; } /* TODO: Keep track of previously enabled clipplanes to avoid unnecessary resetting @@ -2640,6 +2628,8 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined case WINED3D_TOP_BUMPENVMAP: case WINED3D_TOP_BUMPENVMAP_LUMINANCE: FIXME("Implement bump environment mapping in GL_NV_texture_env_combine4 path\n"); + Handled = FALSE; + break; default: Handled = FALSE; @@ -3102,6 +3092,9 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined */ FIXME("Implement bump mapping with GL_NV_texture_shader in non register combiner path\n"); } + Handled = FALSE; + break; + default: Handled = FALSE; } @@ -3348,7 +3341,7 @@ static void transform_texture(struct wined3d_context *context, const struct wine device->strided_streams.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx)) ? device->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format->id : WINED3DFMT_UNKNOWN, - device->frag_pipe->ffp_proj_control); + device->shader_backend->shader_has_ffp_proj_control(device->shader_priv)); /* The sampler applying function calls us if this changes */ if ((context->lastWasPow2Texture & (1 << texUnit)) && state->textures[texUnit]) @@ -3618,14 +3611,9 @@ static void tex_bumpenvlscale(struct wined3d_context *context, const struct wine DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); const struct wined3d_shader *ps = state->pixel_shader; + /* The pixel shader has to know the luminance scale. Do a constants update. */ if (ps && stage && (ps->reg_maps.luminanceparams & (1 << stage))) - { - /* The pixel shader has to know the luminance scale. Do a constants - * update if it isn't scheduled anyway. */ - if (!isStateDirty(context, STATE_PIXELSHADERCONSTANT) - && !isStateDirty(context, STATE_PIXELSHADER)) - shaderconstant(context, state, STATE_PIXELSHADERCONSTANT); - } + context->load_constants = 1; } static void sampler_texmatrix(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -3738,12 +3726,9 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state void apply_pixelshader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_device *device = context->swapchain->device; - BOOL use_vshader = use_vs(state); - BOOL use_pshader = use_ps(state); unsigned int i; - if (use_pshader) + if (use_ps(state)) { if (!context->last_was_pshader) { @@ -3776,13 +3761,13 @@ void apply_pixelshader(struct wined3d_context *context, const struct wined3d_sta context->last_was_pshader = FALSE; } - if (!isStateDirty(context, context->state_table[STATE_VSHADER].representative)) - { - device->shader_backend->shader_select(context, use_pshader, use_vshader); + context->select_shader = 1; + context->load_constants = 1; +} - if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && (use_vshader || use_pshader)) - shaderconstant(context, state, STATE_VERTEXSHADERCONSTANT); - } +static void state_geometry_shader(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +{ + context->select_shader = 1; } static void shader_bumpenvmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -3790,14 +3775,9 @@ static void shader_bumpenvmat(struct wined3d_context *context, const struct wine DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); const struct wined3d_shader *ps = state->pixel_shader; + /* The pixel shader has to know the bump env matrix. Do a constants update. */ if (ps && stage && (ps->reg_maps.bumpmat & (1 << stage))) - { - /* The pixel shader has to know the bump env matrix. Do a constants - * update if it isn't scheduled anyway. */ - if (!isStateDirty(context, STATE_PIXELSHADERCONSTANT) - && !isStateDirty(context, STATE_PIXELSHADER)) - shaderconstant(context, state, STATE_PIXELSHADERCONSTANT); - } + context->load_constants = 1; } static void transform_world(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -4121,6 +4101,8 @@ static inline void unload_numbered_array(struct wined3d_context *context, int i) GL_EXTCALL(glDisableVertexAttribArrayARB(i)); checkGLcall("glDisableVertexAttribArrayARB(reg)"); + if (gl_info->supported[ARB_INSTANCED_ARRAYS]) + GL_EXTCALL(glVertexAttribDivisorARB(i, 0)); context->numbered_array_mask &= ~(1 << i); } @@ -4146,7 +4128,7 @@ static void load_numbered_arrays(struct wined3d_context *context, int i; /* Default to no instancing */ - device->instancedDraw = FALSE; + device->instance_count = 0; for (i = 0; i < MAX_ATTRIBS; i++) { @@ -4163,12 +4145,25 @@ static void load_numbered_arrays(struct wined3d_context *context, stream = &state->streams[stream_info->elements[i].stream_idx]; - /* Do not load instance data. It will be specified using glTexCoord by drawprim */ if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA) { - if (context->numbered_array_mask & (1 << i)) unload_numbered_array(context, i); - device->instancedDraw = TRUE; - continue; + if (!device->instance_count) + device->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1; + + if (!gl_info->supported[ARB_INSTANCED_ARRAYS]) + { + /* Unload instanced arrays, they will be loaded using + * immediate mode instead. */ + if (context->numbered_array_mask & (1 << i)) + unload_numbered_array(context, i); + continue; + } + + GL_EXTCALL(glVertexAttribDivisorARB(i, 1)); + } + else if (gl_info->supported[ARB_INSTANCED_ARRAYS]) + { + GL_EXTCALL(glVertexAttribDivisorARB(i, 0)); } TRACE_(d3d_shader)("Loading array %u [VBO=%u]\n", i, stream_info->elements[i].data.buffer_object); @@ -4310,7 +4305,7 @@ static void load_vertex_data(const struct wined3d_context *context, TRACE("Using fast vertex array code\n"); /* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */ - device->instancedDraw = FALSE; + device->instance_count = 0; /* Blend Data ---------------------------------------------- */ if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT)) @@ -4580,7 +4575,6 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine const struct wined3d_device *device = context->swapchain->device; const struct wined3d_gl_info *gl_info = context->gl_info; BOOL useVertexShaderFunction = use_vs(state); - BOOL usePixelShaderFunction = use_ps(state); BOOL updateFog = FALSE; BOOL transformed; BOOL wasrhw = context->last_was_rhw; @@ -4684,18 +4678,9 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine } } - /* Vertex and pixel shaders are applied together, so let the last dirty - * state do the application. */ - if (!isStateDirty(context, STATE_PIXELSHADER)) - { - device->shader_backend->shader_select(context, usePixelShaderFunction, useVertexShaderFunction); - - if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) - && (useVertexShaderFunction || usePixelShaderFunction)) - shaderconstant(context, state, STATE_VERTEXSHADERCONSTANT); - } - context->last_was_vshader = useVertexShaderFunction; + context->select_shader = 1; + context->load_constants = 1; if (updateFog) context_apply_state(context, state, STATE_RENDER(WINED3D_RS_FOGVERTEXMODE)); @@ -4753,8 +4738,7 @@ static void viewport_vertexpart(struct wined3d_context *context, const struct wi if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE))) state_pscale(context, state, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)); /* Update the position fixup. */ - if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT)) - shaderconstant(context, state, STATE_VERTEXSHADERCONSTANT); + context->load_constants = 1; } static void light(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) @@ -4913,7 +4897,7 @@ static void indexbuffer(struct wined3d_context *context, const struct wined3d_st const struct wined3d_stream_info *stream_info = &context->swapchain->device->strided_streams; const struct wined3d_gl_info *gl_info = context->gl_info; - if (state->user_stream || !state->index_buffer || !stream_info->all_vbo) + if (!state->index_buffer || !stream_info->all_vbo) { GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0)); } @@ -4963,6 +4947,20 @@ static void psorigin(struct wined3d_context *context, const struct wined3d_state } } +void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + const struct wined3d_surface *rt = state->fb->render_targets[0]; + + TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); + + if (state->render_states[WINED3D_RS_SRGBWRITEENABLE] + && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); + else + gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); +} + const struct StateEntryTemplate misc_state_template[] = { { STATE_RENDER(WINED3D_RS_SRCBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3D_RS_DESTBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, @@ -5156,6 +5154,7 @@ const struct StateEntryTemplate misc_state_template[] = { { STATE_BASEVERTEXINDEX, { STATE_STREAMSRC, NULL, }, WINED3D_GL_EXT_NONE }, { STATE_FRAMEBUFFER, { STATE_FRAMEBUFFER, context_state_fb }, WINED3D_GL_EXT_NONE }, { STATE_PIXELSHADER, { STATE_PIXELSHADER, context_state_drawbuf},WINED3D_GL_EXT_NONE }, + { STATE_GEOMETRY_SHADER, { STATE_GEOMETRY_SHADER, state_geometry_shader}, WINED3D_GL_EXT_NONE }, {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, }; @@ -5658,11 +5657,12 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = { {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, }; -/* Context activation and GL locking are done by the caller. */ +/* Context activation is done by the caller. */ static void ffp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {} static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { + caps->wined3d_caps = 0; caps->PrimitiveMiscCaps = 0; caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD | WINED3DTEXOPCAPS_ADDSIGNED @@ -5701,7 +5701,11 @@ static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct caps->MaxSimultaneousTextures = gl_info->limits.textures; } -static HRESULT ffp_fragment_alloc(struct wined3d_device *device) { return WINED3D_OK; } +static void *ffp_fragment_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) +{ + return shader_priv; +} + static void ffp_fragment_free(struct wined3d_device *device) {} static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup) { @@ -5729,7 +5733,35 @@ const struct fragment_pipeline ffp_fragment_pipeline = { ffp_fragment_free, ffp_color_fixup_supported, ffp_fragmentstate_template, - FALSE /* we cannot disable projected textures. The vertex pipe has to do it */ +}; + +static void fp_none_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {} + +static void fp_none_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) +{ + memset(caps, 0, sizeof(*caps)); +} + +static void *fp_none_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv) +{ + return shader_priv; +} + +static void fp_none_free(struct wined3d_device *device) {} + +static BOOL fp_none_color_fixup_supported(struct color_fixup_desc fixup) +{ + return is_identity_fixup(fixup); +} + +const struct fragment_pipeline none_fragment_pipe = +{ + fp_none_enable, + fp_none_get_caps, + fp_none_alloc, + fp_none_free, + fp_none_color_fixup_supported, + NULL, }; static unsigned int num_handlers(const APPLYSTATEFUNC *funcs) @@ -5812,6 +5844,7 @@ static void validate_state_table(struct StateEntry *state_table) STATE_VERTEXSHADERCONSTANT, STATE_PIXELSHADERCONSTANT, STATE_VSHADER, + STATE_GEOMETRY_SHADER, STATE_PIXELSHADER, STATE_VIEWPORT, STATE_SCISSORRECT, diff --git a/reactos/dll/directx/wine/wined3d/stateblock.c b/reactos/dll/directx/wine/wined3d/stateblock.c index 8066fd0848e..8e17d236c5c 100644 --- a/reactos/dll/directx/wine/wined3d/stateblock.c +++ b/reactos/dll/directx/wine/wined3d/stateblock.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -471,6 +471,7 @@ void stateblock_unbind_resources(struct wined3d_stateblock *stateblock) { struct wined3d_state *state = &stateblock->state; struct wined3d_vertex_declaration *decl; + struct wined3d_sampler *sampler; struct wined3d_texture *texture; struct wined3d_buffer *buffer; struct wined3d_shader *shader; @@ -491,6 +492,15 @@ void stateblock_unbind_resources(struct wined3d_stateblock *stateblock) } } + for (i = 0; i < MAX_STREAM_OUT; ++i) + { + if ((buffer = state->stream_output[i].buffer)) + { + state->stream_output[i].buffer = NULL; + wined3d_buffer_decref(buffer); + } + } + for (i = 0; i < MAX_STREAMS; ++i) { if ((buffer = state->streams[i].buffer)) @@ -512,11 +522,71 @@ void stateblock_unbind_resources(struct wined3d_stateblock *stateblock) wined3d_shader_decref(shader); } + for (i = 0; i < MAX_CONSTANT_BUFFERS; ++i) + { + if ((buffer = state->vs_cb[i])) + { + state->vs_cb[i] = NULL; + wined3d_buffer_decref(buffer); + } + } + + for (i = 0; i < MAX_SAMPLER_OBJECTS; ++i) + { + if ((sampler = state->vs_sampler[i])) + { + state->vs_sampler[i] = NULL; + wined3d_sampler_decref(sampler); + } + } + + if ((shader = state->geometry_shader)) + { + state->geometry_shader = NULL; + wined3d_shader_decref(shader); + } + + for (i = 0; i < MAX_CONSTANT_BUFFERS; ++i) + { + if ((buffer = state->gs_cb[i])) + { + state->gs_cb[i] = NULL; + wined3d_buffer_decref(buffer); + } + } + + for (i = 0; i < MAX_SAMPLER_OBJECTS; ++i) + { + if ((sampler = state->gs_sampler[i])) + { + state->gs_sampler[i] = NULL; + wined3d_sampler_decref(sampler); + } + } + if ((shader = state->pixel_shader)) { state->pixel_shader = NULL; wined3d_shader_decref(shader); } + + for (i = 0; i < MAX_SAMPLER_OBJECTS; ++i) + { + if ((sampler = state->ps_sampler[i])) + { + state->ps_sampler[i] = NULL; + wined3d_sampler_decref(sampler); + } + } + + for (i = 0; i < MAX_CONSTANT_BUFFERS; ++i) + { + if ((buffer = state->ps_cb[i])) + { + state->ps_cb[i] = NULL; + wined3d_buffer_decref(buffer); + } + } } ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) @@ -611,7 +681,7 @@ static void wined3d_state_record_lights(struct wined3d_state *dst_state, const s } } -HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) +void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) { const struct wined3d_state *src_state = &stateblock->device->stateBlock->state; unsigned int i; @@ -897,8 +967,6 @@ HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) wined3d_state_record_lights(&stateblock->state, src_state); TRACE("Capture done.\n"); - - return WINED3D_OK; } static void apply_lights(struct wined3d_device *device, const struct wined3d_state *state) @@ -919,7 +987,7 @@ static void apply_lights(struct wined3d_device *device, const struct wined3d_sta } } -HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) +void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) { struct wined3d_device *device = stateblock->device; unsigned int i; @@ -1074,8 +1142,6 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo } TRACE("Applied stateblock %p.\n", stateblock); - - return WINED3D_OK; } void stateblock_init_default_state(struct wined3d_stateblock *stateblock) @@ -1095,7 +1161,6 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) unsigned int i; struct wined3d_swapchain *swapchain; struct wined3d_surface *backbuffer; - HRESULT hr; TRACE("stateblock %p.\n", stateblock); @@ -1103,11 +1168,11 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) memset(stateblock->changed.vertexShaderConstantsF, 0, device->d3d_vshader_constantF * sizeof(BOOL)); /* Set some of the defaults for lights, transforms etc */ - memcpy(&state->transforms[WINED3D_TS_PROJECTION], &identity, sizeof(identity)); - memcpy(&state->transforms[WINED3D_TS_VIEW], &identity, sizeof(identity)); + state->transforms[WINED3D_TS_PROJECTION] = identity; + state->transforms[WINED3D_TS_VIEW] = identity; for (i = 0; i < 256; ++i) { - memcpy(&state->transforms[WINED3D_TS_WORLD_MATRIX(i)], &identity, sizeof(identity)); + state->transforms[WINED3D_TS_WORLD_MATRIX(i)] = identity; } state->fb = &device->fb; @@ -1248,7 +1313,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) for (i = 0; i < MAX_TEXTURES; ++i) { TRACE("Setting up default texture states for texture Stage %u.\n", i); - memcpy(&state->transforms[WINED3D_TS_TEXTURE0 + i], &identity, sizeof(identity)); + state->transforms[WINED3D_TS_TEXTURE0 + i] = identity; state->texture_states[i][WINED3D_TSS_COLOR_OP] = i ? WINED3D_TOP_DISABLE : WINED3D_TOP_MODULATE; state->texture_states[i][WINED3D_TSS_COLOR_ARG1] = WINED3DTA_TEXTURE; state->texture_states[i][WINED3D_TSS_COLOR_ARG2] = WINED3DTA_CURRENT; @@ -1296,16 +1361,13 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) } /* check the return values, because the GetBackBuffer call isn't valid for ddraw */ - hr = wined3d_device_get_swapchain(device, 0, &swapchain); - if (SUCCEEDED(hr) && swapchain) + if ((swapchain = wined3d_device_get_swapchain(device, 0))) { - hr = wined3d_swapchain_get_back_buffer(swapchain, 0, WINED3D_BACKBUFFER_TYPE_MONO, &backbuffer); - if (SUCCEEDED(hr) && backbuffer) + if ((backbuffer = wined3d_swapchain_get_back_buffer(swapchain, 0, WINED3D_BACKBUFFER_TYPE_MONO))) { struct wined3d_resource_desc desc; wined3d_resource_get_desc(&backbuffer->resource, &desc); - wined3d_surface_decref(backbuffer); /* Set the default scissor rect values */ state->scissor_rect.left = 0; @@ -1321,8 +1383,6 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) state->viewport.height = swapchain->desc.backbuffer_height; state->viewport.min_z = 0.0f; state->viewport.max_z = 1.0f; - - wined3d_swapchain_decref(swapchain); } TRACE("Done.\n"); @@ -1391,10 +1451,7 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate stateblock memory.\n"); return E_OUTOFMEMORY; - } hr = stateblock_init(object, device, type); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/wined3d/surface.c b/reactos/dll/directx/wine/wined3d/surface.c index 9bc153ab048..57527e4d96d 100644 --- a/reactos/dll/directx/wine/wined3d/surface.c +++ b/reactos/dll/directx/wine/wined3d/surface.c @@ -26,8 +26,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); @@ -57,8 +57,6 @@ static void surface_cleanup(struct wined3d_surface *surface) context = context_acquire(surface->resource.device, NULL); gl_info = context->gl_info; - ENTER_GL(); - if (surface->texture_name) { TRACE("Deleting texture %u.\n", surface->texture_name); @@ -90,8 +88,6 @@ static void surface_cleanup(struct wined3d_surface *surface) HeapFree(GetProcessHeap(), 0, entry); } - LEAVE_GL(); - context_release(context); } @@ -313,7 +309,7 @@ static void surface_get_rect(const struct wined3d_surface *surface, const RECT * } } -/* GL locking and context activation is done by the caller */ +/* Context activation is done by the caller. */ void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect, enum wined3d_texture_filter_type filter) { @@ -532,7 +528,6 @@ static void surface_load_pbo(struct wined3d_surface *surface, const struct wined GLenum error; context = context_acquire(surface->resource.device, NULL); - ENTER_GL(); GL_EXTCALL(glGenBuffersARB(1, &surface->pbo)); error = gl_info->gl_ops.gl.p_glGetError(); @@ -559,7 +554,6 @@ static void surface_load_pbo(struct wined3d_surface *surface, const struct wined } surface->resource.allocatedMemory = NULL; surface->flags |= SFLAG_PBO; - LEAVE_GL(); context_release(context); } @@ -622,8 +616,6 @@ static void surface_bind(struct wined3d_surface *surface, struct wined3d_context if (srgb) ERR("Trying to bind standalone surface %p as sRGB.\n", surface); - ENTER_GL(); - if (!surface->texture_name) { gl_info->gl_ops.gl.p_glGenTextures(1, &surface->texture_name); @@ -643,8 +635,6 @@ static void surface_bind(struct wined3d_surface *surface, struct wined3d_context { context_bind_texture(context, surface->texture_target, surface->texture_name); } - - LEAVE_GL(); } } @@ -681,7 +671,6 @@ static void surface_release_client_storage(struct wined3d_surface *surface) struct wined3d_context *context = context_acquire(surface->resource.device, NULL); const struct wined3d_gl_info *gl_info = context->gl_info; - ENTER_GL(); gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); if (surface->texture_name) { @@ -696,7 +685,6 @@ static void surface_release_client_storage(struct wined3d_surface *surface) GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); } gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); - LEAVE_GL(); context_release(context); @@ -922,7 +910,6 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD context = context_acquire(device, NULL); gl_info = context->gl_info; - ENTER_GL(); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); @@ -939,7 +926,6 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); - LEAVE_GL(); context_release(context); } @@ -981,12 +967,10 @@ static void surface_unmap(struct wined3d_surface *surface) context = context_acquire(device, NULL); gl_info = context->gl_info; - ENTER_GL(); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); checkGLcall("glUnmapBufferARB"); - LEAVE_GL(); context_release(context); surface->resource.allocatedMemory = NULL; @@ -1108,8 +1092,6 @@ static void wined3d_surface_depth_blt_fbo(const struct wined3d_device *device, s gl_info = context->gl_info; - ENTER_GL(); - context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL, src_surface, SFLAG_INTEXTURE); gl_info->gl_ops.gl.p_glReadBuffer(GL_NONE); checkGLcall("glReadBuffer()"); @@ -1143,8 +1125,6 @@ static void wined3d_surface_depth_blt_fbo(const struct wined3d_device *device, s dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, gl_mask, GL_NEAREST); checkGLcall("glBlitFramebuffer()"); - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ @@ -1226,12 +1206,10 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te buffer = GL_COLOR_ATTACHMENT0; } - ENTER_GL(); context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, src_surface, NULL, src_location); gl_info->gl_ops.gl.p_glReadBuffer(buffer); checkGLcall("glReadBuffer()"); context_check_fbo_status(context, GL_READ_FRAMEBUFFER); - LEAVE_GL(); if (dst_location == SFLAG_INDRAWABLE) { @@ -1245,7 +1223,6 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te buffer = GL_COLOR_ATTACHMENT0; } - ENTER_GL(); context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location); context_set_draw_buffer(context, buffer); context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER); @@ -1264,8 +1241,6 @@ static void surface_blt_fbo(const struct wined3d_device *device, enum wined3d_te dst_rect.left, dst_rect.top, dst_rect.right, dst_rect.bottom, GL_COLOR_BUFFER_BIT, gl_filter); checkGLcall("glBlitFramebuffer()"); - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering || (dst_location == SFLAG_INDRAWABLE && dst_surface->container.u.swapchain->front_buffer == dst_surface)) @@ -1791,7 +1766,6 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); } - ENTER_GL(); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, surface->pbo)"); GL_EXTCALL(glGetBufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0, @@ -1799,7 +1773,6 @@ static void surface_remove_pbo(struct wined3d_surface *surface, const struct win checkGLcall("glGetBufferSubDataARB"); GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo)); checkGLcall("glDeleteBuffersARB"); - LEAVE_GL(); surface->pbo = 0; surface->flags &= ~SFLAG_PBO; @@ -1891,17 +1864,13 @@ static void surface_unload(struct wined3d_resource *resource) */ LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &surface->renderbuffers, struct wined3d_renderbuffer_entry, entry) { - ENTER_GL(); gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id); - LEAVE_GL(); list_remove(&entry->entry); HeapFree(GetProcessHeap(), 0, entry); } list_init(&surface->renderbuffers); surface->current_renderbuffer = NULL; - ENTER_GL(); - /* If we're in a texture, the texture name belongs to the texture. * Otherwise, destroy it. */ if (surface->container.type != WINED3D_CONTAINER_TEXTURE) @@ -1922,8 +1891,6 @@ static void surface_unload(struct wined3d_resource *resource) surface->rb_resolved = 0; } - LEAVE_GL(); - context_release(context); resource_unload(resource); @@ -2104,7 +2071,7 @@ void surface_set_texture_name(struct wined3d_surface *surface, GLuint new_name, surface_force_reload(surface); } -void surface_set_texture_target(struct wined3d_surface *surface, GLenum target) +void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level) { TRACE("surface %p, target %#x.\n", surface, target); @@ -2120,6 +2087,7 @@ void surface_set_texture_target(struct wined3d_surface *surface, GLenum target) } } surface->texture_target = target; + surface->texture_level = level; surface_force_reload(surface); } @@ -2137,8 +2105,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct return; } - ENTER_GL(); - if (format->flags & WINED3DFMT_FLAG_COMPRESSED) { TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n", @@ -2160,8 +2126,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct surface->texture_level, surface->resource.allocatedMemory)); checkGLcall("glGetCompressedTexImageARB"); } - - LEAVE_GL(); } else { @@ -2212,7 +2176,6 @@ static void surface_download_data(struct wined3d_surface *surface, const struct gl_format, gl_type, mem); checkGLcall("glGetTexImage"); } - LEAVE_GL(); if (surface->flags & SFLAG_NONPOW2) { @@ -2313,8 +2276,6 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi update_h /= format->height_scale.denominator; } - ENTER_GL(); - if (data->buffer_object) { GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, data->buffer_object)); @@ -2387,8 +2348,6 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi checkGLcall("glBindBufferARB"); } - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering) gl_info->gl_ops.gl.p_glFlush(); @@ -2704,8 +2663,6 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru surface, surface->texture_target, surface->texture_level, debug_d3dformat(format->id), internal, width, height, format->glFormat, format->glType); - ENTER_GL(); - if (gl_info->supported[APPLE_CLIENT_STORAGE]) { if (surface->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED) @@ -2752,13 +2709,12 @@ static void surface_allocate_surface(struct wined3d_surface *surface, const stru gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); } - LEAVE_GL(); } /* In D3D the depth stencil dimensions have to be greater than or equal to the * render target dimensions. With FBOs, the dimensions have to be an exact match. */ /* TODO: We should synchronize the renderbuffer's content with the texture's content. */ -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const struct wined3d_surface *rt) { const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info; @@ -3150,14 +3106,14 @@ HRESULT CDECL wined3d_surface_restore(struct wined3d_surface *surface) return WINED3D_OK; } -HRESULT CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette) +void CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette) { TRACE("surface %p, palette %p.\n", surface, palette); if (surface->palette == palette) { TRACE("Nop palette change.\n"); - return WINED3D_OK; + return; } if (surface->palette && (surface->resource.usage & WINED3DUSAGE_RENDERTARGET)) @@ -3172,8 +3128,6 @@ HRESULT CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struc surface->surface_ops->surface_realize_palette(surface); } - - return WINED3D_OK; } HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface, @@ -3766,12 +3720,10 @@ static struct wined3d_surface *surface_convert_format(struct wined3d_surface *so return NULL; } - wined3d_surface_create(source->resource.device, source->resource.width, - source->resource.height, to_fmt, 0 /* level */, 0 /* usage */, WINED3D_POOL_SCRATCH, - WINED3D_MULTISAMPLE_NONE /* TODO: Multisampled conversion */, 0 /* MultiSampleQuality */, - source->surface_type, WINED3D_SURFACE_MAPPABLE | WINED3D_SURFACE_DISCARD, - NULL /* parent */, &wined3d_null_parent_ops, &ret); - if (!ret) + /* FIXME: Multisampled conversion? */ + if (FAILED(hr = wined3d_surface_create(source->resource.device, source->resource.width, source->resource.height, + to_fmt, 0, WINED3D_POOL_SCRATCH, WINED3D_MULTISAMPLE_NONE, 0, + WINED3D_SURFACE_MAPPABLE | WINED3D_SURFACE_DISCARD, NULL, &wined3d_null_parent_ops, &ret))) { ERR("Failed to create a destination surface for conversion.\n"); return NULL; @@ -4159,9 +4111,7 @@ void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB /* Tell opengl to try and keep this texture in video ram (well mostly) */ GLclampf tmp; tmp = 0.9f; - ENTER_GL(); context->gl_info->gl_ops.gl.p_glPrioritizeTextures(1, &surface->texture_name, &tmp); - LEAVE_GL(); } context_release(context); @@ -4190,8 +4140,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r context_apply_blit_state(context, device); gl_info = context->gl_info; - ENTER_GL(); - /* Select the correct read buffer, and give some debug output. * There is no need to keep track of the current read buffer or reset it, every part of the code * that reads sets the read buffer as desired. @@ -4258,7 +4206,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r if (!mem) { ERR("Out of memory\n"); - LEAVE_GL(); return; } bpp = surface->resource.format->byte_count * 3; @@ -4347,7 +4294,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r ERR("Out of memory\n"); if (surface->resource.format->id == WINED3DFMT_P8_UINT) HeapFree(GetProcessHeap(), 0, mem); - LEAVE_GL(); return; } @@ -4370,7 +4316,6 @@ static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *r } } - LEAVE_GL(); context_release(context); /* For P8 textures we need to perform an inverse palette lookup. This is @@ -4435,8 +4380,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb) TRACE("Reading back offscreen render target %p.\n", surface); - ENTER_GL(); - if (surface_is_offscreen(surface)) gl_info->gl_ops.gl.p_glReadBuffer(device->offscreenBuffer); else @@ -4447,8 +4390,6 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb) 0, 0, 0, 0, surface->resource.width, surface->resource.height); checkGLcall("glCopyTexSubImage2D"); - LEAVE_GL(); - context_release(context); } @@ -4542,8 +4483,6 @@ static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface, context_apply_blit_state(context, device); gl_info = context->gl_info; - ENTER_GL(); - if (!surface_is_offscreen(surface)) { GLenum buffer = surface_get_gl_buffer(surface); @@ -4586,8 +4525,6 @@ static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface, gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); checkGLcall("glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)"); - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering || (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN && surface->container.u.swapchain->front_buffer == surface)) @@ -4926,7 +4863,6 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc gl_info = context->gl_info; context_apply_blit_state(context, device); surface_internal_preload(dst_surface, SRGB_RGB); - ENTER_GL(); /* Bind the target texture */ context_bind_texture(context, dst_target, dst_surface->texture_name); @@ -5002,7 +4938,6 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc } checkGLcall("glCopyTexSubImage2D"); - LEAVE_GL(); context_release(context); /* The texture is now most up to date - If the surface is a render target and has a drawable, this @@ -5044,7 +4979,6 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st /* Get it a description */ surface_internal_preload(src_surface, SRGB_RGB); } - ENTER_GL(); /* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring. * This way we don't have to wait for the 2nd readback to finish to leave this function. @@ -5277,8 +5211,6 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st checkGLcall("glDeleteTextures(1, &backup)"); } - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ @@ -5346,8 +5278,6 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, device->blitter->set_shader(device->blit_priv, context, src_surface); - ENTER_GL(); - if (color_key) { gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST); @@ -5378,8 +5308,6 @@ static void surface_blt_to_drawable(const struct wined3d_device *device, checkGLcall("glDisable(GL_ALPHA_TEST)"); } - LEAVE_GL(); - /* Leave the opengl state valid for blitting */ device->blitter->unset_shader(context->gl_info); @@ -5600,7 +5528,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surfa return WINED3DERR_INVALIDCALL; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void surface_depth_blt(const struct wined3d_surface *surface, struct wined3d_context *context, GLuint texture, GLint x, GLint y, GLsizei w, GLsizei h, GLenum target) { @@ -5769,8 +5697,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co TRACE("Copying onscreen depth buffer to depth texture.\n"); - ENTER_GL(); - if (!device->depth_blt_texture) gl_info->gl_ops.gl.p_glGenTextures(1, &device->depth_blt_texture); @@ -5816,8 +5742,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co context_invalidate_state(context, STATE_FRAMEBUFFER); - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ } @@ -5825,8 +5749,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co { TRACE("Copying depth texture to onscreen depth buffer.\n"); - ENTER_GL(); - context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, context->swapchain->front_buffer, NULL, SFLAG_INDRAWABLE); surface_depth_blt(surface, context, surface->texture_name, @@ -5835,8 +5757,6 @@ void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_co context_invalidate_state(context, STATE_FRAMEBUFFER); - LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ } @@ -6369,9 +6289,7 @@ static void ffp_blit_p8_upload_palette(const struct wined3d_surface *surface, co d3dfmt_p8_init_palette(surface, table, colorkey_active); TRACE("Using GL_EXT_PALETTED_TEXTURE for 8-bit paletted texture support\n"); - ENTER_GL(); GL_EXTCALL(glColorTableEXT(target, GL_RGBA, 256, GL_RGBA, GL_UNSIGNED_BYTE, table)); - LEAVE_GL(); } /* Context activation is done by the caller. */ @@ -6393,17 +6311,15 @@ static HRESULT ffp_blit_set(void *blit_priv, struct wined3d_context *context, co && gl_info->supported[EXT_PALETTED_TEXTURE]) ffp_blit_p8_upload_palette(surface, gl_info); - ENTER_GL(); gl_info->gl_ops.gl.p_glEnable(target); checkGLcall("glEnable(target)"); - LEAVE_GL(); + return WINED3D_OK; } /* Context activation is done by the caller. */ static void ffp_blit_unset(const struct wined3d_gl_info *gl_info) { - ENTER_GL(); gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_2D)"); if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) @@ -6416,7 +6332,6 @@ static void ffp_blit_unset(const struct wined3d_gl_info *gl_info) gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_RECTANGLE_ARB); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); } - LEAVE_GL(); } static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, @@ -7188,9 +7103,9 @@ const struct blit_shader cpu_blit = { cpu_blit_depth_fill, }; -static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surface_type surface_type, UINT alignment, - UINT width, UINT height, UINT level, enum wined3d_multisample_type multisample_type, - UINT multisample_quality, struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id, +static HRESULT surface_init(struct wined3d_surface *surface, UINT alignment, UINT width, UINT height, + enum wined3d_multisample_type multisample_type, UINT multisample_quality, + struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id, enum wined3d_pool pool, DWORD flags, void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -7249,22 +7164,10 @@ static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surfac if (!resource_size) return WINED3DERR_INVALIDCALL; - surface->surface_type = surface_type; - - switch (surface_type) - { - case WINED3D_SURFACE_TYPE_OPENGL: - surface->surface_ops = &surface_ops; - break; - - case WINED3D_SURFACE_TYPE_GDI: - surface->surface_ops = &gdi_surface_ops; - break; - - default: - ERR("Requested unknown surface implementation %#x.\n", surface_type); - return WINED3DERR_INVALIDCALL; - } + if (device->wined3d->flags & WINED3D_NO3D) + surface->surface_ops = &gdi_surface_ops; + else + surface->surface_ops = &surface_ops; hr = resource_init(&surface->resource, device, WINED3D_RTYPE_SURFACE, format, multisample_type, multisample_quality, usage, pool, width, height, 1, @@ -7278,7 +7181,6 @@ static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surfac /* "Standalone" surface. */ surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); - surface->texture_level = level; list_init(&surface->overlays); /* Flags */ @@ -7330,36 +7232,25 @@ static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surfac } HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height, - enum wined3d_format_id format_id, UINT level, DWORD usage, enum wined3d_pool pool, - enum wined3d_multisample_type multisample_type, DWORD multisample_quality, - enum wined3d_surface_type surface_type, DWORD flags, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface) + enum wined3d_format_id format_id, DWORD usage, enum wined3d_pool pool, + enum wined3d_multisample_type multisample_type, DWORD multisample_quality, DWORD flags, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface) { struct wined3d_surface *object; HRESULT hr; - TRACE("device %p, width %u, height %u, format %s, level %u\n", - device, width, height, debug_d3dformat(format_id), level); + TRACE("device %p, width %u, height %u, format %s\n", + device, width, height, debug_d3dformat(format_id)); TRACE("surface %p, usage %s (%#x), pool %s, multisample_type %#x, multisample_quality %u\n", surface, debug_d3dusage(usage), usage, debug_d3dpool(pool), multisample_type, multisample_quality); - TRACE("surface_type %#x, flags %#x, parent %p, parent_ops %p.\n", surface_type, flags, parent, parent_ops); - - if (surface_type == WINED3D_SURFACE_TYPE_OPENGL && !device->adapter) - { - ERR("OpenGL surfaces are not available without OpenGL.\n"); - return WINED3DERR_NOTAVAILABLE; - } + TRACE("flags %#x, parent %p, parent_ops %p.\n", flags, parent, parent_ops); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate surface memory.\n"); return WINED3DERR_OUTOFVIDEOMEMORY; - } - hr = surface_init(object, surface_type, device->surface_alignment, width, height, level, - multisample_type, multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops); - if (FAILED(hr)) + if (FAILED(hr = surface_init(object, device->surface_alignment, width, height, multisample_type, + multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops))) { WARN("Failed to initialize surface, returning %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); diff --git a/reactos/dll/directx/wine/wined3d/swapchain.c b/reactos/dll/directx/wine/wined3d/swapchain.c index 379b2687b51..c4f17ae6ba2 100644 --- a/reactos/dll/directx/wine/wined3d/swapchain.c +++ b/reactos/dll/directx/wine/wined3d/swapchain.c @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -42,7 +42,8 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain) * is the last buffer to be destroyed, FindContext() depends on that. */ if (swapchain->front_buffer) { - surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_NONE, NULL); + if (swapchain->front_buffer->container.type == WINED3D_CONTAINER_SWAPCHAIN) + surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_NONE, NULL); if (wined3d_surface_decref(swapchain->front_buffer)) WARN("Something's still holding the front buffer (%p).\n", swapchain->front_buffer); swapchain->front_buffer = NULL; @@ -54,7 +55,8 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain) while (i--) { - surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_NONE, NULL); + if (swapchain->back_buffers[i]->container.type == WINED3D_CONTAINER_SWAPCHAIN) + surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_NONE, NULL); if (wined3d_surface_decref(swapchain->back_buffers[i])) WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]); } @@ -128,18 +130,16 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch return swapchain->parent; } -HRESULT CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window) +void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window) { if (!window) window = swapchain->device_window; if (window == swapchain->win_handle) - return WINED3D_OK; + return; TRACE("Setting swapchain %p window from %p to %p.\n", swapchain, swapchain->win_handle, window); swapchain->win_handle = window; - - return WINED3D_OK; } HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, @@ -188,11 +188,11 @@ HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapc return wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT); } -HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, - UINT back_buffer_idx, enum wined3d_backbuffer_type type, struct wined3d_surface **back_buffer) +struct wined3d_surface * CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, + UINT back_buffer_idx, enum wined3d_backbuffer_type type) { - TRACE("swapchain %p, back_buffer_idx %u, type %#x, back_buffer %p.\n", - swapchain, back_buffer_idx, type, back_buffer); + TRACE("swapchain %p, back_buffer_idx %u, type %#x.\n", + swapchain, back_buffer_idx, type); /* Return invalid if there is no backbuffer array, otherwise it will * crash when ddraw is used (there swapchain->back_buffers is always @@ -204,17 +204,12 @@ HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain * WARN("Invalid back buffer index.\n"); /* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it * here in wined3d to avoid problems in other libs. */ - *back_buffer = NULL; - return WINED3DERR_INVALIDCALL; + return NULL; } - *back_buffer = swapchain->back_buffers[back_buffer_idx]; - if (*back_buffer) - wined3d_surface_incref(*back_buffer); + TRACE("Returning back buffer %p.\n", swapchain->back_buffers[back_buffer_idx]); - TRACE("Returning back buffer %p.\n", *back_buffer); - - return WINED3D_OK; + return swapchain->back_buffers[back_buffer_idx]; } HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, @@ -249,14 +244,12 @@ struct wined3d_device * CDECL wined3d_swapchain_get_device(const struct wined3d_ return swapchain->device; } -HRESULT CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, +void CDECL wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc) { TRACE("swapchain %p, desc %p.\n", swapchain, desc); *desc = swapchain->desc; - - return WINED3D_OK; } HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain, @@ -323,7 +316,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, surface_load_location(backbuffer, location, NULL); } - ENTER_GL(); context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, location); gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0); context_check_fbo_status(context, GL_READ_FRAMEBUFFER); @@ -346,7 +338,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, dst_rect->left, win_h - dst_rect->top, dst_rect->right, win_h - dst_rect->bottom, GL_COLOR_BUFFER_BIT, gl_filter); checkGLcall("Swapchain present blit(EXT_framebuffer_blit)\n"); - LEAVE_GL(); } else { @@ -371,8 +362,8 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, if (is_complex_fixup(backbuffer->resource.format->color_fixup)) gl_filter = GL_NEAREST; - ENTER_GL(); context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, swapchain->front_buffer, NULL, SFLAG_INDRAWABLE); + context_bind_texture(context2, backbuffer->texture_target, backbuffer->texture_name); /* Set up the texture. The surface is not in a wined3d_texture * container, so there are no D3D texture settings to dirtify. */ @@ -420,7 +411,6 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, device->blitter->unset_shader(context->gl_info); checkGLcall("Swapchain present blit(manual)\n"); - LEAVE_GL(); context_release(context2); } @@ -566,7 +556,9 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT if (swapchain->num_contexts > 1) gl_info->gl_ops.gl.p_glFinish(); - SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ + + /* call wglSwapBuffers through the gl table to avoid confusing the Steam overlay */ + gl_info->gl_ops.wgl.p_wglSwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ TRACE("SwapBuffers called, Starting new frame\n"); /* FPS support */ @@ -823,9 +815,8 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain) } /* Do not call while under the GL lock. */ -static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_surface_type surface_type, - struct wined3d_device *device, struct wined3d_swapchain_desc *desc, - void *parent, const struct wined3d_parent_ops *parent_ops) +static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device, + struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_adapter *adapter = device->adapter; const struct wined3d_format *format; @@ -849,20 +840,10 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_ "Please configure the application to use double buffering (1 back buffer) if possible.\n"); } - switch (surface_type) - { - case WINED3D_SURFACE_TYPE_GDI: - swapchain->swapchain_ops = &swapchain_gdi_ops; - break; - - case WINED3D_SURFACE_TYPE_OPENGL: - swapchain->swapchain_ops = &swapchain_gl_ops; - break; - - default: - ERR("Invalid surface type %#x.\n", surface_type); - return WINED3DERR_INVALIDCALL; - } + if (device->wined3d->flags & WINED3D_NO3D) + swapchain->swapchain_ops = &swapchain_gdi_ops; + else + swapchain->swapchain_ops = &swapchain_gl_ops; window = desc->device_window ? desc->device_window : device->create_parms.focus_window; @@ -917,8 +898,9 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_ goto err; } - surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain); - if (surface_type == WINED3D_SURFACE_TYPE_OPENGL) + if (swapchain->front_buffer->container.type == WINED3D_CONTAINER_NONE) + surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain); + if (!(device->wined3d->flags & WINED3D_NO3D)) surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE); /* MSDN says we're only allowed a single fullscreen swapchain per device, @@ -944,7 +926,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_ displaymode_set = TRUE; } - if (surface_type == WINED3D_SURFACE_TYPE_OPENGL) + if (!(device->wined3d->flags & WINED3D_NO3D)) { static const enum wined3d_format_id formats[] = { @@ -1025,13 +1007,13 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_ WARN("Failed to create back buffer %u, hr %#x.\n", i, hr); goto err; } - - surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, swapchain); + if (swapchain->back_buffers[i]->container.type == WINED3D_CONTAINER_NONE) + surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, swapchain); } } /* Swapchains share the depth/stencil buffer, so only create a single depthstencil surface. */ - if (desc->enable_auto_depth_stencil && surface_type == WINED3D_SURFACE_TYPE_OPENGL) + if (desc->enable_auto_depth_stencil && !(device->wined3d->flags & WINED3D_NO3D)) { TRACE("Creating depth/stencil buffer.\n"); if (!device->auto_depth_stencil) @@ -1105,25 +1087,20 @@ err: } /* Do not call while under the GL lock. */ -HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, - struct wined3d_swapchain_desc *desc, enum wined3d_surface_type surface_type, - void *parent, const struct wined3d_parent_ops *parent_ops, - struct wined3d_swapchain **swapchain) +HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, struct wined3d_swapchain_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain) { struct wined3d_swapchain *object; HRESULT hr; - TRACE("device %p, desc %p, swapchain %p, parent %p, surface_type %#x.\n", - device, desc, swapchain, parent, surface_type); + TRACE("device %p, desc %p, parent %p, parent_ops %p, swapchain %p.\n", + device, desc, parent, parent_ops, swapchain); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate swapchain memory.\n"); return E_OUTOFMEMORY; - } - hr = swapchain_init(object, surface_type, device, desc, parent, parent_ops); + hr = swapchain_init(object, device, desc, parent, parent_ops); if (FAILED(hr)) { WARN("Failed to initialize swapchain, hr %#x.\n", hr); diff --git a/reactos/dll/directx/wine/wined3d/texture.c b/reactos/dll/directx/wine/wined3d/texture.c index 3d148fbf8aa..9bf4c2ee393 100644 --- a/reactos/dll/directx/wine/wined3d/texture.c +++ b/reactos/dll/directx/wine/wined3d/texture.c @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); @@ -77,9 +77,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc /* A GL context is provided by the caller */ static void gltexture_delete(const struct wined3d_gl_info *gl_info, struct gl_texture *tex) { - ENTER_GL(); gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex->name); - LEAVE_GL(); tex->name = 0; } @@ -153,7 +151,6 @@ static HRESULT wined3d_texture_bind(struct wined3d_texture *texture, gl_tex = wined3d_texture_get_gl_texture(texture, context->gl_info, srgb); target = texture->target; - ENTER_GL(); /* Generate a texture name if we don't already have one. */ if (!gl_tex->name) { @@ -233,11 +230,10 @@ static HRESULT wined3d_texture_bind(struct wined3d_texture *texture, hr = WINED3DERR_INVALIDCALL; } - LEAVE_GL(); return hr; } -/* GL locking is done by the caller */ +/* Context activation is done by the caller. */ static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target, enum wined3d_texture_address d3d_wrap, GLenum param, BOOL cond_np2) { @@ -261,7 +257,7 @@ static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target, checkGLcall("glTexParameteri(target, param, gl_wrap)"); } -/* GL locking is done by the caller (state handler) */ +/* Context activation is done by the caller (state handler). */ void wined3d_texture_apply_state_changes(struct wined3d_texture *texture, const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1], const struct wined3d_gl_info *gl_info) @@ -628,7 +624,6 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture, { GLenum target = texture->target; - ENTER_GL(); gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)"); gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); @@ -637,7 +632,6 @@ static HRESULT texture2d_bind(struct wined3d_texture *texture, checkGLcall("glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)"); gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); checkGLcall("glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)"); - LEAVE_GL(); gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3D_TADDRESS_CLAMP; gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3D_TADDRESS_CLAMP; gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3D_TEXF_POINT; @@ -720,7 +714,7 @@ static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource * surface doesn't try and release it. */ surface_set_texture_name(surface, 0, TRUE); surface_set_texture_name(surface, 0, FALSE); - surface_set_texture_target(surface, 0); + surface_set_texture_target(surface, 0, 0); surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); wined3d_surface_decref(surface); } @@ -859,8 +853,8 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_lengt UINT idx = j * texture->level_count + i; struct wined3d_surface *surface; - if (FAILED(hr = device->device_parent->ops->create_texture_surface(device->device_parent, parent, - tmp_w, tmp_w, format_id, usage, pool, i /* Level */, j, &surface))) + if (FAILED(hr = device->device_parent->ops->create_texture_surface(device->device_parent, + parent, tmp_w, tmp_w, format_id, usage, pool, idx, &surface))) { FIXME("(%p) Failed to create surface, hr %#x.\n", texture, hr); wined3d_texture_cleanup(texture); @@ -868,7 +862,7 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_lengt } surface_set_container(surface, WINED3D_CONTAINER_TEXTURE, texture); - surface_set_texture_target(surface, cube_targets[j]); + surface_set_texture_target(surface, cube_targets[j], i); texture->sub_resources[idx] = &surface->resource; TRACE("Created surface level %u @ %p.\n", i, surface); } @@ -1014,8 +1008,8 @@ static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT he struct wined3d_surface *surface; /* Use the callback to create the texture surface. */ - if (FAILED(hr = device->device_parent->ops->create_texture_surface(device->device_parent, parent, - tmp_w, tmp_h, format->id, usage, pool, i, 0, &surface))) + if (FAILED(hr = device->device_parent->ops->create_texture_surface(device->device_parent, + parent, tmp_w, tmp_h, format->id, usage, pool, i, &surface))) { FIXME("Failed to create surface %p, hr %#x\n", texture, hr); wined3d_texture_cleanup(texture); @@ -1023,7 +1017,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT he } surface_set_container(surface, WINED3D_CONTAINER_TEXTURE, texture); - surface_set_texture_target(surface, texture->target); + surface_set_texture_target(surface, texture->target, i); texture->sub_resources[i] = &surface->resource; TRACE("Created surface level %u @ %p.\n", i, surface); /* Calculate the next mipmap level. */ @@ -1257,7 +1251,6 @@ HRESULT CDECL wined3d_texture_create_2d(struct wined3d_device *device, UINT widt object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Out of memory.\n"); *texture = NULL; return WINED3DERR_OUTOFVIDEOMEMORY; } @@ -1293,7 +1286,6 @@ HRESULT CDECL wined3d_texture_create_3d(struct wined3d_device *device, UINT widt object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Out of memory\n"); *texture = NULL; return WINED3DERR_OUTOFVIDEOMEMORY; } @@ -1329,7 +1321,6 @@ HRESULT CDECL wined3d_texture_create_cube(struct wined3d_device *device, UINT ed object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Out of memory\n"); *texture = NULL; return WINED3DERR_OUTOFVIDEOMEMORY; } diff --git a/reactos/dll/directx/wine/wined3d/utils.c b/reactos/dll/directx/wine/wined3d/utils.c index f2328c921ea..4b29ec86afc 100644 --- a/reactos/dll/directx/wine/wined3d/utils.c +++ b/reactos/dll/directx/wine/wined3d/utils.c @@ -24,8 +24,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" @@ -124,6 +124,7 @@ static const struct wined3d_format_channels formats[] = /* Vendor-specific formats */ {WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {WINED3DFMT_INTZ, 0, 0, 0, 0, 0, 0, 0, 0, 4, 24, 8}, {WINED3DFMT_NVHU, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {WINED3DFMT_NVHS, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, @@ -555,6 +556,29 @@ static void convert_s8_uint_d24_float(const BYTE *src, BYTE *dst, UINT pitch, UI } } +/* The following formats explicitly don't have WINED3DFMT_FLAG_TEXTURE set: + * + * These are never supported on native. + * WINED3DFMT_B8G8R8_UNORM + * WINED3DFMT_B2G3R3_UNORM + * WINED3DFMT_L4A4_UNORM + * WINED3DFMT_S1_UINT_D15_UNORM + * WINED3DFMT_S4X4_UINT_D24_UNORM + * + * Only some Geforce/Voodoo3/G400 cards offer 8-bit textures in case of ddraw. + * Since it is not widely available, don't offer it. Further no Windows driver + * offers WINED3DFMT_P8_UINT_A8_NORM, so don't offer it either. + * WINED3DFMT_P8_UINT + * WINED3DFMT_P8_UINT_A8_UNORM + * + * These formats seem to be similar to the HILO formats in + * GL_NV_texture_shader. NVHU is said to be GL_UNSIGNED_HILO16, + * NVHS GL_SIGNED_HILO16. Rumours say that D3D computes a 3rd channel + * similarly to D3DFMT_CxV8U8 (So NVHS could be called D3DFMT_CxV16U16). ATI + * refused to support formats which can easily be emulated with pixel shaders, + * so applications have to deal with not having NVHS and NVHU. + * WINED3DFMT_NVHU + * WINED3DFMT_NVHS */ static const struct wined3d_format_texture_info format_texture_info[] = { /* format id internal srgbInternal rtInternal @@ -573,16 +597,16 @@ static const struct wined3d_format_texture_info format_texture_info[] = WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_UYVY, GL_RGB, GL_RGB, 0, - GL_YCBCR_422_APPLE, UNSIGNED_SHORT_8_8_APPLE, 0, - WINED3DFMT_FLAG_FILTERING, + GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_APPLE, 0, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_FILTERING, APPLE_YCBCR_422, NULL}, {WINED3DFMT_YUY2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_YUY2, GL_RGB, GL_RGB, 0, - GL_YCBCR_422_APPLE, UNSIGNED_SHORT_8_8_REV_APPLE, 0, - WINED3DFMT_FLAG_FILTERING, + GL_YCBCR_422_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, 0, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_FILTERING, APPLE_YCBCR_422, NULL}, {WINED3DFMT_YV12, GL_ALPHA, GL_ALPHA, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0, @@ -590,70 +614,71 @@ static const struct wined3d_format_texture_info format_texture_info[] = WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_DXT1, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT2, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT3, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT4, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, {WINED3DFMT_DXT5, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ - | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_COMPRESSED, EXT_TEXTURE_COMPRESSION_S3TC, NULL}, /* IEEE formats */ {WINED3DFMT_R32_FLOAT, GL_RGB32F_ARB, GL_RGB32F_ARB, 0, GL_RED, GL_FLOAT, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_FLOAT, NULL}, {WINED3DFMT_R32_FLOAT, GL_R32F, GL_R32F, 0, GL_RED, GL_FLOAT, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_RG, NULL}, {WINED3DFMT_R32G32_FLOAT, GL_RGB32F_ARB, GL_RGB32F_ARB, 0, GL_RGB, GL_FLOAT, 12, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_FLOAT, convert_r32g32_float}, {WINED3DFMT_R32G32_FLOAT, GL_RG32F, GL_RG32F, 0, GL_RG, GL_FLOAT, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_RG, NULL}, {WINED3DFMT_R32G32B32A32_FLOAT, GL_RGBA32F_ARB, GL_RGBA32F_ARB, 0, GL_RGBA, GL_FLOAT, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_FLOAT, NULL}, /* Float */ {WINED3DFMT_R16_FLOAT, GL_RGB16F_ARB, GL_RGB16F_ARB, 0, GL_RED, GL_HALF_FLOAT_ARB, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_FLOAT, NULL}, {WINED3DFMT_R16_FLOAT, GL_R16F, GL_R16F, 0, GL_RED, GL_HALF_FLOAT_ARB, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_RG, NULL}, {WINED3DFMT_R16G16_FLOAT, GL_RGB16F_ARB, GL_RGB16F_ARB, 0, GL_RGB, GL_HALF_FLOAT_ARB, 6, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_FLOAT, convert_r16g16}, {WINED3DFMT_R16G16_FLOAT, GL_RG16F, GL_RG16F, 0, GL_RG, GL_HALF_FLOAT_ARB, 0, - WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_RG, NULL}, {WINED3DFMT_R16G16B16A16_FLOAT, GL_RGBA16F_ARB, GL_RGBA16F_ARB, 0, GL_RGBA, GL_HALF_FLOAT_ARB, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_RENDERTARGET + | WINED3DFMT_FLAG_VTF, ARB_TEXTURE_FLOAT, NULL}, /* Palettized formats */ {WINED3DFMT_P8_UINT, GL_RGBA, GL_RGBA, 0, @@ -671,29 +696,32 @@ static const struct wined3d_format_texture_info format_texture_info[] = WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B8G8R8A8_UNORM, GL_RGBA8, GL_SRGB8_ALPHA8_EXT, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE | WINED3DFMT_FLAG_VTF, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE + | WINED3DFMT_FLAG_VTF, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B8G8R8X8_UNORM, GL_RGB8, GL_SRGB8_EXT, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET - | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B5G6R5_UNORM, GL_RGB5, GL_RGB5, GL_RGB8, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B5G5R5X1_UNORM, GL_RGB5, GL_RGB5_A1, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B5G5R5A1_UNORM, GL_RGB5_A1, GL_RGB5_A1, 0, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B4G4R4A4_UNORM, GL_RGBA4, GL_SRGB8_ALPHA8_EXT, 0, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B2G3R3_UNORM, GL_R3_G3_B2, GL_R3_G3_B2, 0, GL_RGB, GL_UNSIGNED_BYTE_3_3_2, 0, @@ -701,48 +729,54 @@ static const struct wined3d_format_texture_info format_texture_info[] = WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_A8_UNORM, GL_ALPHA8, GL_ALPHA8, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_B4G4R4X4_UNORM, GL_RGB4, GL_RGB4, 0, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_R8G8B8X8_UNORM, GL_RGB8, GL_RGB8, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_R16G16_UNORM, GL_RGB16, GL_RGB16, GL_RGBA16, GL_RGB, GL_UNSIGNED_SHORT, 6, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, convert_r16g16}, {WINED3DFMT_R16G16_UNORM, GL_RG16, GL_RG16, 0, GL_RG, GL_UNSIGNED_SHORT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET, ARB_TEXTURE_RG, NULL}, {WINED3DFMT_B10G10R10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, 0, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_R16G16B16A16_UNORM, GL_RGBA16, GL_RGBA16, 0, GL_RGBA, GL_UNSIGNED_SHORT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_RENDERTARGET, WINED3D_GL_EXT_NONE, NULL}, /* Luminance */ {WINED3DFMT_L8_UNORM, GL_LUMINANCE8, GL_SLUMINANCE8_EXT, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_L8A8_UNORM, GL_LUMINANCE8_ALPHA8, GL_SLUMINANCE8_ALPHA8_EXT, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_SRGB_READ, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_SRGB_READ, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_L4A4_UNORM, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE4_ALPHA4, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 2, @@ -751,52 +785,62 @@ static const struct wined3d_format_texture_info format_texture_info[] = /* Bump mapping stuff */ {WINED3DFMT_R8G8_SNORM, GL_RGB8, GL_RGB8, 0, GL_BGR, GL_UNSIGNED_BYTE, 3, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, WINED3D_GL_EXT_NONE, convert_r8g8_snorm}, {WINED3DFMT_R8G8_SNORM, GL_DSDT8_NV, GL_DSDT8_NV, 0, GL_DSDT_NV, GL_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, NV_TEXTURE_SHADER, NULL}, {WINED3DFMT_R5G5_SNORM_L6_UNORM, GL_RGB5, GL_RGB5, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, WINED3D_GL_EXT_NONE, convert_r5g5_snorm_l6_unorm}, {WINED3DFMT_R5G5_SNORM_L6_UNORM, GL_DSDT8_MAG8_NV, GL_DSDT8_MAG8_NV, 0, GL_DSDT_MAG_NV, GL_BYTE, 3, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, NV_TEXTURE_SHADER, convert_r5g5_snorm_l6_unorm_nv}, {WINED3DFMT_R8G8_SNORM_L8X8_UNORM, GL_RGB8, GL_RGB8, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 4, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, WINED3D_GL_EXT_NONE, convert_r8g8_snorm_l8x8_unorm}, {WINED3DFMT_R8G8_SNORM_L8X8_UNORM, GL_DSDT8_MAG8_INTENSITY8_NV, GL_DSDT8_MAG8_INTENSITY8_NV, 0, GL_DSDT_MAG_VIB_NV, GL_UNSIGNED_INT_8_8_S8_S8_REV_NV, 4, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, NV_TEXTURE_SHADER, convert_r8g8_snorm_l8x8_unorm_nv}, {WINED3DFMT_R8G8B8A8_SNORM, GL_RGBA8, GL_RGBA8, 0, GL_BGRA, GL_UNSIGNED_BYTE, 4, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, WINED3D_GL_EXT_NONE, convert_r8g8b8a8_snorm}, {WINED3DFMT_R8G8B8A8_SNORM, GL_SIGNED_RGBA8_NV, GL_SIGNED_RGBA8_NV, 0, GL_RGBA, GL_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, NV_TEXTURE_SHADER, NULL}, {WINED3DFMT_R16G16_SNORM, GL_RGB16, GL_RGB16, 0, GL_BGR, GL_UNSIGNED_SHORT, 6, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, WINED3D_GL_EXT_NONE, convert_r16g16_snorm}, {WINED3DFMT_R16G16_SNORM, GL_SIGNED_HILO16_NV, GL_SIGNED_HILO16_NV, 0, GL_HILO_NV, GL_SHORT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_BUMPMAP, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_BUMPMAP, NV_TEXTURE_SHADER, NULL}, /* Depth stencil formats */ {WINED3DFMT_D16_LOCKABLE, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, - WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_TEXTURE, NULL}, {WINED3DFMT_D32_UNORM, GL_DEPTH_COMPONENT32_ARB, GL_DEPTH_COMPONENT32_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, - WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_TEXTURE, NULL}, {WINED3DFMT_S1_UINT_D15_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, @@ -812,23 +856,23 @@ static const struct wined3d_format_texture_info format_texture_info[] = ARB_FRAMEBUFFER_OBJECT, convert_s1_uint_d15_unorm}, {WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_TEXTURE, NULL}, {WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, EXT_PACKED_DEPTH_STENCIL, NULL}, {WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, ARB_FRAMEBUFFER_OBJECT, NULL}, {WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_TEXTURE, NULL}, {WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, @@ -844,43 +888,45 @@ static const struct wined3d_format_texture_info format_texture_info[] = ARB_FRAMEBUFFER_OBJECT, convert_s4x4_uint_d24_unorm}, {WINED3DFMT_D16_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_TEXTURE, NULL}, {WINED3DFMT_L16_UNORM, GL_LUMINANCE16, GL_LUMINANCE16, 0, GL_LUMINANCE, GL_UNSIGNED_SHORT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, WINED3D_GL_EXT_NONE, NULL}, {WINED3DFMT_D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0, - WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_BUFFER_FLOAT, NULL}, {WINED3DFMT_S8_UINT_D24_FLOAT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, 0, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 8, - WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_BUFFER_FLOAT, convert_s8_uint_d24_float}, /* Vendor-specific formats */ {WINED3DFMT_ATI2N, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_COMPRESSED, ATI_TEXTURE_COMPRESSION_3DC, NULL}, - {WINED3DFMT_ATI2N, GL_COMPRESSED_RED_GREEN_RGTC2, GL_COMPRESSED_RED_GREEN_RGTC2, 0, + {WINED3DFMT_ATI2N, GL_COMPRESSED_RG_RGTC2, GL_COMPRESSED_RG_RGTC2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_COMPRESSED, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_COMPRESSED, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_INTZ, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_STENCIL, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL, EXT_PACKED_DEPTH_STENCIL, NULL}, {WINED3DFMT_INTZ, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0, - WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH - | WINED3DFMT_FLAG_STENCIL, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL, ARB_FRAMEBUFFER_OBJECT, NULL}, {WINED3DFMT_NULL, GL_RGBA8, GL_RGBA8, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, - WINED3DFMT_FLAG_RENDERTARGET, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_RENDERTARGET, ARB_FRAMEBUFFER_OBJECT, NULL}, }; @@ -991,8 +1037,6 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined GLenum status; GLuint tex; - ENTER_GL(); - while (gl_info->gl_ops.gl.p_glGetError()); gl_info->gl_ops.gl.p_glDisable(GL_BLEND); @@ -1070,10 +1114,10 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined && format->glFormat != GL_LUMINANCE && format->glFormat != GL_LUMINANCE_ALPHA && (format->red_size || format->alpha_size)) { - GLuint rb, tex2; DWORD readback[16 * 16], color, r_range, a_range; BYTE r, a; BOOL match = TRUE; + GLuint rb; if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT] || gl_info->supported[EXT_PACKED_DEPTH_STENCIL]) @@ -1127,10 +1171,9 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined gl_info->gl_ops.gl.p_glEnd(); gl_info->gl_ops.gl.p_glDisable(GL_BLEND); - gl_info->gl_ops.gl.p_glGenTextures(1, &tex2); - gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex2); - gl_info->gl_ops.gl.p_glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, 16, 16, 0); + /* Rebinding texture to workaround a fglrx bug. */ + gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex); gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, readback); checkGLcall("Post-pixelshader blending check"); @@ -1138,9 +1181,9 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined a = color >> 24; r = (color & 0x00ff0000) >> 16; - r_range = format->red_size < 8 ? 1 << (8 - format->red_size - 1) : 1; - a_range = format->alpha_size < 8 ? 1 << (8 - format->alpha_size - 1) : 1; - if (format->red_size && (r < 0x80 - r_range || r > 0x80 + r_range)) + r_range = format->red_size < 8 ? 1 << (8 - format->red_size) : 1; + a_range = format->alpha_size < 8 ? 1 << (8 - format->alpha_size) : 1; + if (format->red_size && (r < 0x7f - r_range || r > 0x7f + r_range)) match = FALSE; else if (format->alpha_size > 1 && (a < 0xbf - a_range || a > 0xbf + a_range)) match = FALSE; @@ -1156,9 +1199,6 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined TRACE("Color output: %#x\n", color); format->flags |= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING; } - - gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex); - gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex2); } if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT] @@ -1194,8 +1234,6 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined format->flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB; gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex); - - LEAVE_GL(); } /* Context activation is done by the caller. */ @@ -1206,14 +1244,10 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info) if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - ENTER_GL(); - gl_info->fbo_ops.glGenFramebuffers(1, &fbo); gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo); gl_info->gl_ops.gl.p_glDrawBuffer(GL_COLOR_ATTACHMENT0); gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0); - - LEAVE_GL(); } for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i) @@ -1248,19 +1282,21 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info) } if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) - { - ENTER_GL(); - gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo); - - LEAVE_GL(); - } } -static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info) +static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info) { + struct fragment_caps fragment_caps; + struct shader_caps shader_caps; + BOOL srgb_write; unsigned int i; + adapter->fragment_pipe->get_caps(gl_info, &fragment_caps); + adapter->shader_backend->shader_get_caps(gl_info, &shader_caps); + srgb_write = (fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_SRGB_WRITE) + && (shader_caps.wined3d_caps & WINED3D_SHADER_CAP_SRGB_WRITE); + for (i = 0; i < sizeof(format_texture_info) / sizeof(*format_texture_info); ++i) { int fmt_idx = getFmtIdx(format_texture_info[i].id); @@ -1293,6 +1329,14 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info) format->height_scale.numerator = 1; format->height_scale.denominator = 1; + if (!gl_info->limits.vertex_samplers) + format->flags &= ~WINED3DFMT_FLAG_VTF; + + if (!(gl_info->quirks & WINED3D_QUIRK_LIMITED_TEX_FILTERING)) + format->flags |= WINED3DFMT_FLAG_FILTERING; + else if (format->id != WINED3DFMT_R32G32B32A32_FLOAT && format->id != WINED3DFMT_R32_FLOAT) + format->flags &= ~WINED3DFMT_FLAG_VTF; + if (format->glGammaInternal != format->glInternal) { /* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */ @@ -1307,6 +1351,9 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info) } } + if ((format->flags & WINED3DFMT_FLAG_SRGB_WRITE) && !srgb_write) + format->flags &= ~WINED3DFMT_FLAG_SRGB_WRITE; + /* Texture conversion stuff */ format->convert = format_texture_info[i].convert; format->conv_byte_count = format_texture_info[i].conv_byte_count; @@ -1345,7 +1392,6 @@ static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal) * than Wine. The Linux binary <= r500 driver is not maintained any more anyway */ - ENTER_GL(); while (gl_info->gl_ops.gl.p_glGetError()); gl_info->gl_ops.gl.p_glGenTextures(1, &buffer); @@ -1423,7 +1469,7 @@ static BOOL check_filter(const struct wined3d_gl_info *gl_info, GLenum internal) FIXME("Error during filtering test for format %x, returning no filtering\n", internal); ret = FALSE; } - LEAVE_GL(); + return ret; } @@ -1488,8 +1534,9 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3 } } -static void apply_format_fixups(struct wined3d_gl_info *gl_info) +static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_gl_info *gl_info) { + unsigned int i; int idx; idx = getFmtIdx(WINED3DFMT_R16_FLOAT); @@ -1615,6 +1662,67 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info) idx = getFmtIdx(WINED3DFMT_R16G16B16A16_FLOAT); gl_info->formats[idx].gl_vtx_type = GL_HALF_FLOAT; } + + if (!gl_info->supported[ARB_HALF_FLOAT_PIXEL]) + { + idx = getFmtIdx(WINED3DFMT_R16_FLOAT); + gl_info->formats[idx].flags &= ~WINED3DFMT_FLAG_TEXTURE; + + idx = getFmtIdx(WINED3DFMT_R16G16_FLOAT); + gl_info->formats[idx].flags &= ~WINED3DFMT_FLAG_TEXTURE; + + idx = getFmtIdx(WINED3DFMT_R16G16B16A16_FLOAT); + gl_info->formats[idx].flags &= ~WINED3DFMT_FLAG_TEXTURE; + } + + if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16) + { + idx = getFmtIdx(WINED3DFMT_R16G16B16A16_UNORM); + gl_info->formats[idx].flags &= ~WINED3DFMT_FLAG_TEXTURE; + } + + /* ATI instancing hack: Although ATI cards do not support Shader Model + * 3.0, they support instancing. To query if the card supports instancing + * CheckDeviceFormat() with the special format MAKEFOURCC('I','N','S','T') + * is used. Should an application check for this, provide a proper return + * value. We can do instancing with all shader versions, but we need + * vertex shaders. + * + * Additionally applications have to set the D3DRS_POINTSIZE render state + * to MAKEFOURCC('I','N','S','T') once to enable instancing. Wined3d + * doesn't need that and just ignores it. + * + * With Shader Model 3.0 capable cards Instancing 'just works' in Windows. */ + /* FIXME: This should just check the shader backend caps. */ + if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER]) + { + idx = getFmtIdx(WINED3DFMT_INST); + gl_info->formats[idx].flags |= WINED3DFMT_FLAG_TEXTURE; + } + + /* Depth bound test. To query if the card supports it CheckDeviceFormat() + * with the special format MAKEFOURCC('N','V','D','B') is used. It is + * enabled by setting D3DRS_ADAPTIVETESS_X render state to + * MAKEFOURCC('N','V','D','B') and then controlled by setting + * D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax) to test + * value. */ + if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST]) + { + idx = getFmtIdx(WINED3DFMT_NVDB); + gl_info->formats[idx].flags |= WINED3DFMT_FLAG_TEXTURE; + } + + for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i) + { + struct wined3d_format *format = &gl_info->formats[idx]; + + if (!(format->flags & WINED3DFMT_FLAG_TEXTURE)) + continue; + + if (!adapter->shader_backend->shader_color_fixup_supported(format->color_fixup) + || !adapter->fragment_pipe->color_fixup_supported(format->color_fixup)) + format->flags &= ~WINED3DFMT_FLAG_TEXTURE; + } } static BOOL init_format_vertex_info(struct wined3d_gl_info *gl_info) @@ -1660,17 +1768,19 @@ BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) } /* Context activation is done by the caller. */ -BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) +BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter) { + struct wined3d_gl_info *gl_info = &adapter->gl_info; + if (!init_format_base_info(gl_info)) return FALSE; if (!init_format_block_info(gl_info)) goto fail; - if (!init_format_texture_info(gl_info)) goto fail; + if (!init_format_texture_info(adapter, gl_info)) goto fail; if (!init_format_vertex_info(gl_info)) goto fail; - apply_format_fixups(gl_info); + apply_format_fixups(adapter, gl_info); init_format_fbo_compat_info(gl_info); - init_format_filter_info(gl_info, vendor); + init_format_filter_info(gl_info, adapter->driver_info.vendor); return TRUE; @@ -2335,6 +2445,8 @@ const char *debug_d3dstate(DWORD state) return "STATE_VDECL"; if (STATE_IS_VSHADER(state)) return "STATE_VSHADER"; + if (STATE_IS_GEOMETRY_SHADER(state)) + return "STATE_GEOMETRY_SHADER"; if (STATE_IS_VIEWPORT(state)) return "STATE_VIEWPORT"; if (STATE_IS_VERTEXSHADERCONSTANT(state)) @@ -2415,29 +2527,6 @@ const char *debug_glerror(GLenum error) { } } -const char *debug_d3dbasis(enum wined3d_basis_type basis) -{ - switch (basis) - { - case WINED3D_BASIS_BEZIER: return "WINED3D_BASIS_BEZIER"; - case WINED3D_BASIS_BSPLINE: return "WINED3D_BASIS_BSPLINE"; - case WINED3D_BASIS_INTERPOLATE: return "WINED3D_BASIS_INTERPOLATE"; - default: return "unrecognized"; - } -} - -const char *debug_d3ddegree(enum wined3d_degree_type degree) -{ - switch (degree) - { - case WINED3D_DEGREE_LINEAR: return "WINED3D_DEGREE_LINEAR"; - case WINED3D_DEGREE_QUADRATIC: return "WINED3D_DEGREE_QUADRATIC"; - case WINED3D_DEGREE_CUBIC: return "WINED3D_DEGREE_CUBIC"; - case WINED3D_DEGREE_QUINTIC: return "WINED3D_DEGREE_QUINTIC"; - default: return "unrecognized"; - } -} - static const char *debug_fixup_channel_source(enum fixup_channel_source source) { switch(source) @@ -2522,8 +2611,8 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage, return FALSE; } -/* Setup this textures matrix according to the texture flags*/ -/* GL locking is done by the caller (state handler) */ +/* Setup this textures matrix according to the texture flags. */ +/* Context activation is done by the caller (state handler). */ void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, enum wined3d_format_id vtx_fmt, BOOL ffp_proj_control) { @@ -3172,11 +3261,10 @@ void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *des } } -/* Activates the texture dimension according to the bound D3D texture. - * Does not care for the colorop or correct gl texture unit(when using nvrc) - * Requires the caller to activate the correct unit before - */ -/* GL locking is done by the caller (state handler) */ +/* Activates the texture dimension according to the bound D3D texture. Does + * not care for the colorop or correct gl texture unit (when using nvrc). + * Requires the caller to activate the correct unit. */ +/* Context activation is done by the caller (state handler). */ void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) { if (texture) @@ -3263,7 +3351,7 @@ void texture_activate_dimensions(const struct wined3d_texture *texture, const st } } -/* GL locking is done by the caller (state handler) */ +/* Context activation is done by the caller (state handler). */ void sampler_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { DWORD sampler = state_id - STATE_SAMPLER(0); @@ -3339,31 +3427,6 @@ UINT wined3d_log2i(UINT32 x) return (i = x >> 16) ? (x = i >> 8) ? l[x] + 24 : l[i] + 16 : (i = x >> 8) ? l[i] + 8 : l[x]; } -/* Set the shader type for this device, depending on the given capabilities - * and the user preferences in wined3d_settings. */ -void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected) -{ - BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20); - - if (wined3d_settings.vs_mode == VS_NONE) *vs_selected = SHADER_NONE; - else if (gl_info->supported[ARB_VERTEX_SHADER] && glsl) - { - /* Geforce4 cards support GLSL but for vertex shaders only. Further its reported GLSL caps are - * wrong. This combined with the fact that glsl won't offer more features or performance, use ARB - * shaders only on this card. */ - if (gl_info->supported[NV_VERTEX_PROGRAM] && !gl_info->supported[NV_VERTEX_PROGRAM2]) *vs_selected = SHADER_ARB; - else *vs_selected = SHADER_GLSL; - } - else if (gl_info->supported[ARB_VERTEX_PROGRAM]) *vs_selected = SHADER_ARB; - else *vs_selected = SHADER_NONE; - - if (wined3d_settings.ps_mode == PS_NONE) *ps_selected = SHADER_NONE; - else if (gl_info->supported[ARB_FRAGMENT_SHADER] && glsl) *ps_selected = SHADER_GLSL; - else if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) *ps_selected = SHADER_ARB; - else if (gl_info->supported[ATI_FRAGMENT_SHADER]) *ps_selected = SHADER_ATI; - else *ps_selected = SHADER_NONE; -} - const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format) diff --git a/reactos/dll/directx/wine/wined3d/vertexdeclaration.c b/reactos/dll/directx/wine/wined3d/vertexdeclaration.c index 2e47bcd95ad..13f449093b9 100644 --- a/reactos/dll/directx/wine/wined3d/vertexdeclaration.c +++ b/reactos/dll/directx/wine/wined3d/vertexdeclaration.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_decl); @@ -252,10 +252,7 @@ HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device, object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if(!object) - { - ERR("Failed to allocate vertex declaration memory.\n"); return E_OUTOFMEMORY; - } hr = vertexdeclaration_init(object, device, elements, element_count, parent, parent_ops); if (FAILED(hr)) diff --git a/reactos/dll/directx/wine/wined3d/view.c b/reactos/dll/directx/wine/wined3d/view.c index 3d06208052d..54ed9e4d668 100644 --- a/reactos/dll/directx/wine/wined3d/view.c +++ b/reactos/dll/directx/wine/wined3d/view.c @@ -17,8 +17,8 @@ * */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" @@ -77,10 +77,7 @@ HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) - { - ERR("Failed to allocate memory\n"); return E_OUTOFMEMORY; - } wined3d_rendertarget_view_init(object, resource, parent); diff --git a/reactos/dll/directx/wine/wined3d/volume.c b/reactos/dll/directx/wine/wined3d/volume.c index ad38d5e2e67..a9cbafef9e3 100644 --- a/reactos/dll/directx/wine/wined3d/volume.c +++ b/reactos/dll/directx/wine/wined3d/volume.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); @@ -88,12 +88,10 @@ void volume_load(const struct wined3d_volume *volume, struct wined3d_context *co volume_bind_and_dirtify(volume, context); - ENTER_GL(); GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal, volume->resource.width, volume->resource.height, volume->resource.depth, 0, format->glFormat, format->glType, volume->resource.allocatedMemory)); checkGLcall("glTexImage3D"); - LEAVE_GL(); /* When adding code releasing volume->resource.allocatedMemory to save * data keep in mind that GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by @@ -314,7 +312,6 @@ HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, UINT width, U object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) { - ERR("Out of memory\n"); *volume = NULL; return WINED3DERR_OUTOFVIDEOMEMORY; } diff --git a/reactos/dll/directx/wine/wined3d/wined3d.spec b/reactos/dll/directx/wine/wined3d/wined3d.spec index eed1174605c..0f7e70313fd 100644 --- a/reactos/dll/directx/wine/wined3d/wined3d.spec +++ b/reactos/dll/directx/wine/wined3d/wined3d.spec @@ -2,7 +2,7 @@ @ stdcall wined3d_mutex_unlock() @ cdecl wined3d_check_depth_stencil_match(ptr long long long long long) -@ cdecl wined3d_check_device_format(ptr long long long long long long long) +@ cdecl wined3d_check_device_format(ptr long long long long long long) @ cdecl wined3d_check_device_format_conversion(ptr long long long long) @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr) @ cdecl wined3d_check_device_type(ptr long long long long long) @@ -41,15 +41,9 @@ @ cdecl wined3d_device_color_fill(ptr ptr ptr ptr) @ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr) @ cdecl wined3d_device_decref(ptr) -@ cdecl wined3d_device_delete_patch(ptr long) @ cdecl wined3d_device_draw_indexed_primitive(ptr long long) -@ cdecl wined3d_device_draw_indexed_primitive_strided(ptr long ptr long ptr long) -@ cdecl wined3d_device_draw_indexed_primitive_up(ptr long ptr long ptr long) +@ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long) @ cdecl wined3d_device_draw_primitive(ptr long long) -@ cdecl wined3d_device_draw_primitive_strided(ptr long ptr) -@ cdecl wined3d_device_draw_primitive_up(ptr long ptr long) -@ cdecl wined3d_device_draw_rect_patch(ptr long ptr ptr) -@ cdecl wined3d_device_draw_tri_patch(ptr long ptr ptr) @ cdecl wined3d_device_end_scene(ptr) @ cdecl wined3d_device_end_stateblock(ptr ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) @@ -59,11 +53,14 @@ @ cdecl wined3d_device_get_clip_plane(ptr long ptr) @ cdecl wined3d_device_get_clip_status(ptr ptr) @ cdecl wined3d_device_get_creation_parameters(ptr ptr) -@ cdecl wined3d_device_get_depth_stencil(ptr ptr) +@ cdecl wined3d_device_get_depth_stencil(ptr) @ cdecl wined3d_device_get_device_caps(ptr ptr) @ cdecl wined3d_device_get_display_mode(ptr long ptr ptr) @ cdecl wined3d_device_get_front_buffer_data(ptr long ptr) @ cdecl wined3d_device_get_gamma_ramp(ptr long ptr) +@ cdecl wined3d_device_get_geometry_shader(ptr) +@ cdecl wined3d_device_get_gs_cb(ptr long) +@ cdecl wined3d_device_get_gs_sampler(ptr long) @ cdecl wined3d_device_get_index_buffer(ptr ptr) @ cdecl wined3d_device_get_light(ptr long ptr) @ cdecl wined3d_device_get_light_enable(ptr long ptr) @@ -71,30 +68,34 @@ @ cdecl wined3d_device_get_npatch_mode(ptr) @ cdecl wined3d_device_get_pixel_shader(ptr) @ cdecl wined3d_device_get_primitive_type(ptr ptr) +@ cdecl wined3d_device_get_ps_cb(ptr long) @ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long) @ cdecl wined3d_device_get_ps_consts_f(ptr long ptr long) @ cdecl wined3d_device_get_ps_consts_i(ptr long ptr long) +@ cdecl wined3d_device_get_ps_sampler(ptr long) @ cdecl wined3d_device_get_raster_status(ptr long ptr) -@ cdecl wined3d_device_get_render_state(ptr long ptr) -@ cdecl wined3d_device_get_render_target(ptr long ptr) -@ cdecl wined3d_device_get_sampler_state(ptr long long ptr) +@ cdecl wined3d_device_get_render_state(ptr long) +@ cdecl wined3d_device_get_render_target(ptr long) +@ cdecl wined3d_device_get_sampler_state(ptr long long) @ cdecl wined3d_device_get_scissor_rect(ptr ptr) @ cdecl wined3d_device_get_software_vertex_processing(ptr) +@ cdecl wined3d_device_get_stream_output(ptr long ptr) @ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr) @ cdecl wined3d_device_get_stream_source_freq(ptr long ptr) -@ cdecl wined3d_device_get_surface_from_dc(ptr ptr ptr) -@ cdecl wined3d_device_get_swapchain(ptr long ptr) +@ cdecl wined3d_device_get_surface_from_dc(ptr ptr) +@ cdecl wined3d_device_get_swapchain(ptr long) @ cdecl wined3d_device_get_swapchain_count(ptr) -@ cdecl wined3d_device_get_texture(ptr long ptr) -@ cdecl wined3d_device_get_texture_stage_state(ptr long long ptr) +@ cdecl wined3d_device_get_texture(ptr long) +@ cdecl wined3d_device_get_texture_stage_state(ptr long long) @ cdecl wined3d_device_get_transform(ptr long ptr) -@ cdecl wined3d_device_get_vertex_declaration(ptr ptr) +@ cdecl wined3d_device_get_vertex_declaration(ptr) @ cdecl wined3d_device_get_vertex_shader(ptr) @ cdecl wined3d_device_get_viewport(ptr ptr) +@ cdecl wined3d_device_get_vs_cb(ptr long) @ cdecl wined3d_device_get_vs_consts_b(ptr long ptr long) @ cdecl wined3d_device_get_vs_consts_f(ptr long ptr long) @ cdecl wined3d_device_get_vs_consts_i(ptr long ptr long) -@ cdecl wined3d_device_get_wined3d(ptr ptr) +@ cdecl wined3d_device_get_vs_sampler(ptr long) @ cdecl wined3d_device_incref(ptr) @ cdecl wined3d_device_init_3d(ptr ptr) @ cdecl wined3d_device_init_gdi(ptr ptr) @@ -102,7 +103,7 @@ @ cdecl wined3d_device_present(ptr ptr ptr ptr ptr long) @ cdecl wined3d_device_process_vertices(ptr long long long ptr ptr long long) @ cdecl wined3d_device_release_focus_window(ptr) -@ cdecl wined3d_device_reset(ptr ptr ptr ptr) +@ cdecl wined3d_device_reset(ptr ptr ptr ptr long) @ cdecl wined3d_device_restore_fullscreen_window(ptr ptr) @ cdecl wined3d_device_set_base_vertex_index(ptr long) @ cdecl wined3d_device_set_clip_plane(ptr long ptr) @@ -112,6 +113,9 @@ @ cdecl wined3d_device_set_depth_stencil(ptr ptr) @ cdecl wined3d_device_set_dialog_box_mode(ptr long) @ cdecl wined3d_device_set_gamma_ramp(ptr long long ptr) +@ cdecl wined3d_device_set_geometry_shader(ptr ptr) +@ cdecl wined3d_device_set_gs_cb(ptr long ptr) +@ cdecl wined3d_device_set_gs_sampler(ptr long ptr) @ cdecl wined3d_device_set_index_buffer(ptr ptr long) @ cdecl wined3d_device_set_light(ptr long ptr) @ cdecl wined3d_device_set_light_enable(ptr long long) @@ -120,14 +124,17 @@ @ cdecl wined3d_device_set_npatch_mode(ptr float) @ cdecl wined3d_device_set_pixel_shader(ptr ptr) @ cdecl wined3d_device_set_primitive_type(ptr long) +@ cdecl wined3d_device_set_ps_cb(ptr long ptr) @ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long) @ cdecl wined3d_device_set_ps_consts_f(ptr long ptr long) @ cdecl wined3d_device_set_ps_consts_i(ptr long ptr long) +@ cdecl wined3d_device_set_ps_sampler(ptr long ptr) @ cdecl wined3d_device_set_render_state(ptr long long) @ cdecl wined3d_device_set_render_target(ptr long ptr long) @ cdecl wined3d_device_set_sampler_state(ptr long long long) @ cdecl wined3d_device_set_scissor_rect(ptr ptr) @ cdecl wined3d_device_set_software_vertex_processing(ptr long) +@ cdecl wined3d_device_set_stream_output(ptr long ptr long) @ cdecl wined3d_device_set_stream_source(ptr long ptr long long) @ cdecl wined3d_device_set_stream_source_freq(ptr long long) @ cdecl wined3d_device_set_texture(ptr long ptr) @@ -136,9 +143,11 @@ @ cdecl wined3d_device_set_vertex_declaration(ptr ptr) @ cdecl wined3d_device_set_vertex_shader(ptr ptr) @ cdecl wined3d_device_set_viewport(ptr ptr) +@ cdecl wined3d_device_set_vs_cb(ptr long ptr) @ cdecl wined3d_device_set_vs_consts_b(ptr long ptr long) @ cdecl wined3d_device_set_vs_consts_f(ptr long ptr long) @ cdecl wined3d_device_set_vs_consts_i(ptr long ptr long) +@ cdecl wined3d_device_set_vs_sampler(ptr long ptr) @ cdecl wined3d_device_setup_fullscreen_window(ptr ptr long long) @ cdecl wined3d_device_show_cursor(ptr long) @ cdecl wined3d_device_uninit_3d(ptr) @@ -175,6 +184,11 @@ @ cdecl wined3d_rendertarget_view_get_resource(ptr) @ cdecl wined3d_rendertarget_view_incref(ptr) +@ cdecl wined3d_sampler_create(ptr ptr) +@ cdecl wined3d_sampler_decref(ptr) +@ cdecl wined3d_sampler_get_parent(ptr) +@ cdecl wined3d_sampler_incref(ptr) + @ cdecl wined3d_shader_create_gs(ptr ptr ptr ptr ptr ptr long) @ cdecl wined3d_shader_create_ps(ptr ptr ptr ptr ptr ptr long) @ cdecl wined3d_shader_create_vs(ptr ptr ptr ptr ptr ptr long) @@ -191,7 +205,7 @@ @ cdecl wined3d_stateblock_incref(ptr) @ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long) -@ cdecl wined3d_surface_create(ptr long long long long long long long long long long ptr ptr ptr) +@ cdecl wined3d_surface_create(ptr long long long long long long long long ptr ptr ptr) @ cdecl wined3d_surface_decref(ptr) @ cdecl wined3d_surface_flip(ptr ptr long) @ cdecl wined3d_surface_from_resource(ptr) @@ -221,9 +235,9 @@ @ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr) @ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr) -@ cdecl wined3d_swapchain_create(ptr ptr long ptr ptr ptr) +@ cdecl wined3d_swapchain_create(ptr ptr ptr ptr ptr) @ cdecl wined3d_swapchain_decref(ptr) -@ cdecl wined3d_swapchain_get_back_buffer(ptr long long ptr) +@ cdecl wined3d_swapchain_get_back_buffer(ptr long long) @ cdecl wined3d_swapchain_get_device(ptr) @ cdecl wined3d_swapchain_get_display_mode(ptr ptr ptr) @ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr) diff --git a/reactos/dll/directx/wine/wined3d/wined3d_gl.h b/reactos/dll/directx/wine/wined3d/wined3d_gl.h index 128937a5cde..06b527467ea 100644 --- a/reactos/dll/directx/wine/wined3d/wined3d_gl.h +++ b/reactos/dll/directx/wine/wined3d/wined3d_gl.h @@ -19,899 +19,18 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * - * Most OpenGL 1.0/1.1/1.2/1.3 constants/types come from the Mesa-project: - * Copyright (C) 1999-2006 Brian Paul - * - * From the Mesa-license: - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __WINE_WINED3D_GL_H #define __WINE_WINED3D_GL_H -/**************************************************** - * OpenGL 1.0/1.1/1.2/1.3 - * types, #defines and function pointers - ****************************************************/ +#include "wine/wgl.h" -/* Types */ -typedef unsigned int GLbitfield; -typedef unsigned char GLboolean; -typedef signed char GLbyte; -typedef unsigned char GLubyte; -typedef short GLshort; -typedef unsigned short GLushort; -typedef int GLint; -typedef unsigned int GLuint; -typedef unsigned int GLenum; -typedef float GLfloat; -typedef int GLsizei; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void GLvoid; -typedef ptrdiff_t GLintptr; -typedef ptrdiff_t GLsizeiptr; -typedef INT64 GLint64; -typedef UINT64 GLuint64; -typedef struct __GLsync *GLsync; - -/* Booleans */ -#define GL_FALSE 0x0 -#define GL_TRUE 0x1 - -/* Data types */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_DOUBLE 0x140A -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 - -/* Errors */ -#define GL_NO_ERROR 0x0 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_OPERATION 0x0502 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_OUT_OF_MEMORY 0x0505 - -/* Utility */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* Accumulation buffer */ -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_ACCUM 0x0100 -#define GL_ADD 0x0104 -#define GL_LOAD 0x0101 -#define GL_MULT 0x0103 -#define GL_RETURN 0x0102 - -/* Alpha testing */ -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_ALPHA_TEST_FUNC 0x0BC1 - -/* Blending */ -#define GL_BLEND 0x0BE2 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND_DST 0x0BE0 -#define GL_ZERO 0x0 -#define GL_ONE 0x1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 - -/* Buffers, Pixel Drawing/Reading */ -#define GL_NONE 0x0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C -#define GL_COLOR_INDEX 0x1900 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_ALPHA_BITS 0x0D55 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_INDEX_BITS 0x0D51 -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_READ_BUFFER 0x0C02 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_BITMAP 0x1A00 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_DITHER 0x0BD0 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 - -/* Clipping */ -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 - -/* Depth buffer */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_BITS 0x0D56 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_COMPONENT 0x1902 - -/* Evaluators */ -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_COEFF 0x0A00 -#define GL_DOMAIN 0x0A02 -#define GL_ORDER 0x0A01 - -/* Feedback */ -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_LINE_RESET_TOKEN 0x0707 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 - -/* Fog */ -#define GL_FOG 0x0B60 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_COLOR 0x0B66 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_LINEAR 0x2601 -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 - -/* Gets */ -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_MODE 0x0C30 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_RENDER_MODE 0x0C40 -#define GL_RGBA_MODE 0x0C31 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_VIEWPORT 0x0BA2 - -/* Hints */ -#define GL_FOG_HINT 0x0C54 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* Implementation limits */ -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B - -/* Lighting */ -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_SHININESS 0x1601 -#define GL_EMISSION 0x1600 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_SHADE_MODEL 0x0B54 -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_NORMALIZE 0x0BA1 - -/* Lines */ -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_LINE_WIDTH_RANGE 0x0B22 - -/* Logic Ops */ -#define GL_LOGIC_OP 0x0BF1 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_CLEAR 0x1500 -#define GL_SET 0x150F -#define GL_COPY 0x1503 -#define GL_COPY_INVERTED 0x150C -#define GL_NOOP 0x1505 -#define GL_INVERT 0x150A -#define GL_AND 0x1501 -#define GL_NAND 0x150E -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_XOR 0x1506 -#define GL_EQUIV 0x1509 -#define GL_AND_REVERSE 0x1502 -#define GL_AND_INVERTED 0x1504 -#define GL_OR_REVERSE 0x150B -#define GL_OR_INVERTED 0x150D - -/* Matrix Mode */ -#define GL_MATRIX_MODE 0x0BA0 -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_TEXTURE 0x1702 - -/* Pixel Mode / Transfer */ -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 - -/* Points */ -#define GL_POINT_SMOOTH 0x0B10 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_POINT_SIZE_RANGE 0x0B12 - -/* Polygons */ -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 - -/* Primitives */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 - -/* Push/Pop bits */ -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0x000FFFFF - -/* Render Mode */ -#define GL_FEEDBACK 0x1C01 -#define GL_RENDER 0x1C00 -#define GL_SELECT 0x1C02 - -/* Scissor box */ -#define GL_SCISSOR_TEST 0x0C11 -#define GL_SCISSOR_BOX 0x0C10 - -/* Stencil */ -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BITS 0x0D57 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_INDEX 0x1901 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 - -/* Texture mapping */ -#define GL_TEXTURE_ENV 0x2300 -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_ENV_COLOR 0x2201 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_BORDER 0x1005 -#define GL_TEXTURE_COMPONENTS 0x1003 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_LINEAR 0x2400 -#define GL_EYE_PLANE 0x2502 -#define GL_SPHERE_MAP 0x2402 -#define GL_DECAL 0x2101 -#define GL_MODULATE 0x2100 -#define GL_NEAREST 0x2600 -#define GL_REPEAT 0x2901 -#define GL_CLAMP 0x2900 -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 - -/* Vertex Arrays */ -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D - -/* OpenGL 1.1 */ -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF -#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF - -/* OpenGL 1.2 constants */ -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_RESCALE_NORMAL 0x803A -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E - -/* OpenGL 1.3 constants */ -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_SUBTRACT 0x84E7 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_MULTISAMPLE_BIT 0x20000000 - -/* GL_VERSION_2_0 */ -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882a -#define GL_DRAW_BUFFER6 0x882b -#define GL_DRAW_BUFFER7 0x882c -#define GL_DRAW_BUFFER8 0x882d -#define GL_DRAW_BUFFER9 0x882e -#define GL_DRAW_BUFFER10 0x882f -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883d -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886a -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8b30 -#define GL_VERTEX_SHADER 0x8b31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8b49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8b4a -#define GL_MAX_VARYING_FLOATS 0x8b4b -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8b4c -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8b4d -#define GL_SHADER_TYPE 0x8b4f -#define GL_FLOAT_VEC2 0x8b50 -#define GL_FLOAT_VEC3 0x8b51 -#define GL_FLOAT_VEC4 0x8b52 -#define GL_INT_VEC2 0x8b53 -#define GL_INT_VEC3 0x8b54 -#define GL_INT_VEC4 0x8b55 -#define GL_BOOL 0x8b56 -#define GL_BOOL_VEC2 0x8b57 -#define GL_BOOL_VEC3 0x8b58 -#define GL_BOOL_VEC4 0x8b59 -#define GL_FLOAT_MAT2 0x8b5a -#define GL_FLOAT_MAT3 0x8b5b -#define GL_FLOAT_MAT4 0x8b5c -#define GL_SAMPLER_1D 0x8b5d -#define GL_SAMPLER_2D 0x8b5e -#define GL_SAMPLER_3D 0x8b5f -#define GL_SAMPLER_CUBE 0x8b60 -#define GL_SAMPLER_1D_SHADOW 0x8b61 -#define GL_SAMPLER_2D_SHADOW 0x8b62 -#define GL_DELETE_STATUS 0x8b80 -#define GL_COMPILE_STATUS 0x8b81 -#define GL_LINK_STATUS 0x8b82 -#define GL_VALIDATE_STATUS 0x8b83 -#define GL_INFO_LOG_LENGTH 0x8b84 -#define GL_ATTACHED_SHADERS 0x8b85 -#define GL_ACTIVE_UNIFORMS 0x8b86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8b87 -#define GL_SHADER_SOURCE_LENGTH 0x8b88 -#define GL_ACTIVE_ATTRIBUTES 0x8b89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8b8a -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8b8b -#define GL_SHADING_LANGUAGE_VERSION 0x8b8c -#define GL_CURRENT_PROGRAM 0x8b8d -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8ca0 -#define GL_LOWER_LEFT 0x8ca1 -#define GL_UPPER_LEFT 0x8ca2 -#define GL_STENCIL_BACK_REF 0x8ca3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8ca4 -#define GL_STENCIL_BACK_WRITEMASK 0x8ca5 -typedef char GLchar; -#endif +#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 /* not in the gl spec */ void (WINE_GLAPI *glDisableWINE)(GLenum cap) DECLSPEC_HIDDEN; void (WINE_GLAPI *glEnableWINE)(GLenum cap) DECLSPEC_HIDDEN; -/* WGL functions */ -HGLRC (WINAPI *pwglCreateContext)(HDC) DECLSPEC_HIDDEN; -BOOL (WINAPI *pwglDeleteContext)(HGLRC) DECLSPEC_HIDDEN; -HGLRC (WINAPI *pwglGetCurrentContext)(void) DECLSPEC_HIDDEN; -HDC (WINAPI *pwglGetCurrentDC)(void) DECLSPEC_HIDDEN; -PROC (WINAPI *pwglGetProcAddress)(LPCSTR) DECLSPEC_HIDDEN; -BOOL (WINAPI *pwglMakeCurrent)(HDC, HGLRC) DECLSPEC_HIDDEN; -BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN; - -#define WGL_FUNCS_GEN \ - USE_WGL_FUNC(wglCreateContext) \ - USE_WGL_FUNC(wglDeleteContext) \ - USE_WGL_FUNC(wglGetCurrentContext) \ - USE_WGL_FUNC(wglGetCurrentDC) \ - USE_WGL_FUNC(wglGetProcAddress) \ - USE_WGL_FUNC(wglMakeCurrent) \ - USE_WGL_FUNC(wglShareLists) - /* OpenGL extensions. */ enum wined3d_gl_extension { @@ -930,6 +49,7 @@ enum wined3d_gl_extension ARB_DEPTH_TEXTURE, ARB_DRAW_BUFFERS, ARB_DRAW_ELEMENTS_BASE_VERTEX, + ARB_DRAW_INSTANCED, ARB_FRAGMENT_PROGRAM, ARB_FRAGMENT_SHADER, ARB_FRAMEBUFFER_OBJECT, @@ -937,6 +57,7 @@ enum wined3d_gl_extension ARB_GEOMETRY_SHADER4, ARB_HALF_FLOAT_PIXEL, ARB_HALF_FLOAT_VERTEX, + ARB_INSTANCED_ARRAYS, ARB_MAP_BUFFER_ALIGNMENT, ARB_MAP_BUFFER_RANGE, ARB_MULTISAMPLE, @@ -946,6 +67,7 @@ enum wined3d_gl_extension ARB_POINT_PARAMETERS, ARB_POINT_SPRITE, ARB_PROVOKING_VERTEX, + ARB_SHADER_BIT_ENCODING, ARB_SHADER_OBJECTS, ARB_SHADER_TEXTURE_LOD, ARB_SHADING_LANGUAGE_100, @@ -1040,1396 +162,6 @@ enum wined3d_gl_extension WINED3D_GL_EXT_COUNT, }; -/* GL_APPLE_client_storage */ -#ifndef GL_APPLE_client_storage -#define GL_APPLE_client_storage 1 -#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85b2 -#endif - -/* GL_APPLE_fence */ -#ifndef GL_APPLE_fence -#define GL_APPLE_fence 1 -#define GL_DRAW_PIXELS_APPLE 0x8a0a -#define GL_FENCE_APPLE 0x8a0b -#endif - -/* GL_APPLE_float_pixels */ -#ifndef GL_APPLE_float_pixels -#define GL_APPLE_float_pixels 1 -#define GL_HALF_APPLE 0x140b -#define GL_COLOR_FLOAT_APPLE 0x8a0f -#define GL_RGBA_FLOAT32_APPLE 0x8814 -#define GL_RGB_FLOAT32_APPLE 0x8815 -#define GL_ALPHA_FLOAT32_APPLE 0x8816 -#define GL_INTENSITY_FLOAT32_APPLE 0x8817 -#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 -#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 -#define GL_RGBA_FLOAT16_APPLE 0x881a -#define GL_RGB_FLOAT16_APPLE 0x881b -#define GL_ALPHA_FLOAT16_APPLE 0x881c -#define GL_INTENSITY_FLOAT16_APPLE 0x881d -#define GL_LUMINANCE_FLOAT16_APPLE 0x881e -#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881f -#endif - -/* GL_APPLE_flush_buffer_range */ -#ifndef GL_APPLE_flush_buffer_range -#define GL_APPLE_flush_buffer_range 1 -#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8a12 -#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8a13 -#endif - -/* GL_APPLE_ycbcr_422 */ -#ifndef GL_APPLE_ycbcr_422 -#define GL_APPLE_ycbcr_422 1 -#define GL_YCBCR_422_APPLE 0x85b9 -#define UNSIGNED_SHORT_8_8_APPLE 0x85ba -#define UNSIGNED_SHORT_8_8_REV_APPLE 0x85bb -#endif - -/* GL_ARB_color_buffer_float */ -#ifndef GL_ARB_color_buffer_float -#define GL_ARB_color_buffer_float 1 -#define GL_RGBA_FLOAT_MODE_ARB 0x8820 -#define GL_CLAMP_VERTEX_COLOR_ARB 0x891a -#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891b -#define GL_CLAMP_READ_COLOR_ARB 0x891c -#define GL_FIXED_ONLY_ARB 0x891d -#endif - -/* GL_ARB_depth_buffer_float */ -#ifndef GL_ARB_depth_buffer_float -#define GL_ARB_depth_buffer_float 1 -#define GL_DEPTH_COMPONENT32F 0x8cac -#define GL_DEPTH32F_STENCIL8 0x8cad -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8dad -#endif - -/* GL_ARB_depth_clamp */ -#ifndef GL_ARB_depth_clamp -#define GL_ARB_depth_clamp 1 -#define GL_DEPTH_CLAMP 0x864f -#endif - -/* GL_ARB_depth_texture */ -#ifndef GL_ARB_depth_texture -#define GL_ARB_depth_texture 1 -#define GL_DEPTH_COMPONENT16_ARB 0x81a5 -#define GL_DEPTH_COMPONENT24_ARB 0x81a6 -#define GL_DEPTH_COMPONENT32_ARB 0x81a7 -#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884a -#define GL_DEPTH_TEXTURE_MODE_ARB 0x884b -#endif - -/* GL_ARB_draw_buffers */ -#ifndef GL_ARB_draw_buffers -#define GL_ARB_draw_buffers 1 -#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 -#define GL_DRAW_BUFFER0_ARB 0x8825 -#define GL_DRAW_BUFFER1_ARB 0x8826 -#define GL_DRAW_BUFFER2_ARB 0x8827 -#define GL_DRAW_BUFFER3_ARB 0x8828 -#define GL_DRAW_BUFFER4_ARB 0x8829 -#define GL_DRAW_BUFFER5_ARB 0x882a -#define GL_DRAW_BUFFER6_ARB 0x882b -#define GL_DRAW_BUFFER7_ARB 0x882c -#define GL_DRAW_BUFFER8_ARB 0x882d -#define GL_DRAW_BUFFER9_ARB 0x882e -#define GL_DRAW_BUFFER10_ARB 0x882f -#define GL_DRAW_BUFFER11_ARB 0x8830 -#define GL_DRAW_BUFFER12_ARB 0x8831 -#define GL_DRAW_BUFFER13_ARB 0x8832 -#define GL_DRAW_BUFFER14_ARB 0x8833 -#define GL_DRAW_BUFFER15_ARB 0x8834 -#endif - -/* GL_ARB_draw_elements_base_vertex */ -#ifndef GL_ARB_draw_elements_base_vertex -#define GL_ARB_draw_elements_base_vertex 1 -#endif - -/* GL_ARB_fragment_program */ -#ifndef GL_ARB_fragment_program -#define GL_ARB_fragment_program 1 -#define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 -#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 -#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 -#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 -#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 -#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880a -#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880b -#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880c -#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880d -#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880e -#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880f -#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 -#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 -#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 -/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ -#endif - -/* GL_ARB_fragment_shader */ -#ifndef GL_ARB_fragment_shader -#define GL_ARB_fragment_shader 1 -#define GL_FRAGMENT_SHADER_ARB 0x8b30 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8b49 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8b8b -#endif - -/* GL_ARB_framebuffer_object */ -#ifndef GL_ARB_framebuffer_object -#define GL_ARB_framebuffer_object 1 -#define GL_FRAMEBUFFER 0x8d40 -#define GL_READ_FRAMEBUFFER 0x8ca8 -#define GL_DRAW_FRAMEBUFFER 0x8ca9 -#define GL_RENDERBUFFER 0x8d41 -#define GL_STENCIL_INDEX1 0x8d46 -#define GL_STENCIL_INDEX4 0x8d47 -#define GL_STENCIL_INDEX8 0x8d48 -#define GL_STENCIL_INDEX16 0x8d49 -#define GL_RENDERBUFFER_WIDTH 0x8d42 -#define GL_RENDERBUFFER_HEIGHT 0x8d43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8d44 -#define GL_RENDERBUFFER_RED_SIZE 0x8d50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8d51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8d52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8d53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8d54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8d55 -#define GL_RENDERBUFFER_SAMPLES 0x8cab -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8cd0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8cd1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8cd2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8cd3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8cd4 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_SRGB 0x8c40 -#define GL_UNSIGNED_NORMALIZED 0x8c17 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_INDEX 0x8222 -#define GL_COLOR_ATTACHMENT0 0x8ce0 -#define GL_COLOR_ATTACHMENT1 0x8ce1 -#define GL_COLOR_ATTACHMENT2 0x8ce2 -#define GL_COLOR_ATTACHMENT3 0x8ce3 -#define GL_COLOR_ATTACHMENT4 0x8ce4 -#define GL_COLOR_ATTACHMENT5 0x8ce5 -#define GL_COLOR_ATTACHMENT6 0x8ce6 -#define GL_COLOR_ATTACHMENT7 0x8ce7 -#define GL_COLOR_ATTACHMENT8 0x8ce8 -#define GL_COLOR_ATTACHMENT9 0x8ce9 -#define GL_COLOR_ATTACHMENT10 0x8cea -#define GL_COLOR_ATTACHMENT11 0x8ceb -#define GL_COLOR_ATTACHMENT12 0x8cec -#define GL_COLOR_ATTACHMENT13 0x8ced -#define GL_COLOR_ATTACHMENT14 0x8cee -#define GL_COLOR_ATTACHMENT15 0x8cef -#define GL_DEPTH_ATTACHMENT 0x8d00 -#define GL_STENCIL_ATTACHMENT 0x8d20 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821a -#define GL_MAX_SAMPLES 0x8d57 -#define GL_FRAMEBUFFER_COMPLETE 0x8cd5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8cd6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8cd7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8cdb -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8cdc -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8cdd -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8d56 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_FRAMEBUFFER_BINDING 0x8ca6 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8ca6 -#define GL_READ_FRAMEBUFFER_BINDING 0x8caa -#define GL_RENDERBUFFER_BINDING 0x8ca7 -#define GL_MAX_COLOR_ATTACHMENTS 0x8cdf -#define GL_MAX_RENDERBUFFER_SIZE 0x84e8 -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_DEPTH_STENCIL 0x84f9 -#define GL_UNSIGNED_INT_24_8 0x84fa -#define GL_DEPTH24_STENCIL8 0x88f0 -#define GL_TEXTURE_STENCIL_SIZE 0x88f1 -#endif - -/* GL_ARB_framebuffer_sRGB */ -#ifndef GL_ARB_framebuffer_sRGB -#define GL_ARB_framebuffer_sRGB 1 -#define GL_FRAMEBUFFER_SRGB 0x8db9 -#endif - -/* GL_ARB_geometry_shader4 */ -#ifndef GL_ARB_geometry_shader4 -#define GL_ARB_geometry_shader4 1 -#define GL_GEOMETRY_SHADER_ARB 0x8dd9 -#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8dda -#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8ddb -#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8ddc -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8c29 -#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8ddd -#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8dde -#define GL_MAX_VARYING_COMPONENTS_ARB 0x8b4b -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8ddf -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8de0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8de1 -#define GL_LINES_ADJACENCY_ARB 0x000a -#define GL_LINE_STRIP_ADJACENCY_ARB 0x000b -#define GL_TRIANGLES_ADJACENCY_ARB 0x000c -#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000d -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8da8 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8da9 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8da7 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8cd4 -#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 -#endif - -/* GL_ARB_half_float_pixel */ -#ifndef GL_ARB_half_float_pixel -#define GL_ARB_half_float_pixel 1 -#define GL_HALF_FLOAT_ARB 0x140b -#endif - -/* GL_ARB_half_float_vertex */ -#ifndef GL_ARB_half_float_vertex -#define GL_ARB_half_float_vertex 1 -/* No _ARB, see extension spec */ -#define GL_HALF_FLOAT 0x140b -#endif - -/* GL_ARB_map_buffer_alignment */ -#ifndef GL_ARB_map_buffer_alignment -#define GL_ARB_map_buffer_alignment 1 -#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90bc -#endif - -/* GL_ARB_map_buffer_range */ -#ifndef GL_ARB_map_buffer_range -#define GL_ARB_map_buffer_range 1 -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#endif - -/* GL_ARB_multisample */ -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 -#define GL_MULTISAMPLE_ARB 0x809d -#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809e -#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809f -#define GL_SAMPLE_COVERAGE_ARB 0x80a0 -#define GL_SAMPLE_BUFFERS_ARB 0x80a8 -#define GL_SAMPLES_ARB 0x80a9 -#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80aa -#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80ab -#define GL_MULTISAMPLE_BIT_ARB 0x20000000 -#endif - -/* GL_ARB_multitexture */ -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 -#define GL_TEXTURE0_ARB 0x84c0 -#define GL_TEXTURE1_ARB 0x84c1 -#define GL_TEXTURE2_ARB 0x84c2 -#define GL_TEXTURE3_ARB 0x84c3 -#define GL_TEXTURE4_ARB 0x84c4 -#define GL_TEXTURE5_ARB 0x84c5 -#define GL_TEXTURE6_ARB 0x84c6 -#define GL_TEXTURE7_ARB 0x84c7 -#define GL_TEXTURE8_ARB 0x84c8 -#define GL_TEXTURE9_ARB 0x84c9 -#define GL_TEXTURE10_ARB 0x84ca -#define GL_TEXTURE11_ARB 0x84cb -#define GL_TEXTURE12_ARB 0x84cc -#define GL_TEXTURE13_ARB 0x84cd -#define GL_TEXTURE14_ARB 0x84ce -#define GL_TEXTURE15_ARB 0x84cf -#define GL_TEXTURE16_ARB 0x84d0 -#define GL_TEXTURE17_ARB 0x84d1 -#define GL_TEXTURE18_ARB 0x84d2 -#define GL_TEXTURE19_ARB 0x84d3 -#define GL_TEXTURE20_ARB 0x84d4 -#define GL_TEXTURE21_ARB 0x84d5 -#define GL_TEXTURE22_ARB 0x84d6 -#define GL_TEXTURE23_ARB 0x84d7 -#define GL_TEXTURE24_ARB 0x84d8 -#define GL_TEXTURE25_ARB 0x84d9 -#define GL_TEXTURE26_ARB 0x84da -#define GL_TEXTURE27_ARB 0x84db -#define GL_TEXTURE28_ARB 0x84dc -#define GL_TEXTURE29_ARB 0x84dd -#define GL_TEXTURE30_ARB 0x84de -#define GL_TEXTURE31_ARB 0x84df -#define GL_ACTIVE_TEXTURE_ARB 0x84e0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84e1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84e2 -#endif - -/* GL_ARB_occlusion_query */ -#ifndef GL_ARB_occlusion_query -#define GL_ARB_occlusion_query 1 -#define GL_SAMPLES_PASSED_ARB 0x8914 -#define GL_QUERY_COUNTER_BITS_ARB 0x8864 -#define GL_CURRENT_QUERY_ARB 0x8865 -#define GL_QUERY_RESULT_ARB 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 -#endif - -/* GL_ARB_pixel_buffer_object */ -#ifndef GL_ARB_pixel_buffer_object -#define GL_ARB_pixel_buffer_object 1 -#define GL_PIXEL_PACK_BUFFER_ARB 0x88eb -#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88ec -#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ed -#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88ef -#endif - -/* GL_ARB_point_parameters */ -#ifndef GL_ARB_point_parameters -#define GL_ARB_point_parameters 1 -#define GL_POINT_SIZE_MIN_ARB 0x8126 -#define GL_POINT_SIZE_MAX_ARB 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 -#endif - -/* GL_ARB_point_sprite */ -#ifndef GL_ARB_point_sprite -#define GL_ARB_point_sprite 1 -#define GL_POINT_SPRITE_ARB 0x8861 -#define GL_COORD_REPLACE_ARB 0x8862 -#endif - -/* GL_ARB_provoking_vertex */ -#ifndef GL_ARB_provoking_vertex -#define GL_ARB_provoking_vertex 1 -#define GL_FIRST_VERTEX_CONVENTION 0x8e4d -#define GL_LAST_VERTEX_CONVENTION 0x8e4e -#define GL_PROVOKING_VERTEX 0x8e4f -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8e4c -#endif - -/* GL_ARB_shader_objects */ -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -typedef char GLcharARB; -typedef unsigned int GLhandleARB; -#define GL_PROGRAM_OBJECT_ARB 0x8b40 -#define GL_OBJECT_TYPE_ARB 0x8b4e -#define GL_OBJECT_SUBTYPE_ARB 0x8b4f -#define GL_OBJECT_DELETE_STATUS_ARB 0x8b80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8b81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8b82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8b83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8b84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8b85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8b86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8b87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8b88 -#define GL_SHADER_OBJECT_ARB 0x8b48 -#define GL_FLOAT_VEC2_ARB 0x8b50 -#define GL_FLOAT_VEC3_ARB 0x8b51 -#define GL_FLOAT_VEC4_ARB 0x8b52 -#define GL_INT_VEC2_ARB 0x8b53 -#define GL_INT_VEC3_ARB 0x8b54 -#define GL_INT_VEC4_ARB 0x8b55 -#define GL_BOOL_ARB 0x8b56 -#define GL_BOOL_VEC2_ARB 0x8b57 -#define GL_BOOL_VEC3_ARB 0x8b58 -#define GL_BOOL_VEC4_ARB 0x8b59 -#define GL_FLOAT_MAT2_ARB 0x8b5a -#define GL_FLOAT_MAT3_ARB 0x8b5b -#define GL_FLOAT_MAT4_ARB 0x8b5c -#define GL_SAMPLER_1D_ARB 0x8b5d -#define GL_SAMPLER_2D_ARB 0x8b5e -#define GL_SAMPLER_3D_ARB 0x8b5f -#define GL_SAMPLER_CUBE_ARB 0x8b60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8b61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8b62 -#define GL_SAMPLER_2D_RECT_ARB 0x8b63 -#define GL_SAMPELR_2D_RECT_SHADOW_ARB 0x8b64 -#endif - -/* GL_ARB_shading_language_100 */ -#ifndef GL_ARB_shading_language_100 -#define GL_ARB_shading_language_100 1 -#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8b8c -#endif - -/* GL_ARB_shadow */ -#ifndef GL_ARB_shadow -#define GL_ARB_shadow 1 -#define GL_TEXTURE_COMPARE_MODE_ARB 0x884c -#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884d -#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884e -#endif - -/* GL_ARB_sync */ -#ifndef GL_ARB_sync -#define GL_ARB_sync 1 -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_TIMEOUT_IGNORED 0xffffffffffffffffULL -#define GL_ALREADY_SIGNALED 0x911a -#define GL_TIMEOUT_EXPIRED 0x911b -#define GL_CONDITION_SATISFIED 0x911c -#define GL_WAIT_FAILED 0x911d -#endif - -/* GL_ARB_texture_border_clamp */ -#ifndef GL_ARB_texture_border_clamp -#define GL_ARB_texture_border_clamp 1 -#define GL_CLAMP_TO_BORDER_ARB 0x812d -#endif - -/* GL_ARB_texture_compression_rgtc */ -#ifndef GL_ARB_texture_compression_rgtc -#define GL_ARB_texture_compression_rgtc 1 -#define GL_COMPRESSED_RED_RGTC1 0x8dbb -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8dbc -#define GL_COMPRESSED_RED_GREEN_RGTC2 0x8dbd -#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2 0x8dbe -#endif - -/* GL_ARB_texture_cube_map */ -#ifndef GL_ARB_texture_cube_map -#define GL_ARB_texture_cube_map 1 -#define GL_NORMAL_MAP_ARB 0x8511 -#define GL_REFLECTION_MAP_ARB 0x8512 -#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851a -#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851b -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851c -#endif - -/* GL_ARB_texture_env_dot3 */ -#ifndef GL_ARB_texture_env_dot3 -#define GL_ARB_texture_env_dot3 1 -#define GL_DOT3_RGB_ARB 0x86ae -#define GL_DOT3_RGBA_ARB 0x86af -#endif - -/* GL_ARB_texture_float */ -#ifndef GL_ARB_texture_float -#define GL_ARB_texture_float 1 -#define GL_RGBA32F_ARB 0x8814 -#define GL_RGB32F_ARB 0x8815 -#define GL_RGBA16F_ARB 0x881a -#define GL_RGB16F_ARB 0x881b -#endif - -/* GL_ARB_texture_mirrored_repeat */ -#ifndef GL_ARB_texture_mirrored_repeat -#define GL_ARB_texture_mirrored_repeat 1 -#define GL_MIRRORED_REPEAT_ARB 0x8370 -#endif - -/* GL_ARB_texture_rectangle */ -#ifndef GL_ARB_texture_rectangle -#define GL_ARB_texture_rectangle 1 -#define GL_TEXTURE_RECTANGLE_ARB 0x84f5 -#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84f6 -#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84f7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84f8 -#define GL_SAMPLER_2D_RECT_ARB 0x8b63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8b64 -#endif - -/* GL_ARB_texture_rg */ -#ifndef GL_ARB_texture_rg -#define GL_ARB_texture_rg 1 -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822a -#define GL_RG8 0x822b -#define GL_RG16 0x822c -#define GL_R16F 0x822d -#define GL_R32F 0x822e -#define GL_RG16F 0x822f -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823a -#define GL_RG32I 0x823b -#define GL_RG32UI 0x823c -#endif - -/* GL_ARB_vertex_blend */ -#ifndef GL_ARB_vertex_blend -#define GL_ARB_vertex_blend 1 -#define GL_MAX_VERTEX_UNITS_ARB 0x86a4 -#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86a5 -#define GL_WEIGHT_SUM_UNITY_ARB 0x86a6 -#define GL_VERTEX_BLEND_ARB 0x86a7 -#define GL_CURRENT_WEIGHT_ARB 0x86a8 -#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86a9 -#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86aa -#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86ab -#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86ac -#define GL_WEIGHT_ARRAY_ARB 0x86ad -#define GL_MODELVIEW0_ARB 0x1700 -#define GL_MODELVIEW1_ARB 0x850a -#define GL_MODELVIEW2_ARB 0x8722 -#define GL_MODELVIEW3_ARB 0x8723 -#define GL_MODELVIEW4_ARB 0x8724 -#define GL_MODELVIEW5_ARB 0x8725 -#define GL_MODELVIEW6_ARB 0x8726 -#define GL_MODELVIEW7_ARB 0x8727 -#define GL_MODELVIEW8_ARB 0x8728 -#define GL_MODELVIEW9_ARB 0x8729 -#define GL_MODELVIEW10_ARB 0x872a -#define GL_MODELVIEW11_ARB 0x872b -#define GL_MODELVIEW12_ARB 0x872c -#define GL_MODELVIEW13_ARB 0x872d -#define GL_MODELVIEW14_ARB 0x872e -#define GL_MODELVIEW15_ARB 0x872f -#define GL_MODELVIEW16_ARB 0x8730 -#define GL_MODELVIEW17_ARB 0x8731 -#define GL_MODELVIEW18_ARB 0x8732 -#define GL_MODELVIEW19_ARB 0x8733 -#define GL_MODELVIEW20_ARB 0x8734 -#define GL_MODELVIEW21_ARB 0x8735 -#define GL_MODELVIEW22_ARB 0x8736 -#define GL_MODELVIEW23_ARB 0x8737 -#define GL_MODELVIEW24_ARB 0x8738 -#define GL_MODELVIEW25_ARB 0x8739 -#define GL_MODELVIEW26_ARB 0x873a -#define GL_MODELVIEW27_ARB 0x873b -#define GL_MODELVIEW28_ARB 0x873c -#define GL_MODELVIEW29_ARB 0x873d -#define GL_MODELVIEW30_ARB 0x873e -#define GL_MODELVIEW31_ARB 0x873f -#endif - -/* GL_ARB_vertex_buffer_object */ -#ifndef GL_ARB_vertex_buffer_object -#define GL_ARB_vertex_buffer_object 1 -#define GL_BUFFER_SIZE_ARB 0x8764 -#define GL_BUFFER_USAGE_ARB 0x8765 -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889a -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889b -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889c -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889d -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889e -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889f -#define GL_READ_ONLY_ARB 0x88b8 -#define GL_WRITE_ONLY_ARB 0x88b9 -#define GL_READ_WRITE_ARB 0x88ba -#define GL_BUFFER_ACCESS_ARB 0x88bb -#define GL_BUFFER_MAPPED_ARB 0x88bc -#define GL_BUFFER_MAP_POINTER_ARB 0x88bd -#define GL_STREAM_DRAW_ARB 0x88e0 -#define GL_STREAM_READ_ARB 0x88e1 -#define GL_STREAM_COPY_ARB 0x88e2 -#define GL_STATIC_DRAW_ARB 0x88e4 -#define GL_STATIC_READ_ARB 0x88e5 -#define GL_STATIC_COPY_ARB 0x88e6 -#define GL_DYNAMIC_DRAW_ARB 0x88e8 -#define GL_DYNAMIC_READ_ARB 0x88e9 -#define GL_DYNAMIC_COPY_ARB 0x88ea -#endif - -/* GL_ARB_vertex_program */ -#ifndef GL_ARB_vertex_program -#define GL_ARB_vertex_program 1 -#define GL_VERTEX_PROGRAM_ARB 0x8620 -#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 -#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 -#define GL_COLOR_SUM_ARB 0x8458 -#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886a -#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 -#define GL_PROGRAM_LENGTH_ARB 0x8627 -#define GL_PROGRAM_FORMAT_ARB 0x8876 -#define GL_PROGRAM_BINDING_ARB 0x8677 -#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88a0 -#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88a1 -#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88a2 -#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88a3 -#define GL_PROGRAM_TEMPORARIES_ARB 0x88a4 -#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88a5 -#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88a6 -#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88a7 -#define GL_PROGRAM_PARAMETERS_ARB 0x88a8 -#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88a9 -#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88aa -#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88ab -#define GL_PROGRAM_ATTRIBS_ARB 0x88ac -#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88ad -#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88ae -#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88af -#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88b0 -#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88b1 -#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88b2 -#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88b3 -#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88b4 -#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88b5 -#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88b6 -#define GL_PROGRAM_STRING_ARB 0x8628 -#define GL_PROGRAM_ERROR_POSITION_ARB 0x864b -#define GL_CURRENT_MATRIX_ARB 0x8641 -#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88b7 -#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 -#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 -#define GL_MAX_PROGRAM_MATRICES_ARB 0x862f -#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862e -#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 -#define GL_MATRIX0_ARB 0x88c0 -#define GL_MATRIX1_ARB 0x88c1 -#define GL_MATRIX2_ARB 0x88c2 -#define GL_MATRIX3_ARB 0x88c3 -#define GL_MATRIX4_ARB 0x88c4 -#define GL_MATRIX5_ARB 0x88c5 -#define GL_MATRIX6_ARB 0x88c6 -#define GL_MATRIX7_ARB 0x88c7 -#define GL_MATRIX8_ARB 0x88c8 -#define GL_MATRIX9_ARB 0x88c9 -#define GL_MATRIX10_ARB 0x88ca -#define GL_MATRIX11_ARB 0x88cb -#define GL_MATRIX12_ARB 0x88cc -#define GL_MATRIX13_ARB 0x88cd -#define GL_MATRIX14_ARB 0x88ce -#define GL_MATRIX15_ARB 0x88cf -#define GL_MATRIX16_ARB 0x88d0 -#define GL_MATRIX17_ARB 0x88d1 -#define GL_MATRIX18_ARB 0x88d2 -#define GL_MATRIX19_ARB 0x88d3 -#define GL_MATRIX20_ARB 0x88d4 -#define GL_MATRIX21_ARB 0x88d5 -#define GL_MATRIX22_ARB 0x88d6 -#define GL_MATRIX23_ARB 0x88d7 -#define GL_MATRIX24_ARB 0x88d8 -#define GL_MATRIX25_ARB 0x88d9 -#define GL_MATRIX26_ARB 0x88da -#define GL_MATRIX27_ARB 0x88db -#define GL_MATRIX28_ARB 0x88dc -#define GL_MATRIX29_ARB 0x88dd -#define GL_MATRIX30_ARB 0x88de -#define GL_MATRIX31_ARB 0x88df -#endif - -/* GL_ARB_vertex_shader */ -#ifndef GL_ARB_vertex_shader -#define GL_ARB_vertex_shader 1 -#define GL_VERTEX_SHADER_ARB 0x8b31 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8b4a -#define GL_MAX_VARYING_FLOATS_ARB 0x8b4b -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8b4c -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8b4d -#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8b89 -#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8b8a -#endif - -/* GL_ATI_fragment_shader */ -#ifndef GL_ATI_fragment_shader -#define GL_ATI_fragment_shader 1 -#define GL_FRAGMENT_SHADER_ATI 0x8920 -#define GL_REG_0_ATI 0x8921 -#define GL_REG_1_ATI 0x8922 -#define GL_REG_2_ATI 0x8923 -#define GL_REG_3_ATI 0x8924 -#define GL_REG_4_ATI 0x8925 -#define GL_REG_5_ATI 0x8926 -#define GL_CON_0_ATI 0x8941 -#define GL_CON_1_ATI 0x8942 -#define GL_CON_2_ATI 0x8943 -#define GL_CON_3_ATI 0x8944 -#define GL_CON_4_ATI 0x8945 -#define GL_CON_5_ATI 0x8946 -#define GL_CON_6_ATI 0x8947 -#define GL_CON_7_ATI 0x8948 -#define GL_MOV_ATI 0x8961 -#define GL_ADD_ATI 0x8963 -#define GL_MUL_ATI 0x8964 -#define GL_SUB_ATI 0x8965 -#define GL_DOT3_ATI 0x8966 -#define GL_DOT4_ATI 0x8967 -#define GL_MAD_ATI 0x8968 -#define GL_LERP_ATI 0x8969 -#define GL_CND_ATI 0x896a -#define GL_CND0_ATI 0x896b -#define GL_DOT2_ADD_ATI 0x896c -#define GL_SECONDARY_INTERPOLATOR_ATI 0x896d -#define GL_SWIZZLE_STR_ATI 0x8976 -#define GL_SWIZZLE_STQ_ATI 0x8977 -#define GL_SWIZZLE_STR_DR_ATI 0x8978 -#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 -#define GL_RED_BIT_ATI 0x00000001 -#define GL_GREEN_BIT_ATI 0x00000002 -#define GL_BLUE_BIT_ATI 0x00000004 -#define GL_2X_BIT_ATI 0x00000001 -#define GL_4X_BIT_ATI 0x00000002 -#define GL_8X_BIT_ATI 0x00000004 -#define GL_HALF_BIT_ATI 0x00000008 -#define GL_QUARTER_BIT_ATI 0x00000010 -#define GL_EIGHTH_BIT_ATI 0x00000020 -#define GL_SATURATE_BIT_ATI 0x00000040 -#define GL_COMP_BIT_ATI 0x00000002 -#define GL_NEGATE_BIT_ATI 0x00000004 -#define GL_BIAS_BIT_ATI 0x00000008 -#endif - -/* GL_ATI_separate_stencil */ -#ifndef GL_ATI_separate_stencil -#define GL_ATI_separate_stencil 1 -#define GL_STENCIL_BACK_FUNC_ATI 0x8800 -#define GL_STENCIL_BACK_FAIL_ATI 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 -#endif - -/* GL_ATI_texture_compression_3dc */ -#ifndef GL_ATI_texture_compression_3dc -#define GL_ATI_texture_compression_3dc 1 -#define GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI 0x8837 -#endif - -/* GL_ATI_texture_env_combine3 */ -#ifndef GL_ATI_texture_env_combine3 -#define GL_ATI_texture_env_combine3 1 -#define GL_MODULATE_ADD_ATI 0x8744 -#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 -#define GL_MODULATE_SUBTRACT_ATI 0x8746 -/* #define ONE */ -/* #define ZERO */ -#endif - -/* GL_ATI_texture_mirror_once */ -#ifndef GL_ATI_texture_mirror_once -#define GL_ATI_texture_mirror_once 1 -#define GL_MIRROR_CLAMP_ATI 0x8742 -#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 -#endif - -/* GL_EXT_blend_color */ -#ifndef GL_EXT_blend_color -#define GL_EXT_blend_color 1 -#define GL_CONSTANT_COLOR_EXT 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 -#define GL_CONSTANT_ALPHA_EXT 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 -#define GL_BLEND_COLOR_EXT 0x8005 -#endif - -/* GL_EXT_blend_func_separate */ -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 -#define GL_BLEND_DST_RGB_EXT 0x80c8 -#define GL_BLEND_SRC_RGB_EXT 0x80c9 -#define GL_BLEND_DST_ALPHA_EXT 0x80ca -#define GL_BLEND_SRC_ALPHA_EXT 0x80cb -#endif - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#define GL_FUNC_ADD_EXT 0x8006 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#define GL_BLEND_EQUATION_EXT 0x8009 -#endif - -/* GL_EXT_blend_subtract */ -#ifndef GL_EXT_blend_subtract -#define GL_EXT_blend_subtract 1 -#define GL_FUNC_SUBTRACT_EXT 0x800a -#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800b -#endif - -/* GL_EXT_depth_bounds_test */ -#ifndef GL_EXT_depth_bounds_test -#define GL_EXT_depth_bounds_test 1 -#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 -#define GL_DEPTH_BOUNDS_EXT 0x8891 -#endif - -/* GL_EXT_fog_coord */ -#ifndef GL_EXT_fog_coord -#define GL_EXT_fog_coord 1 -#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 -#define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 -#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 -#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 -#endif - -/* GL_EXT_framebuffer_blit */ -#ifndef GL_EXT_framebuffer_blit -#define GL_EXT_framebuffer_blit 1 -#define GL_READ_FRAMEBUFFER_EXT 0x8ca8 -#define GL_DRAW_FRAMEBUFFER_EXT 0x8ca9 -#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8ca6 -#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8caa -#endif - -/* GL_EXT_framebuffer_multisample */ -#ifndef GL_EXT_framebuffer_multisample -#define GL_EXT_framebuffer_multisample 1 -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8cab -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8d56 -#define GL_MAX_SAMPLES_EXT 0x8d57 -#endif - -/* GL_EXT_framebuffer_object */ -#ifndef GL_EXT_framebuffer_object -#define GL_EXT_framebuffer_object 1 -#define GL_FRAMEBUFFER_EXT 0x8d40 -#define GL_RENDERBUFFER_EXT 0x8d41 -#define GL_STENCIL_INDEX1_EXT 0x8d46 -#define GL_STENCIL_INDEX4_EXT 0x8d47 -#define GL_STENCIL_INDEX8_EXT 0x8d48 -#define GL_STENCIL_INDEX16_EXT 0x8d49 -#define GL_RENDERBUFFER_WIDTH_EXT 0x8d42 -#define GL_RENDERBUFFER_HEIGHT_EXT 0x8d43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8d44 -#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8d50 -#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8d51 -#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8d52 -#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8d53 -#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8d54 -#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8d55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8cd0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8cd1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8cd2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8cd3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8cd4 -#define GL_COLOR_ATTACHMENT0_EXT 0x8ce0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8ce1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8ce2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8ce3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8ce4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8ce5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8ce6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8ce7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8ce8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8ce9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8cea -#define GL_COLOR_ATTACHMENT11_EXT 0x8ceb -#define GL_COLOR_ATTACHMENT12_EXT 0x8cec -#define GL_COLOR_ATTACHMENT13_EXT 0x8ced -#define GL_COLOR_ATTACHMENT14_EXT 0x8cee -#define GL_COLOR_ATTACHMENT15_EXT 0x8cef -#define GL_DEPTH_ATTACHMENT_EXT 0x8d00 -#define GL_STENCIL_ATTACHMENT_EXT 0x8d20 -#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8cd5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8cd6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8cd7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8cd9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8cda -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8cdb -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8cdc -#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8cdd -#define GL_FRAMEBUFFER_BINDING_EXT 0x8ca6 -#define GL_RENDERBUFFER_BINDING_EXT 0x8ca7 -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8cdF -#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84e8 -#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 -#endif - -/* GL_EXT_gpu_program_parameters */ -#ifndef GL_EXT_gpu_program_parameters -#define GL_EXT_gpu_program_parameters 1 -#endif - -/* GL_EXT_gpu_shader4 */ -#ifndef GL_EXT_gpu_shader4 -#define GL_EXT_gpu_shader4 1 -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88fd -#define GL_SAMPLER_1D_ARRAY_EXT 0x8dc0 -#define GL_SAMPLER_2D_ARRAY_EXT 0x8dc1 -#define GL_SAMPLER_BUFFER_EXT 0x8dc2 -#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8dc3 -#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8dc4 -#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8dc5 -#define GL_UNSIGNED_INT_VEC2_EXT 0x8dc6 -#define GL_UNSIGNED_INT_VEC3_EXT 0x8dc7 -#define GL_UNSIGNED_INT_VEC4_EXT 0x8dc8 -#define GL_INT_SAMPLER_1D_EXT 0x8dc9 -#define GL_INT_SAMPLER_2D_EXT 0x8dca -#define GL_INT_SAMPLER_3D_EXT 0x8dcb -#define GL_INT_SAMPLER_CUBE_EXT 0x8dcc -#define GL_INT_SAMPLER_2D_RECT_EXT 0x8dcd -#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8dce -#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8dcf -#define GL_INT_SAMPLER_BUFFER_EXT 0x8dd0 -#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8dd1 -#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8dd2 -#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8dd3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8dd4 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8dd5 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8dd6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8dd7 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8dd8 -#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 -#endif - -/* GL_EXT_packed_depth_stencil */ -#ifndef GL_EXT_packed_depth_stencil -#define GL_EXT_packed_depth_stencil 1 -#define GL_DEPTH_STENCIL_EXT 0x84f9 -#define GL_UNSIGNED_INT_24_8_EXT 0x84fa -#define GL_DEPTH24_STENCIL8_EXT 0x88f0 -#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88f1 -#endif - -/* GL_EXT_paletted_texture */ -#ifndef GL_EXT_paletted_texture -#define GL_EXT_paletted_texture 1 -#define GL_COLOR_INDEX1_EXT 0x80e2 -#define GL_COLOR_INDEX2_EXT 0x80e3 -#define GL_COLOR_INDEX4_EXT 0x80e4 -#define GL_COLOR_INDEX8_EXT 0x80e5 -#define GL_COLOR_INDEX12_EXT 0x80e6 -#define GL_COLOR_INDEX16_EXT 0x80e7 -#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ed -#endif - -/* GL_EXT_point_parameters */ -#ifndef GL_EXT_point_parameters -#define GL_EXT_point_parameters 1 -#define GL_POINT_SIZE_MIN_EXT 0x8126 -#define GL_POINT_SIZE_MAX_EXT 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 -#define GL_DISTANCE_ATTENUATION_EXT 0x8129 -#endif - -/* GL_EXT_provoking_vertex */ -#ifndef GL_EXT_provoking_vertex -#define GL_EXT_provoking_vertex 1 -#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8e4d -#define GL_LAST_VERTEX_CONVENTION_EXT 0x8e4e -#define GL_PROVOKING_VERTEX_EXT 0x8e4f -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8e4c -#endif - -/* GL_EXT_secondary_color */ -#ifndef GL_EXT_secondary_color -#define GL_EXT_secondary_color 1 -#define GL_COLOR_SUM_EXT 0x8458 -#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845a -#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845b -#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845c -#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845d -#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845e -#endif - -/* GL_EXT_stencil_two_side */ -#ifndef GL_EXT_stencil_two_side -#define GL_EXT_stencil_two_side 1 -#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 -#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 -#endif - -/* GL_EXT_stencil_wrap */ -#ifndef GL_EXT_stencil_wrap -#define GL_EXT_stencil_wrap 1 -#define GL_INCR_WRAP_EXT 0x8507 -#define GL_DECR_WRAP_EXT 0x8508 -#endif - -/* GL_EXT_texture3D */ -#ifndef GL_EXT_texture3D -#define GL_EXT_texture3D 1 -#define GL_PACK_SKIP_IMAGES_EXT 0x806b -#define GL_PACK_IMAGE_HEIGHT_EXT 0x806c -#define GL_UNPACK_SKIP_IMAGES_EXT 0x806d -#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806e -#define GL_TEXTURE_3D_EXT 0x806f -#define GL_PROXY_TEXTURE_3D_EXT 0x8070 -#define GL_TEXTURE_DEPTH_EXT 0x8071 -#define GL_TEXTURE_WRAP_R_EXT 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 -#endif - -/* GL_EXT_texture_compression_rgtc */ -#ifndef GL_EXT_texture_compression_rgtc -#define GL_EXT_texture_compression_rgtc 1 -#define GL_COMPRESSED_RED_RGTC1_EXT 0x8dbb -#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8dbc -#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8dbd -#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8dbe -#endif - -/* GL_EXT_texture_compression_s3tc */ -#ifndef GL_EXT_texture_compression_s3tc -#define GL_EXT_texture_compression_s3tc 1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83f0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83f1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83f2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83f3 -#endif - -/* GL_EXT_texture_env_combine */ -#ifndef GL_EXT_texture_env_combine -#define GL_EXT_texture_env_combine 1 -#define GL_COMBINE_EXT 0x8570 -#define GL_COMBINE_RGB_EXT 0x8571 -#define GL_COMBINE_ALPHA_EXT 0x8572 -#define GL_RGB_SCALE_EXT 0x8573 -#define GL_ADD_SIGNED_EXT 0x8574 -#define GL_INTERPOLATE_EXT 0x8575 -#define GL_SUBTRACT_EXT 0x84e7 -#define GL_CONSTANT_EXT 0x8576 -#define GL_PRIMARY_COLOR_EXT 0x8577 -#define GL_PREVIOUS_EXT 0x8578 -#define GL_SOURCE0_RGB_EXT 0x8580 -#define GL_SOURCE1_RGB_EXT 0x8581 -#define GL_SOURCE2_RGB_EXT 0x8582 -#define GL_SOURCE3_RGB_EXT 0x8583 -#define GL_SOURCE4_RGB_EXT 0x8584 -#define GL_SOURCE5_RGB_EXT 0x8585 -#define GL_SOURCE6_RGB_EXT 0x8586 -#define GL_SOURCE7_RGB_EXT 0x8587 -#define GL_SOURCE0_ALPHA_EXT 0x8588 -#define GL_SOURCE1_ALPHA_EXT 0x8589 -#define GL_SOURCE2_ALPHA_EXT 0x858a -#define GL_SOURCE3_ALPHA_EXT 0x858b -#define GL_SOURCE4_ALPHA_EXT 0x858c -#define GL_SOURCE5_ALPHA_EXT 0x858d -#define GL_SOURCE6_ALPHA_EXT 0x858e -#define GL_SOURCE7_ALPHA_EXT 0x858f -#define GL_OPERAND0_RGB_EXT 0x8590 -#define GL_OPERAND1_RGB_EXT 0x8591 -#define GL_OPERAND2_RGB_EXT 0x8592 -#define GL_OPERAND3_RGB_EXT 0x8593 -#define GL_OPERAND4_RGB_EXT 0x8594 -#define GL_OPERAND5_RGB_EXT 0x8595 -#define GL_OPERAND6_RGB_EXT 0x8596 -#define GL_OPERAND7_RGB_EXT 0x8597 -#define GL_OPERAND0_ALPHA_EXT 0x8598 -#define GL_OPERAND1_ALPHA_EXT 0x8599 -#define GL_OPERAND2_ALPHA_EXT 0x859a -#define GL_OPERAND3_ALPHA_EXT 0x859b -#define GL_OPERAND4_ALPHA_EXT 0x859c -#define GL_OPERAND5_ALPHA_EXT 0x859d -#define GL_OPERAND6_ALPHA_EXT 0x859e -#define GL_OPERAND7_ALPHA_EXT 0x859f -#endif - -/* GL_EXT_texture_env_dot3 */ -#ifndef GL_EXT_texture_env_dot3 -#define GL_EXT_texture_env_dot3 1 -#define GL_DOT3_RGB_EXT 0x8740 -#define GL_DOT3_RGBA_EXT 0x8741 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84fe -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84ff -#endif - -/* GL_EXT_texture_lod_bias */ -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84fd -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif - -/* GL_EXT_texture_sRGB */ -#ifndef GL_EXT_texture_sRGB -#define GL_EXT_texture_sRGB 1 -#define GL_SRGB_EXT 0x8c40 -#define GL_SRGB8_EXT 0x8c41 -#define GL_SRGB_ALPHA_EXT 0x8c42 -#define GL_SRGB8_ALPHA8_EXT 0x8c43 -#define GL_SLUMINANCE_ALPHA_EXT 0x8c44 -#define GL_SLUMINANCE8_ALPHA8_EXT 0x8c45 -#define GL_SLUMINANCE_EXT 0x8c46 -#define GL_SLUMINANCE8_EXT 0x8c47 -#define GL_COMPRESSED_SRGB_EXT 0x8c48 -#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8c49 -#define GL_COMPRESSED_SLUMINANCE_EXT 0x8c4a -#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8c4b -#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8c4c -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8c4d -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8c4e -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8c4f -#endif - -/* GL_EXT_texture_sRGB_decode */ -#ifndef GL_EXT_texture_sRGB_decode -#define GL_EXT_texture_sRGB_decode 1 -#define GL_TEXTURE_SRGB_DECODE_EXT 0x8a48 -#define GL_DECODE_EXT 0x8a49 -#define GL_SKIP_DECODE_EXT 0x8a4a -#endif - -/* GL_NV_depth_clamp */ -#ifndef GL_NV_depth_clamp -#define GL_NV_depth_clamp 1 -#define GL_DEPTH_CLAMP_NV 0x864f -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#define GL_ALL_COMPLETED_NV 0x84f2 -#define GL_FENCE_STATUS_NV 0x84f3 -#define GL_FENCE_CONDITION_NV 0x84f4 -#endif - -/* GL_NV_fog_distance */ -#ifndef GL_NV_fog_distance -#define GL_NV_fog_distance 1 -#define GL_FOG_DISTANCE_MODE_NV 0x855a -#define GL_EYE_RADIAL_NV 0x855b -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855c -/* reuse GL_EYE_PLANE */ -#endif - -/* GL_NV_half_float */ -#ifndef GL_NV_half_float -#define GL_NV_half_float 1 -typedef unsigned short GLhalfNV; -#define GL_HALF_FLOAT_NV 0x140b -#endif - -/* GL_NV_light_max_exponent */ -#ifndef GL_NV_light_max_exponent -#define GL_NV_light_max_exponent 1 -#define GL_MAX_SHININESS_NV 0x8504 -#define GL_MAX_SPOT_EXPONENT_NV 0x8505 -#endif - -/* GL_NV_point_sprite */ -#ifndef GL_NV_point_sprite -#define GL_NV_point_sprite 1 -#define GL_NV_POINT_SPRITE_NV 0x8861 -#define GL_NV_COORD_REPLACE_NV 0x8862 -#define GL_NV_POINT_SPRITE_R_MODE_NV 0x8863 -#endif - -/* GL_NV_register_combiners */ -#ifndef GL_NV_register_combiners -#define GL_NV_register_combiners 1 -#define GL_REGISTER_COMBINERS_NV 0x8522 -#define GL_VARIABLE_A_NV 0x8523 -#define GL_VARIABLE_B_NV 0x8524 -#define GL_VARIABLE_C_NV 0x8525 -#define GL_VARIABLE_D_NV 0x8526 -#define GL_VARIABLE_E_NV 0x8527 -#define GL_VARIABLE_F_NV 0x8528 -#define GL_VARIABLE_G_NV 0x8529 -#define GL_CONSTANT_COLOR0_NV 0x852a -#define GL_CONSTANT_COLOR1_NV 0x852b -#define GL_PRIMARY_COLOR_NV 0x852c -#define GL_SECONDARY_COLOR_NV 0x852d -#define GL_SPARE0_NV 0x852e -#define GL_SPARE1_NV 0x852f -#define GL_DISCARD_NV 0x8530 -#define GL_E_TIMES_F_NV 0x8531 -#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 -#define GL_UNSIGNED_IDENTITY_NV 0x8536 -#define GL_UNSIGNED_INVERT_NV 0x8537 -#define GL_EXPAND_NORMAL_NV 0x8538 -#define GL_EXPAND_NEGATE_NV 0x8539 -#define GL_HALF_BIAS_NORMAL_NV 0x853a -#define GL_HALF_BIAS_NEGATE_NV 0x853b -#define GL_SIGNED_IDENTITY_NV 0x853c -#define GL_SIGNED_NEGATE_NV 0x853d -#define GL_SCALE_BY_TWO_NV 0x853e -#define GL_SCALE_BY_FOUR_NV 0x853f -#define GL_SCALE_BY_ONE_HALF_NV 0x8540 -#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 -#define GL_COMBINER_INPUT_NV 0x8542 -#define GL_COMBINER_MAPPING_NV 0x8543 -#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 -#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 -#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 -#define GL_COMBINER_MUX_SUM_NV 0x8547 -#define GL_COMBINER_SCALE_NV 0x8548 -#define GL_COMBINER_BIAS_NV 0x8549 -#define GL_COMBINER_AB_OUTPUT_NV 0x854a -#define GL_COMBINER_CD_OUTPUT_NV 0x854b -#define GL_COMBINER_SUM_OUTPUT_NV 0x854c -#define GL_MAX_GENERAL_COMBINERS_NV 0x854d -#define GL_NUM_GENERAL_COMBINERS_NV 0x854e -#define GL_COLOR_SUM_CLAMP_NV 0x854f -#define GL_COMBINER0_NV 0x8550 -#define GL_COMBINER1_NV 0x8551 -#define GL_COMBINER2_NV 0x8552 -#define GL_COMBINER3_NV 0x8553 -#define GL_COMBINER4_NV 0x8554 -#define GL_COMBINER5_NV 0x8555 -#define GL_COMBINER6_NV 0x8556 -#define GL_COMBINER7_NV 0x8557 -/* reuse GL_TEXTURE0_ARB */ -/* reuse GL_TEXTURE1_ARB */ -/* reuse GL_ZERO */ -/* reuse GL_NONE */ -/* reuse GL_FOG */ -#endif - -/* GL_NV_register_combiners2 */ -#ifndef GL_NV_register_combiners2 -#define GL_NV_register_combiners2 1 -#define GL_PER_STAGE_CONSTANTS_NV 0x8535 -#endif - -/* GL_NV_texgen_reflection */ -#ifndef GL_NV_texgen_reflection -#define GL_NV_texgen_reflection 1 -#define GL_NORMAL_MAP_NV 0x8511 -#define GL_REFLECTION_MAP_NV 0x8512 -#endif - -/* GL_NV_texture_env_combine4 */ -#ifndef GL_NV_texture_env_combine4 -#define GL_NV_texture_env_combine4 1 -#define GL_COMBINE4_NV 0x8503 -#define GL_SOURCE3_RGB_NV 0x8583 -#define GL_SOURCE3_ALPHA_NV 0x858b -#define GL_OPERAND3_RGB_NV 0x8593 -#define GL_OPERAND3_ALPHA_NV 0x859b -#endif - -/* GL_NV_texture_shader */ -#ifndef GL_NV_texture_shader -#define GL_NV_texture_shader 1 -#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864c -#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864d -#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864e -#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86d9 -#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86da -#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86db -#define GL_DSDT_MAG_INTENSITY_NV 0x86dc -#define GL_SHADER_CONSISTENT_NV 0x86dd -#define GL_TEXTURE_SHADER_NV 0x86de -#define GL_SHADER_OPERATION_NV 0x86df -#define GL_CULL_MODES_NV 0x86e0 -#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86e1 -#define GL_OFFSET_TEXTURE_SCALE_NV 0x86e2 -#define GL_OFFSET_TEXTURE_BIAS_NV 0x86e3 -#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV -#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV -#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV -#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86e4 -#define GL_CONST_EYE_NV 0x86e5 -#define GL_PASS_THROUGH_NV 0x86e6 -#define GL_CULL_FRAGMENT_NV 0x86e7 -#define GL_OFFSET_TEXTURE_2D_NV 0x86e8 -#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86e9 -#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86ea -#define GL_DOT_PRODUCT_NV 0x86ec -#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ed -#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86ee -#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86f0 -#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86f1 -#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86f2 -#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86f3 -#define GL_HILO_NV 0x86f4 -#define GL_DSDT_NV 0x86f5 -#define GL_DSDT_MAG_NV 0x86f6 -#define GL_DSDT_MAG_VIB_NV 0x86f7 -#define GL_HILO16_NV 0x86f8 -#define GL_SIGNED_HILO_NV 0x86f9 -#define GL_SIGNED_HILO16_NV 0x86fa -#define GL_SIGNED_RGBA_NV 0x86fb -#define GL_SIGNED_RGBA8_NV 0x86fc -#define GL_SIGNED_RGB_NV 0x86fe -#define GL_SIGNED_RGB8_NV 0x86ff -#define GL_SIGNED_LUMINANCE_NV 0x8701 -#define GL_SIGNED_LUMINANCE8_NV 0x8702 -#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 -#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 -#define GL_SIGNED_ALPHA_NV 0x8705 -#define GL_SIGNED_ALPHA8_NV 0x8706 -#define GL_SIGNED_INTENSITY_NV 0x8707 -#define GL_SIGNED_INTENSITY8_NV 0x8708 -#define GL_DSDT8_NV 0x8709 -#define GL_DSDT8_MAG8_NV 0x870a -#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870b -#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870c -#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870d -#define GL_HI_SCALE_NV 0x870e -#define GL_LO_SCALE_NV 0x870f -#define GL_DS_SCALE_NV 0x8710 -#define GL_DT_SCALE_NV 0x8711 -#define GL_MAGNITUDE_SCALE_NV 0x8712 -#define GL_VIBRANCE_SCALE_NV 0x8713 -#define GL_HI_BIAS_NV 0x8714 -#define GL_LO_BIAS_NV 0x8715 -#define GL_DS_BIAS_NV 0x8716 -#define GL_DT_BIAS_NV 0x8717 -#define GL_MAGNITUDE_BIAS_NV 0x8718 -#define GL_VIBRANCE_BIAS_NV 0x8719 -#define GL_TEXTURE_BORDER_VALUES_NV 0x871a -#define GL_TEXTURE_HI_SIZE_NV 0x871b -#define GL_TEXTURE_LO_SIZE_NV 0x871c -#define GL_TEXTURE_DS_SIZE_NV 0x871d -#define GL_TEXTURE_DT_SIZE_NV 0x871e -#define GL_TEXTURE_MAG_SIZE_NV 0x871f -#endif - -/* GL_NV_texture_shader2 */ -#ifndef GL_NV_texture_shader2 -#define GL_NV_texture_shader2 1 -#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86ef -#endif - -/* GL_NV_vertex_program2_option */ -#ifndef GL_NV_vertex_program2_option -#define GL_NV_vertex_program2_option 1 -#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88f4 -#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88f5 -#endif - -/* GL_SGIS_generate_mipmap */ -#ifndef GL_SGIS_generate_mipmap -#define GL_SGIS_generate_mipmap 1 -#define GL_GENERATE_MIPMAP_SGIS 0x8191 -#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 -#endif - #include "wine/wglext.h" #define GL_EXT_FUNCS_GEN \ @@ -2454,6 +186,9 @@ typedef unsigned short GLhalfNV; USE_GL_FUNC(glDrawElementsInstancedBaseVertex) \ USE_GL_FUNC(glDrawRangeElementsBaseVertex) \ USE_GL_FUNC(glMultiDrawElementsBaseVertex) \ + /* GL_ARB_draw_instanced */ \ + USE_GL_FUNC(glDrawArraysInstancedARB) \ + USE_GL_FUNC(glDrawElementsInstancedARB) \ /* GL_ARB_framebuffer_object */ \ USE_GL_FUNC(glBindFramebuffer) \ USE_GL_FUNC(glBindRenderbuffer) \ @@ -2480,6 +215,8 @@ typedef unsigned short GLhalfNV; USE_GL_FUNC(glFramebufferTextureFaceARB) \ USE_GL_FUNC(glFramebufferTextureLayerARB) \ USE_GL_FUNC(glProgramParameteriARB) \ + /* GL_ARB_instanced_arrays */ \ + USE_GL_FUNC(glVertexAttribDivisorARB) \ /* GL_ARB_map_buffer_range */ \ USE_GL_FUNC(glFlushMappedBufferRange) \ USE_GL_FUNC(glMapBufferRange) \ diff --git a/reactos/dll/directx/wine/wined3d/wined3d_main.c b/reactos/dll/directx/wine/wined3d/wined3d_main.c index 01a4071c6e6..f49e5bcdd00 100644 --- a/reactos/dll/directx/wine/wined3d/wined3d_main.c +++ b/reactos/dll/directx/wine/wined3d/wined3d_main.c @@ -22,10 +22,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include "config.h" +#include "wine/port.h" -//#include "initguid.h" +#include "initguid.h" #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); @@ -72,8 +72,6 @@ static CRITICAL_SECTION wined3d_wndproc_cs = {&wined3d_wndproc_cs_debug, -1, 0, * where appropriate. */ struct wined3d_settings wined3d_settings = { - VS_HW, /* Hardware by default */ - PS_HW, /* Hardware by default */ TRUE, /* Use of GLSL enabled by default */ ORM_FBO, /* Use FBOs to do offscreen rendering */ RTL_READTEX, /* Default render target locking method */ @@ -84,6 +82,9 @@ struct wined3d_settings wined3d_settings = TRUE, /* Multisampling enabled by default. */ FALSE, /* No strict draw ordering. */ TRUE, /* Don't try to render onscreen by default. */ + ~0U, /* No VS shader model limit by default. */ + ~0U, /* No GS shader model limit by default. */ + ~0U, /* No PS shader model limit by default. */ }; /* Do not call while under the GL lock. */ @@ -196,27 +197,6 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) if (hkey || appkey) { - if ( !get_config_key( hkey, appkey, "VertexShaderMode", buffer, size) ) - { - if (!strcmp(buffer,"none")) - { - TRACE("Disable vertex shaders\n"); - wined3d_settings.vs_mode = VS_NONE; - } - } - if ( !get_config_key( hkey, appkey, "PixelShaderMode", buffer, size) ) - { - if (!strcmp(buffer,"enabled")) - { - TRACE("Allow pixel shaders\n"); - wined3d_settings.ps_mode = PS_HW; - } - if (!strcmp(buffer,"disabled")) - { - TRACE("Disable pixel shaders\n"); - wined3d_settings.ps_mode = PS_NONE; - } - } if ( !get_config_key( hkey, appkey, "UseGLSL", buffer, size) ) { if (!strcmp(buffer,"disabled")) @@ -323,13 +303,13 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) TRACE("Not always rendering backbuffers offscreen.\n"); wined3d_settings.always_offscreen = FALSE; } + if (!get_config_key_dword(hkey, appkey, "MaxShaderModelVS", &wined3d_settings.max_sm_vs)) + TRACE("Limiting VS shader model to %u.\n", wined3d_settings.max_sm_vs); + if (!get_config_key_dword(hkey, appkey, "MaxShaderModelGS", &wined3d_settings.max_sm_gs)) + TRACE("Limiting GS shader model to %u.\n", wined3d_settings.max_sm_gs); + if (!get_config_key_dword(hkey, appkey, "MaxShaderModelPS", &wined3d_settings.max_sm_ps)) + TRACE("Limiting PS shader model to %u.\n", wined3d_settings.max_sm_ps); } - if (wined3d_settings.vs_mode == VS_HW) - TRACE("Allow HW vertex shaders\n"); - if (wined3d_settings.ps_mode == PS_NONE) - TRACE("Disable pixel shaders\n"); - if (wined3d_settings.glslRequested) - TRACE("If supported by your system, GL Shading Language will be used\n"); if (appkey) RegCloseKey( appkey ); if (hkey) RegCloseKey( hkey ); diff --git a/reactos/dll/directx/wine/wined3d/wined3d_private.h b/reactos/dll/directx/wine/wined3d/wined3d_private.h index 4963e960374..45f6b295f46 100644 --- a/reactos/dll/directx/wine/wined3d/wined3d_private.h +++ b/reactos/dll/directx/wine/wined3d/wined3d_private.h @@ -24,10 +24,6 @@ #ifndef __WINE_WINED3D_PRIVATE_H #define __WINE_WINED3D_PRIVATE_H -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #ifdef USE_WIN32_OPENGL #define WINE_GLAPI __stdcall #else @@ -35,25 +31,25 @@ #endif #include -//#include -//#include +#include +#include #define NONAMELESSUNION #define NONAMELESSSTRUCT #define COBJMACROS -#include -//#include "winbase.h" -#include -#include -#include -#include -#include +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/debug.h" +#include "wine/unicode.h" -#include -#include +#include "objbase.h" +#include "wine/wined3d.h" #include "wined3d_gl.h" -#include -#include -#include +#include "wine/list.h" +#include "wine/rbtree.h" +#include "wine/wgl_driver.h" /* Driver quirks */ #define WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT 0x00000001 @@ -158,6 +154,7 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN; /* Device caps */ #define MAX_PALETTES 65536 +#define MAX_STREAM_OUT 4 #define MAX_STREAMS 16 #define MAX_TEXTURES 8 #define MAX_FRAGMENT_SAMPLERS 16 @@ -165,6 +162,8 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN; #define MAX_COMBINED_SAMPLERS (MAX_FRAGMENT_SAMPLERS + MAX_VERTEX_SAMPLERS) #define MAX_ACTIVE_LIGHTS 8 #define MAX_CLIPPLANES WINED3DMAXUSERCLIPPLANES +#define MAX_CONSTANT_BUFFERS 15 +#define MAX_SAMPLER_OBJECTS 16 struct min_lookup { @@ -238,26 +237,9 @@ static inline float float_24_to_32(DWORD in) } } -/** - * Settings - */ -#define VS_NONE 0 -#define VS_HW 1 - -#define PS_NONE 0 -#define PS_HW 1 - -#define VBO_NONE 0 -#define VBO_HW 1 - #define ORM_BACKBUFFER 0 #define ORM_FBO 1 -#define SHADER_ARB 1 -#define SHADER_GLSL 2 -#define SHADER_ATI 3 -#define SHADER_NONE 4 - #define RTL_READDRAW 1 #define RTL_READTEX 2 @@ -268,9 +250,6 @@ static inline float float_24_to_32(DWORD in) * values in wined3d_main.c as well. */ struct wined3d_settings { - /* vertex and pixel shader modes */ - int vs_mode; - int ps_mode; /* Ideally, we don't want the user to have to request GLSL. If the * hardware supports GLSL, we should use it. However, until it's fully * implemented, we'll leave it as a registry setting for developers. */ @@ -285,6 +264,9 @@ struct wined3d_settings int allow_multisampling; BOOL strict_draw_ordering; BOOL always_offscreen; + unsigned int max_sm_vs; + unsigned int max_sm_gs; + unsigned int max_sm_ps; }; extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; @@ -324,10 +306,20 @@ enum wined3d_shader_register_type WINED3DSPR_PREDICATE = 19, WINED3DSPR_IMMCONST, WINED3DSPR_CONSTBUFFER, + WINED3DSPR_PRIMID, WINED3DSPR_NULL, WINED3DSPR_RESOURCE, }; +enum wined3d_data_type +{ + WINED3D_DATA_FLOAT, + WINED3D_DATA_INT, + WINED3D_DATA_RESOURCE, + WINED3D_DATA_SAMPLER, + WINED3D_DATA_UINT, +}; + enum wined3d_immconst_type { WINED3D_IMMCONST_SCALAR, @@ -369,8 +361,9 @@ enum wined3d_shader_dst_modifier }; /* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */ -#define WINED3DSI_TEXLD_PROJECT 1 -#define WINED3DSI_TEXLD_BIAS 2 +#define WINED3DSI_TEXLD_PROJECT 0x1 +#define WINED3DSI_TEXLD_BIAS 0x2 +#define WINED3DSI_INDEXED_DYNAMIC 0x4 enum wined3d_shader_rel_op { @@ -399,10 +392,11 @@ enum wined3d_shader_rel_op #define MAX_REG_ADDR 1 #define MAX_REG_TEMP 32 #define MAX_REG_TEXCRD 8 -#define MAX_REG_INPUT 12 -#define MAX_REG_OUTPUT 12 +#define MAX_REG_INPUT 32 +#define MAX_REG_OUTPUT 32 #define MAX_CONST_I 16 #define MAX_CONST_B 16 +#define WINED3D_MAX_CBS 15 /* FIXME: This needs to go up to 2048 for * Shader model 3 according to msdn (and for software shaders) */ @@ -434,6 +428,10 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_CRS, WINED3DSIH_CUT, WINED3DSIH_DCL, + WINED3DSIH_DCL_CONSTANT_BUFFER, + WINED3DSIH_DCL_INPUT_PRIMITIVE, + WINED3DSIH_DCL_OUTPUT_TOPOLOGY, + WINED3DSIH_DCL_VERTICES_OUT, WINED3DSIH_DEF, WINED3DSIH_DEFB, WINED3DSIH_DEFI, @@ -555,12 +553,13 @@ struct wined3d_shader_reg_maps DWORD temporary; /* MAX_REG_TEMP, 32 */ DWORD *constf; /* pixel, vertex */ DWORD texcoord_mask[MAX_REG_TEXCRD]; /* vertex < 3.0 */ - WORD input_registers; /* max(MAX_REG_INPUT, MAX_ATTRIBS), 16 */ - WORD output_registers; /* MAX_REG_OUTPUT, 12 */ + DWORD input_registers; /* max(MAX_REG_INPUT, MAX_ATTRIBS), 32 */ + DWORD output_registers; /* MAX_REG_OUTPUT, 32 */ WORD integer_constants; /* MAX_CONST_I, 16 */ WORD boolean_constants; /* MAX_CONST_B, 16 */ WORD local_int_consts; /* MAX_CONST_I, 16 */ WORD local_bool_consts; /* MAX_CONST_B, 16 */ + UINT cb_sizes[WINED3D_MAX_CBS]; enum wined3d_sampler_texture_type sampler_type[max(MAX_FRAGMENT_SAMPLERS, MAX_VERTEX_SAMPLERS)]; BYTE bumpmat; /* MAX_TEXTURES, 8 */ @@ -613,12 +612,17 @@ struct wined3d_shader_context void *backend_data; }; +struct wined3d_shader_register_index +{ + const struct wined3d_shader_src_param *rel_addr; + unsigned int offset; +}; + struct wined3d_shader_register { enum wined3d_shader_register_type type; - UINT idx; - UINT array_idx; - const struct wined3d_shader_src_param *rel_addr; + enum wined3d_data_type data_type; + struct wined3d_shader_register_index idx[2]; enum wined3d_immconst_type immconst_type; DWORD immconst_data[4]; }; @@ -638,19 +642,6 @@ struct wined3d_shader_src_param enum wined3d_shader_src_modifier modifiers; }; -struct wined3d_shader_instruction -{ - const struct wined3d_shader_context *ctx; - enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; - DWORD flags; - BOOL coissue; - DWORD predicate; - UINT dst_count; - const struct wined3d_shader_dst_param *dst; - UINT src_count; - const struct wined3d_shader_src_param *src; -}; - struct wined3d_shader_semantic { enum wined3d_decl_usage usage; @@ -659,6 +650,26 @@ struct wined3d_shader_semantic struct wined3d_shader_dst_param reg; }; +struct wined3d_shader_instruction +{ + const struct wined3d_shader_context *ctx; + enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx; + DWORD flags; + BOOL coissue; + const struct wined3d_shader_src_param *predicate; + UINT dst_count; + const struct wined3d_shader_dst_param *dst; + UINT src_count; + const struct wined3d_shader_src_param *src; + union + { + struct wined3d_shader_semantic semantic; + enum wined3d_primitive_type primitive_type; + struct wined3d_shader_src_param src; + UINT count; + } declaration; +}; + struct wined3d_shader_attribute { enum wined3d_decl_usage usage; @@ -677,13 +688,7 @@ struct wined3d_shader_frontend void *(*shader_init)(const DWORD *ptr, const struct wined3d_shader_signature *output_signature); void (*shader_free)(void *data); void (*shader_read_header)(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version); - void (*shader_read_opcode)(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins, UINT *param_size); - void (*shader_read_src_param)(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param, - struct wined3d_shader_src_param *src_rel_addr); - void (*shader_read_dst_param)(void *data, const DWORD **ptr, struct wined3d_shader_dst_param *dst_param, - struct wined3d_shader_src_param *dst_rel_addr); - void (*shader_read_semantic)(const DWORD **ptr, struct wined3d_shader_semantic *semantic); - void (*shader_read_comment)(const DWORD **ptr, const char **comment, UINT *comment_size); + void (*shader_read_instruction)(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins); BOOL (*shader_is_end)(void *data, const DWORD **ptr); }; @@ -692,15 +697,20 @@ extern const struct wined3d_shader_frontend sm4_shader_frontend DECLSPEC_HIDDEN; typedef void (*SHADER_HANDLER)(const struct wined3d_shader_instruction *); -struct shader_caps { - DWORD VertexShaderVersion; - DWORD MaxVertexShaderConst; +#define WINED3D_SHADER_CAP_VS_CLIPPING 0x00000001 +#define WINED3D_SHADER_CAP_SRGB_WRITE 0x00000002 - DWORD PixelShaderVersion; - float PixelShader1xMaxValue; - DWORD MaxPixelShaderConst; +struct shader_caps +{ + UINT vs_version; + UINT gs_version; + UINT ps_version; - BOOL VSClipping; + DWORD vs_uniform_count; + DWORD ps_uniform_count; + float ps_1x_max_value; + + DWORD wined3d_caps; }; enum tex_types @@ -761,42 +771,43 @@ struct vs_compile_args { WORD swizzle_map; /* MAX_ATTRIBS, 16 */ }; +enum wined3d_shader_mode +{ + WINED3D_SHADER_MODE_NONE, + WINED3D_SHADER_MODE_FFP, + WINED3D_SHADER_MODE_SHADER, +}; + struct wined3d_context; struct wined3d_state; +struct fragment_pipeline; struct wined3d_shader_backend_ops { void (*shader_handle_instruction)(const struct wined3d_shader_instruction *); - void (*shader_select)(const struct wined3d_context *context, BOOL usePS, BOOL useVS); + void (*shader_select)(const struct wined3d_context *context, enum wined3d_shader_mode vertex_mode, + enum wined3d_shader_mode fragment_mode); void (*shader_select_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info, enum tex_types tex_type, const SIZE *ds_mask_size); void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info); void (*shader_update_float_vertex_constants)(struct wined3d_device *device, UINT start, UINT count); void (*shader_update_float_pixel_constants)(struct wined3d_device *device, UINT start, UINT count); - void (*shader_load_constants)(const struct wined3d_context *context, char usePS, char useVS); + void (*shader_load_constants)(const struct wined3d_context *context, BOOL usePS, BOOL useVS); void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info, const struct wined3d_state *state); void (*shader_destroy)(struct wined3d_shader *shader); - HRESULT (*shader_alloc_private)(struct wined3d_device *device); + HRESULT (*shader_alloc_private)(struct wined3d_device *device, const struct fragment_pipeline *fragment_pipe); void (*shader_free_private)(struct wined3d_device *device); void (*shader_context_destroyed)(void *shader_priv, const struct wined3d_context *context); void (*shader_get_caps)(const struct wined3d_gl_info *gl_info, struct shader_caps *caps); BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup); + BOOL (*shader_has_ffp_proj_control)(void *shader_priv); }; extern const struct wined3d_shader_backend_ops glsl_shader_backend DECLSPEC_HIDDEN; extern const struct wined3d_shader_backend_ops arb_program_shader_backend DECLSPEC_HIDDEN; extern const struct wined3d_shader_backend_ops none_shader_backend DECLSPEC_HIDDEN; -#define ENTER_GL() do {} while(0) -#define LEAVE_GL() do {} while(0) - -/***************************************************************************** - * Defines - */ - -/* GL related defines */ -/* ------------------ */ #define GL_EXTCALL(f) (gl_info->gl_ops.ext.p_##f) #define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xff) @@ -912,13 +923,8 @@ struct wined3d_stream_info WORD use_map; /* MAX_ATTRIBS, 16 */ }; -/***************************************************************************** - * Prototypes - */ - -/* Routine common to the draw primitive and draw indexed primitive routines */ -void drawPrimitive(struct wined3d_device *device, UINT index_count, - UINT start_idx, BOOL indexed, const void *idxData) DECLSPEC_HIDDEN; +void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count, + UINT start_instance, UINT instance_count, BOOL indexed, const void *idx_data) DECLSPEC_HIDDEN; DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN; typedef void (WINE_GLAPI *glAttribFunc)(const void *data); @@ -964,7 +970,10 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC #define STATE_VSHADER (STATE_VDECL + 1) #define STATE_IS_VSHADER(a) ((a) == STATE_VSHADER) -#define STATE_VIEWPORT (STATE_VSHADER + 1) +#define STATE_GEOMETRY_SHADER (STATE_VSHADER + 1) +#define STATE_IS_GEOMETRY_SHADER(a) ((a) == STATE_GEOMETRY_SHADER) + +#define STATE_VIEWPORT (STATE_GEOMETRY_SHADER + 1) #define STATE_IS_VIEWPORT(a) ((a) == STATE_VIEWPORT) #define STATE_VERTEXSHADERCONSTANT (STATE_VIEWPORT + 1) @@ -1060,21 +1069,23 @@ struct wined3d_context DWORD tid; /* Thread ID which owns this context at the moment */ /* Stores some information about the context state for optimization */ - WORD render_offscreen : 1; - WORD last_was_rhw : 1; /* true iff last draw_primitive was in xyzrhw mode */ - WORD last_was_pshader : 1; - WORD last_was_vshader : 1; - WORD namedArraysLoaded : 1; - WORD numberedArraysLoaded : 1; - WORD last_was_blit : 1; - WORD last_was_ckey : 1; - WORD fog_coord : 1; - WORD fog_enabled : 1; - WORD num_untracked_materials : 2; /* Max value 2 */ - WORD current : 1; - WORD destroyed : 1; - WORD valid : 1; - WORD padding : 1; + DWORD render_offscreen : 1; + DWORD last_was_rhw : 1; /* true iff last draw_primitive was in xyzrhw mode */ + DWORD last_was_pshader : 1; + DWORD last_was_vshader : 1; + DWORD namedArraysLoaded : 1; + DWORD numberedArraysLoaded : 1; + DWORD last_was_blit : 1; + DWORD last_was_ckey : 1; + DWORD fog_coord : 1; + DWORD fog_enabled : 1; + DWORD num_untracked_materials : 2; /* Max value 2 */ + DWORD current : 1; + DWORD destroyed : 1; + DWORD valid : 1; + DWORD select_shader : 1; + DWORD load_constants : 1; + DWORD padding : 15; BYTE texShaderBumpMap; /* MAX_TEXTURES, 8 */ BYTE lastWasPow2Texture; /* MAX_TEXTURES, 8 */ DWORD numbered_array_mask; @@ -1147,8 +1158,12 @@ struct StateEntryTemplate enum wined3d_gl_extension extension; }; +#define WINED3D_FRAGMENT_CAP_PROJ_CONTROL 0x00000001 +#define WINED3D_FRAGMENT_CAP_SRGB_WRITE 0x00000002 + struct fragment_caps { + DWORD wined3d_caps; DWORD PrimitiveMiscCaps; DWORD TextureOpCaps; DWORD MaxTextureBlendStages; @@ -1159,20 +1174,21 @@ struct fragment_pipeline { void (*enable_extension)(const struct wined3d_gl_info *gl_info, BOOL enable); void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps); - HRESULT (*alloc_private)(struct wined3d_device *device); + void *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv); void (*free_private)(struct wined3d_device *device); BOOL (*color_fixup_supported)(struct color_fixup_desc fixup); const struct StateEntryTemplate *states; - BOOL ffp_proj_control; }; extern const struct StateEntryTemplate misc_state_template[] DECLSPEC_HIDDEN; extern const struct StateEntryTemplate ffp_vertexstate_template[] DECLSPEC_HIDDEN; +extern const struct fragment_pipeline none_fragment_pipe DECLSPEC_HIDDEN; extern const struct fragment_pipeline ffp_fragment_pipeline DECLSPEC_HIDDEN; extern const struct fragment_pipeline atifs_fragment_pipeline DECLSPEC_HIDDEN; extern const struct fragment_pipeline arbfp_fragment_pipeline DECLSPEC_HIDDEN; extern const struct fragment_pipeline nvts_fragment_pipeline DECLSPEC_HIDDEN; extern const struct fragment_pipeline nvrc_fragment_pipeline DECLSPEC_HIDDEN; +extern const struct fragment_pipeline glsl_fragment_pipe DECLSPEC_HIDDEN; /* "Base" state table */ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs, @@ -1331,6 +1347,8 @@ enum wined3d_pci_device CARD_AMD_RADEON_HD6700 = 0x68ba, CARD_AMD_RADEON_HD6800 = 0x6739, CARD_AMD_RADEON_HD6900 = 0x6719, + CARD_AMD_RADEON_HD7700 = 0x683d, + CARD_AMD_RADEON_HD7800 = 0x6819, CARD_AMD_RADEON_HD7900 = 0x679a, CARD_NVIDIA_RIVA_128 = 0x0018, @@ -1361,6 +1379,7 @@ enum wined3d_pci_device CARD_NVIDIA_GEFORCE_8800GTS = 0x0193, CARD_NVIDIA_GEFORCE_8800GTX = 0x0191, CARD_NVIDIA_GEFORCE_9200 = 0x086d, + CARD_NVIDIA_GEFORCE_9300 = 0x086c, CARD_NVIDIA_GEFORCE_9400M = 0x0863, CARD_NVIDIA_GEFORCE_9400GT = 0x042c, CARD_NVIDIA_GEFORCE_9500GT = 0x0640, @@ -1386,6 +1405,7 @@ enum wined3d_pci_device CARD_NVIDIA_GEFORCE_GTX465 = 0x06c4, CARD_NVIDIA_GEFORCE_GTX470 = 0x06cd, CARD_NVIDIA_GEFORCE_GTX480 = 0x06c0, + CARD_NVIDIA_GEFORCE_GT520 = 0x1040, CARD_NVIDIA_GEFORCE_GT540M = 0x0df4, CARD_NVIDIA_GEFORCE_GTX550 = 0x1244, CARD_NVIDIA_GEFORCE_GT555M = 0x04b8, @@ -1393,7 +1413,14 @@ enum wined3d_pci_device CARD_NVIDIA_GEFORCE_GTX560 = 0x1201, CARD_NVIDIA_GEFORCE_GTX570 = 0x1081, CARD_NVIDIA_GEFORCE_GTX580 = 0x1080, + CARD_NVIDIA_GEFORCE_GT610 = 0x104a, CARD_NVIDIA_GEFORCE_GT630M = 0x0de9, + CARD_NVIDIA_GEFORCE_GT640M = 0x0fd2, + CARD_NVIDIA_GEFORCE_GT650M = 0x0fd1, + CARD_NVIDIA_GEFORCE_GTX650 = 0x0fc6, + CARD_NVIDIA_GEFORCE_GTX650TI = 0x11c6, + CARD_NVIDIA_GEFORCE_GTX660 = 0x11c0, + CARD_NVIDIA_GEFORCE_GTX660TI = 0x1183, CARD_NVIDIA_GEFORCE_GTX670 = 0x1189, CARD_NVIDIA_GEFORCE_GTX680 = 0x1180, @@ -1505,7 +1532,7 @@ struct wined3d_gl_info { DWORD glsl_version; struct wined3d_gl_limits limits; - DWORD reserved_glsl_constants; + DWORD reserved_glsl_constants, reserved_arb_constants; DWORD quirks; BOOL supported[WINED3D_GL_EXT_COUNT]; GLint wrap_lookup[WINED3D_TADDRESS_MIRROR_ONCE - WINED3D_TADDRESS_WRAP + 1]; @@ -1531,8 +1558,6 @@ struct wined3d_driver_info struct wined3d_adapter { UINT ordinal; - BOOL opengl; - POINT monitorPoint; enum wined3d_format_id screen_format; @@ -1550,28 +1575,12 @@ struct wined3d_adapter const struct blit_shader *blitter; }; +BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN; unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount) DECLSPEC_HIDDEN; -BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN; BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; -/***************************************************************************** - * High order patch management - */ -struct wined3d_rect_patch -{ - UINT Handle; - float *mem; - struct wined3d_strided_data strided; - struct wined3d_rect_patch_info rect_patch_info; - float numSegs[4]; - char has_normals, has_texcoords; - struct list entry; -}; - -HRESULT tesselate_rectpatch(struct wined3d_device *device, struct wined3d_rect_patch *patch) DECLSPEC_HIDDEN; - enum projection_types { proj_none = 0, @@ -1669,9 +1678,6 @@ struct wined3d_device /* X and GL Information */ GLenum offscreenBuffer; - /* Selected capabilities */ - int vs_selected_mode; - int ps_selected_mode; const struct wined3d_shader_backend_ops *shader_backend; void *shader_priv; void *fragment_priv; @@ -1679,13 +1685,13 @@ struct wined3d_device struct StateEntry StateTable[STATE_HIGHEST + 1]; /* Array of functions for states which are handled by more than one pipeline part */ APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1]; - const struct fragment_pipeline *frag_pipe; const struct blit_shader *blitter; unsigned int max_ffp_textures; - DWORD vshader_version, pshader_version; + UINT vs_version, gs_version, ps_version; DWORD d3d_vshader_constantF, d3d_pshader_constantF; /* Advertised d3d caps, not GL ones */ DWORD vs_clipping; + UINT instance_count; WORD view_ident : 1; /* true iff view matrix is identity */ WORD vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */ @@ -1696,9 +1702,8 @@ struct wined3d_device WORD inScene : 1; /* A flag to check for proper BeginScene / EndScene call pairs */ WORD softwareVertexProcessing : 1; /* process vertex shaders using software or hardware */ WORD useDrawStridedSlow : 1; - WORD instancedDraw : 1; WORD filter_messages : 1; - WORD padding : 5; + WORD padding : 6; BYTE fixed_function_usage_map; /* MAX_TEXTURES, 8 */ @@ -1753,18 +1758,12 @@ struct wined3d_device /* Stream source management */ struct wined3d_stream_info strided_streams; - const struct wined3d_strided_data *up_strided; struct wined3d_event_query *buffer_queries[MAX_ATTRIBS]; unsigned int num_buffer_queries; /* Context management */ struct wined3d_context **contexts; UINT context_count; - - /* High level patch management */ -#define PATCHMAP_SIZE 43 -#define PATCHMAP_HASHFUNC(x) ((x) % PATCHMAP_SIZE) /* Primitive and simple function */ - struct list patches[PATCHMAP_SIZE]; }; void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb, @@ -1780,8 +1779,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; -void device_stream_info_from_declaration(struct wined3d_device *device, - struct wined3d_stream_info *stream_info) DECLSPEC_HIDDEN; void device_switch_onscreen_ds(struct wined3d_device *device, struct wined3d_context *context, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; void device_update_stream_info(struct wined3d_device *device, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; @@ -2016,7 +2013,6 @@ struct wined3d_surface DWORD flags; - enum wined3d_surface_type surface_type; UINT pow2Width; UINT pow2Height; @@ -2096,7 +2092,7 @@ void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, void surface_set_container(struct wined3d_surface *surface, enum wined3d_container_type type, void *container) DECLSPEC_HIDDEN; void surface_set_texture_name(struct wined3d_surface *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN; -void surface_set_texture_target(struct wined3d_surface *surface, GLenum target) DECLSPEC_HIDDEN; +void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level) DECLSPEC_HIDDEN; void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN; void surface_update_draw_binding(struct wined3d_surface *surface) DECLSPEC_HIDDEN; HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point, @@ -2172,6 +2168,12 @@ enum wined3d_conversion_type void d3dfmt_p8_init_palette(const struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN; +struct wined3d_sampler +{ + LONG refcount; + void *parent; +}; + struct wined3d_vertex_declaration_element { const struct wined3d_format *format; @@ -2232,6 +2234,12 @@ struct StageState { DWORD state; }; +struct wined3d_stream_output +{ + struct wined3d_buffer *buffer; + UINT offset; +}; + struct wined3d_stream_state { struct wined3d_buffer *buffer; @@ -2246,8 +2254,8 @@ struct wined3d_state const struct wined3d_fb_state *fb; struct wined3d_vertex_declaration *vertex_declaration; + struct wined3d_stream_output stream_output[MAX_STREAM_OUT]; struct wined3d_stream_state streams[MAX_STREAMS + 1 /* tesselated pseudo-stream */]; - BOOL user_stream; struct wined3d_buffer *index_buffer; enum wined3d_format_id index_format; INT base_vertex_index; @@ -2255,11 +2263,19 @@ struct wined3d_state GLenum gl_primitive_type; struct wined3d_shader *vertex_shader; + struct wined3d_buffer *vs_cb[MAX_CONSTANT_BUFFERS]; + struct wined3d_sampler *vs_sampler[MAX_SAMPLER_OBJECTS]; BOOL vs_consts_b[MAX_CONST_B]; INT vs_consts_i[MAX_CONST_I * 4]; float *vs_consts_f; + struct wined3d_shader *geometry_shader; + struct wined3d_buffer *gs_cb[MAX_CONSTANT_BUFFERS]; + struct wined3d_sampler *gs_sampler[MAX_SAMPLER_OBJECTS]; + struct wined3d_shader *pixel_shader; + struct wined3d_buffer *ps_cb[MAX_CONSTANT_BUFFERS]; + struct wined3d_sampler *ps_sampler[MAX_SAMPLER_OBJECTS]; BOOL ps_consts_b[MAX_CONST_B]; INT ps_consts_i[MAX_CONST_I * 4]; float *ps_consts_f; @@ -2479,8 +2495,6 @@ const char *debug_d3dtstype(enum wined3d_transform_state tstype) DECLSPEC_HIDDEN const char *debug_d3dpool(enum wined3d_pool pool) DECLSPEC_HIDDEN; const char *debug_fbostatus(GLenum status) DECLSPEC_HIDDEN; const char *debug_glerror(GLenum error) DECLSPEC_HIDDEN; -const char *debug_d3dbasis(enum wined3d_basis_type basis) DECLSPEC_HIDDEN; -const char *debug_d3ddegree(enum wined3d_degree_type order) DECLSPEC_HIDDEN; const char *debug_d3dtop(enum wined3d_texture_op d3dtop) DECLSPEC_HIDDEN; void dump_color_fixup_desc(struct color_fixup_desc fixup) DECLSPEC_HIDDEN; const char *debug_surflocation(DWORD flag) DECLSPEC_HIDDEN; @@ -2509,11 +2523,14 @@ void state_fogstartend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN; void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN; +void state_srgbwrite(struct wined3d_context *context, + const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN; BOOL getColorBits(const struct wined3d_format *format, BYTE *redSize, BYTE *greenSize, BYTE *blueSize, BYTE *alphaSize, BYTE *totalSize) DECLSPEC_HIDDEN; BOOL getDepthStencilBits(const struct wined3d_format *format, BYTE *depthSize, BYTE *stencilSize) DECLSPEC_HIDDEN; +GLenum gl_primitive_type_from_d3d(enum wined3d_primitive_type primitive_type) DECLSPEC_HIDDEN; /* Math utils */ void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *src1, @@ -2521,8 +2538,6 @@ void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *s UINT wined3d_log2i(UINT32 x) DECLSPEC_HIDDEN; unsigned int count_bits(unsigned int mask) DECLSPEC_HIDDEN; -void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, int *vs_selected) DECLSPEC_HIDDEN; - struct wined3d_shader_lconst { struct list entry; @@ -2532,17 +2547,12 @@ struct wined3d_shader_lconst struct wined3d_shader_limits { - unsigned int temporary; - unsigned int texcoord; unsigned int sampler; unsigned int constant_int; unsigned int constant_float; unsigned int constant_bool; - unsigned int address; unsigned int packed_output; unsigned int packed_input; - unsigned int attributes; - unsigned int label; }; #ifdef __GNUC__ @@ -2564,6 +2574,13 @@ struct wined3d_vertex_shader struct wined3d_shader_attribute attributes[MAX_ATTRIBS]; }; +struct wined3d_geometry_shader +{ + enum wined3d_primitive_type input_type; + enum wined3d_primitive_type output_type; + UINT vertices_out; +}; + struct wined3d_pixel_shader { /* Pixel shader input semantics */ @@ -2609,6 +2626,7 @@ struct wined3d_shader union { struct wined3d_vertex_shader vs; + struct wined3d_geometry_shader gs; struct wined3d_pixel_shader ps; } u; }; @@ -2634,23 +2652,14 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_sh const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN; -static inline BOOL shader_is_pshader_version(enum wined3d_shader_type type) -{ - return type == WINED3D_SHADER_TYPE_PIXEL; -} - -static inline BOOL shader_is_vshader_version(enum wined3d_shader_type type) -{ - return type == WINED3D_SHADER_TYPE_VERTEX; -} - static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) { switch (reg->type) { case WINED3DSPR_RASTOUT: /* oFog & oPts */ - if (reg->idx) return TRUE; + if (reg->idx[0].offset) + return TRUE; /* oPos */ return FALSE; @@ -2658,10 +2667,11 @@ static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) case WINED3DSPR_CONSTBOOL: /* b# */ case WINED3DSPR_LOOP: /* aL */ case WINED3DSPR_PREDICATE: /* p0 */ + case WINED3DSPR_PRIMID: /* primID */ return TRUE; case WINED3DSPR_MISCTYPE: - switch(reg->idx) + switch (reg->idx[0].offset) { case 0: /* vPos */ return FALSE; @@ -2776,6 +2786,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN #define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000 #define WINED3DFMT_FLAG_BLOCKS 0x00020000 #define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000 +#define WINED3DFMT_FLAG_TEXTURE 0x00080000 struct wined3d_rational { diff --git a/reactos/include/psdk/ddraw.h b/reactos/include/psdk/ddraw.h index 47ce451fb08..a7cf71eaa48 100644 --- a/reactos/include/psdk/ddraw.h +++ b/reactos/include/psdk/ddraw.h @@ -706,6 +706,7 @@ struct IDirectDrawClipper; typedef struct IDirectDraw *LPDIRECTDRAW; typedef struct IDirectDraw2 *LPDIRECTDRAW2; +typedef struct IDirectDraw3 *LPDIRECTDRAW3; typedef struct IDirectDraw4 *LPDIRECTDRAW4; typedef struct IDirectDraw7 *LPDIRECTDRAW7; typedef struct IDirectDrawSurface *LPDIRECTDRAWSURFACE; @@ -1213,8 +1214,8 @@ typedef struct _DDRGBA #if (defined (WIN32) || defined( _WIN32 ) ) && !defined( _NO_COM ) - typedef BOOL (* LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); - typedef BOOL (* LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); + typedef BOOL (WINAPI *LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); + typedef BOOL (WINAPI *LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); extern HRESULT WINAPI DirectDrawEnumerateW( LPDDENUMCALLBACKW lpCallback, LPVOID lpContext ); extern HRESULT WINAPI DirectDrawEnumerateA( LPDDENUMCALLBACKA lpCallback, LPVOID lpContext ); @@ -1223,8 +1224,8 @@ typedef struct _DDRGBA DECLARE_HANDLE(HMONITOR); #endif - typedef BOOL (*LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); - typedef BOOL (*LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); + typedef BOOL (WINAPI *LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); + typedef BOOL (WINAPI *LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); extern HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); extern HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); @@ -1556,6 +1557,94 @@ typedef struct _DDOVERLAYFX #endif #endif +#if defined( _WIN32 ) && !defined( _NO_COM ) + #undef INTERFACE + #define INTERFACE IDirectDraw3 + DECLARE_INTERFACE_(IDirectDraw3,IUnknown) + { + STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + STDMETHOD(Compact)(THIS) PURE; + STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER *, IUnknown * ) PURE; + STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown * ) PURE; + STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE *, IUnknown *) PURE; + STDMETHOD(DuplicateSurface)( THIS_ LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE * ) PURE; + STDMETHOD(EnumDisplayModes)( THIS_ DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK ) PURE; + STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK ) PURE; + STDMETHOD(FlipToGDISurface)(THIS) PURE; + STDMETHOD(GetCaps)( THIS_ LPDDCAPS, LPDDCAPS) PURE; + STDMETHOD(GetDisplayMode)( THIS_ LPDDSURFACEDESC) PURE; + STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD ) PURE; + STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE *) PURE; + STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE; + STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE; + STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL ) PURE; + STDMETHOD(Initialize)(THIS_ GUID *) PURE; + STDMETHOD(RestoreDisplayMode)(THIS) PURE; + STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE; + STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD,DWORD, DWORD, DWORD) PURE; + STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE ) PURE; + STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS, LPDWORD, LPDWORD) PURE; + STDMETHOD(GetSurfaceFromDC)(THIS_ HDC, LPDIRECTDRAWSURFACE*) PURE; +}; + + #if !defined(__cplusplus) || defined(CINTERFACE) + #define IDirectDraw3_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) + #define IDirectDraw3_AddRef(p) (p)->lpVtbl->AddRef(p) + #define IDirectDraw3_Release(p) (p)->lpVtbl->Release(p) + #define IDirectDraw3_Compact(p) (p)->lpVtbl->Compact(p) + #define IDirectDraw3_CreateClipper(p,a,b,c) (p)->lpVtbl->CreateClipper(p,a,b,c) + #define IDirectDraw3_CreatePalette(p,a,b,c,d) (p)->lpVtbl->CreatePalette(p,a,b,c,d) + #define IDirectDraw3_CreateSurface(p,a,b,c) (p)->lpVtbl->CreateSurface(p,a,b,c) + #define IDirectDraw3_DuplicateSurface(p,a,b) (p)->lpVtbl->DuplicateSurface(p,a,b) + #define IDirectDraw3_EnumDisplayModes(p,a,b,c,d) (p)->lpVtbl->EnumDisplayModes(p,a,b,c,d) + #define IDirectDraw3_EnumSurfaces(p,a,b,c,d) (p)->lpVtbl->EnumSurfaces(p,a,b,c,d) + #define IDirectDraw3_FlipToGDISurface(p) (p)->lpVtbl->FlipToGDISurface(p) + #define IDirectDraw3_GetCaps(p,a,b) (p)->lpVtbl->GetCaps(p,a,b) + #define IDirectDraw3_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) + #define IDirectDraw3_GetFourCCCodes(p,a,b) (p)->lpVtbl->GetFourCCCodes(p,a,b) + #define IDirectDraw3_GetGDISurface(p,a) (p)->lpVtbl->GetGDISurface(p,a) + #define IDirectDraw3_GetMonitorFrequency(p,a) (p)->lpVtbl->GetMonitorFrequency(p,a) + #define IDirectDraw3_GetScanLine(p,a) (p)->lpVtbl->GetScanLine(p,a) + #define IDirectDraw3_GetVerticalBlankStatus(p,a) (p)->lpVtbl->GetVerticalBlankStatus(p,a) + #define IDirectDraw3_Initialize(p,a) (p)->lpVtbl->Initialize(p,a) + #define IDirectDraw3_RestoreDisplayMode(p) (p)->lpVtbl->RestoreDisplayMode(p) + #define IDirectDraw3_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) + #define IDirectDraw3_SetDisplayMode(p,a,b,c,d,e) (p)->lpVtbl->SetDisplayMode(p,a,b,c,d,e) + #define IDirectDraw3_WaitForVerticalBlank(p,a,b) (p)->lpVtbl->WaitForVerticalBlank(p,a,b) + #define IDirectDraw3_GetAvailableVidMem(p,a,b,c) (p)->lpVtbl->GetAvailableVidMem(p,a,b,c) + #define IDirectDraw3_GetSurfaceFromDC(p,a,b) (p)->lpVtbl->GetSurfaceFromDC(p,a,b) + #else + #define IDirectDraw3_QueryInterface(p,a,b) (p)->QueryInterface(a,b) + #define IDirectDraw3_AddRef(p) (p)->AddRef() + #define IDirectDraw3_Release(p) (p)->Release() + #define IDirectDraw3_Compact(p) (p)->Compact() + #define IDirectDraw3_CreateClipper(p,a,b,c) (p)->CreateClipper(a,b,c) + #define IDirectDraw3_CreatePalette(p,a,b,c,d) (p)->CreatePalette(a,b,c,d) + #define IDirectDraw3_CreateSurface(p,a,b,c) (p)->CreateSurface(a,b,c) + #define IDirectDraw3_DuplicateSurface(p,a,b) (p)->DuplicateSurface(a,b) + #define IDirectDraw3_EnumDisplayModes(p,a,b,c,d) (p)->EnumDisplayModes(a,b,c,d) + #define IDirectDraw3_EnumSurfaces(p,a,b,c,d) (p)->EnumSurfaces(a,b,c,d) + #define IDirectDraw3_FlipToGDISurface(p) (p)->FlipToGDISurface() + #define IDirectDraw3_GetCaps(p,a,b) (p)->GetCaps(a,b) + #define IDirectDraw3_GetDisplayMode(p,a) (p)->GetDisplayMode(a) + #define IDirectDraw3_GetFourCCCodes(p,a,b) (p)->GetFourCCCodes(a,b) + #define IDirectDraw3_GetGDISurface(p,a) (p)->GetGDISurface(a) + #define IDirectDraw3_GetMonitorFrequency(p,a) (p)->GetMonitorFrequency(a) + #define IDirectDraw3_GetScanLine(p,a) (p)->GetScanLine(a) + #define IDirectDraw3_GetVerticalBlankStatus(p,a) (p)->GetVerticalBlankStatus(a) + #define IDirectDraw3_Initialize(p,a) (p)->Initialize(a) + #define IDirectDraw3_RestoreDisplayMode(p) (p)->RestoreDisplayMode() + #define IDirectDraw3_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b) + #define IDirectDraw3_SetDisplayMode(p,a,b,c,d,e) (p)->SetDisplayMode(a,b,c,d,e) + #define IDirectDraw3_WaitForVerticalBlank(p,a,b) (p)->WaitForVerticalBlank(a,b) + #define IDirectDraw3_GetAvailableVidMem(p,a,b,c) (p)->GetAvailableVidMem(a,b,c) + #define IDirectDraw3_GetSurfaceFromDC(p,a,b) (p)->GetSurfaceFromDC(a,b) + #endif +#endif + + #if defined( _WIN32 ) && !defined( _NO_COM ) #undef INTERFACE #define INTERFACE IDirectDraw4 diff --git a/reactos/include/reactos/wine/wgl.h b/reactos/include/reactos/wine/wgl.h new file mode 100644 index 00000000000..d3cfc7e2428 --- /dev/null +++ b/reactos/include/reactos/wine/wgl.h @@ -0,0 +1,5081 @@ +/* Automatically generated from http://www.opengl.org/registry/api files; DO NOT EDIT! */ + +#ifndef __WINE_WGL_H +#define __WINE_WGL_H + +#ifndef GLAPIENTRY +#define GLAPIENTRY __stdcall +#endif + +typedef unsigned int GLbitfield; +typedef unsigned char GLboolean; +typedef signed char GLbyte; +typedef char GLchar; +typedef char GLcharARB; +typedef double GLclampd; +typedef float GLclampf; +typedef double GLdouble; +typedef unsigned int GLenum; +typedef float GLfloat; +typedef unsigned short GLhalfNV; +typedef unsigned int GLhandleARB; +typedef int GLint; +typedef INT64 GLint64; +typedef INT_PTR GLintptr; +typedef INT_PTR GLintptrARB; +typedef short GLshort; +typedef int GLsizei; +typedef INT_PTR GLsizeiptr; +typedef INT_PTR GLsizeiptrARB; +typedef const unsigned char * GLstring; +typedef struct __GLsync * GLsync; +typedef unsigned char GLubyte; +typedef unsigned int GLuint; +typedef UINT64 GLuint64; +typedef unsigned short GLushort; +typedef INT_PTR GLvdpauSurfaceNV; +typedef void GLvoid; + +#define GL_1PASS_EXT 0x80A1 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2D 0x0600 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_2_BYTES 0x1407 +#define GL_3D 0x0601 +#define GL_3DC_XY_AMD 0x87FA +#define GL_3DC_X_AMD 0x87F9 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_3_BYTES 0x1408 +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_EXT 0x80CC +#define GL_422_REV_AVERAGE_EXT 0x80CF +#define GL_422_REV_EXT 0x80CD +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_4_BYTES 0x1409 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_ABGR_EXT 0x8000 +#define GL_ACCUM 0x0100 +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_ACTIVE_PROGRAM_EXT 0x8B8D +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#define GL_ACTIVE_SUBROUTINES 0x8DE5 +#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 +#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 +#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_ADD 0x0104 +#define GL_ADD_ATI 0x8963 +#define GL_ADD_BLEND_IMG 0x8C09 +#define GL_ADD_SIGNED 0x8574 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_ALPHA 0x1906 +#define GL_ALPHA12 0x803D +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16 0x803E +#define GL_ALPHA16F_ARB 0x881C +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_ALPHA16_EXT 0x803E +#define GL_ALPHA16_SNORM 0x9018 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_ALPHA4 0x803B +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA8_SNORM 0x9014 +#define GL_ALPHA_BIAS 0x0D1D +#define GL_ALPHA_BITS 0x0D55 +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_ALPHA_INTEGER 0x8D97 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#define GL_ALPHA_MAX_SGIX 0x8321 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_SNORM 0x9010 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_ALWAYS 0x0207 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_AMBIENT 0x1200 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_AND 0x1501 +#define GL_AND_INVERTED 0x1504 +#define GL_AND_REVERSE 0x1502 +#define GL_ANY_SAMPLES_PASSED 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ARC_TO_NV 0xFE +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#define GL_ARRAY_SIZE 0x92FB +#define GL_ARRAY_STRIDE 0x92FE +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_ASYNC_MARKER_SGIX 0x8329 +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000 +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ATTENUATION_EXT 0x834D +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_AUTO_NORMAL 0x0D80 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_AUX_BUFFERS 0x0C00 +#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 +#define GL_AVERAGE_EXT 0x8335 +#define GL_AVERAGE_HP 0x8160 +#define GL_BACK 0x0405 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_RIGHT 0x0403 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_BEVEL_NV 0x90A6 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_BGRA_EXT 0x80E1 +#define GL_BGRA_INTEGER 0x8D9B +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_BGR_EXT 0x80E0 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BIAS_BIT_ATI 0x00000008 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BITMAP 0x1A00 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_BLEND 0x0BE2 +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_COLOR_EXT 0x8005 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_DST_ALPHA_EXT 0x80CA +#define GL_BLEND_DST_ALPHA_OES 0x80CA +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_DST_RGB_EXT 0x80C8 +#define GL_BLEND_DST_RGB_OES 0x80C8 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#define GL_BLEND_EQUATION_ALPHA_OES 0x883D +#define GL_BLEND_EQUATION_EXT 0x8009 +#define GL_BLEND_EQUATION_OES 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_RGB_OES 0x8009 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_BLEND_SRC_ALPHA_EXT 0x80CB +#define GL_BLEND_SRC_ALPHA_OES 0x80CB +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_SRC_RGB_EXT 0x80C9 +#define GL_BLEND_SRC_RGB_OES 0x80C9 +#define GL_BLOCK_INDEX 0x92FD +#define GL_BLUE 0x1905 +#define GL_BLUE_BIAS 0x0D1B +#define GL_BLUE_BITS 0x0D54 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BOLD_BIT_NV 0x01 +#define GL_BOOL 0x8B56 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_BUFFER 0x82E0 +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#define GL_BUFFER_OBJECT_APPLE 0x85B3 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200 +#define GL_BUFFER_USAGE 0x8765 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_TARGET_ATI 0x877C +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_BYTE 0x1400 +#define GL_C3F_V3F 0x2A24 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_CCW 0x0901 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_CLAMP 0x2900 +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_CLAMP_TO_BORDER 0x812D +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLEAR 0x1500 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_CMYKA_EXT 0x800D +#define GL_CMYK_EXT 0x800C +#define GL_CND0_ATI 0x896B +#define GL_CND_ATI 0x896A +#define GL_COEFF 0x0A00 +#define GL_COLOR 0x1800 +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_COLOR_ARRAY 0x8076 +#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT0_OES 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT_EXT 0x90F0 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_COLOR_ENCODING 0x8296 +#define GL_COLOR_EXT 0x1800 +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#define GL_COLOR_INDEX 0x1900 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEXES 0x1603 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_COLOR_SUM 0x8458 +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_COLOR_TABLE 0x80D0 +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_SGI 0x80D0 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_COMBINE 0x8570 +#define GL_COMBINE4_NV 0x8503 +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_COMBINE_ALPHA 0x8572 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040 +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#define GL_COMPATIBLE_SUBROUTINES 0x8E4B +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_RG 0x8226 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 +#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267 +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_CONDITION_SATISFIED 0x911C +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_CONSTANT 0x8576 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_CONSTANT_ARB 0x8576 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_CONSTANT_EXT 0x8576 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_FLAGS 0x821E +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_CONTINUOUS_AMD 0x9007 +#define GL_CONVEX_HULL_NV 0x908B +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_2_ATI 0x8943 +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_COORD_REPLACE 0x8862 +#define GL_COORD_REPLACE_ARB 0x8862 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_SAMPLES_NV 0x80A9 +#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_CUBIC_EXT 0x8334 +#define GL_CUBIC_HP 0x815F +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_CULL_MODES_NV 0x86E0 +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_IBM 103050 +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_CURRENT_BIT 0x00000001 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_CURRENT_QUERY 0x8865 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_CURRENT_TIME_NV 0x8E28 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_CW 0x0900 +#define GL_DATA_BUFFER_AMD 0x9151 +#define GL_DEBUG_ASSERT_MESA 0x875B +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149 +#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F +#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B +#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 +#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D +#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E +#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C +#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_OBJECT_MESA 0x8759 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_PRINT_MESA 0x875A +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DECAL 0x2101 +#define GL_DECODE_EXT 0x8A49 +#define GL_DECR 0x1E03 +#define GL_DECR_WRAP 0x8508 +#define GL_DECR_WRAP_EXT 0x8508 +#define GL_DECR_WRAP_OES 0x8508 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_DELETE_STATUS 0x8B80 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DEPTH 0x1801 +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_DEPTH_ATTACHMENT_OES 0x8D00 +#define GL_DEPTH_BIAS 0x0D1F +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +#define GL_DEPTH_CLAMP 0x864F +#define GL_DEPTH_CLAMP_FAR_AMD 0x901F +#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E +#define GL_DEPTH_CLAMP_NV 0x864F +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_DEPTH_EXT 0x1801 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_DEPTH_STENCIL_MESA 0x8750 +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DIFFUSE 0x1201 +#define GL_DISCARD_ATI 0x8763 +#define GL_DISCARD_NV 0x8530 +#define GL_DISCRETE_AMD 0x9006 +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_DISPLAY_LIST 0x82E7 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#define GL_DITHER 0x0BD0 +#define GL_DOMAIN 0x0A02 +#define GL_DONT_CARE 0x1100 +#define GL_DOT2_ADD_ATI 0x896C +#define GL_DOT3_ATI 0x8966 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#define GL_DOT3_RGBA_ARB 0x86AF +#define GL_DOT3_RGBA_EXT 0x8741 +#define GL_DOT3_RGBA_IMG 0x86AF +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT4_ATI 0x8967 +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_DOUBLE 0x140A +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_DOUBLE_EXT 0x140A +#define GL_DOUBLE_MAT2 0x8F46 +#define GL_DOUBLE_MAT2_EXT 0x8F46 +#define GL_DOUBLE_MAT3 0x8F47 +#define GL_DOUBLE_MAT3_EXT 0x8F47 +#define GL_DOUBLE_MAT4 0x8F48 +#define GL_DOUBLE_MAT4_EXT 0x8F48 +#define GL_DOUBLE_VEC2 0x8FFC +#define GL_DOUBLE_VEC2_EXT 0x8FFC +#define GL_DOUBLE_VEC3 0x8FFD +#define GL_DOUBLE_VEC3_EXT 0x8FFD +#define GL_DOUBLE_VEC4 0x8FFE +#define GL_DOUBLE_VEC4_EXT 0x8FFE +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER_EXT 0x0C01 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 +#define GL_DRAW_INDIRECT_BUFFER 0x8F3F +#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 +#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 +#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_DSDT_NV 0x86F5 +#define GL_DST_ALPHA 0x0304 +#define GL_DST_COLOR 0x0306 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_BIAS_NV 0x8717 +#define GL_DT_SCALE_NV 0x8711 +#define GL_DU8DV8_ATI 0x877A +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_DUDV_ATI 0x8779 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_DYNAMIC_COPY_ARB 0x88EA +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_EDGE_FLAG 0x0B43 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26 +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29 +#define GL_ELEMENT_ARRAY_APPLE 0x8A0C +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_MAP_NV 0x855F +#define GL_EMISSION 0x1600 +#define GL_ENABLE_BIT 0x00002000 +#define GL_EQUAL 0x0202 +#define GL_EQUIV 0x1509 +#define GL_ETC1_RGB8_OES 0x8D64 +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_BIT 0x00010000 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_EVAL_VERTEX_ATRRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATRRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATRRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATRRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATRRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATRRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATRRIB15_NV 0x86D5 +#define GL_EVAL_VERTEX_ATRRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATRRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATRRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATRRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATRRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATRRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATRRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATRRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATRRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXTENSIONS 0x1F03 +#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_EYE_PLANE 0x2502 +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_EYE_RADIAL_NV 0x855B +#define GL_E_TIMES_F_NV 0x8531 +#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07 +#define GL_FACTOR_MAX_AMD 0x901D +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FAILURE_NV 0x9030 +#define GL_FALSE 0 +#define GL_FASTEST 0x1101 +#define GL_FEEDBACK 0x1C01 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 +#define GL_FENCE_APPLE 0x8A0B +#define GL_FENCE_CONDITION_NV 0x84F4 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FIELDS_NV 0x8E27 +#define GL_FIELD_LOWER_NV 0x9023 +#define GL_FIELD_UPPER_NV 0x9022 +#define GL_FILE_NAME_NV 0x9074 +#define GL_FILL 0x1B02 +#define GL_FILTER 0x829A +#define GL_FILTER4_SGIS 0x8146 +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_FIXED 0x140C +#define GL_FIXED_OES 0x140C +#define GL_FIXED_ONLY 0x891D +#define GL_FIXED_ONLY_ARB 0x891D +#define GL_FLAT 0x1D00 +#define GL_FLOAT 0x1406 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_FOG 0x0B60 +#define GL_FOG_BIT 0x00000080 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_COORD 0x8451 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_FOG_END 0x0B64 +#define GL_FOG_FACTOR_TO_ALPHA_SGIX 0x836F +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_GEN_MODE_NV 0x855A +#define GL_FOG_HINT 0x0C54 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#define GL_FOG_START 0x0B63 +#define GL_FONT_ASCENDER_NV 0x00200000 +#define GL_FONT_DESCENDER_NV 0x00400000 +#define GL_FONT_HAS_KERNING_NV 0x10000000 +#define GL_FONT_HEIGHT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_NV 0x02000000 +#define GL_FONT_MAX_ADVANCE_WIDTH_NV 0x01000000 +#define GL_FONT_UNDERLINE_POSITION_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_NV 0x08000000 +#define GL_FONT_UNITS_PER_EM_NV 0x00100000 +#define GL_FONT_X_MAX_BOUNDS_NV 0x00040000 +#define GL_FONT_X_MIN_BOUNDS_NV 0x00010000 +#define GL_FONT_Y_MAX_BOUNDS_NV 0x00080000 +#define GL_FONT_Y_MIN_BOUNDS_NV 0x00020000 +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FRACTIONAL_EVEN 0x8E7C +#define GL_FRACTIONAL_ODD 0x8E7B +#define GL_FRAGMENTS_INSTRUMENT_COUNTERS_SGIX 0x8314 +#define GL_FRAGMENTS_INSTRUMENT_MAX_SGIX 0x8315 +#define GL_FRAGMENTS_INSTRUMENT_SGIX 0x8313 +#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08 +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8BB3 +#define GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8BB2 +#define GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x8BB1 +#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 +#define GL_FRAGMENT_PROGRAM_POSITION_MESA 0x8BB0 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_FRAMEBUFFER 0x8D40 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6 +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES 0x8CDC +#define GL_FRAMEBUFFER_OES 0x8D40 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAME_NV 0x8E26 +#define GL_FRONT 0x0404 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_FRONT_FACE 0x0B46 +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_FUNC_ADD_OES 0x8006 +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_SUBTRACT_OES 0x800A +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_SHADER_ARB 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEQUAL 0x0206 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLYPH_HAS_KERNING_NV 0x100 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GPU_ADDRESS_NV 0x8F34 +#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 +#define GL_GREATER 0x0204 +#define GL_GREEN 0x1904 +#define GL_GREEN_BIAS 0x0D19 +#define GL_GREEN_BITS 0x0D53 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_HALF_APPLE 0x140B +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_HALF_FLOAT 0x140B +#define GL_HALF_FLOAT_ARB 0x140B +#define GL_HALF_FLOAT_NV 0x140B +#define GL_HALF_FLOAT_OES 0x8D61 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_HIGH_INT 0x8DF5 +#define GL_HILO16_NV 0x86F8 +#define GL_HILO8_NV 0x885E +#define GL_HILO_NV 0x86F4 +#define GL_HINT_BIT 0x00008000 +#define GL_HISTOGRAM 0x8024 +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_SINK 0x802D +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HI_BIAS_NV 0x8714 +#define GL_HI_SCALE_NV 0x870E +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_IDENTITY_NV 0x862A +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_1D_ARRAY_EXT 0x9052 +#define GL_IMAGE_1D_EXT 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_2D_ARRAY_EXT 0x9053 +#define GL_IMAGE_2D_EXT 0x904D +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056 +#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055 +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_2D_RECT_EXT 0x904F +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_3D_EXT 0x904E +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C +#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_CUBE_EXT 0x9050 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_INCR 0x1E02 +#define GL_INCR_WRAP 0x8507 +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_INCR_WRAP_OES 0x8507 +#define GL_INDEX 0x8222 +#define GL_INDEX_ARRAY 0x8077 +#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_BITS 0x0D51 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#define GL_INT 0x1404 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_NV 0x140E +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16 0x804D +#define GL_INTENSITY16F_ARB 0x881D +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_INTENSITY16_EXT 0x804D +#define GL_INTENSITY16_SNORM 0x901B +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY8_SNORM 0x9017 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_INTENSITY_SNORM 0x9013 +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_INGR 0x8568 +#define GL_INTERLACE_READ_OML 0x8981 +#define GL_INTERLACE_SGIX 0x8094 +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERPOLATE 0x8575 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#define GL_INT_2_10_10_10_REV 0x8D9F +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D +#define GL_INT_IMAGE_1D_EXT 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E +#define GL_INT_IMAGE_2D_EXT 0x9058 +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061 +#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_2D_RECT_EXT 0x905A +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_3D_EXT 0x9059 +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_CUBE_EXT 0x905B +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506 +#define GL_INVALID_INDEX 0xFFFFFFFFu +#define GL_INVALID_OPERATION 0x0502 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_INVARIANT_EXT 0x87C2 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVERSE_NV 0x862B +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_INVERT 0x150A +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#define GL_ISOLINES 0x8E7A +#define GL_IS_PER_PATCH 0x92E7 +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_KEEP 0x1E00 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027 +#define GL_LAYER_NV 0x8DAA +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_LEFT 0x0406 +#define GL_LEQUAL 0x0203 +#define GL_LERP_ATI 0x8969 +#define GL_LESS 0x0201 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_LIGHTING 0x0B50 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LINE 0x1B01 +#define GL_LINEAR 0x2601 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINES 0x0001 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINES_ADJACENCY_ARB 0x000A +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_BIT 0x00000004 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_QUALITY_HINT_SGIX 0x835B +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_STRIP 0x0003 +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_TO_NV 0x04 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 +#define GL_LINK_STATUS 0x8B82 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_BIT 0x00020000 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 +#define GL_LIST_PRIORITY_SGIX 0x8182 +#define GL_LOAD 0x0101 +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_EXT 0x87C4 +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F +#define GL_LOGIC_OP 0x0BF1 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_LOW_FLOAT 0x8DF0 +#define GL_LOW_INT 0x8DF3 +#define GL_LO_BIAS_NV 0x8715 +#define GL_LO_SCALE_NV 0x870F +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE16_SNORM 0x9019 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_SNORM 0x9015 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_LUMINANCE_ALPHA_SNORM 0x9012 +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_SNORM 0x9011 +#define GL_MAD_ATI 0x8968 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_MAJOR_VERSION 0x821B +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP2_BINORMAL_EXT 0x8447 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_STENCIL 0x0D11 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX7_NV 0x8637 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX_EXT 0x87C0 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MATRIX_STRIDE 0x92FF +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_MAX 0x8008 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39 +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_EXT 0x8008 +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_IMAGE_UNITS_EXT 0x8F38 +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_MAX_PATCH_VERTICES 0x8E7D +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 +#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8 +#define GL_MAX_SAMPLES 0x8D57 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +#define GL_MAX_SAMPLES_EXT 0x8D57 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A +#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#define GL_MAX_SUBROUTINES 0x8DE7 +#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 +#define GL_MAX_TESS_GEN_LEVEL 0x8E7E +#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_MAX_TEXTURE_COORDS 0x8871 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_STREAMS 0x8E71 +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_VIEWPORTS 0x825B +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_WIDTH 0x827E +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_MIN 0x8007 +#define GL_MINMAX 0x802E +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_MINOR_VERSION 0x821C +#define GL_MIN_EXT 0x8007 +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B +#define GL_MIN_LOD_WARNING_AMD 0x919C +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 +#define GL_MIN_SPARSE_LEVEL_AMD 0x919B +#define GL_MIPMAP 0x8293 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#define GL_MIRRORED_REPEAT_OES 0x8370 +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_MODELVIEW 0x1700 +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW1_EXT 0x850A +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_MATRIX1_EXT 0x8506 +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_MODULATE 0x2100 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_COLOR_IMG 0x8C04 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_MOVE_TO_NV 0x02 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOV_ATI 0x8961 +#define GL_MULT 0x0103 +#define GL_MULTISAMPLE 0x809D +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_MULTISAMPLE_ARB 0x809D +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_MULTIVIEW_EXT 0x90F1 +#define GL_MULTI_HULLS_NV 0x908C +#define GL_MUL_ATI 0x8964 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_N3F_V3F 0x2A25 +#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 +#define GL_NAMED_STRING_TYPE_ARB 0x8DEA +#define GL_NAME_LENGTH 0x92F9 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_NAND 0x150E +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NEAREST 0x2600 +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEVER 0x0200 +#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025 +#define GL_NICEST 0x1102 +#define GL_NONE 0 +#define GL_NOOP 0x1505 +#define GL_NOR 0x1508 +#define GL_NORMALIZE 0x0BA1 +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_NORMAL_MAP_OES 0x8511 +#define GL_NOTEQUAL 0x0205 +#define GL_NO_ERROR 0 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_NUM_EXTENSIONS 0x821D +#define GL_NUM_FILL_STREAMS_NV 0x8E29 +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024 +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_PLANE 0x2501 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_OBJECT_TYPE 0x9112 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#define GL_OFFSET 0x92FC +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_ONE 1 +#define GL_ONE_EXT 0x87DE +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB +#define GL_ONE_MINUS_SRC1_COLOR 0x88FA +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_OPERAND2_ALPHA_EXT 0x859A +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND3_ALPHA_NV 0x859B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_MOV_EXT 0x8799 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_SUB_EXT 0x8796 +#define GL_OR 0x1507 +#define GL_ORDER 0x0A01 +#define GL_OR_INVERTED 0x150D +#define GL_OR_REVERSE 0x150B +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_SIZE_SGIX 0x831C +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_PACK_INVERT_MESA 0x8758 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_MAX_COMPRESSED_SIZE_SGIX 0x831B +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#define GL_PACK_ROW_BYTES_APPLE 0x8A15 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_PARTIAL_SUCCESS_NV 0x902E +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_PATCHES 0x000E +#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 +#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 +#define GL_PATCH_VERTICES 0x8E72 +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_PATH_SAMPLE_QUALITY_NV 0x9085 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_PATH_STROKE_BOUND_NV 0x9086 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_PATH_STROKE_OVERSAMPLE_COUNT_NV 0x9087 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFORMANCE_MONITOR_AMD 0x9152 +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_PERTURB_EXT 0x85AE +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#define GL_PHONG_HINT_WIN 0x80EB +#define GL_PHONG_WIN 0x80EA +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080 +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_POINT 0x1B00 +#define GL_POINTS 0x0000 +#define GL_POINT_BIT 0x00000002 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_RANGE 0x0B12 +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_POINT_SPRITE 0x8861 +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#define GL_POINT_TOKEN 0x0701 +#define GL_POLYGON 0x0009 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_POSITION 0x1203 +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_PRESENT_DURATION_NV 0x8E2B +#define GL_PRESENT_TIME_NV 0x8E2A +#define GL_PRESERVE_ATI 0x8762 +#define GL_PREVIOUS 0x8578 +#define GL_PREVIOUS_ARB 0x8578 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PROGRAM 0x82E2 +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_MATRIX_EXT 0x8E2D +#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_PROJECTION 0x1701 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_PROJECTIVE_2D_NV 0x9093 +#define GL_PROJECTIVE_3D_NV 0x9095 +#define GL_PROVOKING_VERTEX 0x8E4F +#define GL_PROVOKING_VERTEX_EXT 0x8E4F +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_PURGEABLE_APPLE 0x8A1D +#define GL_Q 0x2003 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_QUADS 0x0007 +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_QUAD_STRIP 0x0008 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_QUERY 0x82E3 +#define GL_QUERY_BUFFER_AMD 0x9192 +#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_OBJECT_AMD 0x9153 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_R 0x2002 +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_R16 0x822A +#define GL_R16F 0x822D +#define GL_R16F_EXT 0x822D +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R16_SNORM 0x8F98 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R32F 0x822E +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_R3_G3_B2 0x2A10 +#define GL_R8 0x8229 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R8_EXT 0x8229 +#define GL_R8_SNORM 0x8F94 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_RASTERIZER_DISCARD_EXT 0x8C89 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#define GL_READ_BUFFER 0x0C02 +#define GL_READ_BUFFER_EXT 0x0C02 +#define GL_READ_BUFFER_NV 0x0C02 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_READ_ONLY 0x88B8 +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#define GL_READ_WRITE 0x88BA +#define GL_READ_WRITE_ARB 0x88BA +#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05 +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_RECT_NV 0xF6 +#define GL_RED 0x1903 +#define GL_REDUCE 0x8016 +#define GL_REDUCE_EXT 0x8016 +#define GL_RED_BIAS 0x0D15 +#define GL_RED_BITS 0x0D52 +#define GL_RED_BIT_ATI 0x00000001 +#define GL_RED_EXT 0x1903 +#define GL_RED_INTEGER 0x8D94 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_SNORM 0x8F90 +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFLECTION_MAP 0x8512 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_REFLECTION_MAP_NV 0x8512 +#define GL_REFLECTION_MAP_OES 0x8512 +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_2_ATI 0x8923 +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_RELEASED_APPLE 0x8A19 +#define GL_RENDER 0x1C00 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_RENDERBUFFER_BINDING_ANGLE 0x8CA7 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_RENDERBUFFER_BINDING_OES 0x8CA7 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52 +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44 +#define GL_RENDERBUFFER_OES 0x8D41 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50 +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_WIDTH_OES 0x8D42 +#define GL_RENDERER 0x1F01 +#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 +#define GL_RENDER_MODE 0x0C40 +#define GL_REPEAT 0x2901 +#define GL_REPLACE 0x1E01 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_REPLACE_EXT 0x8062 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_REPLACE_VALUE_AMD 0x874B +#define GL_REPLICATE_BORDER 0x8153 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESCALE_NORMAL 0x803A +#define GL_RESCALE_NORMAL_EXT 0x803A +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_RESTART_SUN 0x0001 +#define GL_RETAINED_APPLE 0x8A1B +#define GL_RETURN 0x0102 +#define GL_RG 0x8227 +#define GL_RG16 0x822C +#define GL_RG16F 0x822F +#define GL_RG16F_EXT 0x822F +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG16_SNORM 0x8F99 +#define GL_RG32F 0x8230 +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#define GL_RG8 0x822B +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG8_EXT 0x822B +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB 0x1907 +#define GL_RGB10 0x8052 +#define GL_RGB10_A2 0x8059 +#define GL_RGB10_A2UI 0x906F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGB16F 0x881B +#define GL_RGB16F_ARB 0x881B +#define GL_RGB16F_EXT 0x881B +#define GL_RGB16I 0x8D89 +#define GL_RGB16I_EXT 0x8D89 +#define GL_RGB16UI 0x8D77 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_RGB16_EXT 0x8054 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGB2_EXT 0x804E +#define GL_RGB32F 0x8815 +#define GL_RGB32F_ARB 0x8815 +#define GL_RGB32I 0x8D83 +#define GL_RGB32I_EXT 0x8D83 +#define GL_RGB32UI 0x8D71 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_RGB4 0x804F +#define GL_RGB4_EXT 0x804F +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGB5 0x8050 +#define GL_RGB565 0x8D62 +#define GL_RGB565_OES 0x8D62 +#define GL_RGB5_A1 0x8057 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB8I 0x8D8F +#define GL_RGB8I_EXT 0x8D8F +#define GL_RGB8UI 0x8D7D +#define GL_RGB8UI_EXT 0x8D7D +#define GL_RGB8_EXT 0x8051 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGB9_E5 0x8C3D +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_RGBA 0x1908 +#define GL_RGBA12 0x805A +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16 0x805B +#define GL_RGBA16F 0x881A +#define GL_RGBA16F_ARB 0x881A +#define GL_RGBA16F_EXT 0x881A +#define GL_RGBA16I 0x8D88 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGBA16UI 0x8D76 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGBA16_EXT 0x805B +#define GL_RGBA16_SNORM 0x8F9B +#define GL_RGBA2 0x8055 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA32F 0x8814 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGBA32I 0x8D82 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGBA32UI 0x8D70 +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGBA4 0x8056 +#define GL_RGBA4_DXT5_S3TC 0x83A5 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGBA4_OES 0x8056 +#define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA8 0x8058 +#define GL_RGBA8I 0x8D8E +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGBA8UI 0x8D7C +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGBA8_EXT 0x8058 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E +#define GL_RGBA_MODE 0x0C31 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C +#define GL_RGBA_SNORM 0x8F93 +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB_SCALE 0x8573 +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_RGB_SNORM 0x8F92 +#define GL_RG_EXT 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_RG_SNORM 0x8F91 +#define GL_RIGHT 0x0407 +#define GL_ROUND_NV 0x90A4 +#define GL_S 0x2000 +#define GL_SAMPLER 0x82E6 +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_SAMPLER_BINDING 0x8919 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_SAMPLER_OBJECT_AMD 0x9155 +#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLES_PASSED 0x8914 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_EXT 0x80A0 +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_MASK_NV 0x8E51 +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_POSITION_NV 0x8E50 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_SCALAR_EXT 0x87BE +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA +#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCISSOR_BIT 0x00080000 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27 +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E +#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_SELECT 0x1C02 +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 +#define GL_SEPARABLE_2D 0x8012 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#define GL_SET 0x150F +#define GL_SET_AMD 0x874A +#define GL_SGX_BINARY_IMG 0x8C0A +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#define GL_SHADER 0x82E1 +#define GL_SHADER_BINARY_DMP 0x9250 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_SHADER_BINARY_VIV 0x8FC4 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_INCLUDE_ARB 0x8DAE +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_TYPE 0x8B4F +#define GL_SHADE_MODEL 0x0B54 +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#define GL_SHININESS 0x1601 +#define GL_SHORT 0x1402 +#define GL_SIGNALED 0x9119 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SKIP_DECODE_EXT 0x8A4A +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_SLICE_ACCUM_SUN 0x85CC +#define GL_SLIM10U_SGIX 0x831E +#define GL_SLIM12S_SGIX 0x831F +#define GL_SLIM8U_SGIX 0x831D +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_SMOOTH 0x1D01 +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SPARE0_NV 0x852E +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_SPARE1_NV 0x852F +#define GL_SPECULAR 0x1202 +#define GL_SPHERE_MAP 0x2402 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SQUARE_NV 0x90A3 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC1_COLOR 0x88F9 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_ALPHA 0x858A +#define GL_SRC2_RGB 0x8582 +#define GL_SRC_ALPHA 0x0302 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_SRC_COLOR 0x0300 +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB_DECODE_ARB 0x8299 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_STATE_RESTORE 0x8BDC +#define GL_STATIC_ATI 0x8760 +#define GL_STATIC_COPY 0x88E6 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STENCIL 0x1802 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_STENCIL_ATTACHMENT_OES 0x8D20 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_STENCIL_EXT 0x1802 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_INDEX 0x1901 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#define GL_STENCIL_OP_VALUE_AMD 0x874C +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STEREO 0x0C33 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_CLIENT_APPLE 0x85B4 +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +#define GL_STORAGE_SHARED_APPLE 0x85BF +#define GL_STREAM_COPY 0x88E2 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F +#define GL_SUBTRACT 0x84E7 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_SUB_ATI 0x8965 +#define GL_SUCCESS_NV 0x902F +#define GL_SURFACE_MAPPED_NV 0x8700 +#define GL_SURFACE_REGISTERED_NV 0x86FD +#define GL_SURFACE_STATE_NV 0x86EB +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_X11_FENCE_EXT 0x90E1 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_T 0x2001 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_C4F_N3F_V4F 0x2A2D +#define GL_T4F_V4F 0x2A28 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 +#define GL_TESS_CONTROL_PROGRAM_NV 0x891E +#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74 +#define GL_TESS_CONTROL_SHADER 0x8E88 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F +#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75 +#define GL_TESS_EVALUATION_SHADER 0x8E87 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_TESS_GEN_MODE 0x8E76 +#define GL_TESS_GEN_POINT_MODE 0x8E79 +#define GL_TESS_GEN_SPACING 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_TEXTURE31_ARB 0x84DF +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_TEXTURE_3D 0x806F +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#define GL_TEXTURE_3D_BINDING_OES 0x806A +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06 +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_TEXTURE_BUFFER_ARB 0x8C2A +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A +#define GL_TEXTURE_CUBE_MAP_OES 0x8513 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519 +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_GEN_Q 0x0C63 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_STR_OES 0x8D60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 +#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 +#define GL_TEXTURE_SWIZZLE_A 0x8E45 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_B 0x8E44 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_G 0x8E43 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_R 0x8E42 +#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100 +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +#define GL_TIMESTAMP 0x8E28 +#define GL_TIME_ELAPSED 0x88BF +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_TRACE_ALL_BITS_MESA 0xFFFF +#define GL_TRACE_ARRAYS_BIT_MESA 0x0004 +#define GL_TRACE_ERRORS_BIT_MESA 0x0020 +#define GL_TRACE_MASK_MESA 0x8755 +#define GL_TRACE_NAME_MESA 0x8756 +#define GL_TRACE_OPERATIONS_BIT_MESA 0x0001 +#define GL_TRACE_PIXELS_BIT_MESA 0x0010 +#define GL_TRACE_PRIMITIVES_BIT_MESA 0x0002 +#define GL_TRACE_TEXTURES_BIT_MESA 0x0008 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800 +#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 +#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 +#define GL_TRANSPOSE_NV 0x862C +#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 +#define GL_TRANSPOSE_PROJECTIVE_2D_NV 0x9097 +#define GL_TRANSPOSE_PROJECTIVE_3D_NV 0x9099 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLES_ADJACENCY_ARB 0x000C +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_FAN 0x0006 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_TRUE 1 +#define GL_TYPE 0x92FA +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_UNDEFINED_APPLE 0x8A1C +#define GL_UNDEFINED_VERTEX 0x8260 +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#define GL_UNPACK_CMYK_HINT_EXT 0x800F +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_SIZE_SGIX 0x831A +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_UNSIGNALED 0x9118 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_BYTE_2_3_3_REV_EXT 0x8362 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INT 0x1405 +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_UNSIGNED_INT_24_8_MESA 0x8751 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_8_8_8_8_REV_EXT 0x8367 +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068 +#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069 +#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063 +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F +#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_UNSIGNED_NEGATE_NV 0x853D +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 +#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_EXT 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_5_6_5_REV_EXT 0x8364 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_UPPER_LEFT 0x8CA2 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_UTF16_NV 0x909B +#define GL_UTF8_NV 0x909A +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_EXT 0x87C1 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_VECTOR_EXT 0x87BF +#define GL_VENDOR 0x1F00 +#define GL_VERSION 0x1F02 +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 +#define GL_VERSION_1_3 1 +#define GL_VERSION_1_4 1 +#define GL_VERSION_1_5 1 +#define GL_VERSION_2_0 1 +#define GL_VERSION_2_1 1 +#define GL_VERSION_3_0 1 +#define GL_VERSION_3_1 1 +#define GL_VERSION_3_2 1 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21 +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD +#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 +#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 +#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 +#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 +#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 +#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 +#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 +#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 +#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 +#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8BB7 +#define GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8BB6 +#define GL_VERTEX_PROGRAM_CALLBACK_MESA 0x8BB4 +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_POSITION_MESA 0x8BB4 +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_VERTEX_TEXTURE 0x829B +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_VIDEO_BUFFER_BINDING_NV 0x9021 +#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D +#define GL_VIDEO_BUFFER_NV 0x9020 +#define GL_VIDEO_BUFFER_PITCH_NV 0x9028 +#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B +#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A +#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039 +#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038 +#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C +#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026 +#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029 +#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A +#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B +#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C +#define GL_VIEWPORT 0x0BA2 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 +#define GL_VOLATILE_APPLE 0x8A1A +#define GL_WAIT_FAILED 0x911D +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E +#define GL_WEIGHT_ARRAY_OES 0x86AD +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_WRAP_BORDER_SUN 0x81D4 +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#define GL_WRITE_DISCARD_NV 0x88BE +#define GL_WRITE_ONLY 0x88B9 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_W_EXT 0x87D8 +#define GL_XOR 0x1506 +#define GL_X_EXT 0x87D5 +#define GL_YCBAYCR8A_4224_NV 0x9032 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_YCBCR_MESA 0x8757 +#define GL_YCBYCR8_422_NV 0x9031 +#define GL_YCRCBA_SGIX 0x8319 +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#define GL_YCRCB_SGIX 0x8318 +#define GL_Y_EXT 0x87D6 +#define GL_Z400_BINARY_AMD 0x8740 +#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036 +#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037 +#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035 +#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034 +#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033 +#define GL_ZERO 0 +#define GL_ZERO_EXT 0x87DD +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 +#define GL_Z_EXT 0x87D7 + +void GLAPIENTRY glAccum(GLenum,GLfloat); +void GLAPIENTRY glAlphaFunc(GLenum,GLfloat); +GLboolean GLAPIENTRY glAreTexturesResident(GLsizei,const GLuint*,GLboolean*); +void GLAPIENTRY glArrayElement(GLint); +void GLAPIENTRY glBegin(GLenum); +void GLAPIENTRY glBindTexture(GLenum,GLuint); +void GLAPIENTRY glBitmap(GLsizei,GLsizei,GLfloat,GLfloat,GLfloat,GLfloat,const GLubyte*); +void GLAPIENTRY glBlendFunc(GLenum,GLenum); +void GLAPIENTRY glCallList(GLuint); +void GLAPIENTRY glCallLists(GLsizei,GLenum,const GLvoid*); +void GLAPIENTRY glClear(GLbitfield); +void GLAPIENTRY glClearAccum(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glClearColor(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glClearDepth(GLdouble); +void GLAPIENTRY glClearIndex(GLfloat); +void GLAPIENTRY glClearStencil(GLint); +void GLAPIENTRY glClipPlane(GLenum,const GLdouble*); +void GLAPIENTRY glColor3b(GLbyte,GLbyte,GLbyte); +void GLAPIENTRY glColor3bv(const GLbyte*); +void GLAPIENTRY glColor3d(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glColor3dv(const GLdouble*); +void GLAPIENTRY glColor3f(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glColor3fv(const GLfloat*); +void GLAPIENTRY glColor3i(GLint,GLint,GLint); +void GLAPIENTRY glColor3iv(const GLint*); +void GLAPIENTRY glColor3s(GLshort,GLshort,GLshort); +void GLAPIENTRY glColor3sv(const GLshort*); +void GLAPIENTRY glColor3ub(GLubyte,GLubyte,GLubyte); +void GLAPIENTRY glColor3ubv(const GLubyte*); +void GLAPIENTRY glColor3ui(GLuint,GLuint,GLuint); +void GLAPIENTRY glColor3uiv(const GLuint*); +void GLAPIENTRY glColor3us(GLushort,GLushort,GLushort); +void GLAPIENTRY glColor3usv(const GLushort*); +void GLAPIENTRY glColor4b(GLbyte,GLbyte,GLbyte,GLbyte); +void GLAPIENTRY glColor4bv(const GLbyte*); +void GLAPIENTRY glColor4d(GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glColor4dv(const GLdouble*); +void GLAPIENTRY glColor4f(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glColor4fv(const GLfloat*); +void GLAPIENTRY glColor4i(GLint,GLint,GLint,GLint); +void GLAPIENTRY glColor4iv(const GLint*); +void GLAPIENTRY glColor4s(GLshort,GLshort,GLshort,GLshort); +void GLAPIENTRY glColor4sv(const GLshort*); +void GLAPIENTRY glColor4ub(GLubyte,GLubyte,GLubyte,GLubyte); +void GLAPIENTRY glColor4ubv(const GLubyte*); +void GLAPIENTRY glColor4ui(GLuint,GLuint,GLuint,GLuint); +void GLAPIENTRY glColor4uiv(const GLuint*); +void GLAPIENTRY glColor4us(GLushort,GLushort,GLushort,GLushort); +void GLAPIENTRY glColor4usv(const GLushort*); +void GLAPIENTRY glColorMask(GLboolean,GLboolean,GLboolean,GLboolean); +void GLAPIENTRY glColorMaterial(GLenum,GLenum); +void GLAPIENTRY glColorPointer(GLint,GLenum,GLsizei,const GLvoid*); +void GLAPIENTRY glCopyPixels(GLint,GLint,GLsizei,GLsizei,GLenum); +void GLAPIENTRY glCopyTexImage1D(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLint); +void GLAPIENTRY glCopyTexImage2D(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint); +void GLAPIENTRY glCopyTexSubImage1D(GLenum,GLint,GLint,GLint,GLint,GLsizei); +void GLAPIENTRY glCopyTexSubImage2D(GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei); +void GLAPIENTRY glCullFace(GLenum); +GLint GLAPIENTRY glDebugEntry(GLint,GLint); +void GLAPIENTRY glDeleteLists(GLuint,GLsizei); +void GLAPIENTRY glDeleteTextures(GLsizei,const GLuint*); +void GLAPIENTRY glDepthFunc(GLenum); +void GLAPIENTRY glDepthMask(GLboolean); +void GLAPIENTRY glDepthRange(GLdouble,GLdouble); +void GLAPIENTRY glDisable(GLenum); +void GLAPIENTRY glDisableClientState(GLenum); +void GLAPIENTRY glDrawArrays(GLenum,GLint,GLsizei); +void GLAPIENTRY glDrawBuffer(GLenum); +void GLAPIENTRY glDrawElements(GLenum,GLsizei,GLenum,const GLvoid*); +void GLAPIENTRY glDrawPixels(GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); +void GLAPIENTRY glEdgeFlag(GLboolean); +void GLAPIENTRY glEdgeFlagPointer(GLsizei,const GLvoid*); +void GLAPIENTRY glEdgeFlagv(const GLboolean*); +void GLAPIENTRY glEnable(GLenum); +void GLAPIENTRY glEnableClientState(GLenum); +void GLAPIENTRY glEnd(void); +void GLAPIENTRY glEndList(void); +void GLAPIENTRY glEvalCoord1d(GLdouble); +void GLAPIENTRY glEvalCoord1dv(const GLdouble*); +void GLAPIENTRY glEvalCoord1f(GLfloat); +void GLAPIENTRY glEvalCoord1fv(const GLfloat*); +void GLAPIENTRY glEvalCoord2d(GLdouble,GLdouble); +void GLAPIENTRY glEvalCoord2dv(const GLdouble*); +void GLAPIENTRY glEvalCoord2f(GLfloat,GLfloat); +void GLAPIENTRY glEvalCoord2fv(const GLfloat*); +void GLAPIENTRY glEvalMesh1(GLenum,GLint,GLint); +void GLAPIENTRY glEvalMesh2(GLenum,GLint,GLint,GLint,GLint); +void GLAPIENTRY glEvalPoint1(GLint); +void GLAPIENTRY glEvalPoint2(GLint,GLint); +void GLAPIENTRY glFeedbackBuffer(GLsizei,GLenum,GLfloat*); +void GLAPIENTRY glFinish(void); +void GLAPIENTRY glFlush(void); +void GLAPIENTRY glFogf(GLenum,GLfloat); +void GLAPIENTRY glFogfv(GLenum,const GLfloat*); +void GLAPIENTRY glFogi(GLenum,GLint); +void GLAPIENTRY glFogiv(GLenum,const GLint*); +void GLAPIENTRY glFrontFace(GLenum); +void GLAPIENTRY glFrustum(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble); +GLuint GLAPIENTRY glGenLists(GLsizei); +void GLAPIENTRY glGenTextures(GLsizei,GLuint*); +void GLAPIENTRY glGetBooleanv(GLenum,GLboolean*); +void GLAPIENTRY glGetClipPlane(GLenum,GLdouble*); +void GLAPIENTRY glGetDoublev(GLenum,GLdouble*); +GLenum GLAPIENTRY glGetError(void); +void GLAPIENTRY glGetFloatv(GLenum,GLfloat*); +void GLAPIENTRY glGetIntegerv(GLenum,GLint*); +void GLAPIENTRY glGetLightfv(GLenum,GLenum,GLfloat*); +void GLAPIENTRY glGetLightiv(GLenum,GLenum,GLint*); +void GLAPIENTRY glGetMapdv(GLenum,GLenum,GLdouble*); +void GLAPIENTRY glGetMapfv(GLenum,GLenum,GLfloat*); +void GLAPIENTRY glGetMapiv(GLenum,GLenum,GLint*); +void GLAPIENTRY glGetMaterialfv(GLenum,GLenum,GLfloat*); +void GLAPIENTRY glGetMaterialiv(GLenum,GLenum,GLint*); +void GLAPIENTRY glGetPixelMapfv(GLenum,GLfloat*); +void GLAPIENTRY glGetPixelMapuiv(GLenum,GLuint*); +void GLAPIENTRY glGetPixelMapusv(GLenum,GLushort*); +void GLAPIENTRY glGetPointerv(GLenum,GLvoid**); +void GLAPIENTRY glGetPolygonStipple(GLubyte*); +const GLubyte * GLAPIENTRY glGetString(GLenum); +void GLAPIENTRY glGetTexEnvfv(GLenum,GLenum,GLfloat*); +void GLAPIENTRY glGetTexEnviv(GLenum,GLenum,GLint*); +void GLAPIENTRY glGetTexGendv(GLenum,GLenum,GLdouble*); +void GLAPIENTRY glGetTexGenfv(GLenum,GLenum,GLfloat*); +void GLAPIENTRY glGetTexGeniv(GLenum,GLenum,GLint*); +void GLAPIENTRY glGetTexImage(GLenum,GLint,GLenum,GLenum,GLvoid*); +void GLAPIENTRY glGetTexLevelParameterfv(GLenum,GLint,GLenum,GLfloat*); +void GLAPIENTRY glGetTexLevelParameteriv(GLenum,GLint,GLenum,GLint*); +void GLAPIENTRY glGetTexParameterfv(GLenum,GLenum,GLfloat*); +void GLAPIENTRY glGetTexParameteriv(GLenum,GLenum,GLint*); +void GLAPIENTRY glHint(GLenum,GLenum); +void GLAPIENTRY glIndexMask(GLuint); +void GLAPIENTRY glIndexPointer(GLenum,GLsizei,const GLvoid*); +void GLAPIENTRY glIndexd(GLdouble); +void GLAPIENTRY glIndexdv(const GLdouble*); +void GLAPIENTRY glIndexf(GLfloat); +void GLAPIENTRY glIndexfv(const GLfloat*); +void GLAPIENTRY glIndexi(GLint); +void GLAPIENTRY glIndexiv(const GLint*); +void GLAPIENTRY glIndexs(GLshort); +void GLAPIENTRY glIndexsv(const GLshort*); +void GLAPIENTRY glIndexub(GLubyte); +void GLAPIENTRY glIndexubv(const GLubyte*); +void GLAPIENTRY glInitNames(void); +void GLAPIENTRY glInterleavedArrays(GLenum,GLsizei,const GLvoid*); +GLboolean GLAPIENTRY glIsEnabled(GLenum); +GLboolean GLAPIENTRY glIsList(GLuint); +GLboolean GLAPIENTRY glIsTexture(GLuint); +void GLAPIENTRY glLightModelf(GLenum,GLfloat); +void GLAPIENTRY glLightModelfv(GLenum,const GLfloat*); +void GLAPIENTRY glLightModeli(GLenum,GLint); +void GLAPIENTRY glLightModeliv(GLenum,const GLint*); +void GLAPIENTRY glLightf(GLenum,GLenum,GLfloat); +void GLAPIENTRY glLightfv(GLenum,GLenum,const GLfloat*); +void GLAPIENTRY glLighti(GLenum,GLenum,GLint); +void GLAPIENTRY glLightiv(GLenum,GLenum,const GLint*); +void GLAPIENTRY glLineStipple(GLint,GLushort); +void GLAPIENTRY glLineWidth(GLfloat); +void GLAPIENTRY glListBase(GLuint); +void GLAPIENTRY glLoadIdentity(void); +void GLAPIENTRY glLoadMatrixd(const GLdouble*); +void GLAPIENTRY glLoadMatrixf(const GLfloat*); +void GLAPIENTRY glLoadName(GLuint); +void GLAPIENTRY glLogicOp(GLenum); +void GLAPIENTRY glMap1d(GLenum,GLdouble,GLdouble,GLint,GLint,const GLdouble*); +void GLAPIENTRY glMap1f(GLenum,GLfloat,GLfloat,GLint,GLint,const GLfloat*); +void GLAPIENTRY glMap2d(GLenum,GLdouble,GLdouble,GLint,GLint,GLdouble,GLdouble,GLint,GLint,const GLdouble*); +void GLAPIENTRY glMap2f(GLenum,GLfloat,GLfloat,GLint,GLint,GLfloat,GLfloat,GLint,GLint,const GLfloat*); +void GLAPIENTRY glMapGrid1d(GLint,GLdouble,GLdouble); +void GLAPIENTRY glMapGrid1f(GLint,GLfloat,GLfloat); +void GLAPIENTRY glMapGrid2d(GLint,GLdouble,GLdouble,GLint,GLdouble,GLdouble); +void GLAPIENTRY glMapGrid2f(GLint,GLfloat,GLfloat,GLint,GLfloat,GLfloat); +void GLAPIENTRY glMaterialf(GLenum,GLenum,GLfloat); +void GLAPIENTRY glMaterialfv(GLenum,GLenum,const GLfloat*); +void GLAPIENTRY glMateriali(GLenum,GLenum,GLint); +void GLAPIENTRY glMaterialiv(GLenum,GLenum,const GLint*); +void GLAPIENTRY glMatrixMode(GLenum); +void GLAPIENTRY glMultMatrixd(const GLdouble*); +void GLAPIENTRY glMultMatrixf(const GLfloat*); +void GLAPIENTRY glNewList(GLuint,GLenum); +void GLAPIENTRY glNormal3b(GLbyte,GLbyte,GLbyte); +void GLAPIENTRY glNormal3bv(const GLbyte*); +void GLAPIENTRY glNormal3d(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glNormal3dv(const GLdouble*); +void GLAPIENTRY glNormal3f(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glNormal3fv(const GLfloat*); +void GLAPIENTRY glNormal3i(GLint,GLint,GLint); +void GLAPIENTRY glNormal3iv(const GLint*); +void GLAPIENTRY glNormal3s(GLshort,GLshort,GLshort); +void GLAPIENTRY glNormal3sv(const GLshort*); +void GLAPIENTRY glNormalPointer(GLenum,GLsizei,const GLvoid*); +void GLAPIENTRY glOrtho(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glPassThrough(GLfloat); +void GLAPIENTRY glPixelMapfv(GLenum,GLint,const GLfloat*); +void GLAPIENTRY glPixelMapuiv(GLenum,GLint,const GLuint*); +void GLAPIENTRY glPixelMapusv(GLenum,GLint,const GLushort*); +void GLAPIENTRY glPixelStoref(GLenum,GLfloat); +void GLAPIENTRY glPixelStorei(GLenum,GLint); +void GLAPIENTRY glPixelTransferf(GLenum,GLfloat); +void GLAPIENTRY glPixelTransferi(GLenum,GLint); +void GLAPIENTRY glPixelZoom(GLfloat,GLfloat); +void GLAPIENTRY glPointSize(GLfloat); +void GLAPIENTRY glPolygonMode(GLenum,GLenum); +void GLAPIENTRY glPolygonOffset(GLfloat,GLfloat); +void GLAPIENTRY glPolygonStipple(const GLubyte*); +void GLAPIENTRY glPopAttrib(void); +void GLAPIENTRY glPopClientAttrib(void); +void GLAPIENTRY glPopMatrix(void); +void GLAPIENTRY glPopName(void); +void GLAPIENTRY glPrioritizeTextures(GLsizei,const GLuint*,const GLfloat*); +void GLAPIENTRY glPushAttrib(GLbitfield); +void GLAPIENTRY glPushClientAttrib(GLbitfield); +void GLAPIENTRY glPushMatrix(void); +void GLAPIENTRY glPushName(GLuint); +void GLAPIENTRY glRasterPos2d(GLdouble,GLdouble); +void GLAPIENTRY glRasterPos2dv(const GLdouble*); +void GLAPIENTRY glRasterPos2f(GLfloat,GLfloat); +void GLAPIENTRY glRasterPos2fv(const GLfloat*); +void GLAPIENTRY glRasterPos2i(GLint,GLint); +void GLAPIENTRY glRasterPos2iv(const GLint*); +void GLAPIENTRY glRasterPos2s(GLshort,GLshort); +void GLAPIENTRY glRasterPos2sv(const GLshort*); +void GLAPIENTRY glRasterPos3d(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glRasterPos3dv(const GLdouble*); +void GLAPIENTRY glRasterPos3f(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glRasterPos3fv(const GLfloat*); +void GLAPIENTRY glRasterPos3i(GLint,GLint,GLint); +void GLAPIENTRY glRasterPos3iv(const GLint*); +void GLAPIENTRY glRasterPos3s(GLshort,GLshort,GLshort); +void GLAPIENTRY glRasterPos3sv(const GLshort*); +void GLAPIENTRY glRasterPos4d(GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glRasterPos4dv(const GLdouble*); +void GLAPIENTRY glRasterPos4f(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glRasterPos4fv(const GLfloat*); +void GLAPIENTRY glRasterPos4i(GLint,GLint,GLint,GLint); +void GLAPIENTRY glRasterPos4iv(const GLint*); +void GLAPIENTRY glRasterPos4s(GLshort,GLshort,GLshort,GLshort); +void GLAPIENTRY glRasterPos4sv(const GLshort*); +void GLAPIENTRY glReadBuffer(GLenum); +void GLAPIENTRY glReadPixels(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLvoid*); +void GLAPIENTRY glRectd(GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glRectdv(const GLdouble*,const GLdouble*); +void GLAPIENTRY glRectf(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glRectfv(const GLfloat*,const GLfloat*); +void GLAPIENTRY glRecti(GLint,GLint,GLint,GLint); +void GLAPIENTRY glRectiv(const GLint*,const GLint*); +void GLAPIENTRY glRects(GLshort,GLshort,GLshort,GLshort); +void GLAPIENTRY glRectsv(const GLshort*,const GLshort*); +GLint GLAPIENTRY glRenderMode(GLenum); +void GLAPIENTRY glRotated(GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glRotatef(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glScaled(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glScalef(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glScissor(GLint,GLint,GLsizei,GLsizei); +void GLAPIENTRY glSelectBuffer(GLsizei,GLuint*); +void GLAPIENTRY glShadeModel(GLenum); +void GLAPIENTRY glStencilFunc(GLenum,GLint,GLuint); +void GLAPIENTRY glStencilMask(GLuint); +void GLAPIENTRY glStencilOp(GLenum,GLenum,GLenum); +void GLAPIENTRY glTexCoord1d(GLdouble); +void GLAPIENTRY glTexCoord1dv(const GLdouble*); +void GLAPIENTRY glTexCoord1f(GLfloat); +void GLAPIENTRY glTexCoord1fv(const GLfloat*); +void GLAPIENTRY glTexCoord1i(GLint); +void GLAPIENTRY glTexCoord1iv(const GLint*); +void GLAPIENTRY glTexCoord1s(GLshort); +void GLAPIENTRY glTexCoord1sv(const GLshort*); +void GLAPIENTRY glTexCoord2d(GLdouble,GLdouble); +void GLAPIENTRY glTexCoord2dv(const GLdouble*); +void GLAPIENTRY glTexCoord2f(GLfloat,GLfloat); +void GLAPIENTRY glTexCoord2fv(const GLfloat*); +void GLAPIENTRY glTexCoord2i(GLint,GLint); +void GLAPIENTRY glTexCoord2iv(const GLint*); +void GLAPIENTRY glTexCoord2s(GLshort,GLshort); +void GLAPIENTRY glTexCoord2sv(const GLshort*); +void GLAPIENTRY glTexCoord3d(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glTexCoord3dv(const GLdouble*); +void GLAPIENTRY glTexCoord3f(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glTexCoord3fv(const GLfloat*); +void GLAPIENTRY glTexCoord3i(GLint,GLint,GLint); +void GLAPIENTRY glTexCoord3iv(const GLint*); +void GLAPIENTRY glTexCoord3s(GLshort,GLshort,GLshort); +void GLAPIENTRY glTexCoord3sv(const GLshort*); +void GLAPIENTRY glTexCoord4d(GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glTexCoord4dv(const GLdouble*); +void GLAPIENTRY glTexCoord4f(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glTexCoord4fv(const GLfloat*); +void GLAPIENTRY glTexCoord4i(GLint,GLint,GLint,GLint); +void GLAPIENTRY glTexCoord4iv(const GLint*); +void GLAPIENTRY glTexCoord4s(GLshort,GLshort,GLshort,GLshort); +void GLAPIENTRY glTexCoord4sv(const GLshort*); +void GLAPIENTRY glTexCoordPointer(GLint,GLenum,GLsizei,const GLvoid*); +void GLAPIENTRY glTexEnvf(GLenum,GLenum,GLfloat); +void GLAPIENTRY glTexEnvfv(GLenum,GLenum,const GLfloat*); +void GLAPIENTRY glTexEnvi(GLenum,GLenum,GLint); +void GLAPIENTRY glTexEnviv(GLenum,GLenum,const GLint*); +void GLAPIENTRY glTexGend(GLenum,GLenum,GLdouble); +void GLAPIENTRY glTexGendv(GLenum,GLenum,const GLdouble*); +void GLAPIENTRY glTexGenf(GLenum,GLenum,GLfloat); +void GLAPIENTRY glTexGenfv(GLenum,GLenum,const GLfloat*); +void GLAPIENTRY glTexGeni(GLenum,GLenum,GLint); +void GLAPIENTRY glTexGeniv(GLenum,GLenum,const GLint*); +void GLAPIENTRY glTexImage1D(GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const GLvoid*); +void GLAPIENTRY glTexImage2D(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); +void GLAPIENTRY glTexParameterf(GLenum,GLenum,GLfloat); +void GLAPIENTRY glTexParameterfv(GLenum,GLenum,const GLfloat*); +void GLAPIENTRY glTexParameteri(GLenum,GLenum,GLint); +void GLAPIENTRY glTexParameteriv(GLenum,GLenum,const GLint*); +void GLAPIENTRY glTexSubImage1D(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); +void GLAPIENTRY glTexSubImage2D(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); +void GLAPIENTRY glTranslated(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glTranslatef(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glVertex2d(GLdouble,GLdouble); +void GLAPIENTRY glVertex2dv(const GLdouble*); +void GLAPIENTRY glVertex2f(GLfloat,GLfloat); +void GLAPIENTRY glVertex2fv(const GLfloat*); +void GLAPIENTRY glVertex2i(GLint,GLint); +void GLAPIENTRY glVertex2iv(const GLint*); +void GLAPIENTRY glVertex2s(GLshort,GLshort); +void GLAPIENTRY glVertex2sv(const GLshort*); +void GLAPIENTRY glVertex3d(GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glVertex3dv(const GLdouble*); +void GLAPIENTRY glVertex3f(GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glVertex3fv(const GLfloat*); +void GLAPIENTRY glVertex3i(GLint,GLint,GLint); +void GLAPIENTRY glVertex3iv(const GLint*); +void GLAPIENTRY glVertex3s(GLshort,GLshort,GLshort); +void GLAPIENTRY glVertex3sv(const GLshort*); +void GLAPIENTRY glVertex4d(GLdouble,GLdouble,GLdouble,GLdouble); +void GLAPIENTRY glVertex4dv(const GLdouble*); +void GLAPIENTRY glVertex4f(GLfloat,GLfloat,GLfloat,GLfloat); +void GLAPIENTRY glVertex4fv(const GLfloat*); +void GLAPIENTRY glVertex4i(GLint,GLint,GLint,GLint); +void GLAPIENTRY glVertex4iv(const GLint*); +void GLAPIENTRY glVertex4s(GLshort,GLshort,GLshort,GLshort); +void GLAPIENTRY glVertex4sv(const GLshort*); +void GLAPIENTRY glVertexPointer(GLint,GLenum,GLsizei,const GLvoid*); +void GLAPIENTRY glViewport(GLint,GLint,GLsizei,GLsizei); + +#endif /* __WINE_WGL_H */ diff --git a/reactos/include/reactos/wine/wgl_driver.h b/reactos/include/reactos/wine/wgl_driver.h index c4092e2f578..8d235017b84 100644 --- a/reactos/include/reactos/wine/wgl_driver.h +++ b/reactos/include/reactos/wine/wgl_driver.h @@ -7,7 +7,7 @@ #define WINE_GLAPI #endif -#define WINE_WGL_DRIVER_VERSION 6 +#define WINE_WGL_DRIVER_VERSION 10 struct wgl_context; struct wgl_pbuffer; @@ -25,6 +25,7 @@ struct opengl_funcs BOOL (WINE_GLAPI *p_wglMakeCurrent)(HDC,struct wgl_context *); BOOL (WINE_GLAPI *p_wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR *); BOOL (WINE_GLAPI *p_wglShareLists)(struct wgl_context *,struct wgl_context *); + BOOL (WINE_GLAPI *p_wglSwapBuffers)(HDC); } wgl; struct @@ -374,7 +375,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glActiveStencilFaceEXT)(GLenum); void (WINE_GLAPI *p_glActiveTexture)(GLenum); void (WINE_GLAPI *p_glActiveTextureARB)(GLenum); - void (WINE_GLAPI *p_glActiveVaryingNV)(GLuint,const char*); + void (WINE_GLAPI *p_glActiveVaryingNV)(GLuint,const GLchar*); void (WINE_GLAPI *p_glAlphaFragmentOp1ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glAlphaFragmentOp2ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glAlphaFragmentOp3ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint); @@ -384,7 +385,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glArrayElementEXT)(GLint); void (WINE_GLAPI *p_glArrayObjectATI)(GLenum,GLint,GLenum,GLsizei,GLuint,GLuint); void (WINE_GLAPI *p_glAsyncMarkerSGIX)(GLuint); - void (WINE_GLAPI *p_glAttachObjectARB)(unsigned int,unsigned int); + void (WINE_GLAPI *p_glAttachObjectARB)(GLhandleARB,GLhandleARB); void (WINE_GLAPI *p_glAttachShader)(GLuint,GLuint); void (WINE_GLAPI *p_glBeginConditionalRender)(GLuint,GLenum); void (WINE_GLAPI *p_glBeginConditionalRenderNV)(GLuint,GLenum); @@ -399,21 +400,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glBeginTransformFeedbackNV)(GLenum); void (WINE_GLAPI *p_glBeginVertexShaderEXT)(void); void (WINE_GLAPI *p_glBeginVideoCaptureNV)(GLuint); - void (WINE_GLAPI *p_glBindAttribLocation)(GLuint,GLuint,const char*); - void (WINE_GLAPI *p_glBindAttribLocationARB)(unsigned int,GLuint,const char*); + void (WINE_GLAPI *p_glBindAttribLocation)(GLuint,GLuint,const GLchar*); + void (WINE_GLAPI *p_glBindAttribLocationARB)(GLhandleARB,GLuint,const GLcharARB*); void (WINE_GLAPI *p_glBindBuffer)(GLenum,GLuint); void (WINE_GLAPI *p_glBindBufferARB)(GLenum,GLuint); void (WINE_GLAPI *p_glBindBufferBase)(GLenum,GLuint,GLuint); void (WINE_GLAPI *p_glBindBufferBaseEXT)(GLenum,GLuint,GLuint); void (WINE_GLAPI *p_glBindBufferBaseNV)(GLenum,GLuint,GLuint); - void (WINE_GLAPI *p_glBindBufferOffsetEXT)(GLenum,GLuint,GLuint,INT_PTR); - void (WINE_GLAPI *p_glBindBufferOffsetNV)(GLenum,GLuint,GLuint,INT_PTR); - void (WINE_GLAPI *p_glBindBufferRange)(GLenum,GLuint,GLuint,INT_PTR,INT_PTR); - void (WINE_GLAPI *p_glBindBufferRangeEXT)(GLenum,GLuint,GLuint,INT_PTR,INT_PTR); - void (WINE_GLAPI *p_glBindBufferRangeNV)(GLenum,GLuint,GLuint,INT_PTR,INT_PTR); - void (WINE_GLAPI *p_glBindFragDataLocation)(GLuint,GLuint,const char*); - void (WINE_GLAPI *p_glBindFragDataLocationEXT)(GLuint,GLuint,const char*); - void (WINE_GLAPI *p_glBindFragDataLocationIndexed)(GLuint,GLuint,GLuint,const char*); + void (WINE_GLAPI *p_glBindBufferOffsetEXT)(GLenum,GLuint,GLuint,GLintptr); + void (WINE_GLAPI *p_glBindBufferOffsetNV)(GLenum,GLuint,GLuint,GLintptr); + void (WINE_GLAPI *p_glBindBufferRange)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glBindBufferRangeEXT)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glBindBufferRangeNV)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glBindFragDataLocation)(GLuint,GLuint,const GLchar*); + void (WINE_GLAPI *p_glBindFragDataLocationEXT)(GLuint,GLuint,const GLchar*); + void (WINE_GLAPI *p_glBindFragDataLocationIndexed)(GLuint,GLuint,GLuint,const GLchar*); void (WINE_GLAPI *p_glBindFragmentShaderATI)(GLuint); void (WINE_GLAPI *p_glBindFramebuffer)(GLenum,GLuint); void (WINE_GLAPI *p_glBindFramebufferEXT)(GLenum,GLuint); @@ -436,8 +437,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glBindTransformFeedbackNV)(GLenum,GLuint); void (WINE_GLAPI *p_glBindVertexArray)(GLuint); void (WINE_GLAPI *p_glBindVertexArrayAPPLE)(GLuint); + void (WINE_GLAPI *p_glBindVertexBuffer)(GLuint,GLuint,GLintptr,GLsizei); void (WINE_GLAPI *p_glBindVertexShaderEXT)(GLuint); - void (WINE_GLAPI *p_glBindVideoCaptureStreamBufferNV)(GLuint,GLuint,GLenum,INT_PTR); + void (WINE_GLAPI *p_glBindVideoCaptureStreamBufferNV)(GLuint,GLuint,GLenum,GLintptrARB); void (WINE_GLAPI *p_glBindVideoCaptureStreamTextureNV)(GLuint,GLuint,GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glBinormal3bEXT)(GLbyte,GLbyte,GLbyte); void (WINE_GLAPI *p_glBinormal3bvEXT)(const GLbyte*); @@ -473,18 +475,20 @@ struct opengl_funcs void (WINE_GLAPI *p_glBlendFunciARB)(GLuint,GLenum,GLenum); void (WINE_GLAPI *p_glBlitFramebuffer)(GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum); void (WINE_GLAPI *p_glBlitFramebufferEXT)(GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum); - void (WINE_GLAPI *p_glBufferAddressRangeNV)(GLenum,GLuint,UINT64,INT_PTR); - void (WINE_GLAPI *p_glBufferData)(GLenum,INT_PTR,const GLvoid*,GLenum); - void (WINE_GLAPI *p_glBufferDataARB)(GLenum,INT_PTR,const GLvoid*,GLenum); + void (WINE_GLAPI *p_glBufferAddressRangeNV)(GLenum,GLuint,UINT64,GLsizeiptr); + void (WINE_GLAPI *p_glBufferData)(GLenum,GLsizeiptr,const GLvoid*,GLenum); + void (WINE_GLAPI *p_glBufferDataARB)(GLenum,GLsizeiptrARB,const GLvoid*,GLenum); void (WINE_GLAPI *p_glBufferParameteriAPPLE)(GLenum,GLenum,GLint); GLuint (WINE_GLAPI *p_glBufferRegionEnabled)(void); - void (WINE_GLAPI *p_glBufferSubData)(GLenum,INT_PTR,INT_PTR,const GLvoid*); - void (WINE_GLAPI *p_glBufferSubDataARB)(GLenum,INT_PTR,INT_PTR,const GLvoid*); + void (WINE_GLAPI *p_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const GLvoid*); + void (WINE_GLAPI *p_glBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,const GLvoid*); GLenum (WINE_GLAPI *p_glCheckFramebufferStatus)(GLenum); GLenum (WINE_GLAPI *p_glCheckFramebufferStatusEXT)(GLenum); GLenum (WINE_GLAPI *p_glCheckNamedFramebufferStatusEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glClampColor)(GLenum,GLenum); void (WINE_GLAPI *p_glClampColorARB)(GLenum,GLenum); + void (WINE_GLAPI *p_glClearBufferData)(GLenum,GLenum,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glClearBufferSubData)(GLenum,GLenum,GLintptr,GLsizeiptr,GLenum,GLenum,const void*); void (WINE_GLAPI *p_glClearBufferfi)(GLenum,GLint,GLfloat,GLint); void (WINE_GLAPI *p_glClearBufferfv)(GLenum,GLint,const GLfloat*); void (WINE_GLAPI *p_glClearBufferiv)(GLenum,GLint,const GLint*); @@ -493,6 +497,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glClearColorIuiEXT)(GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glClearDepthdNV)(GLdouble); void (WINE_GLAPI *p_glClearDepthf)(GLfloat); + void (WINE_GLAPI *p_glClearNamedBufferDataEXT)(GLuint,GLenum,GLenum,GLenum,const void*); + void (WINE_GLAPI *p_glClearNamedBufferSubDataEXT)(GLuint,GLenum,GLenum,GLenum,GLsizeiptr,GLsizeiptr,const void*); void (WINE_GLAPI *p_glClientActiveTexture)(GLenum); void (WINE_GLAPI *p_glClientActiveTextureARB)(GLenum); void (WINE_GLAPI *p_glClientActiveVertexStreamATI)(GLenum); @@ -500,12 +506,12 @@ struct opengl_funcs GLenum (WINE_GLAPI *p_glClientWaitSync)(GLvoid*,GLbitfield,UINT64); void (WINE_GLAPI *p_glColor3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glColor3fVertex3fvSUN)(const GLfloat*,const GLfloat*); - void (WINE_GLAPI *p_glColor3hNV)(unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glColor3hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glColor3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glColor3hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glColor4fNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glColor4fNormal3fVertex3fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*); - void (WINE_GLAPI *p_glColor4hNV)(unsigned short,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glColor4hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glColor4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glColor4hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glColor4ubVertex2fSUN)(GLubyte,GLubyte,GLubyte,GLubyte,GLfloat,GLfloat); void (WINE_GLAPI *p_glColor4ubVertex2fvSUN)(const GLubyte*,const GLfloat*); void (WINE_GLAPI *p_glColor4ubVertex3fSUN)(GLubyte,GLubyte,GLubyte,GLubyte,GLfloat,GLfloat,GLfloat); @@ -540,8 +546,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glCombinerParameterivNV)(GLenum,const GLint*); void (WINE_GLAPI *p_glCombinerStageParameterfvNV)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glCompileShader)(GLuint); - void (WINE_GLAPI *p_glCompileShaderARB)(unsigned int); - void (WINE_GLAPI *p_glCompileShaderIncludeARB)(GLuint,GLsizei,const char**,const GLint*); + void (WINE_GLAPI *p_glCompileShaderARB)(GLhandleARB); + void (WINE_GLAPI *p_glCompileShaderIncludeARB)(GLuint,GLsizei,const GLchar**,const GLint*); void (WINE_GLAPI *p_glCompressedMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glCompressedMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glCompressedMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*); @@ -578,7 +584,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glConvolutionParameteriEXT)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glConvolutionParameteriv)(GLenum,GLenum,const GLint*); void (WINE_GLAPI *p_glConvolutionParameterivEXT)(GLenum,GLenum,const GLint*); - void (WINE_GLAPI *p_glCopyBufferSubData)(GLenum,GLenum,INT_PTR,INT_PTR,INT_PTR); + void (WINE_GLAPI *p_glCopyBufferSubData)(GLenum,GLenum,GLintptr,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glCopyColorSubTable)(GLenum,GLsizei,GLint,GLint,GLsizei); void (WINE_GLAPI *p_glCopyColorSubTableEXT)(GLenum,GLsizei,GLint,GLint,GLsizei); void (WINE_GLAPI *p_glCopyColorTable)(GLenum,GLenum,GLint,GLint,GLsizei); @@ -587,6 +593,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glCopyConvolutionFilter1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei); void (WINE_GLAPI *p_glCopyConvolutionFilter2D)(GLenum,GLenum,GLint,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glCopyConvolutionFilter2DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLsizei); + void (WINE_GLAPI *p_glCopyImageSubData)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei); void (WINE_GLAPI *p_glCopyImageSubDataNV)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei); void (WINE_GLAPI *p_glCopyMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLint); void (WINE_GLAPI *p_glCopyMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint); @@ -610,21 +617,24 @@ struct opengl_funcs void (WINE_GLAPI *p_glCoverStrokePathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glCoverStrokePathNV)(GLuint,GLenum); GLuint (WINE_GLAPI *p_glCreateProgram)(void); - unsigned int (WINE_GLAPI *p_glCreateProgramObjectARB)(void); + GLhandleARB (WINE_GLAPI *p_glCreateProgramObjectARB)(void); GLuint (WINE_GLAPI *p_glCreateShader)(GLenum); - unsigned int (WINE_GLAPI *p_glCreateShaderObjectARB)(GLenum); - GLuint (WINE_GLAPI *p_glCreateShaderProgramEXT)(GLenum,const char*); - GLuint (WINE_GLAPI *p_glCreateShaderProgramv)(GLenum,GLsizei,const char* const*); + GLhandleARB (WINE_GLAPI *p_glCreateShaderObjectARB)(GLenum); + GLuint (WINE_GLAPI *p_glCreateShaderProgramEXT)(GLenum,const GLchar*); + GLuint (WINE_GLAPI *p_glCreateShaderProgramv)(GLenum,GLsizei,const GLchar* const*); GLvoid* (WINE_GLAPI *p_glCreateSyncFromCLeventARB)(void *,void *,GLbitfield); void (WINE_GLAPI *p_glCullParameterdvEXT)(GLenum,GLdouble*); void (WINE_GLAPI *p_glCullParameterfvEXT)(GLenum,GLfloat*); void (WINE_GLAPI *p_glCurrentPaletteMatrixARB)(GLint); + void (WINE_GLAPI *p_glDebugMessageCallback)(void *,const void*); void (WINE_GLAPI *p_glDebugMessageCallbackAMD)(void *,GLvoid*); void (WINE_GLAPI *p_glDebugMessageCallbackARB)(void *,const GLvoid*); + void (WINE_GLAPI *p_glDebugMessageControl)(GLenum,GLenum,GLenum,GLsizei,const GLuint*,GLboolean); void (WINE_GLAPI *p_glDebugMessageControlARB)(GLenum,GLenum,GLenum,GLsizei,const GLuint*,GLboolean); void (WINE_GLAPI *p_glDebugMessageEnableAMD)(GLenum,GLenum,GLsizei,const GLuint*,GLboolean); - void (WINE_GLAPI *p_glDebugMessageInsertAMD)(GLenum,GLenum,GLuint,GLsizei,const char*); - void (WINE_GLAPI *p_glDebugMessageInsertARB)(GLenum,GLenum,GLuint,GLenum,GLsizei,const char*); + void (WINE_GLAPI *p_glDebugMessageInsert)(GLenum,GLenum,GLuint,GLenum,GLsizei,const GLchar*); + void (WINE_GLAPI *p_glDebugMessageInsertAMD)(GLenum,GLenum,GLuint,GLsizei,const GLchar*); + void (WINE_GLAPI *p_glDebugMessageInsertARB)(GLenum,GLenum,GLuint,GLenum,GLsizei,const GLchar*); void (WINE_GLAPI *p_glDeformSGIX)(GLbitfield); void (WINE_GLAPI *p_glDeformationMap3dSGIX)(GLenum,GLdouble,GLdouble,GLint,GLint,GLdouble,GLdouble,GLint,GLint,GLdouble,GLdouble,GLint,GLint,const GLdouble*); void (WINE_GLAPI *p_glDeformationMap3fSGIX)(GLenum,GLfloat,GLfloat,GLint,GLint,GLfloat,GLfloat,GLint,GLint,GLfloat,GLfloat,GLint,GLint,const GLfloat*); @@ -637,9 +647,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glDeleteFragmentShaderATI)(GLuint); void (WINE_GLAPI *p_glDeleteFramebuffers)(GLsizei,const GLuint*); void (WINE_GLAPI *p_glDeleteFramebuffersEXT)(GLsizei,const GLuint*); - void (WINE_GLAPI *p_glDeleteNamedStringARB)(GLint,const char*); + void (WINE_GLAPI *p_glDeleteNamedStringARB)(GLint,const GLchar*); void (WINE_GLAPI *p_glDeleteNamesAMD)(GLenum,GLuint,const GLuint*); - void (WINE_GLAPI *p_glDeleteObjectARB)(unsigned int); + void (WINE_GLAPI *p_glDeleteObjectARB)(GLhandleARB); void (WINE_GLAPI *p_glDeleteObjectBufferATI)(GLuint); void (WINE_GLAPI *p_glDeleteOcclusionQueriesNV)(GLsizei,const GLuint*); void (WINE_GLAPI *p_glDeletePathsNV)(GLuint,GLsizei); @@ -667,7 +677,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glDepthRangeIndexed)(GLuint,GLdouble,GLdouble); void (WINE_GLAPI *p_glDepthRangedNV)(GLdouble,GLdouble); void (WINE_GLAPI *p_glDepthRangef)(GLfloat,GLfloat); - void (WINE_GLAPI *p_glDetachObjectARB)(unsigned int,unsigned int); + void (WINE_GLAPI *p_glDetachObjectARB)(GLhandleARB,GLhandleARB); void (WINE_GLAPI *p_glDetachShader)(GLuint,GLuint); void (WINE_GLAPI *p_glDetailTexFuncSGIS)(GLenum,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glDisableClientStateIndexedEXT)(GLenum,GLuint); @@ -677,6 +687,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glDisableVertexAttribArray)(GLuint); void (WINE_GLAPI *p_glDisableVertexAttribArrayARB)(GLuint); void (WINE_GLAPI *p_glDisablei)(GLenum,GLuint); + void (WINE_GLAPI *p_glDispatchCompute)(GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glDispatchComputeIndirect)(GLintptr); void (WINE_GLAPI *p_glDrawArraysEXT)(GLenum,GLint,GLsizei); void (WINE_GLAPI *p_glDrawArraysIndirect)(GLenum,const GLvoid*); void (WINE_GLAPI *p_glDrawArraysInstanced)(GLenum,GLint,GLsizei,GLsizei); @@ -743,9 +755,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glFinishFenceNV)(GLuint); void (WINE_GLAPI *p_glFinishObjectAPPLE)(GLenum,GLint); void (WINE_GLAPI *p_glFinishTextureSUNX)(void); - void (WINE_GLAPI *p_glFlushMappedBufferRange)(GLenum,INT_PTR,INT_PTR); - void (WINE_GLAPI *p_glFlushMappedBufferRangeAPPLE)(GLenum,INT_PTR,INT_PTR); - void (WINE_GLAPI *p_glFlushMappedNamedBufferRangeEXT)(GLuint,INT_PTR,INT_PTR); + void (WINE_GLAPI *p_glFlushMappedBufferRange)(GLenum,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glFlushMappedBufferRangeAPPLE)(GLenum,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glFlushMappedNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glFlushPixelDataRangeNV)(GLenum); void (WINE_GLAPI *p_glFlushRasterSGIX)(void); void (WINE_GLAPI *p_glFlushVertexArrayRangeAPPLE)(GLsizei,GLvoid*); @@ -762,8 +774,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glFogCoordfEXT)(GLfloat); void (WINE_GLAPI *p_glFogCoordfv)(const GLfloat*); void (WINE_GLAPI *p_glFogCoordfvEXT)(const GLfloat*); - void (WINE_GLAPI *p_glFogCoordhNV)(unsigned short); - void (WINE_GLAPI *p_glFogCoordhvNV)(const unsigned short*); + void (WINE_GLAPI *p_glFogCoordhNV)(GLhalfNV); + void (WINE_GLAPI *p_glFogCoordhvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glFogFuncSGIS)(GLsizei,const GLfloat*); void (WINE_GLAPI *p_glFragmentColorMaterialSGIX)(GLenum,GLenum); void (WINE_GLAPI *p_glFragmentLightModelfSGIX)(GLenum,GLfloat); @@ -782,6 +794,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glFrameZoomSGIX)(GLint); void (WINE_GLAPI *p_glFramebufferDrawBufferEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glFramebufferDrawBuffersEXT)(GLuint,GLsizei,const GLenum*); + void (WINE_GLAPI *p_glFramebufferParameteri)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glFramebufferReadBufferEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glFramebufferRenderbuffer)(GLenum,GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glFramebufferRenderbufferEXT)(GLenum,GLenum,GLenum,GLuint); @@ -832,24 +845,24 @@ struct opengl_funcs void (WINE_GLAPI *p_glGenerateMultiTexMipmapEXT)(GLenum,GLenum); void (WINE_GLAPI *p_glGenerateTextureMipmapEXT)(GLuint,GLenum); void (WINE_GLAPI *p_glGetActiveAtomicCounterBufferiv)(GLuint,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetActiveAttrib)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,char*); - void (WINE_GLAPI *p_glGetActiveAttribARB)(unsigned int,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,char*); - void (WINE_GLAPI *p_glGetActiveSubroutineName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,char*); - void (WINE_GLAPI *p_glGetActiveSubroutineUniformName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetActiveAttrib)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*); + void (WINE_GLAPI *p_glGetActiveAttribARB)(GLhandleARB,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLcharARB*); + void (WINE_GLAPI *p_glGetActiveSubroutineName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*); + void (WINE_GLAPI *p_glGetActiveSubroutineUniformName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetActiveSubroutineUniformiv)(GLuint,GLenum,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetActiveUniform)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,char*); - void (WINE_GLAPI *p_glGetActiveUniformARB)(unsigned int,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,char*); - void (WINE_GLAPI *p_glGetActiveUniformBlockName)(GLuint,GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetActiveUniform)(GLuint,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLchar*); + void (WINE_GLAPI *p_glGetActiveUniformARB)(GLhandleARB,GLuint,GLsizei,GLsizei*,GLint*,GLenum*,GLcharARB*); + void (WINE_GLAPI *p_glGetActiveUniformBlockName)(GLuint,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetActiveUniformBlockiv)(GLuint,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetActiveUniformName)(GLuint,GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetActiveUniformName)(GLuint,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetActiveUniformsiv)(GLuint,GLsizei,const GLuint*,GLenum,GLint*); - void (WINE_GLAPI *p_glGetActiveVaryingNV)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,char*); + void (WINE_GLAPI *p_glGetActiveVaryingNV)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*); void (WINE_GLAPI *p_glGetArrayObjectfvATI)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetArrayObjectivATI)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetAttachedObjectsARB)(unsigned int,GLsizei,GLsizei*,unsigned int*); + void (WINE_GLAPI *p_glGetAttachedObjectsARB)(GLhandleARB,GLsizei,GLsizei*,GLhandleARB*); void (WINE_GLAPI *p_glGetAttachedShaders)(GLuint,GLsizei,GLsizei*,GLuint*); - GLint (WINE_GLAPI *p_glGetAttribLocation)(GLuint,const char*); - GLint (WINE_GLAPI *p_glGetAttribLocationARB)(unsigned int,const char*); + GLint (WINE_GLAPI *p_glGetAttribLocation)(GLuint,const GLchar*); + GLint (WINE_GLAPI *p_glGetAttribLocationARB)(GLhandleARB,const GLcharARB*); void (WINE_GLAPI *p_glGetBooleanIndexedvEXT)(GLenum,GLuint,GLboolean*); void (WINE_GLAPI *p_glGetBooleani_v)(GLenum,GLuint,GLboolean*); void (WINE_GLAPI *p_glGetBufferParameteri64v)(GLenum,GLenum,INT64*); @@ -858,8 +871,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetBufferParameterui64vNV)(GLenum,GLenum,UINT64*); void (WINE_GLAPI *p_glGetBufferPointerv)(GLenum,GLenum,GLvoid**); void (WINE_GLAPI *p_glGetBufferPointervARB)(GLenum,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetBufferSubData)(GLenum,INT_PTR,INT_PTR,GLvoid*); - void (WINE_GLAPI *p_glGetBufferSubDataARB)(GLenum,INT_PTR,INT_PTR,GLvoid*); + void (WINE_GLAPI *p_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid*); + void (WINE_GLAPI *p_glGetBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,GLvoid*); void (WINE_GLAPI *p_glGetColorTable)(GLenum,GLenum,GLenum,GLvoid*); void (WINE_GLAPI *p_glGetColorTableEXT)(GLenum,GLenum,GLenum,GLvoid*); void (WINE_GLAPI *p_glGetColorTableParameterfv)(GLenum,GLenum,GLfloat*); @@ -884,8 +897,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetConvolutionParameterfvEXT)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetConvolutionParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetConvolutionParameterivEXT)(GLenum,GLenum,GLint*); - GLuint (WINE_GLAPI *p_glGetDebugMessageLogAMD)(GLuint,GLsizei,GLenum*,GLuint*,GLuint*,GLsizei*,char*); - GLuint (WINE_GLAPI *p_glGetDebugMessageLogARB)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,char*); + GLuint (WINE_GLAPI *p_glGetDebugMessageLog)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,GLchar*); + GLuint (WINE_GLAPI *p_glGetDebugMessageLogAMD)(GLuint,GLsizei,GLenum*,GLuint*,GLuint*,GLsizei*,GLchar*); + GLuint (WINE_GLAPI *p_glGetDebugMessageLogARB)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetDetailTexFuncSGIS)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetDoubleIndexedvEXT)(GLenum,GLuint,GLdouble*); void (WINE_GLAPI *p_glGetDoublei_v)(GLenum,GLuint,GLdouble*); @@ -895,18 +909,19 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetFloatIndexedvEXT)(GLenum,GLuint,GLfloat*); void (WINE_GLAPI *p_glGetFloati_v)(GLenum,GLuint,GLfloat*); void (WINE_GLAPI *p_glGetFogFuncSGIS)(GLfloat*); - GLint (WINE_GLAPI *p_glGetFragDataIndex)(GLuint,const char*); - GLint (WINE_GLAPI *p_glGetFragDataLocation)(GLuint,const char*); - GLint (WINE_GLAPI *p_glGetFragDataLocationEXT)(GLuint,const char*); + GLint (WINE_GLAPI *p_glGetFragDataIndex)(GLuint,const GLchar*); + GLint (WINE_GLAPI *p_glGetFragDataLocation)(GLuint,const GLchar*); + GLint (WINE_GLAPI *p_glGetFragDataLocationEXT)(GLuint,const GLchar*); void (WINE_GLAPI *p_glGetFragmentLightfvSGIX)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetFragmentLightivSGIX)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetFragmentMaterialfvSGIX)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetFragmentMaterialivSGIX)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetFramebufferAttachmentParameteriv)(GLenum,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetFramebufferAttachmentParameterivEXT)(GLenum,GLenum,GLenum,GLint*); + void (WINE_GLAPI *p_glGetFramebufferParameteriv)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetFramebufferParameterivEXT)(GLuint,GLenum,GLint*); GLenum (WINE_GLAPI *p_glGetGraphicsResetStatusARB)(void); - unsigned int (WINE_GLAPI *p_glGetHandleARB)(GLenum); + GLhandleARB (WINE_GLAPI *p_glGetHandleARB)(GLenum); void (WINE_GLAPI *p_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); void (WINE_GLAPI *p_glGetHistogramEXT)(GLenum,GLboolean,GLenum,GLenum,GLvoid*); void (WINE_GLAPI *p_glGetHistogramParameterfv)(GLenum,GLenum,GLfloat*); @@ -916,7 +931,7 @@ struct opengl_funcs UINT64 (WINE_GLAPI *p_glGetImageHandleNV)(GLuint,GLint,GLboolean,GLint,GLenum); void (WINE_GLAPI *p_glGetImageTransformParameterfvHP)(GLenum,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetImageTransformParameterivHP)(GLenum,GLenum,GLint*); - void (WINE_GLAPI *p_glGetInfoLogARB)(unsigned int,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetInfoLogARB)(GLhandleARB,GLsizei,GLsizei*,GLcharARB*); GLint (WINE_GLAPI *p_glGetInstrumentsSGIX)(void); void (WINE_GLAPI *p_glGetInteger64i_v)(GLenum,GLuint,INT64*); void (WINE_GLAPI *p_glGetInteger64v)(GLenum,INT64*); @@ -924,6 +939,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetIntegeri_v)(GLenum,GLuint,GLint*); void (WINE_GLAPI *p_glGetIntegerui64i_vNV)(GLenum,GLuint,UINT64*); void (WINE_GLAPI *p_glGetIntegerui64vNV)(GLenum,UINT64*); + void (WINE_GLAPI *p_glGetInternalformati64v)(GLenum,GLenum,GLenum,GLsizei,INT64*); void (WINE_GLAPI *p_glGetInternalformativ)(GLenum,GLenum,GLenum,GLsizei,GLint*); void (WINE_GLAPI *p_glGetInvariantBooleanvEXT)(GLuint,GLenum,GLboolean*); void (WINE_GLAPI *p_glGetInvariantFloatvEXT)(GLuint,GLenum,GLfloat*); @@ -961,8 +977,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetNamedBufferParameterivEXT)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedBufferParameterui64vNV)(GLuint,GLenum,UINT64*); void (WINE_GLAPI *p_glGetNamedBufferPointervEXT)(GLuint,GLenum,GLvoid**); - void (WINE_GLAPI *p_glGetNamedBufferSubDataEXT)(GLuint,INT_PTR,INT_PTR,GLvoid*); + void (WINE_GLAPI *p_glGetNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,GLvoid*); void (WINE_GLAPI *p_glGetNamedFramebufferAttachmentParameterivEXT)(GLuint,GLenum,GLenum,GLint*); + void (WINE_GLAPI *p_glGetNamedFramebufferParameterivEXT)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterIivEXT)(GLuint,GLenum,GLuint,GLint*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterIuivEXT)(GLuint,GLenum,GLuint,GLuint*); void (WINE_GLAPI *p_glGetNamedProgramLocalParameterdvEXT)(GLuint,GLenum,GLuint,GLdouble*); @@ -970,13 +987,15 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetNamedProgramStringEXT)(GLuint,GLenum,GLenum,GLvoid*); void (WINE_GLAPI *p_glGetNamedProgramivEXT)(GLuint,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetNamedRenderbufferParameterivEXT)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetNamedStringARB)(GLint,const char*,GLsizei,GLint*,char*); - void (WINE_GLAPI *p_glGetNamedStringivARB)(GLint,const char*,GLenum,GLint*); + void (WINE_GLAPI *p_glGetNamedStringARB)(GLint,const GLchar*,GLsizei,GLint*,GLchar*); + void (WINE_GLAPI *p_glGetNamedStringivARB)(GLint,const GLchar*,GLenum,GLint*); void (WINE_GLAPI *p_glGetObjectBufferfvATI)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetObjectBufferivATI)(GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetObjectParameterfvARB)(unsigned int,GLenum,GLfloat*); + void (WINE_GLAPI *p_glGetObjectLabel)(GLenum,GLuint,GLsizei,GLsizei*,GLchar*); + void (WINE_GLAPI *p_glGetObjectParameterfvARB)(GLhandleARB,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetObjectParameterivAPPLE)(GLenum,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetObjectParameterivARB)(unsigned int,GLenum,GLint*); + void (WINE_GLAPI *p_glGetObjectParameterivARB)(GLhandleARB,GLenum,GLint*); + void (WINE_GLAPI *p_glGetObjectPtrLabel)(const void*,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetOcclusionQueryivNV)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetOcclusionQueryuivNV)(GLuint,GLenum,GLuint*); void (WINE_GLAPI *p_glGetPathColorGenfvNV)(GLenum,GLenum,GLfloat*); @@ -994,12 +1013,14 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetPathTexGenivNV)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetPerfMonitorCounterDataAMD)(GLuint,GLenum,GLsizei,GLuint*,GLint*); void (WINE_GLAPI *p_glGetPerfMonitorCounterInfoAMD)(GLuint,GLuint,GLenum,GLvoid*); - void (WINE_GLAPI *p_glGetPerfMonitorCounterStringAMD)(GLuint,GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetPerfMonitorCounterStringAMD)(GLuint,GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetPerfMonitorCountersAMD)(GLuint,GLint*,GLint*,GLsizei,GLuint*); - void (WINE_GLAPI *p_glGetPerfMonitorGroupStringAMD)(GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetPerfMonitorGroupStringAMD)(GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetPerfMonitorGroupsAMD)(GLint*,GLsizei,GLuint*); void (WINE_GLAPI *p_glGetPixelTexGenParameterfvSGIS)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetPixelTexGenParameterivSGIS)(GLenum,GLint*); + void (WINE_GLAPI *p_glGetPixelTransformParameterfvEXT)(GLenum,GLenum,GLfloat*); + void (WINE_GLAPI *p_glGetPixelTransformParameterivEXT)(GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetPointerIndexedvEXT)(GLenum,GLuint,GLvoid**); void (WINE_GLAPI *p_glGetPointervEXT)(GLenum,GLvoid**); void (WINE_GLAPI *p_glGetProgramBinary)(GLuint,GLsizei,GLsizei*,GLenum*,GLvoid*); @@ -1007,7 +1028,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetProgramEnvParameterIuivNV)(GLenum,GLuint,GLuint*); void (WINE_GLAPI *p_glGetProgramEnvParameterdvARB)(GLenum,GLuint,GLdouble*); void (WINE_GLAPI *p_glGetProgramEnvParameterfvARB)(GLenum,GLuint,GLfloat*); - void (WINE_GLAPI *p_glGetProgramInfoLog)(GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetProgramInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*); + void (WINE_GLAPI *p_glGetProgramInterfaceiv)(GLuint,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetProgramLocalParameterIivNV)(GLenum,GLuint,GLint*); void (WINE_GLAPI *p_glGetProgramLocalParameterIuivNV)(GLenum,GLuint,GLuint*); void (WINE_GLAPI *p_glGetProgramLocalParameterdvARB)(GLenum,GLuint,GLdouble*); @@ -1016,8 +1038,13 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetProgramNamedParameterfvNV)(GLuint,GLsizei,const GLubyte*,GLfloat*); void (WINE_GLAPI *p_glGetProgramParameterdvNV)(GLenum,GLuint,GLenum,GLdouble*); void (WINE_GLAPI *p_glGetProgramParameterfvNV)(GLenum,GLuint,GLenum,GLfloat*); - void (WINE_GLAPI *p_glGetProgramPipelineInfoLog)(GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetProgramPipelineInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetProgramPipelineiv)(GLuint,GLenum,GLint*); + GLuint (WINE_GLAPI *p_glGetProgramResourceIndex)(GLuint,GLenum,const GLchar*); + GLint (WINE_GLAPI *p_glGetProgramResourceLocation)(GLuint,GLenum,const GLchar*); + GLint (WINE_GLAPI *p_glGetProgramResourceLocationIndex)(GLuint,GLenum,const GLchar*); + void (WINE_GLAPI *p_glGetProgramResourceName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*); + void (WINE_GLAPI *p_glGetProgramResourceiv)(GLuint,GLenum,GLuint,GLsizei,const GLenum*,GLsizei,GLsizei*,GLint*); void (WINE_GLAPI *p_glGetProgramStageiv)(GLuint,GLenum,GLenum,GLint*); void (WINE_GLAPI *p_glGetProgramStringARB)(GLenum,GLenum,GLvoid*); void (WINE_GLAPI *p_glGetProgramStringNV)(GLuint,GLenum,GLubyte*); @@ -1044,15 +1071,15 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetSamplerParameteriv)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetSeparableFilter)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*); void (WINE_GLAPI *p_glGetSeparableFilterEXT)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*); - void (WINE_GLAPI *p_glGetShaderInfoLog)(GLuint,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetShaderInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*); void (WINE_GLAPI *p_glGetShaderPrecisionFormat)(GLenum,GLenum,GLint*,GLint*); - void (WINE_GLAPI *p_glGetShaderSource)(GLuint,GLsizei,GLsizei*,char*); - void (WINE_GLAPI *p_glGetShaderSourceARB)(unsigned int,GLsizei,GLsizei*,char*); + void (WINE_GLAPI *p_glGetShaderSource)(GLuint,GLsizei,GLsizei*,GLchar*); + void (WINE_GLAPI *p_glGetShaderSourceARB)(GLhandleARB,GLsizei,GLsizei*,GLcharARB*); void (WINE_GLAPI *p_glGetShaderiv)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetSharpenTexFuncSGIS)(GLenum,GLfloat*); const GLubyte * (WINE_GLAPI *p_glGetStringi)(GLenum,GLuint); - GLuint (WINE_GLAPI *p_glGetSubroutineIndex)(GLuint,GLenum,const char*); - GLint (WINE_GLAPI *p_glGetSubroutineUniformLocation)(GLuint,GLenum,const char*); + GLuint (WINE_GLAPI *p_glGetSubroutineIndex)(GLuint,GLenum,const GLchar*); + GLint (WINE_GLAPI *p_glGetSubroutineUniformLocation)(GLuint,GLenum,const GLchar*); void (WINE_GLAPI *p_glGetSynciv)(GLvoid*,GLenum,GLsizei,GLsizei*,GLint*); void (WINE_GLAPI *p_glGetTexBumpParameterfvATI)(GLenum,GLfloat*); void (WINE_GLAPI *p_glGetTexBumpParameterivATI)(GLenum,GLint*); @@ -1072,22 +1099,22 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetTextureParameterivEXT)(GLuint,GLenum,GLenum,GLint*); UINT64 (WINE_GLAPI *p_glGetTextureSamplerHandleNV)(GLuint,GLuint); void (WINE_GLAPI *p_glGetTrackMatrixivNV)(GLenum,GLuint,GLenum,GLint*); - void (WINE_GLAPI *p_glGetTransformFeedbackVarying)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,char*); - void (WINE_GLAPI *p_glGetTransformFeedbackVaryingEXT)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,char*); + void (WINE_GLAPI *p_glGetTransformFeedbackVarying)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*); + void (WINE_GLAPI *p_glGetTransformFeedbackVaryingEXT)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*); void (WINE_GLAPI *p_glGetTransformFeedbackVaryingNV)(GLuint,GLuint,GLint*); - GLuint (WINE_GLAPI *p_glGetUniformBlockIndex)(GLuint,const char*); + GLuint (WINE_GLAPI *p_glGetUniformBlockIndex)(GLuint,const GLchar*); GLint (WINE_GLAPI *p_glGetUniformBufferSizeEXT)(GLuint,GLint); - void (WINE_GLAPI *p_glGetUniformIndices)(GLuint,GLsizei,const char* const*,GLuint*); - GLint (WINE_GLAPI *p_glGetUniformLocation)(GLuint,const char*); - GLint (WINE_GLAPI *p_glGetUniformLocationARB)(unsigned int,const char*); - INT_PTR (WINE_GLAPI *p_glGetUniformOffsetEXT)(GLuint,GLint); + void (WINE_GLAPI *p_glGetUniformIndices)(GLuint,GLsizei,const GLchar* const*,GLuint*); + GLint (WINE_GLAPI *p_glGetUniformLocation)(GLuint,const GLchar*); + GLint (WINE_GLAPI *p_glGetUniformLocationARB)(GLhandleARB,const GLcharARB*); + GLintptr (WINE_GLAPI *p_glGetUniformOffsetEXT)(GLuint,GLint); void (WINE_GLAPI *p_glGetUniformSubroutineuiv)(GLenum,GLint,GLuint*); void (WINE_GLAPI *p_glGetUniformdv)(GLuint,GLint,GLdouble*); void (WINE_GLAPI *p_glGetUniformfv)(GLuint,GLint,GLfloat*); - void (WINE_GLAPI *p_glGetUniformfvARB)(unsigned int,GLint,GLfloat*); + void (WINE_GLAPI *p_glGetUniformfvARB)(GLhandleARB,GLint,GLfloat*); void (WINE_GLAPI *p_glGetUniformi64vNV)(GLuint,GLint,INT64*); void (WINE_GLAPI *p_glGetUniformiv)(GLuint,GLint,GLint*); - void (WINE_GLAPI *p_glGetUniformivARB)(unsigned int,GLint,GLint*); + void (WINE_GLAPI *p_glGetUniformivARB)(GLhandleARB,GLint,GLint*); void (WINE_GLAPI *p_glGetUniformui64vNV)(GLuint,GLint,UINT64*); void (WINE_GLAPI *p_glGetUniformuiv)(GLuint,GLint,GLuint*); void (WINE_GLAPI *p_glGetUniformuivEXT)(GLuint,GLint,GLuint*); @@ -1097,7 +1124,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glGetVariantFloatvEXT)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetVariantIntegervEXT)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetVariantPointervEXT)(GLuint,GLenum,GLvoid**); - GLint (WINE_GLAPI *p_glGetVaryingLocationNV)(GLuint,const char*); + GLint (WINE_GLAPI *p_glGetVaryingLocationNV)(GLuint,const GLchar*); void (WINE_GLAPI *p_glGetVertexAttribArrayObjectfvATI)(GLuint,GLenum,GLfloat*); void (WINE_GLAPI *p_glGetVertexAttribArrayObjectivATI)(GLuint,GLenum,GLint*); void (WINE_GLAPI *p_glGetVertexAttribIiv)(GLuint,GLenum,GLint*); @@ -1162,7 +1189,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glImageTransformParameterfvHP)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glImageTransformParameteriHP)(GLenum,GLenum,GLint); void (WINE_GLAPI *p_glImageTransformParameterivHP)(GLenum,GLenum,const GLint*); - GLvoid* (WINE_GLAPI *p_glImportSyncEXT)(GLenum,INT_PTR,GLbitfield); + GLvoid* (WINE_GLAPI *p_glImportSyncEXT)(GLenum,GLintptr,GLbitfield); void (WINE_GLAPI *p_glIndexFormatNV)(GLenum,GLsizei); void (WINE_GLAPI *p_glIndexFuncEXT)(GLenum,GLclampf); void (WINE_GLAPI *p_glIndexMaterialEXT)(GLenum,GLenum); @@ -1171,6 +1198,12 @@ struct opengl_funcs void (WINE_GLAPI *p_glInsertComponentEXT)(GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glInstrumentsBufferSGIX)(GLsizei,GLint*); void (WINE_GLAPI *p_glInterpolatePathsNV)(GLuint,GLuint,GLuint,GLfloat); + void (WINE_GLAPI *p_glInvalidateBufferData)(GLuint); + void (WINE_GLAPI *p_glInvalidateBufferSubData)(GLuint,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glInvalidateFramebuffer)(GLenum,GLsizei,const GLenum*); + void (WINE_GLAPI *p_glInvalidateSubFramebuffer)(GLenum,GLsizei,const GLenum*,GLint,GLint,GLsizei,GLsizei); + void (WINE_GLAPI *p_glInvalidateTexImage)(GLuint,GLint); + void (WINE_GLAPI *p_glInvalidateTexSubImage)(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei); GLboolean (WINE_GLAPI *p_glIsAsyncMarkerSGIX)(GLuint); GLboolean (WINE_GLAPI *p_glIsBuffer)(GLuint); GLboolean (WINE_GLAPI *p_glIsBufferARB)(GLuint); @@ -1184,7 +1217,7 @@ struct opengl_funcs GLboolean (WINE_GLAPI *p_glIsImageHandleResidentNV)(UINT64); GLboolean (WINE_GLAPI *p_glIsNameAMD)(GLenum,GLuint); GLboolean (WINE_GLAPI *p_glIsNamedBufferResidentNV)(GLuint); - GLboolean (WINE_GLAPI *p_glIsNamedStringARB)(GLint,const char*); + GLboolean (WINE_GLAPI *p_glIsNamedStringARB)(GLint,const GLchar*); GLboolean (WINE_GLAPI *p_glIsObjectBufferATI)(GLuint); GLboolean (WINE_GLAPI *p_glIsOcclusionQueryNV)(GLuint); GLboolean (WINE_GLAPI *p_glIsPathNV)(GLuint); @@ -1211,7 +1244,7 @@ struct opengl_funcs GLboolean (WINE_GLAPI *p_glIsVertexAttribEnabledAPPLE)(GLuint,GLenum); void (WINE_GLAPI *p_glLightEnviSGIX)(GLenum,GLint); void (WINE_GLAPI *p_glLinkProgram)(GLuint); - void (WINE_GLAPI *p_glLinkProgramARB)(unsigned int); + void (WINE_GLAPI *p_glLinkProgramARB)(GLhandleARB); void (WINE_GLAPI *p_glListParameterfSGIX)(GLuint,GLenum,GLfloat); void (WINE_GLAPI *p_glListParameterfvSGIX)(GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glListParameteriSGIX)(GLuint,GLenum,GLint); @@ -1235,10 +1268,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glMakeTextureHandleResidentNV)(UINT64); GLvoid* (WINE_GLAPI *p_glMapBuffer)(GLenum,GLenum); GLvoid* (WINE_GLAPI *p_glMapBufferARB)(GLenum,GLenum); - GLvoid* (WINE_GLAPI *p_glMapBufferRange)(GLenum,INT_PTR,INT_PTR,GLbitfield); + GLvoid* (WINE_GLAPI *p_glMapBufferRange)(GLenum,GLintptr,GLsizeiptr,GLbitfield); void (WINE_GLAPI *p_glMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLint,GLint,GLboolean,const GLvoid*); GLvoid* (WINE_GLAPI *p_glMapNamedBufferEXT)(GLuint,GLenum); - GLvoid* (WINE_GLAPI *p_glMapNamedBufferRangeEXT)(GLuint,INT_PTR,INT_PTR,GLbitfield); + GLvoid* (WINE_GLAPI *p_glMapNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr,GLbitfield); GLvoid* (WINE_GLAPI *p_glMapObjectBufferATI)(GLuint); void (WINE_GLAPI *p_glMapParameterfvNV)(GLenum,GLenum,const GLfloat*); void (WINE_GLAPI *p_glMapParameterivNV)(GLenum,GLenum,const GLint*); @@ -1281,11 +1314,13 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultTransposeMatrixfARB)(const GLfloat*); void (WINE_GLAPI *p_glMultiDrawArrays)(GLenum,const GLint*,const GLsizei*,GLsizei); void (WINE_GLAPI *p_glMultiDrawArraysEXT)(GLenum,const GLint*,const GLsizei*,GLsizei); + void (WINE_GLAPI *p_glMultiDrawArraysIndirect)(GLenum,const void*,GLsizei,GLsizei); void (WINE_GLAPI *p_glMultiDrawArraysIndirectAMD)(GLenum,const GLvoid*,GLsizei,GLsizei); void (WINE_GLAPI *p_glMultiDrawElementArrayAPPLE)(GLenum,const GLint*,const GLsizei*,GLsizei); void (WINE_GLAPI *p_glMultiDrawElements)(GLenum,const GLsizei*,GLenum,const GLvoid* const*,GLsizei); void (WINE_GLAPI *p_glMultiDrawElementsBaseVertex)(GLenum,const GLsizei*,GLenum,const GLvoid* const*,GLsizei,const GLint*); void (WINE_GLAPI *p_glMultiDrawElementsEXT)(GLenum,const GLsizei*,GLenum,const GLvoid**,GLsizei); + void (WINE_GLAPI *p_glMultiDrawElementsIndirect)(GLenum,GLenum,const void*,GLsizei,GLsizei); void (WINE_GLAPI *p_glMultiDrawElementsIndirectAMD)(GLenum,GLenum,const GLvoid*,GLsizei,GLsizei); void (WINE_GLAPI *p_glMultiDrawRangeElementArrayAPPLE)(GLenum,GLuint,GLuint,const GLint*,const GLsizei*,GLsizei); void (WINE_GLAPI *p_glMultiModeDrawArraysIBM)(const GLenum*,const GLint*,const GLsizei*,GLsizei,GLint); @@ -1303,8 +1338,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord1fv)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord1fvARB)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord1fvSGIS)(GLenum,const GLfloat *); - void (WINE_GLAPI *p_glMultiTexCoord1hNV)(GLenum,unsigned short); - void (WINE_GLAPI *p_glMultiTexCoord1hvNV)(GLenum,const unsigned short*); + void (WINE_GLAPI *p_glMultiTexCoord1hNV)(GLenum,GLhalfNV); + void (WINE_GLAPI *p_glMultiTexCoord1hvNV)(GLenum,const GLhalfNV*); void (WINE_GLAPI *p_glMultiTexCoord1i)(GLenum,GLint); void (WINE_GLAPI *p_glMultiTexCoord1iARB)(GLenum,GLint); void (WINE_GLAPI *p_glMultiTexCoord1iSGIS)(GLenum,GLint); @@ -1329,8 +1364,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord2fv)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord2fvARB)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord2fvSGIS)(GLenum,GLfloat *); - void (WINE_GLAPI *p_glMultiTexCoord2hNV)(GLenum,unsigned short,unsigned short); - void (WINE_GLAPI *p_glMultiTexCoord2hvNV)(GLenum,const unsigned short*); + void (WINE_GLAPI *p_glMultiTexCoord2hNV)(GLenum,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glMultiTexCoord2hvNV)(GLenum,const GLhalfNV*); void (WINE_GLAPI *p_glMultiTexCoord2i)(GLenum,GLint,GLint); void (WINE_GLAPI *p_glMultiTexCoord2iARB)(GLenum,GLint,GLint); void (WINE_GLAPI *p_glMultiTexCoord2iSGIS)(GLenum,GLint,GLint); @@ -1355,8 +1390,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord3fv)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord3fvARB)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord3fvSGIS)(GLenum,GLfloat *); - void (WINE_GLAPI *p_glMultiTexCoord3hNV)(GLenum,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glMultiTexCoord3hvNV)(GLenum,const unsigned short*); + void (WINE_GLAPI *p_glMultiTexCoord3hNV)(GLenum,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glMultiTexCoord3hvNV)(GLenum,const GLhalfNV*); void (WINE_GLAPI *p_glMultiTexCoord3i)(GLenum,GLint,GLint,GLint); void (WINE_GLAPI *p_glMultiTexCoord3iARB)(GLenum,GLint,GLint,GLint); void (WINE_GLAPI *p_glMultiTexCoord3iSGIS)(GLenum,GLint,GLint,GLint); @@ -1381,8 +1416,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexCoord4fv)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord4fvARB)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glMultiTexCoord4fvSGIS)(GLenum,GLfloat *); - void (WINE_GLAPI *p_glMultiTexCoord4hNV)(GLenum,unsigned short,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glMultiTexCoord4hvNV)(GLenum,const unsigned short*); + void (WINE_GLAPI *p_glMultiTexCoord4hNV)(GLenum,GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glMultiTexCoord4hvNV)(GLenum,const GLhalfNV*); void (WINE_GLAPI *p_glMultiTexCoord4i)(GLenum,GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glMultiTexCoord4iARB)(GLenum,GLint,GLint,GLint,GLint); void (WINE_GLAPI *p_glMultiTexCoord4iSGIS)(GLenum,GLint,GLint,GLint,GLint); @@ -1428,9 +1463,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); - void (WINE_GLAPI *p_glNamedBufferDataEXT)(GLuint,INT_PTR,const GLvoid*,GLenum); - void (WINE_GLAPI *p_glNamedBufferSubDataEXT)(GLuint,INT_PTR,INT_PTR,const GLvoid*); - void (WINE_GLAPI *p_glNamedCopyBufferSubDataEXT)(GLuint,GLuint,INT_PTR,INT_PTR,INT_PTR); + void (WINE_GLAPI *p_glNamedBufferDataEXT)(GLuint,GLsizeiptr,const GLvoid*,GLenum); + void (WINE_GLAPI *p_glNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,const GLvoid*); + void (WINE_GLAPI *p_glNamedCopyBufferSubDataEXT)(GLuint,GLuint,GLintptr,GLintptr,GLsizeiptr); + void (WINE_GLAPI *p_glNamedFramebufferParameteriEXT)(GLuint,GLenum,GLint); void (WINE_GLAPI *p_glNamedFramebufferRenderbufferEXT)(GLuint,GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glNamedFramebufferTexture1DEXT)(GLuint,GLenum,GLenum,GLuint,GLint); void (WINE_GLAPI *p_glNamedFramebufferTexture2DEXT)(GLuint,GLenum,GLenum,GLuint,GLint); @@ -1453,13 +1489,13 @@ struct opengl_funcs void (WINE_GLAPI *p_glNamedRenderbufferStorageEXT)(GLuint,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glNamedRenderbufferStorageMultisampleCoverageEXT)(GLuint,GLsizei,GLsizei,GLenum,GLsizei,GLsizei); void (WINE_GLAPI *p_glNamedRenderbufferStorageMultisampleEXT)(GLuint,GLsizei,GLenum,GLsizei,GLsizei); - void (WINE_GLAPI *p_glNamedStringARB)(GLenum,GLint,const char*,GLint,const char*); + void (WINE_GLAPI *p_glNamedStringARB)(GLenum,GLint,const GLchar*,GLint,const GLchar*); GLuint (WINE_GLAPI *p_glNewBufferRegion)(GLenum); GLuint (WINE_GLAPI *p_glNewObjectBufferATI)(GLsizei,const GLvoid*,GLenum); void (WINE_GLAPI *p_glNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glNormal3fVertex3fvSUN)(const GLfloat*,const GLfloat*); - void (WINE_GLAPI *p_glNormal3hNV)(unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glNormal3hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glNormal3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glNormal3hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glNormalFormatNV)(GLenum,GLsizei); void (WINE_GLAPI *p_glNormalP3ui)(GLenum,GLuint); void (WINE_GLAPI *p_glNormalP3uiv)(GLenum,const GLuint*); @@ -1476,6 +1512,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glNormalStream3ivATI)(GLenum,const GLint*); void (WINE_GLAPI *p_glNormalStream3sATI)(GLenum,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glNormalStream3svATI)(GLenum,const GLshort*); + void (WINE_GLAPI *p_glObjectLabel)(GLenum,GLuint,GLsizei,const GLchar*); + void (WINE_GLAPI *p_glObjectPtrLabel)(const void*,GLsizei,const GLchar*); GLenum (WINE_GLAPI *p_glObjectPurgeableAPPLE)(GLenum,GLuint,GLenum); GLenum (WINE_GLAPI *p_glObjectUnpurgeableAPPLE)(GLenum,GLuint,GLenum); void (WINE_GLAPI *p_glPNTrianglesfATI)(GLenum,GLfloat); @@ -1503,7 +1541,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glPathTexGenNV)(GLenum,GLenum,GLint,const GLfloat*); void (WINE_GLAPI *p_glPauseTransformFeedback)(void); void (WINE_GLAPI *p_glPauseTransformFeedbackNV)(void); - void (WINE_GLAPI *p_glPixelDataRangeNV)(GLenum,GLsizei,GLvoid*); + void (WINE_GLAPI *p_glPixelDataRangeNV)(GLenum,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glPixelTexGenParameterfSGIS)(GLenum,GLfloat); void (WINE_GLAPI *p_glPixelTexGenParameterfvSGIS)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glPixelTexGenParameteriSGIS)(GLenum,GLint); @@ -1529,6 +1567,7 @@ struct opengl_funcs GLint (WINE_GLAPI *p_glPollAsyncSGIX)(GLuint*); GLint (WINE_GLAPI *p_glPollInstrumentsSGIX)(GLint*); void (WINE_GLAPI *p_glPolygonOffsetEXT)(GLfloat,GLfloat); + void (WINE_GLAPI *p_glPopDebugGroup)(void); void (WINE_GLAPI *p_glPresentFrameDualFillNV)(GLuint,UINT64,GLuint,GLuint,GLenum,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint); void (WINE_GLAPI *p_glPresentFrameKeyedNV)(GLuint,UINT64,GLuint,GLuint,GLenum,GLenum,GLuint,GLuint,GLenum,GLuint,GLuint); void (WINE_GLAPI *p_glPrimitiveRestartIndex)(GLuint); @@ -1700,6 +1739,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glProvokingVertex)(GLenum); void (WINE_GLAPI *p_glProvokingVertexEXT)(GLenum); void (WINE_GLAPI *p_glPushClientAttribDefaultEXT)(GLbitfield); + void (WINE_GLAPI *p_glPushDebugGroup)(GLenum,GLuint,GLsizei,const GLchar*); void (WINE_GLAPI *p_glQueryCounter)(GLuint,GLenum); void (WINE_GLAPI *p_glReadBufferRegion)(GLenum,GLint,GLint,GLsizei,GLsizei); void (WINE_GLAPI *p_glReadInstrumentsSGIX)(GLint); @@ -1772,8 +1812,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glSecondaryColor3fEXT)(GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glSecondaryColor3fv)(const GLfloat*); void (WINE_GLAPI *p_glSecondaryColor3fvEXT)(const GLfloat*); - void (WINE_GLAPI *p_glSecondaryColor3hNV)(unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glSecondaryColor3hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glSecondaryColor3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glSecondaryColor3hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glSecondaryColor3i)(GLint,GLint,GLint); void (WINE_GLAPI *p_glSecondaryColor3iEXT)(GLint,GLint,GLint); void (WINE_GLAPI *p_glSecondaryColor3iv)(const GLint*); @@ -1815,8 +1855,9 @@ struct opengl_funcs void (WINE_GLAPI *p_glShaderOp1EXT)(GLenum,GLuint,GLuint); void (WINE_GLAPI *p_glShaderOp2EXT)(GLenum,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glShaderOp3EXT)(GLenum,GLuint,GLuint,GLuint,GLuint); - void (WINE_GLAPI *p_glShaderSource)(GLuint,GLsizei,const char* const*,const GLint*); - void (WINE_GLAPI *p_glShaderSourceARB)(unsigned int,GLsizei,const char**,const GLint*); + void (WINE_GLAPI *p_glShaderSource)(GLuint,GLsizei,const GLchar* const*,const GLint*); + void (WINE_GLAPI *p_glShaderSourceARB)(GLhandleARB,GLsizei,const GLcharARB**,const GLint*); + void (WINE_GLAPI *p_glShaderStorageBlockBinding)(GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glSharpenTexFuncSGIS)(GLenum,GLsizei,const GLfloat*); void (WINE_GLAPI *p_glSpriteParameterfSGIX)(GLenum,GLfloat); void (WINE_GLAPI *p_glSpriteParameterfvSGIX)(GLenum,const GLfloat*); @@ -1858,10 +1899,11 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexBuffer)(GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glTexBufferARB)(GLenum,GLenum,GLuint); void (WINE_GLAPI *p_glTexBufferEXT)(GLenum,GLenum,GLuint); + void (WINE_GLAPI *p_glTexBufferRange)(GLenum,GLenum,GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glTexBumpParameterfvATI)(GLenum,const GLfloat*); void (WINE_GLAPI *p_glTexBumpParameterivATI)(GLenum,const GLint*); - void (WINE_GLAPI *p_glTexCoord1hNV)(unsigned short); - void (WINE_GLAPI *p_glTexCoord1hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glTexCoord1hNV)(GLhalfNV); + void (WINE_GLAPI *p_glTexCoord1hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glTexCoord2fColor3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord2fColor3fVertex3fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord2fColor4fNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); @@ -1872,16 +1914,16 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexCoord2fNormal3fVertex3fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord2fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord2fVertex3fvSUN)(const GLfloat*,const GLfloat*); - void (WINE_GLAPI *p_glTexCoord2hNV)(unsigned short,unsigned short); - void (WINE_GLAPI *p_glTexCoord2hvNV)(const unsigned short*); - void (WINE_GLAPI *p_glTexCoord3hNV)(unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glTexCoord3hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glTexCoord2hNV)(GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glTexCoord2hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glTexCoord3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glTexCoord3hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glTexCoord4fColor4fNormal3fVertex4fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord4fColor4fNormal3fVertex4fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*,const GLfloat*); void (WINE_GLAPI *p_glTexCoord4fVertex4fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat); void (WINE_GLAPI *p_glTexCoord4fVertex4fvSUN)(const GLfloat*,const GLfloat*); - void (WINE_GLAPI *p_glTexCoord4hNV)(unsigned short,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glTexCoord4hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glTexCoord4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glTexCoord4hvNV)(const GLhalfNV*); void (WINE_GLAPI *p_glTexCoordFormatNV)(GLint,GLenum,GLsizei); void (WINE_GLAPI *p_glTexCoordP1ui)(GLenum,GLuint); void (WINE_GLAPI *p_glTexCoordP1uiv)(GLenum,const GLuint*); @@ -1909,7 +1951,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexRenderbufferNV)(GLenum,GLuint); void (WINE_GLAPI *p_glTexStorage1D)(GLenum,GLsizei,GLenum,GLsizei); void (WINE_GLAPI *p_glTexStorage2D)(GLenum,GLsizei,GLenum,GLsizei,GLsizei); + void (WINE_GLAPI *p_glTexStorage2DMultisample)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTexStorage3D)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei); + void (WINE_GLAPI *p_glTexStorage3DMultisample)(GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei,GLboolean); + void (WINE_GLAPI *p_glTexStorageSparseAMD)(GLenum,GLenum,GLsizei,GLsizei,GLsizei,GLsizei,GLbitfield); void (WINE_GLAPI *p_glTexSubImage1DEXT)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glTexSubImage2DEXT)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); @@ -1917,6 +1962,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glTexSubImage4DSGIS)(GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glTextureBarrierNV)(void); void (WINE_GLAPI *p_glTextureBufferEXT)(GLuint,GLenum,GLenum,GLuint); + void (WINE_GLAPI *p_glTextureBufferRangeEXT)(GLuint,GLenum,GLenum,GLuint,GLintptr,GLsizeiptr); void (WINE_GLAPI *p_glTextureColorMaskSGIS)(GLboolean,GLboolean,GLboolean,GLboolean); void (WINE_GLAPI *p_glTextureImage1DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLint,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glTextureImage2DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*); @@ -1938,15 +1984,19 @@ struct opengl_funcs void (WINE_GLAPI *p_glTextureRenderbufferEXT)(GLuint,GLenum,GLuint); void (WINE_GLAPI *p_glTextureStorage1DEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei); void (WINE_GLAPI *p_glTextureStorage2DEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei); + void (WINE_GLAPI *p_glTextureStorage2DMultisampleEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLboolean); void (WINE_GLAPI *p_glTextureStorage3DEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei); + void (WINE_GLAPI *p_glTextureStorage3DMultisampleEXT)(GLuint,GLenum,GLsizei,GLenum,GLsizei,GLsizei,GLsizei,GLboolean); + void (WINE_GLAPI *p_glTextureStorageSparseAMD)(GLuint,GLenum,GLenum,GLsizei,GLsizei,GLsizei,GLsizei,GLbitfield); void (WINE_GLAPI *p_glTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); void (WINE_GLAPI *p_glTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*); + void (WINE_GLAPI *p_glTextureView)(GLuint,GLenum,GLuint,GLenum,GLuint,GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glTrackMatrixNV)(GLenum,GLuint,GLenum,GLenum); void (WINE_GLAPI *p_glTransformFeedbackAttribsNV)(GLuint,const GLint*,GLenum); void (WINE_GLAPI *p_glTransformFeedbackStreamAttribsNV)(GLsizei,const GLint*,GLsizei,const GLint*,GLenum); - void (WINE_GLAPI *p_glTransformFeedbackVaryings)(GLuint,GLsizei,const char* const*,GLenum); - void (WINE_GLAPI *p_glTransformFeedbackVaryingsEXT)(GLuint,GLsizei,const char**,GLenum); + void (WINE_GLAPI *p_glTransformFeedbackVaryings)(GLuint,GLsizei,const GLchar* const*,GLenum); + void (WINE_GLAPI *p_glTransformFeedbackVaryingsEXT)(GLuint,GLsizei,const GLchar**,GLenum); void (WINE_GLAPI *p_glTransformFeedbackVaryingsNV)(GLuint,GLsizei,const GLint*,GLenum); void (WINE_GLAPI *p_glTransformPathNV)(GLuint,GLuint,GLenum,const GLfloat*); void (WINE_GLAPI *p_glUniform1d)(GLint,GLdouble); @@ -2056,21 +2106,21 @@ struct opengl_funcs void (WINE_GLAPI *p_glUnmapObjectBufferATI)(GLuint); void (WINE_GLAPI *p_glUpdateObjectBufferATI)(GLuint,GLuint,GLsizei,const GLvoid*,GLenum); void (WINE_GLAPI *p_glUseProgram)(GLuint); - void (WINE_GLAPI *p_glUseProgramObjectARB)(unsigned int); + void (WINE_GLAPI *p_glUseProgramObjectARB)(GLhandleARB); void (WINE_GLAPI *p_glUseProgramStages)(GLuint,GLbitfield,GLuint); void (WINE_GLAPI *p_glUseShaderProgramEXT)(GLenum,GLuint); void (WINE_GLAPI *p_glVDPAUFiniNV)(void); - void (WINE_GLAPI *p_glVDPAUGetSurfaceivNV)(INT_PTR,GLenum,GLsizei,GLsizei*,GLint*); + void (WINE_GLAPI *p_glVDPAUGetSurfaceivNV)(GLvdpauSurfaceNV,GLenum,GLsizei,GLsizei*,GLint*); void (WINE_GLAPI *p_glVDPAUInitNV)(const GLvoid*,const GLvoid*); - void (WINE_GLAPI *p_glVDPAUIsSurfaceNV)(INT_PTR); - void (WINE_GLAPI *p_glVDPAUMapSurfacesNV)(GLsizei,const INT_PTR*); - INT_PTR (WINE_GLAPI *p_glVDPAURegisterOutputSurfaceNV)(GLvoid*,GLenum,GLsizei,const GLuint*); - INT_PTR (WINE_GLAPI *p_glVDPAURegisterVideoSurfaceNV)(GLvoid*,GLenum,GLsizei,const GLuint*); - void (WINE_GLAPI *p_glVDPAUSurfaceAccessNV)(INT_PTR,GLenum); - void (WINE_GLAPI *p_glVDPAUUnmapSurfacesNV)(GLsizei,const INT_PTR*); - void (WINE_GLAPI *p_glVDPAUUnregisterSurfaceNV)(INT_PTR); + void (WINE_GLAPI *p_glVDPAUIsSurfaceNV)(GLvdpauSurfaceNV); + void (WINE_GLAPI *p_glVDPAUMapSurfacesNV)(GLsizei,const GLvdpauSurfaceNV*); + GLvdpauSurfaceNV (WINE_GLAPI *p_glVDPAURegisterOutputSurfaceNV)(GLvoid*,GLenum,GLsizei,const GLuint*); + GLvdpauSurfaceNV (WINE_GLAPI *p_glVDPAURegisterVideoSurfaceNV)(const GLvoid*,GLenum,GLsizei,const GLuint*); + void (WINE_GLAPI *p_glVDPAUSurfaceAccessNV)(GLvdpauSurfaceNV,GLenum); + void (WINE_GLAPI *p_glVDPAUUnmapSurfacesNV)(GLsizei,const GLvdpauSurfaceNV*); + void (WINE_GLAPI *p_glVDPAUUnregisterSurfaceNV)(GLvdpauSurfaceNV); void (WINE_GLAPI *p_glValidateProgram)(GLuint); - void (WINE_GLAPI *p_glValidateProgramARB)(unsigned int); + void (WINE_GLAPI *p_glValidateProgramARB)(GLhandleARB); void (WINE_GLAPI *p_glValidateProgramPipeline)(GLuint); void (WINE_GLAPI *p_glVariantArrayObjectATI)(GLuint,GLenum,GLsizei,GLuint,GLuint); void (WINE_GLAPI *p_glVariantPointerEXT)(GLuint,GLenum,GLuint,const GLvoid*); @@ -2082,16 +2132,22 @@ struct opengl_funcs void (WINE_GLAPI *p_glVariantubvEXT)(GLuint,const GLubyte*); void (WINE_GLAPI *p_glVariantuivEXT)(GLuint,const GLuint*); void (WINE_GLAPI *p_glVariantusvEXT)(GLuint,const GLushort*); - void (WINE_GLAPI *p_glVertex2hNV)(unsigned short,unsigned short); - void (WINE_GLAPI *p_glVertex2hvNV)(const unsigned short*); - void (WINE_GLAPI *p_glVertex3hNV)(unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glVertex3hvNV)(const unsigned short*); - void (WINE_GLAPI *p_glVertex4hNV)(unsigned short,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glVertex4hvNV)(const unsigned short*); + void (WINE_GLAPI *p_glVertex2hNV)(GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glVertex2hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glVertex3hNV)(GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glVertex3hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glVertex4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glVertex4hvNV)(const GLhalfNV*); + void (WINE_GLAPI *p_glVertexArrayBindVertexBufferEXT)(GLuint,GLuint,GLuint,GLintptr,GLsizei); void (WINE_GLAPI *p_glVertexArrayParameteriAPPLE)(GLenum,GLint); void (WINE_GLAPI *p_glVertexArrayRangeAPPLE)(GLsizei,GLvoid*); void (WINE_GLAPI *p_glVertexArrayRangeNV)(GLsizei,const GLvoid*); - void (WINE_GLAPI *p_glVertexArrayVertexAttribLOffsetEXT)(GLuint,GLuint,GLuint,GLint,GLenum,GLsizei,INT_PTR); + void (WINE_GLAPI *p_glVertexArrayVertexAttribBindingEXT)(GLuint,GLuint,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexAttribFormatEXT)(GLuint,GLuint,GLint,GLenum,GLboolean,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexAttribIFormatEXT)(GLuint,GLuint,GLint,GLenum,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexAttribLFormatEXT)(GLuint,GLuint,GLint,GLenum,GLuint); + void (WINE_GLAPI *p_glVertexArrayVertexAttribLOffsetEXT)(GLuint,GLuint,GLuint,GLint,GLenum,GLsizei,GLintptr); + void (WINE_GLAPI *p_glVertexArrayVertexBindingDivisorEXT)(GLuint,GLuint,GLuint); void (WINE_GLAPI *p_glVertexAttrib1d)(GLuint,GLdouble); void (WINE_GLAPI *p_glVertexAttrib1dARB)(GLuint,GLdouble); void (WINE_GLAPI *p_glVertexAttrib1dNV)(GLuint,GLdouble); @@ -2104,8 +2160,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttrib1fv)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib1fvARB)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib1fvNV)(GLuint,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttrib1hNV)(GLuint,unsigned short); - void (WINE_GLAPI *p_glVertexAttrib1hvNV)(GLuint,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttrib1hNV)(GLuint,GLhalfNV); + void (WINE_GLAPI *p_glVertexAttrib1hvNV)(GLuint,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttrib1s)(GLuint,GLshort); void (WINE_GLAPI *p_glVertexAttrib1sARB)(GLuint,GLshort); void (WINE_GLAPI *p_glVertexAttrib1sNV)(GLuint,GLshort); @@ -2124,8 +2180,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttrib2fv)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib2fvARB)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib2fvNV)(GLuint,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttrib2hNV)(GLuint,unsigned short,unsigned short); - void (WINE_GLAPI *p_glVertexAttrib2hvNV)(GLuint,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttrib2hNV)(GLuint,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glVertexAttrib2hvNV)(GLuint,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttrib2s)(GLuint,GLshort,GLshort); void (WINE_GLAPI *p_glVertexAttrib2sARB)(GLuint,GLshort,GLshort); void (WINE_GLAPI *p_glVertexAttrib2sNV)(GLuint,GLshort,GLshort); @@ -2144,8 +2200,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttrib3fv)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib3fvARB)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib3fvNV)(GLuint,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttrib3hNV)(GLuint,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glVertexAttrib3hvNV)(GLuint,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttrib3hNV)(GLuint,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glVertexAttrib3hvNV)(GLuint,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttrib3s)(GLuint,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glVertexAttrib3sARB)(GLuint,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glVertexAttrib3sNV)(GLuint,GLshort,GLshort,GLshort); @@ -2180,8 +2236,8 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttrib4fv)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib4fvARB)(GLuint,const GLfloat*); void (WINE_GLAPI *p_glVertexAttrib4fvNV)(GLuint,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttrib4hNV)(GLuint,unsigned short,unsigned short,unsigned short,unsigned short); - void (WINE_GLAPI *p_glVertexAttrib4hvNV)(GLuint,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttrib4hNV)(GLuint,GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV); + void (WINE_GLAPI *p_glVertexAttrib4hvNV)(GLuint,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttrib4iv)(GLuint,const GLint*); void (WINE_GLAPI *p_glVertexAttrib4ivARB)(GLuint,const GLint*); void (WINE_GLAPI *p_glVertexAttrib4s)(GLuint,GLshort,GLshort,GLshort,GLshort); @@ -2199,8 +2255,10 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttrib4usv)(GLuint,const GLushort*); void (WINE_GLAPI *p_glVertexAttrib4usvARB)(GLuint,const GLushort*); void (WINE_GLAPI *p_glVertexAttribArrayObjectATI)(GLuint,GLint,GLenum,GLboolean,GLsizei,GLuint,GLuint); + void (WINE_GLAPI *p_glVertexAttribBinding)(GLuint,GLuint); void (WINE_GLAPI *p_glVertexAttribDivisor)(GLuint,GLuint); void (WINE_GLAPI *p_glVertexAttribDivisorARB)(GLuint,GLuint); + void (WINE_GLAPI *p_glVertexAttribFormat)(GLuint,GLint,GLenum,GLboolean,GLuint); void (WINE_GLAPI *p_glVertexAttribFormatNV)(GLuint,GLint,GLenum,GLboolean,GLsizei); void (WINE_GLAPI *p_glVertexAttribI1i)(GLuint,GLint); void (WINE_GLAPI *p_glVertexAttribI1iEXT)(GLuint,GLint); @@ -2242,6 +2300,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttribI4uivEXT)(GLuint,const GLuint*); void (WINE_GLAPI *p_glVertexAttribI4usv)(GLuint,const GLushort*); void (WINE_GLAPI *p_glVertexAttribI4usvEXT)(GLuint,const GLushort*); + void (WINE_GLAPI *p_glVertexAttribIFormat)(GLuint,GLint,GLenum,GLuint); void (WINE_GLAPI *p_glVertexAttribIFormatNV)(GLuint,GLint,GLenum,GLsizei); void (WINE_GLAPI *p_glVertexAttribIPointer)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glVertexAttribIPointerEXT)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); @@ -2277,6 +2336,7 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttribL4i64vNV)(GLuint,const INT64*); void (WINE_GLAPI *p_glVertexAttribL4ui64NV)(GLuint,UINT64,UINT64,UINT64,UINT64); void (WINE_GLAPI *p_glVertexAttribL4ui64vNV)(GLuint,const UINT64*); + void (WINE_GLAPI *p_glVertexAttribLFormat)(GLuint,GLint,GLenum,GLuint); void (WINE_GLAPI *p_glVertexAttribLFormatNV)(GLuint,GLint,GLenum,GLsizei); void (WINE_GLAPI *p_glVertexAttribLPointer)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glVertexAttribLPointerEXT)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); @@ -2293,21 +2353,22 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexAttribPointerNV)(GLuint,GLint,GLenum,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glVertexAttribs1dvNV)(GLuint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribs1fvNV)(GLuint,GLsizei,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttribs1hvNV)(GLuint,GLsizei,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttribs1hvNV)(GLuint,GLsizei,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttribs1svNV)(GLuint,GLsizei,const GLshort*); void (WINE_GLAPI *p_glVertexAttribs2dvNV)(GLuint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribs2fvNV)(GLuint,GLsizei,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttribs2hvNV)(GLuint,GLsizei,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttribs2hvNV)(GLuint,GLsizei,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttribs2svNV)(GLuint,GLsizei,const GLshort*); void (WINE_GLAPI *p_glVertexAttribs3dvNV)(GLuint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribs3fvNV)(GLuint,GLsizei,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttribs3hvNV)(GLuint,GLsizei,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttribs3hvNV)(GLuint,GLsizei,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttribs3svNV)(GLuint,GLsizei,const GLshort*); void (WINE_GLAPI *p_glVertexAttribs4dvNV)(GLuint,GLsizei,const GLdouble*); void (WINE_GLAPI *p_glVertexAttribs4fvNV)(GLuint,GLsizei,const GLfloat*); - void (WINE_GLAPI *p_glVertexAttribs4hvNV)(GLuint,GLsizei,const unsigned short*); + void (WINE_GLAPI *p_glVertexAttribs4hvNV)(GLuint,GLsizei,const GLhalfNV*); void (WINE_GLAPI *p_glVertexAttribs4svNV)(GLuint,GLsizei,const GLshort*); void (WINE_GLAPI *p_glVertexAttribs4ubvNV)(GLuint,GLsizei,const GLubyte*); + void (WINE_GLAPI *p_glVertexBindingDivisor)(GLuint,GLuint); void (WINE_GLAPI *p_glVertexBlendARB)(GLint); void (WINE_GLAPI *p_glVertexBlendEnvfATI)(GLenum,GLfloat); void (WINE_GLAPI *p_glVertexBlendEnviATI)(GLenum,GLint); @@ -2353,11 +2414,11 @@ struct opengl_funcs void (WINE_GLAPI *p_glVertexStream4ivATI)(GLenum,const GLint*); void (WINE_GLAPI *p_glVertexStream4sATI)(GLenum,GLshort,GLshort,GLshort,GLshort); void (WINE_GLAPI *p_glVertexStream4svATI)(GLenum,const GLshort*); - void (WINE_GLAPI *p_glVertexWeightPointerEXT)(GLsizei,GLenum,GLsizei,const GLvoid*); + void (WINE_GLAPI *p_glVertexWeightPointerEXT)(GLint,GLenum,GLsizei,const GLvoid*); void (WINE_GLAPI *p_glVertexWeightfEXT)(GLfloat); void (WINE_GLAPI *p_glVertexWeightfvEXT)(const GLfloat*); - void (WINE_GLAPI *p_glVertexWeighthNV)(unsigned short); - void (WINE_GLAPI *p_glVertexWeighthvNV)(const unsigned short*); + void (WINE_GLAPI *p_glVertexWeighthNV)(GLhalfNV); + void (WINE_GLAPI *p_glVertexWeighthvNV)(const GLhalfNV*); GLenum (WINE_GLAPI *p_glVideoCaptureNV)(GLuint,GLuint*,UINT64*); void (WINE_GLAPI *p_glVideoCaptureStreamParameterdvNV)(GLuint,GLuint,GLenum,const GLdouble*); void (WINE_GLAPI *p_glVideoCaptureStreamParameterfvNV)(GLuint,GLuint,GLenum,const GLfloat*); @@ -2796,5 +2857,6 @@ struct opengl_funcs USE_GL_FUNC(glViewport) extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version ); +extern BOOL CDECL __wine_set_pixel_format( HWND hwnd, int format ); #endif /* __WINE_WGL_DRIVER_H */ diff --git a/reactos/include/reactos/wine/wined3d.h b/reactos/include/reactos/wine/wined3d.h index b8cc8436e1f..a1ac0a71054 100644 --- a/reactos/include/reactos/wine/wined3d.h +++ b/reactos/include/reactos/wine/wined3d.h @@ -748,12 +748,6 @@ enum wined3d_decl_usage WINED3D_DECL_USAGE_SAMPLE = 13 }; -enum wined3d_surface_type -{ - WINED3D_SURFACE_TYPE_OPENGL, /* OpenGL surface: Renders using libGL, needed for 3D */ - WINED3D_SURFACE_TYPE_GDI, /* User surface. No 3D, DirectDraw rendering with GDI */ -}; - enum wined3d_sysval_semantic { WINED3D_SV_DEPTH = 0xffffffff, @@ -1220,6 +1214,7 @@ enum wined3d_display_rotation #define WINED3DDEVCAPS_NPATCHES 0x01000000 #define WINED3D_LEGACY_DEPTH_BIAS 0x00000001 +#define WINED3D_NO3D 0x00000002 /* dwDDFX */ /* arithmetic stretching along y axis */ @@ -1981,6 +1976,7 @@ struct wined3d_palette; struct wined3d_query; struct wined3d_rendertarget_view; struct wined3d_resource; +struct wined3d_sampler; struct wined3d_shader; struct wined3d_stateblock; struct wined3d_surface; @@ -2004,7 +2000,7 @@ struct wined3d_device_parent_ops struct wined3d_surface **surface); HRESULT (__cdecl *create_texture_surface)(struct wined3d_device_parent *device_parent, void *container_parent, UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, enum wined3d_pool pool, - UINT level, enum wined3d_cubemap_face face, struct wined3d_surface **surface); + UINT sub_resource_idx, struct wined3d_surface **surface); HRESULT (__cdecl *create_volume)(struct wined3d_device_parent *device_parent, void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format_id, enum wined3d_pool pool, DWORD usage, struct wined3d_volume **volume); @@ -2022,8 +2018,7 @@ HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d, enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id); HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx, enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage, - enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id, - enum wined3d_surface_type surface_type); + enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id); HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id source_format_id, enum wined3d_format_id target_format_id); @@ -2086,23 +2081,10 @@ HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD behaviour_flags, BYTE surface_alignment, struct wined3d_device_parent *device_parent, struct wined3d_device **device); ULONG __cdecl wined3d_device_decref(struct wined3d_device *device); -HRESULT __cdecl wined3d_device_delete_patch(struct wined3d_device *device, UINT handle); HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count); -HRESULT __cdecl wined3d_device_draw_indexed_primitive_strided(struct wined3d_device *device, UINT index_count, - const struct wined3d_strided_data *strided_data, UINT vertex_count, const void *index_data, - enum wined3d_format_id index_data_format_id); -HRESULT __cdecl wined3d_device_draw_indexed_primitive_up(struct wined3d_device *device, - UINT index_count, const void *index_data, enum wined3d_format_id index_data_format_id, - const void *stream_data, UINT stream_stride); +void __cdecl wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device, + UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count); HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count); -HRESULT __cdecl wined3d_device_draw_primitive_strided(struct wined3d_device *device, - UINT vertex_count, const struct wined3d_strided_data *strided_data); -HRESULT __cdecl wined3d_device_draw_primitive_up(struct wined3d_device *device, - UINT vertex_count, const void *stream_data, UINT stream_stride); -HRESULT __cdecl wined3d_device_draw_rect_patch(struct wined3d_device *device, UINT handle, - const float *num_segs, const struct wined3d_rect_patch_info *rect_patch_info); -HRESULT __cdecl wined3d_device_draw_tri_patch(struct wined3d_device *device, UINT handle, - const float *num_segs, const struct wined3d_tri_patch_info *tri_patch_info); HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); @@ -2114,10 +2096,9 @@ HRESULT __cdecl wined3d_device_get_clip_plane(const struct wined3d_device *devic UINT plane_idx, struct wined3d_vec4 *plane); HRESULT __cdecl wined3d_device_get_clip_status(const struct wined3d_device *device, struct wined3d_clip_status *clip_status); -HRESULT __cdecl wined3d_device_get_creation_parameters(const struct wined3d_device *device, +void __cdecl wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *creation_parameters); -HRESULT __cdecl wined3d_device_get_depth_stencil(const struct wined3d_device *device, - struct wined3d_surface **depth_stencil); +struct wined3d_surface * __cdecl wined3d_device_get_depth_stencil(const struct wined3d_device *device); HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps); HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); @@ -2125,62 +2106,66 @@ HRESULT __cdecl wined3d_device_get_front_buffer_data(const struct wined3d_device UINT swapchain_idx, struct wined3d_surface *dst_surface); void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_gamma_ramp *ramp); -HRESULT __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device, - struct wined3d_buffer **index_buffer); +struct wined3d_shader * __cdecl wined3d_device_get_geometry_shader(const struct wined3d_device *device); +struct wined3d_buffer * __cdecl wined3d_device_get_gs_cb(const struct wined3d_device *device, UINT idx); +struct wined3d_sampler * __cdecl wined3d_device_get_gs_sampler(const struct wined3d_device *device, UINT idx); +struct wined3d_buffer * __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device, + enum wined3d_format_id *format); HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device, UINT light_idx, struct wined3d_light *light); HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable); -HRESULT __cdecl wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material); +void __cdecl wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material); float __cdecl wined3d_device_get_npatch_mode(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device); void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device, enum wined3d_primitive_type *primitive_topology); +struct wined3d_buffer * __cdecl wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx); HRESULT __cdecl wined3d_device_get_ps_consts_b(const struct wined3d_device *device, UINT start_register, BOOL *constants, UINT bool_count); HRESULT __cdecl wined3d_device_get_ps_consts_f(const struct wined3d_device *device, UINT start_register, float *constants, UINT vector4f_count); HRESULT __cdecl wined3d_device_get_ps_consts_i(const struct wined3d_device *device, UINT start_register, int *constants, UINT vector4i_count); +struct wined3d_sampler * __cdecl wined3d_device_get_ps_sampler(const struct wined3d_device *device, UINT idx); HRESULT __cdecl wined3d_device_get_raster_status(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_raster_status *raster_status); -HRESULT __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, - enum wined3d_render_state state, DWORD *value); -HRESULT __cdecl wined3d_device_get_render_target(const struct wined3d_device *device, - UINT render_target_idx, struct wined3d_surface **render_target); -HRESULT __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *device, - UINT sampler_idx, enum wined3d_sampler_state state, DWORD *value); -HRESULT __cdecl wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect); +DWORD __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state); +struct wined3d_surface * __cdecl wined3d_device_get_render_target(const struct wined3d_device *device, + UINT render_target_idx); +DWORD __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *device, + UINT sampler_idx, enum wined3d_sampler_state state); +void __cdecl wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect); BOOL __cdecl wined3d_device_get_software_vertex_processing(const struct wined3d_device *device); +struct wined3d_buffer * __cdecl wined3d_device_get_stream_output(struct wined3d_device *device, + UINT idx, UINT *offset); HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride); HRESULT __cdecl wined3d_device_get_stream_source_freq(const struct wined3d_device *device, UINT stream_idx, UINT *divider); -HRESULT __cdecl wined3d_device_get_surface_from_dc(const struct wined3d_device *device, - HDC dc, struct wined3d_surface **surface); -HRESULT __cdecl wined3d_device_get_swapchain(const struct wined3d_device *device, - UINT swapchain_idx, struct wined3d_swapchain **swapchain); +struct wined3d_surface * __cdecl wined3d_device_get_surface_from_dc(const struct wined3d_device *device, HDC dc); +struct wined3d_swapchain * __cdecl wined3d_device_get_swapchain(const struct wined3d_device *device, + UINT swapchain_idx); UINT __cdecl wined3d_device_get_swapchain_count(const struct wined3d_device *device); -HRESULT __cdecl wined3d_device_get_texture(const struct wined3d_device *device, - UINT stage, struct wined3d_texture **texture); -HRESULT __cdecl wined3d_device_get_texture_stage_state(const struct wined3d_device *device, - UINT stage, enum wined3d_texture_stage_state state, DWORD *value); -HRESULT __cdecl wined3d_device_get_transform(const struct wined3d_device *device, +struct wined3d_texture * __cdecl wined3d_device_get_texture(const struct wined3d_device *device, UINT stage); +DWORD __cdecl wined3d_device_get_texture_stage_state(const struct wined3d_device *device, + UINT stage, enum wined3d_texture_stage_state state); +void __cdecl wined3d_device_get_transform(const struct wined3d_device *device, enum wined3d_transform_state state, struct wined3d_matrix *matrix); -HRESULT __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device, - struct wined3d_vertex_declaration **declaration); +struct wined3d_vertex_declaration * __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(const struct wined3d_device *device); -HRESULT __cdecl wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport); +void __cdecl wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport); +struct wined3d_buffer * __cdecl wined3d_device_get_vs_cb(const struct wined3d_device *device, UINT idx); HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device, UINT start_register, BOOL *constants, UINT bool_count); HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *device, UINT start_register, float *constants, UINT vector4f_count); HRESULT __cdecl wined3d_device_get_vs_consts_i(const struct wined3d_device *device, UINT start_register, int *constants, UINT vector4i_count); -HRESULT __cdecl wined3d_device_get_wined3d(const struct wined3d_device *device, struct wined3d **wined3d); +struct wined3d_sampler * __cdecl wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx); ULONG __cdecl wined3d_device_incref(struct wined3d_device *device); HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc); HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc); -HRESULT __cdecl wined3d_device_multiply_transform(struct wined3d_device *device, +void __cdecl wined3d_device_multiply_transform(struct wined3d_device *device, enum wined3d_transform_state state, const struct wined3d_matrix *matrix); HRESULT __cdecl wined3d_device_present(const struct wined3d_device *device, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region, DWORD flags); @@ -2190,9 +2175,9 @@ HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device, void __cdecl wined3d_device_release_focus_window(struct wined3d_device *device); HRESULT __cdecl wined3d_device_reset(struct wined3d_device *device, const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode, - wined3d_device_reset_cb callback); + wined3d_device_reset_cb callback, BOOL reset_state); void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window); -HRESULT __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index); +void __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index); HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const struct wined3d_vec4 *plane); HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device, @@ -2201,53 +2186,62 @@ void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device, int x_screen_space, int y_screen_space, DWORD flags); HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device, UINT x_hotspot, UINT y_hotspot, struct wined3d_surface *cursor_surface); -HRESULT __cdecl wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil); +void __cdecl wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil); HRESULT __cdecl wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs); void __cdecl wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, DWORD flags, const struct wined3d_gamma_ramp *ramp); -HRESULT __cdecl wined3d_device_set_index_buffer(struct wined3d_device *device, +void __cdecl wined3d_device_set_geometry_shader(struct wined3d_device *device, struct wined3d_shader *shader); +void __cdecl wined3d_device_set_gs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer); +void __cdecl wined3d_device_set_gs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler); +void __cdecl wined3d_device_set_index_buffer(struct wined3d_device *device, struct wined3d_buffer *index_buffer, enum wined3d_format_id format_id); HRESULT __cdecl wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light); HRESULT __cdecl wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable); -HRESULT __cdecl wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material); +void __cdecl wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material); void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device); HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments); -HRESULT __cdecl wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader); +void __cdecl wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader); void __cdecl wined3d_device_set_primitive_type(struct wined3d_device *device, enum wined3d_primitive_type primitive_topology); +void __cdecl wined3d_device_set_ps_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer); HRESULT __cdecl wined3d_device_set_ps_consts_b(struct wined3d_device *device, UINT start_register, const BOOL *constants, UINT bool_count); HRESULT __cdecl wined3d_device_set_ps_consts_f(struct wined3d_device *device, UINT start_register, const float *constants, UINT vector4f_count); HRESULT __cdecl wined3d_device_set_ps_consts_i(struct wined3d_device *device, UINT start_register, const int *constants, UINT vector4i_count); -HRESULT __cdecl wined3d_device_set_render_state(struct wined3d_device *device, +void __cdecl wined3d_device_set_ps_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler); +void __cdecl wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value); HRESULT __cdecl wined3d_device_set_render_target(struct wined3d_device *device, UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport); -HRESULT __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device, +void __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); -HRESULT __cdecl wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect); -HRESULT __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software); +void __cdecl wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect); +void __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software); +void __cdecl wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx, + struct wined3d_buffer *buffer, UINT offset); HRESULT __cdecl wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride); HRESULT __cdecl wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider); HRESULT __cdecl wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture); -HRESULT __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *device, +void __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *device, UINT stage, enum wined3d_texture_stage_state state, DWORD value); -HRESULT __cdecl wined3d_device_set_transform(struct wined3d_device *device, +void __cdecl wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state state, const struct wined3d_matrix *matrix); -HRESULT __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, +void __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, struct wined3d_vertex_declaration *declaration); -HRESULT __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); -HRESULT __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport); +void __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); +void __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport); +void __cdecl wined3d_device_set_vs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer); HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device, UINT start_register, const BOOL *constants, UINT bool_count); HRESULT __cdecl wined3d_device_set_vs_consts_f(struct wined3d_device *device, UINT start_register, const float *constants, UINT vector4f_count); HRESULT __cdecl wined3d_device_set_vs_consts_i(struct wined3d_device *device, UINT start_register, const int *constants, UINT vector4i_count); +void __cdecl wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler); void __cdecl wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h); BOOL __cdecl wined3d_device_show_cursor(struct wined3d_device *device, BOOL show); HRESULT __cdecl wined3d_device_uninit_3d(struct wined3d_device *device); @@ -2294,6 +2288,11 @@ void * __cdecl wined3d_rendertarget_view_get_parent(const struct wined3d_rendert struct wined3d_resource * __cdecl wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view); ULONG __cdecl wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view); +HRESULT __cdecl wined3d_sampler_create(void *parent, struct wined3d_sampler **sampler); +ULONG __cdecl wined3d_sampler_decref(struct wined3d_sampler *sampler); +void * __cdecl wined3d_sampler_get_parent(const struct wined3d_sampler *sampler); +ULONG __cdecl wined3d_sampler_incref(struct wined3d_sampler *sampler); + HRESULT __cdecl wined3d_shader_create_gs(struct wined3d_device *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version); @@ -2311,8 +2310,8 @@ ULONG __cdecl wined3d_shader_incref(struct wined3d_shader *shader); HRESULT __cdecl wined3d_shader_set_local_constants_float(struct wined3d_shader *shader, UINT start_idx, const float *src_data, UINT vector4f_count); -HRESULT __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock); -HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock); +void __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock); +void __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock); HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); @@ -2322,10 +2321,9 @@ HRESULT __cdecl wined3d_surface_blt(struct wined3d_surface *dst_surface, const R struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *blt_fx, enum wined3d_texture_filter_type filter); HRESULT __cdecl wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height, - enum wined3d_format_id format_id, UINT level, DWORD usage, enum wined3d_pool pool, - enum wined3d_multisample_type multisample_type, DWORD multisample_quality, - enum wined3d_surface_type surface_type, DWORD flags, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface); + enum wined3d_format_id format_id, DWORD usage, enum wined3d_pool pool, + enum wined3d_multisample_type multisample_type, DWORD multisample_quality, DWORD flags, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface); ULONG __cdecl wined3d_surface_decref(struct wined3d_surface *surface); HRESULT __cdecl wined3d_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override, DWORD flags); struct wined3d_surface * __cdecl wined3d_surface_from_resource(struct wined3d_resource *resource); @@ -2351,7 +2349,7 @@ HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface, DWORD flags, const struct wined3d_color_key *color_key); HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem); HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y); -HRESULT __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette); +void __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette); DWORD __cdecl wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD new_priority); HRESULT __cdecl wined3d_surface_unmap(struct wined3d_surface *surface); HRESULT __cdecl wined3d_surface_update_desc(struct wined3d_surface *surface, @@ -2362,12 +2360,11 @@ HRESULT __cdecl wined3d_surface_update_overlay(struct wined3d_surface *surface, HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface, DWORD flags, struct wined3d_surface *ref); -HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device, - struct wined3d_swapchain_desc *desc, enum wined3d_surface_type surface_type, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain); +HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device, struct wined3d_swapchain_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain); ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain); -HRESULT __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, - UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type, struct wined3d_surface **backbuffer); +struct wined3d_surface * __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, + UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type); struct wined3d_device * __cdecl wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain); HRESULT __cdecl wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); @@ -2376,7 +2373,7 @@ HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swa HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain, struct wined3d_gamma_ramp *ramp); void * __cdecl wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain); -HRESULT __cdecl wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, +void __cdecl wined3d_swapchain_get_desc(const struct wined3d_swapchain *swapchain, struct wined3d_swapchain_desc *desc); HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, struct wined3d_raster_status *raster_status); @@ -2386,7 +2383,7 @@ HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain, const RGNDATA *dirty_region, DWORD flags); HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain, DWORD flags, const struct wined3d_gamma_ramp *ramp); -HRESULT __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window); +void __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window); HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture, UINT layer, const struct wined3d_box *dirty_region);