[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
This commit is contained in:
Jérôme Gardou 2013-02-28 18:21:10 +00:00
parent a263a1faad
commit e10ddf87b8
72 changed files with 13668 additions and 9751 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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;
}

View file

@ -19,10 +19,10 @@
*
*/
#include <config.h>
#include <initguid.h>
#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))
{

View file

@ -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 <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <wine/debug.h>
#include <d3d8.h>
#include <wine/wined3d.h>
#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

File diff suppressed because it is too large Load diff

View file

@ -20,18 +20,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include "config.h"
//#include <stdarg.h>
#include <stdarg.h>
#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))

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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))

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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;
}

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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)))
{

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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;
}

View file

@ -21,7 +21,7 @@
/* IDirect3DVertexDeclaration8 is internal to our implementation.
* It's not visible in the API. */
#include <config.h>
#include "config.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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;
}

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include "config.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);

View file

@ -21,8 +21,8 @@
*
*/
#include <config.h>
#include <initguid.h>
#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))
{

View file

@ -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 <assert.h>
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#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 <d3d9.h>
#include <wine/wined3d.h>
#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

File diff suppressed because it is too large Load diff

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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))

View file

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include "config.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);

View file

@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include "config.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);

View file

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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;
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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))
{

View file

@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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)))
{

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include "config.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#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))

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include "config.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#include "wine/port.h"
#include "config.h"
#include "wine/port.h"
#include "ddraw_private.h"

View file

@ -20,13 +20,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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,

View file

@ -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 <assert.h>
#define COBJMACROS
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include <wine/debug.h>
#include "wine/debug.h"
#include <winbase.h>
#include <wingdi.h>
#include <winreg.h>
#include <winuser.h>
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include <d3d.h>
//#include "ddraw.h"
#include "d3d.h"
#include "ddraw.h"
#ifdef DDRAW_INIT_GUID
#include <initguid.h>
#include "initguid.h"
#endif
#include <wine/list.h>
#include <wine/wined3d.h>
#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

File diff suppressed because it is too large Load diff

View file

@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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);

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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();

View file

@ -24,20 +24,20 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#include "wine/port.h"
#include "config.h"
#include "wine/port.h"
#define DDRAW_INIT_GUID
#include "ddraw_private.h"
#include <rpcproxy.h>
#include "rpcproxy.h"
#include <wine/exception.h>
//#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
{

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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;

View file

@ -16,8 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#include "wine/port.h"
#include "config.h"
#include "wine/port.h"
#include "ddraw_private.h"

View file

@ -21,8 +21,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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;

View file

@ -21,8 +21,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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;

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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);

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
//#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, &current_viewport);
if (current_viewport)
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_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, &current_viewport);
if (current_viewport)
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_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, &current_viewport);
if (current_viewport)
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_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, &current_viewport);
if (current_viewport)
if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(d3d_device3, &current_viewport)))
{
struct d3d_viewport *vp = impl_from_IDirect3DViewport3(current_viewport);
viewport_activate(vp, TRUE);

View file

@ -22,6 +22,7 @@ list(APPEND SOURCE
palette.c
query.c
resource.c
sampler.c
shader.c
shader_sm1.c
shader_sm4.c

File diff suppressed because it is too large Load diff

View file

@ -18,18 +18,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
//#include <math.h>
//#include <stdio.h>
#include <math.h>
#include <stdio.h>
#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 */
};

View file

@ -22,8 +22,8 @@
*
*/
#include <config.h>
#include <wine/port.h>
#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;
}

View file

@ -19,10 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
//#include <stdio.h>
#include <stdio.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#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)
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -24,24 +24,39 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw);
//#include <stdio.h>
//#include <math.h>
#include <stdio.h>
#include <math.h>
/* 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;
}

View file

@ -18,10 +18,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
//#include <stdio.h>
#include <stdio.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#endif

File diff suppressed because it is too large Load diff

View file

@ -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 <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
//#include <math.h>
//#include <stdio.h>
#include <math.h>
#include <stdio.h>
#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 */
};

View file

@ -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 <config.h>
#include <wine/port.h>
//#include "winerror.h"
//#include "wine/debug.h"
#include "config.h"
#include "wine/port.h"
#include "winerror.h"
#include "wine/debug.h"
//#include <string.h>
#include <string.h>
#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))

View file

@ -19,8 +19,8 @@
*/
#include <config.h>
#include <wine/port.h>
#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))

View file

@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);

View file

@ -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;
}

File diff suppressed because it is too large Load diff

View file

@ -22,8 +22,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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,
};

View file

@ -16,28 +16,44 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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, &param->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, &param->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,
};

View file

@ -25,10 +25,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#include "config.h"
#include "wine/port.h"
//#include <stdio.h>
#include <stdio.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#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,

View file

@ -22,8 +22,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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))

View file

@ -26,8 +26,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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);

View file

@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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);

View file

@ -20,8 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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;
}

View file

@ -24,8 +24,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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)

View file

@ -22,8 +22,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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))

View file

@ -17,8 +17,8 @@
*
*/
#include <config.h>
#include <wine/port.h>
#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);

View file

@ -19,8 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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;
}

View file

@ -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)

File diff suppressed because it is too large Load diff

View file

@ -22,10 +22,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <config.h>
#include <wine/port.h>
#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 );

View file

@ -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 <stdarg.h>
//#include <math.h>
//#include <limits.h>
#include <math.h>
#include <limits.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#define COBJMACROS
#include <windef.h>
//#include "winbase.h"
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include <objbase.h>
#include <wine/wined3d.h>
#include "objbase.h"
#include "wine/wined3d.h"
#include "wined3d_gl.h"
#include <wine/list.h>
#include <wine/rbtree.h>
#include <wine/wgl_driver.h>
#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
{

View file

@ -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

File diff suppressed because it is too large Load diff

View file

@ -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 */

View file

@ -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);