[D3D8][D3D9][DDRAW][WINED3D] Sync with Wine Staging 2.9. This work couldn't have been committed without Sebastian Gasiorek's work on CORE-11331 so thanks again! Dedicated to Daniel. CORE-13362

svn path=/trunk/; revision=75061
This commit is contained in:
Amine Khaldi
2017-06-16 18:50:42 +00:00
parent 0cc09fc848
commit 4b0ee92f91
70 changed files with 32329 additions and 28056 deletions
+18 -6
View File
@@ -164,7 +164,7 @@ static void WINAPI d3d8_vertexbuffer_PreLoad(IDirect3DVertexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_preload(buffer->wined3d_buffer);
wined3d_resource_preload(wined3d_buffer_get_resource(buffer->wined3d_buffer));
wined3d_mutex_unlock();
}
@@ -179,14 +179,20 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface, UINT
BYTE **data, DWORD flags)
{
struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
HRESULT hr;
TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
iface, offset, size, data, flags);
wined3d_box.left = offset;
wined3d_box.right = offset + size;
wined3d_mutex_lock();
hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, data, flags);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer),
0, &wined3d_map_desc, &wined3d_box, flags);
wined3d_mutex_unlock();
*data = wined3d_map_desc.data;
return hr;
}
@@ -198,7 +204,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_Unlock(IDirect3DVertexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_unmap(buffer->wined3d_buffer);
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0);
wined3d_mutex_unlock();
return D3D_OK;
@@ -441,7 +447,7 @@ static void WINAPI d3d8_indexbuffer_PreLoad(IDirect3DIndexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_preload(buffer->wined3d_buffer);
wined3d_resource_preload(wined3d_buffer_get_resource(buffer->wined3d_buffer));
wined3d_mutex_unlock();
}
@@ -456,14 +462,20 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, UINT o
BYTE **data, DWORD flags)
{
struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
HRESULT hr;
TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
iface, offset, size, data, flags);
wined3d_box.left = offset;
wined3d_box.right = offset + size;
wined3d_mutex_lock();
hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, data, flags);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer),
0, &wined3d_map_desc, &wined3d_box, flags);
wined3d_mutex_unlock();
*data = wined3d_map_desc.data;
return hr;
}
@@ -475,7 +487,7 @@ static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_unmap(buffer->wined3d_buffer);
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0);
wined3d_mutex_unlock();
return D3D_OK;
+1 -1
View File
@@ -1,5 +1,5 @@
@ stdcall D3D8GetSWInfo()
@ stdcall DebugSetMute()
@ stdcall Direct3DCreate8(long)
@ stdcall ValidatePixelShader(ptr long long ptr)
@ stdcall ValidatePixelShader(ptr ptr long ptr)
@ stdcall ValidateVertexShader(ptr ptr ptr long ptr)
+39 -41
View File
@@ -53,75 +53,73 @@ IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT sdk_version)
/***********************************************************************
* ValidateVertexShader (D3D8.@)
*
* I've seen reserved1 and reserved2 always passed as 0's
* bool seems always passed as 0 or 1, but other values work as well...
* toto result?
*/
HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
HRESULT WINAPI ValidateVertexShader(DWORD *vertexshader, DWORD *reserved1, DWORD *reserved2,
BOOL return_error, char **errors)
{
HRESULT ret;
static BOOL warned;
const char *message = "";
HRESULT hr = E_FAIL;
if (TRACE_ON(d3d8) || !warned) {
FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, bool, toto);
warned = TRUE;
}
TRACE("(%p %p %p %d %p): semi-stub\n", vertexshader, reserved1, reserved2, return_error, errors);
if (!vertexshader)
return E_FAIL;
if (!vertexshader)
{
message = "(Global Validation Error) Version Token: Code pointer cannot be NULL.\n";
goto done;
}
if (reserved1 || reserved2)
return E_FAIL;
switch(*vertexshader) {
switch (*vertexshader)
{
case 0xFFFE0101:
case 0xFFFE0100:
ret=S_OK;
hr = S_OK;
break;
default:
WARN("Invalid shader version token %#x.\n", *vertexshader);
ret=E_FAIL;
}
message = "(Global Validation Error) Version Token: Unsupported vertex shader version.\n";
}
return ret;
done:
if (!return_error) message = "";
if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 1)))
strcpy(*errors, message);
return hr;
}
/***********************************************************************
* ValidatePixelShader (D3D8.@)
*
* PARAMS
* toto result?
*/
HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
HRESULT WINAPI ValidatePixelShader(DWORD *pixelshader, DWORD *reserved1, BOOL return_error, char **errors)
{
HRESULT ret;
static BOOL warned;
const char *message = "";
HRESULT hr = E_FAIL;
if (TRACE_ON(d3d8) || !warned) {
FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto);
warned = TRUE;
}
TRACE("(%p %p %d %p): semi-stub\n", pixelshader, reserved1, return_error, errors);
if (!pixelshader)
return E_FAIL;
if (!pixelshader)
return E_FAIL;
if (reserved1)
return E_FAIL;
switch(*pixelshader) {
switch (*pixelshader)
{
case 0xFFFF0100:
case 0xFFFF0101:
case 0xFFFF0102:
case 0xFFFF0103:
case 0xFFFF0104:
ret=S_OK;
hr = S_OK;
break;
default:
WARN("Invalid shader version token %#x.\n", *pixelshader);
ret=E_FAIL;
}
return ret;
message = "(Global Validation Error) Version Token: Unsupported pixel shader version.\n";
}
if (!return_error) message = "";
if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 1)))
strcpy(*errors, message);
return hr;
}
void d3d8_resource_cleanup(struct d3d8_resource *resource)
+7 -61
View File
@@ -45,69 +45,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
#include <d3d8.h>
#include <wine/wined3d.h>
#define D3DPRESENTFLAGS_MASK 0x00000fffu
/* CreateVertexShader can return > 0xFFFF */
#define VS_HIGHESTFIXEDFXF 0xF0000000
/* ===========================================================================
Macros
=========================================================================== */
/* Not nice, but it lets wined3d support different versions of directx */
#define WINECAPSTOD3D8CAPS(_pD3D8Caps, _pWineCaps) \
_pD3D8Caps->DeviceType = (D3DDEVTYPE) _pWineCaps->DeviceType; \
_pD3D8Caps->AdapterOrdinal = _pWineCaps->AdapterOrdinal; \
_pD3D8Caps->Caps = _pWineCaps->Caps; \
_pD3D8Caps->Caps2 = _pWineCaps->Caps2; \
_pD3D8Caps->Caps3 = _pWineCaps->Caps3; \
_pD3D8Caps->PresentationIntervals = _pWineCaps->PresentationIntervals; \
_pD3D8Caps->CursorCaps = _pWineCaps->CursorCaps; \
_pD3D8Caps->DevCaps = _pWineCaps->DevCaps; \
_pD3D8Caps->PrimitiveMiscCaps = _pWineCaps->PrimitiveMiscCaps; \
_pD3D8Caps->RasterCaps = _pWineCaps->RasterCaps; \
_pD3D8Caps->ZCmpCaps = _pWineCaps->ZCmpCaps; \
_pD3D8Caps->SrcBlendCaps = _pWineCaps->SrcBlendCaps; \
_pD3D8Caps->DestBlendCaps = _pWineCaps->DestBlendCaps; \
_pD3D8Caps->AlphaCmpCaps = _pWineCaps->AlphaCmpCaps; \
_pD3D8Caps->ShadeCaps = _pWineCaps->ShadeCaps; \
_pD3D8Caps->TextureCaps = _pWineCaps->TextureCaps; \
_pD3D8Caps->TextureFilterCaps = _pWineCaps->TextureFilterCaps; \
_pD3D8Caps->CubeTextureFilterCaps = _pWineCaps->CubeTextureFilterCaps; \
_pD3D8Caps->VolumeTextureFilterCaps = _pWineCaps->VolumeTextureFilterCaps; \
_pD3D8Caps->TextureAddressCaps = _pWineCaps->TextureAddressCaps; \
_pD3D8Caps->VolumeTextureAddressCaps = _pWineCaps->VolumeTextureAddressCaps; \
_pD3D8Caps->LineCaps = _pWineCaps->LineCaps; \
_pD3D8Caps->MaxTextureWidth = _pWineCaps->MaxTextureWidth; \
_pD3D8Caps->MaxTextureHeight = _pWineCaps->MaxTextureHeight; \
_pD3D8Caps->MaxVolumeExtent = _pWineCaps->MaxVolumeExtent; \
_pD3D8Caps->MaxTextureRepeat = _pWineCaps->MaxTextureRepeat; \
_pD3D8Caps->MaxTextureAspectRatio = _pWineCaps->MaxTextureAspectRatio; \
_pD3D8Caps->MaxAnisotropy = _pWineCaps->MaxAnisotropy; \
_pD3D8Caps->MaxVertexW = _pWineCaps->MaxVertexW; \
_pD3D8Caps->GuardBandLeft = _pWineCaps->GuardBandLeft; \
_pD3D8Caps->GuardBandTop = _pWineCaps->GuardBandTop; \
_pD3D8Caps->GuardBandRight = _pWineCaps->GuardBandRight; \
_pD3D8Caps->GuardBandBottom = _pWineCaps->GuardBandBottom; \
_pD3D8Caps->ExtentsAdjust = _pWineCaps->ExtentsAdjust; \
_pD3D8Caps->StencilCaps = _pWineCaps->StencilCaps; \
_pD3D8Caps->FVFCaps = _pWineCaps->FVFCaps; \
_pD3D8Caps->TextureOpCaps = _pWineCaps->TextureOpCaps; \
_pD3D8Caps->MaxTextureBlendStages = _pWineCaps->MaxTextureBlendStages; \
_pD3D8Caps->MaxSimultaneousTextures = _pWineCaps->MaxSimultaneousTextures; \
_pD3D8Caps->VertexProcessingCaps = _pWineCaps->VertexProcessingCaps; \
_pD3D8Caps->MaxActiveLights = _pWineCaps->MaxActiveLights; \
_pD3D8Caps->MaxUserClipPlanes = _pWineCaps->MaxUserClipPlanes; \
_pD3D8Caps->MaxVertexBlendMatrices = _pWineCaps->MaxVertexBlendMatrices; \
_pD3D8Caps->MaxVertexBlendMatrixIndex = _pWineCaps->MaxVertexBlendMatrixIndex; \
_pD3D8Caps->MaxPointSize = _pWineCaps->MaxPointSize; \
_pD3D8Caps->MaxPrimitiveCount = _pWineCaps->MaxPrimitiveCount; \
_pD3D8Caps->MaxVertexIndex = _pWineCaps->MaxVertexIndex; \
_pD3D8Caps->MaxStreams = _pWineCaps->MaxStreams; \
_pD3D8Caps->MaxStreamStride = _pWineCaps->MaxStreamStride; \
_pD3D8Caps->VertexShaderVersion = _pWineCaps->VertexShaderVersion; \
_pD3D8Caps->MaxVertexShaderConst = _pWineCaps->MaxVertexShaderConst; \
_pD3D8Caps->PixelShaderVersion = _pWineCaps->PixelShaderVersion; \
_pD3D8Caps->MaxPixelShaderValue = _pWineCaps->PixelShader1xMaxValue;
void fixup_caps(WINED3DCAPS *pWineCaps) DECLSPEC_HIDDEN;
void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d8
{
@@ -249,7 +192,10 @@ struct d3d8_surface
struct d3d8_texture *texture;
};
struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN;
struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface) DECLSPEC_HIDDEN;
void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface,
struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN;
void surface_init(struct d3d8_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN;
+261 -155
View File
@@ -70,7 +70,6 @@ D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format)
case WINED3DFMT_X8D24_UNORM: return D3DFMT_D24X8;
case WINED3DFMT_S4X4_UINT_D24_UNORM: return D3DFMT_D24X4S4;
case WINED3DFMT_D16_UNORM: return D3DFMT_D16;
case WINED3DFMT_VERTEXDATA: return D3DFMT_VERTEXDATA;
case WINED3DFMT_R16_UINT: return D3DFMT_INDEX16;
case WINED3DFMT_R32_UINT: return D3DFMT_INDEX32;
default:
@@ -121,18 +120,17 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format)
case D3DFMT_D24X8: return WINED3DFMT_X8D24_UNORM;
case D3DFMT_D24X4S4: return WINED3DFMT_S4X4_UINT_D24_UNORM;
case D3DFMT_D16: return WINED3DFMT_D16_UNORM;
case D3DFMT_VERTEXDATA: return WINED3DFMT_VERTEXDATA;
case D3DFMT_INDEX16: return WINED3DFMT_R16_UINT;
case D3DFMT_INDEX32: return WINED3DFMT_R32_UINT;
default:
FIXME("Unhandled D3DFORMAT %#x\n", format);
FIXME("Unhandled D3DFORMAT %#x.\n", format);
return WINED3DFMT_UNKNOWN;
}
}
static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, UINT primitive_count)
{
switch(primitive_type)
switch (primitive_type)
{
case D3DPT_POINTLIST:
return primitive_count;
@@ -151,7 +149,7 @@ static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, U
return primitive_count + 2;
default:
FIXME("Unhandled primitive type %#x\n", primitive_type);
FIXME("Unhandled primitive type %#x.\n", primitive_type);
return 0;
}
}
@@ -170,7 +168,7 @@ static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS
present_parameters->EnableAutoDepthStencil = swapchain_desc->enable_auto_depth_stencil;
present_parameters->AutoDepthStencilFormat
= d3dformat_from_wined3dformat(swapchain_desc->auto_depth_stencil_format);
present_parameters->Flags = swapchain_desc->flags;
present_parameters->Flags = swapchain_desc->flags & D3DPRESENTFLAGS_MASK;
present_parameters->FullScreen_RefreshRateInHz = swapchain_desc->refresh_rate;
present_parameters->FullScreen_PresentationInterval = swapchain_desc->swap_interval;
}
@@ -204,14 +202,88 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
swapchain_desc->enable_auto_depth_stencil = present_parameters->EnableAutoDepthStencil;
swapchain_desc->auto_depth_stencil_format
= wined3dformat_from_d3dformat(present_parameters->AutoDepthStencilFormat);
swapchain_desc->flags = present_parameters->Flags;
swapchain_desc->flags
= (present_parameters->Flags & D3DPRESENTFLAGS_MASK) | WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH;
swapchain_desc->refresh_rate = present_parameters->FullScreen_RefreshRateInHz;
swapchain_desc->swap_interval = present_parameters->FullScreen_PresentationInterval;
swapchain_desc->auto_restore_display_mode = TRUE;
if (present_parameters->Flags & ~D3DPRESENTFLAGS_MASK)
FIXME("Unhandled flags %#x.\n", present_parameters->Flags & ~D3DPRESENTFLAGS_MASK);
return TRUE;
}
void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps)
{
caps->DeviceType = (D3DDEVTYPE)wined3d_caps->DeviceType;
caps->AdapterOrdinal = wined3d_caps->AdapterOrdinal;
caps->Caps = wined3d_caps->Caps;
caps->Caps2 = wined3d_caps->Caps2;
caps->Caps3 = wined3d_caps->Caps3;
caps->PresentationIntervals = wined3d_caps->PresentationIntervals;
caps->CursorCaps = wined3d_caps->CursorCaps;
caps->DevCaps = wined3d_caps->DevCaps;
caps->PrimitiveMiscCaps = wined3d_caps->PrimitiveMiscCaps;
caps->RasterCaps = wined3d_caps->RasterCaps;
caps->ZCmpCaps = wined3d_caps->ZCmpCaps;
caps->SrcBlendCaps = wined3d_caps->SrcBlendCaps;
caps->DestBlendCaps = wined3d_caps->DestBlendCaps;
caps->AlphaCmpCaps = wined3d_caps->AlphaCmpCaps;
caps->ShadeCaps = wined3d_caps->ShadeCaps;
caps->TextureCaps = wined3d_caps->TextureCaps;
caps->TextureFilterCaps = wined3d_caps->TextureFilterCaps;
caps->CubeTextureFilterCaps = wined3d_caps->CubeTextureFilterCaps;
caps->VolumeTextureFilterCaps = wined3d_caps->VolumeTextureFilterCaps;
caps->TextureAddressCaps = wined3d_caps->TextureAddressCaps;
caps->VolumeTextureAddressCaps = wined3d_caps->VolumeTextureAddressCaps;
caps->LineCaps = wined3d_caps->LineCaps;
caps->MaxTextureWidth = wined3d_caps->MaxTextureWidth;
caps->MaxTextureHeight = wined3d_caps->MaxTextureHeight;
caps->MaxVolumeExtent = wined3d_caps->MaxVolumeExtent;
caps->MaxTextureRepeat = wined3d_caps->MaxTextureRepeat;
caps->MaxTextureAspectRatio = wined3d_caps->MaxTextureAspectRatio;
caps->MaxAnisotropy = wined3d_caps->MaxAnisotropy;
caps->MaxVertexW = wined3d_caps->MaxVertexW;
caps->GuardBandLeft = wined3d_caps->GuardBandLeft;
caps->GuardBandTop = wined3d_caps->GuardBandTop;
caps->GuardBandRight = wined3d_caps->GuardBandRight;
caps->GuardBandBottom = wined3d_caps->GuardBandBottom;
caps->ExtentsAdjust = wined3d_caps->ExtentsAdjust;
caps->StencilCaps = wined3d_caps->StencilCaps;
caps->FVFCaps = wined3d_caps->FVFCaps;
caps->TextureOpCaps = wined3d_caps->TextureOpCaps;
caps->MaxTextureBlendStages = wined3d_caps->MaxTextureBlendStages;
caps->MaxSimultaneousTextures = wined3d_caps->MaxSimultaneousTextures;
caps->VertexProcessingCaps = wined3d_caps->VertexProcessingCaps;
caps->MaxActiveLights = wined3d_caps->MaxActiveLights;
caps->MaxUserClipPlanes = wined3d_caps->MaxUserClipPlanes;
caps->MaxVertexBlendMatrices = wined3d_caps->MaxVertexBlendMatrices;
caps->MaxVertexBlendMatrixIndex = wined3d_caps->MaxVertexBlendMatrixIndex;
caps->MaxPointSize = wined3d_caps->MaxPointSize;
caps->MaxPrimitiveCount = wined3d_caps->MaxPrimitiveCount;
caps->MaxVertexIndex = wined3d_caps->MaxVertexIndex;
caps->MaxStreams = wined3d_caps->MaxStreams;
caps->MaxStreamStride = wined3d_caps->MaxStreamStride;
caps->VertexShaderVersion = wined3d_caps->VertexShaderVersion;
caps->MaxVertexShaderConst = wined3d_caps->MaxVertexShaderConst;
caps->PixelShaderVersion = wined3d_caps->PixelShaderVersion;
caps->MaxPixelShaderValue = wined3d_caps->PixelShader1xMaxValue;
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
if (caps->PixelShaderVersion)
caps->PixelShaderVersion = D3DPS_VERSION(1, 4);
else
caps->PixelShaderVersion = D3DPS_VERSION(0, 0);
if (caps->VertexShaderVersion)
caps->VertexShaderVersion = D3DVS_VERSION(1, 1);
else
caps->VertexShaderVersion = D3DVS_VERSION(0, 0);
caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst);
caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
}
/* Handle table functions */
static DWORD d3d8_allocate_handle(struct d3d8_handle_table *t, void *object, enum d3d8_handle_type type)
{
@@ -443,7 +515,7 @@ static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D
static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
WINED3DCAPS *wined3d_caps;
WINED3DCAPS wined3d_caps;
HRESULT hr;
TRACE("iface %p, caps %p.\n", iface, caps);
@@ -451,16 +523,11 @@ static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS
if (!caps)
return D3DERR_INVALIDCALL;
if (!(wined3d_caps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wined3d_caps))))
return D3DERR_INVALIDCALL; /* well this is what MSDN says to return */
wined3d_mutex_lock();
hr = wined3d_device_get_device_caps(device->wined3d_device, wined3d_caps);
hr = wined3d_device_get_device_caps(device->wined3d_device, &wined3d_caps);
wined3d_mutex_unlock();
fixup_caps(wined3d_caps);
WINECAPSTOD3D8CAPS(caps, wined3d_caps)
HeapFree(GetProcessHeap(), 0, wined3d_caps);
d3dcaps_from_wined3dcaps(caps, &wined3d_caps);
return hr;
}
@@ -600,44 +667,34 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if
static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
{
struct wined3d_resource_desc desc;
IDirect3DBaseTexture8 *texture;
struct d3d8_surface *surface;
IUnknown *parent;
wined3d_resource_get_desc(resource, &desc);
if (desc.pool == WINED3D_POOL_DEFAULT)
if (desc.pool != WINED3D_POOL_DEFAULT)
return D3D_OK;
if (desc.resource_type != WINED3D_RTYPE_TEXTURE_2D)
{
struct d3d8_surface *surface;
if (desc.resource_type == WINED3D_RTYPE_TEXTURE_2D)
{
IUnknown *parent = wined3d_resource_get_parent(resource);
IDirect3DBaseTexture8 *texture;
if (SUCCEEDED(IUnknown_QueryInterface(parent, &IID_IDirect3DBaseTexture8, (void **)&texture)))
{
IDirect3DBaseTexture8_Release(texture);
WARN("Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", texture, resource);
return D3DERR_DEVICELOST;
}
return D3D_OK;
}
if (desc.resource_type != WINED3D_RTYPE_SURFACE)
{
WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource);
return D3DERR_DEVICELOST;
}
surface = wined3d_resource_get_parent(resource);
if (surface->resource.refcount)
{
WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource);
return D3DERR_DEVICELOST;
}
WARN("Surface %p (resource %p) is an implicit resource with ref 0.\n", surface, resource);
WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource);
return D3DERR_DEVICELOST;
}
return D3D_OK;
parent = wined3d_resource_get_parent(resource);
if (parent && SUCCEEDED(IUnknown_QueryInterface(parent, &IID_IDirect3DBaseTexture8, (void **)&texture)))
{
IDirect3DBaseTexture8_Release(texture);
WARN("Texture %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", texture, resource);
return D3DERR_DEVICELOST;
}
surface = wined3d_texture_get_sub_resource_parent(wined3d_texture_from_resource(resource), 0);
if (!surface->resource.refcount)
return D3D_OK;
WARN("Surface %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface);
return D3DERR_DEVICELOST;
}
static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface,
@@ -786,6 +843,9 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface,
TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
iface, width, height, levels, usage, format, pool, texture);
if (!format)
return D3DERR_INVALIDCALL;
*texture = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -816,6 +876,9 @@ static HRESULT WINAPI d3d8_device_CreateVolumeTexture(IDirect3DDevice8 *iface,
TRACE("iface %p, width %u, height %u, depth %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
iface, width, height, depth, levels, usage, format, pool, texture);
if (!format)
return D3DERR_INVALIDCALL;
*texture = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -845,6 +908,9 @@ static HRESULT WINAPI d3d8_device_CreateCubeTexture(IDirect3DDevice8 *iface, UIN
TRACE("iface %p, edge_length %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
iface, edge_length, levels, usage, format, pool, texture);
if (!format)
return D3DERR_INVALIDCALL;
*texture = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@@ -929,8 +995,8 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width
struct wined3d_texture *texture;
HRESULT hr;
TRACE("device %p, width %u, height %u, format %#x, flags %#x, surface %p,\n"
"\tusage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n",
TRACE("device %p, width %u, height %u, format %#x, flags %#x, surface %p, "
"usage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n",
device, width, height, format, flags, surface,
usage, pool, multisample_type, multisample_quality);
@@ -948,7 +1014,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width
wined3d_mutex_lock();
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &desc,
1, flags, NULL, NULL, &d3d8_null_wined3d_parent_ops, &texture)))
1, 1, flags, NULL, NULL, &d3d8_null_wined3d_parent_ops, &texture)))
{
wined3d_mutex_unlock();
WARN("Failed to create texture, hr %#x.\n", hr);
@@ -976,6 +1042,9 @@ static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UI
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n",
iface, width, height, format, multisample_type, lockable, surface);
if (!format)
return D3DERR_INVALIDCALL;
*surface = NULL;
if (lockable)
flags |= WINED3D_TEXTURE_CREATE_MAPPABLE;
@@ -993,6 +1062,9 @@ static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *if
TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n",
iface, width, height, format, multisample_type, surface);
if (!format)
return D3DERR_INVALIDCALL;
*surface = NULL;
/* TODO: Verify that Discard is false */
@@ -1022,8 +1094,7 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
struct d3d8_surface *src = unsafe_impl_from_IDirect3DSurface8(src_surface);
struct d3d8_surface *dst = unsafe_impl_from_IDirect3DSurface8(dst_surface);
enum wined3d_format_id src_format, dst_format;
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
struct wined3d_sub_resource_desc wined3d_desc;
UINT src_w, src_h;
TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n",
@@ -1033,8 +1104,7 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
* destination texture is in WINED3D_POOL_DEFAULT. */
wined3d_mutex_lock();
wined3d_resource = wined3d_texture_get_sub_resource(src->wined3d_texture, src->sub_resource_idx);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_texture_get_sub_resource_desc(src->wined3d_texture, src->sub_resource_idx, &wined3d_desc);
if (wined3d_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
WARN("Source %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", src_surface);
@@ -1045,8 +1115,7 @@ static HRESULT WINAPI d3d8_device_CopyRects(IDirect3DDevice8 *iface,
src_w = wined3d_desc.width;
src_h = wined3d_desc.height;
wined3d_resource = wined3d_texture_get_sub_resource(dst->wined3d_texture, dst->sub_resource_idx);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_texture_get_sub_resource_desc(dst->wined3d_texture, dst->sub_resource_idx, &wined3d_desc);
if (wined3d_desc.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
WARN("Destination %p is a depth stencil surface, returning D3DERR_INVALIDCALL.\n", dst_surface);
@@ -1154,38 +1223,42 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target);
struct d3d8_surface *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil);
struct wined3d_rendertarget_view *original_dsv;
struct wined3d_rendertarget_view *original_dsv, *rtv;
HRESULT hr = D3D_OK;
TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil);
if (rt_impl && d3d8_surface_get_device(rt_impl) != device)
{
WARN("Render target surface does not match device.\n");
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
if (ds_impl)
{
struct wined3d_sub_resource_desc ds_desc, rt_desc;
struct wined3d_rendertarget_view *original_rtv;
struct wined3d_resource_desc ds_desc, rt_desc;
struct wined3d_resource *wined3d_resource;
struct d3d8_surface *original_surface;
/* If no render target is passed in check the size against the current RT */
if (!render_target)
{
if (!(original_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0)))
{
wined3d_mutex_unlock();
return D3DERR_NOTFOUND;
}
original_surface = wined3d_rendertarget_view_get_sub_resource_parent(original_rtv);
wined3d_resource = wined3d_texture_get_sub_resource(original_surface->wined3d_texture, original_surface->sub_resource_idx);
wined3d_texture_get_sub_resource_desc(original_surface->wined3d_texture,
original_surface->sub_resource_idx, &rt_desc);
}
else
wined3d_resource = wined3d_texture_get_sub_resource(rt_impl->wined3d_texture, rt_impl->sub_resource_idx);
wined3d_resource_get_desc(wined3d_resource, &rt_desc);
wined3d_texture_get_sub_resource_desc(rt_impl->wined3d_texture,
rt_impl->sub_resource_idx, &rt_desc);
wined3d_resource = wined3d_texture_get_sub_resource(ds_impl->wined3d_texture, ds_impl->sub_resource_idx);
wined3d_resource_get_desc(wined3d_resource, &ds_desc);
wined3d_texture_get_sub_resource_desc(ds_impl->wined3d_texture, ds_impl->sub_resource_idx, &ds_desc);
if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height)
{
@@ -1199,16 +1272,17 @@ static HRESULT WINAPI d3d8_device_SetRenderTarget(IDirect3DDevice8 *iface,
WARN("Multisample settings do not match, returning D3DERR_INVALIDCALL\n");
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
}
original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device);
wined3d_device_set_depth_stencil_view(device->wined3d_device,
ds_impl ? d3d8_surface_get_rendertarget_view(ds_impl) : NULL);
if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0,
d3d8_surface_get_rendertarget_view(rt_impl), TRUE)))
rtv = ds_impl ? d3d8_surface_acquire_rendertarget_view(ds_impl) : NULL;
wined3d_device_set_depth_stencil_view(device->wined3d_device, rtv);
d3d8_surface_release_rendertarget_view(ds_impl, rtv);
rtv = render_target ? d3d8_surface_acquire_rendertarget_view(rt_impl) : NULL;
if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, rtv, TRUE)))
wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv);
d3d8_surface_release_rendertarget_view(rt_impl, rtv);
wined3d_mutex_unlock();
@@ -1323,6 +1397,12 @@ static HRESULT WINAPI d3d8_device_Clear(IDirect3DDevice8 *iface, DWORD rect_coun
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
iface, rect_count, rects, flags, color, z, stencil);
if (rect_count && !rects)
{
WARN("count %u with NULL rects.\n", rect_count);
rect_count = 0;
}
wined3d_mutex_lock();
hr = wined3d_device_clear(device->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock();
@@ -1378,12 +1458,19 @@ static HRESULT WINAPI d3d8_device_MultiplyTransform(IDirect3DDevice8 *iface,
static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3DVIEWPORT8 *viewport)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_viewport vp;
TRACE("iface %p, viewport %p.\n", iface, viewport);
/* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */
vp.x = viewport->X;
vp.y = viewport->Y;
vp.width = viewport->Width;
vp.height = viewport->Height;
vp.min_z = viewport->MinZ;
vp.max_z = viewport->MaxZ;
wined3d_mutex_lock();
wined3d_device_set_viewport(device->wined3d_device, (const struct wined3d_viewport *)viewport);
wined3d_device_set_viewport(device->wined3d_device, &vp);
wined3d_mutex_unlock();
return D3D_OK;
@@ -1392,14 +1479,21 @@ static HRESULT WINAPI d3d8_device_SetViewport(IDirect3DDevice8 *iface, const D3D
static HRESULT WINAPI d3d8_device_GetViewport(IDirect3DDevice8 *iface, D3DVIEWPORT8 *viewport)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
struct wined3d_viewport wined3d_viewport;
TRACE("iface %p, viewport %p.\n", iface, viewport);
/* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock();
wined3d_device_get_viewport(device->wined3d_device, (struct wined3d_viewport *)viewport);
wined3d_device_get_viewport(device->wined3d_device, &wined3d_viewport);
wined3d_mutex_unlock();
viewport->X = wined3d_viewport.x;
viewport->Y = wined3d_viewport.y;
viewport->Width = wined3d_viewport.width;
viewport->Height = wined3d_viewport.height;
viewport->MinZ = wined3d_viewport.min_z;
viewport->MaxZ = wined3d_viewport.max_z;
return D3D_OK;
}
@@ -1590,7 +1684,7 @@ static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD *
hr = wined3d_device_end_stateblock(device->wined3d_device, &stateblock);
if (FAILED(hr))
{
WARN("IWineD3DDevice_EndStateBlock returned an error\n");
WARN("Failed to end the state block, %#x.\n", hr);
wined3d_mutex_unlock();
return hr;
}
@@ -1706,7 +1800,7 @@ static HRESULT WINAPI d3d8_device_CreateStateBlock(IDirect3DDevice8 *iface,
if (FAILED(hr))
{
wined3d_mutex_unlock();
ERR("IWineD3DDevice_CreateStateBlock failed, hr %#x\n", hr);
ERR("Failed to create the state block, hr %#x\n", hr);
return hr;
}
@@ -1805,39 +1899,43 @@ static HRESULT WINAPI d3d8_device_SetTexture(IDirect3DDevice8 *iface, DWORD stag
static const struct tss_lookup
{
BOOL sampler_state;
enum wined3d_texture_stage_state state;
union
{
enum wined3d_texture_stage_state texture_state;
enum wined3d_sampler_state sampler_state;
} u;
}
tss_lookup[] =
{
{FALSE, WINED3D_TSS_INVALID}, /* 0, unused */
{FALSE, WINED3D_TSS_COLOR_OP}, /* 1, D3DTSS_COLOROP */
{FALSE, WINED3D_TSS_COLOR_ARG1}, /* 2, D3DTSS_COLORARG1 */
{FALSE, WINED3D_TSS_COLOR_ARG2}, /* 3, D3DTSS_COLORARG2 */
{FALSE, WINED3D_TSS_ALPHA_OP}, /* 4, D3DTSS_ALPHAOP */
{FALSE, WINED3D_TSS_ALPHA_ARG1}, /* 5, D3DTSS_ALPHAARG1 */
{FALSE, WINED3D_TSS_ALPHA_ARG2}, /* 6, D3DTSS_ALPHAARG2 */
{FALSE, WINED3D_TSS_BUMPENV_MAT00}, /* 7, D3DTSS_BUMPENVMAT00 */
{FALSE, WINED3D_TSS_BUMPENV_MAT01}, /* 8, D3DTSS_BUMPENVMAT01 */
{FALSE, WINED3D_TSS_BUMPENV_MAT10}, /* 9, D3DTSS_BUMPENVMAT10 */
{FALSE, WINED3D_TSS_BUMPENV_MAT11}, /* 10, D3DTSS_BUMPENVMAT11 */
{FALSE, WINED3D_TSS_TEXCOORD_INDEX}, /* 11, D3DTSS_TEXCOORDINDEX */
{FALSE, WINED3D_TSS_INVALID}, /* 12, unused */
{TRUE, WINED3D_SAMP_ADDRESS_U}, /* 13, D3DTSS_ADDRESSU */
{TRUE, WINED3D_SAMP_ADDRESS_V}, /* 14, D3DTSS_ADDRESSV */
{TRUE, WINED3D_SAMP_BORDER_COLOR}, /* 15, D3DTSS_BORDERCOLOR */
{TRUE, WINED3D_SAMP_MAG_FILTER}, /* 16, D3DTSS_MAGFILTER */
{TRUE, WINED3D_SAMP_MIN_FILTER}, /* 17, D3DTSS_MINFILTER */
{TRUE, WINED3D_SAMP_MIP_FILTER}, /* 18, D3DTSS_MIPFILTER */
{TRUE, WINED3D_SAMP_MIPMAP_LOD_BIAS}, /* 19, D3DTSS_MIPMAPLODBIAS */
{TRUE, WINED3D_SAMP_MAX_MIP_LEVEL}, /* 20, D3DTSS_MAXMIPLEVEL */
{TRUE, WINED3D_SAMP_MAX_ANISOTROPY}, /* 21, D3DTSS_MAXANISOTROPY */
{FALSE, WINED3D_TSS_BUMPENV_LSCALE}, /* 22, D3DTSS_BUMPENVLSCALE */
{FALSE, WINED3D_TSS_BUMPENV_LOFFSET}, /* 23, D3DTSS_BUMPENVLOFFSET */
{FALSE, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS}, /* 24, D3DTSS_TEXTURETRANSFORMFLAGS */
{TRUE, WINED3D_SAMP_ADDRESS_W}, /* 25, D3DTSS_ADDRESSW */
{FALSE, WINED3D_TSS_COLOR_ARG0}, /* 26, D3DTSS_COLORARG0 */
{FALSE, WINED3D_TSS_ALPHA_ARG0}, /* 27, D3DTSS_ALPHAARG0 */
{FALSE, WINED3D_TSS_RESULT_ARG}, /* 28, D3DTSS_RESULTARG */
{FALSE, {WINED3D_TSS_INVALID}}, /* 0, unused */
{FALSE, {WINED3D_TSS_COLOR_OP}}, /* 1, D3DTSS_COLOROP */
{FALSE, {WINED3D_TSS_COLOR_ARG1}}, /* 2, D3DTSS_COLORARG1 */
{FALSE, {WINED3D_TSS_COLOR_ARG2}}, /* 3, D3DTSS_COLORARG2 */
{FALSE, {WINED3D_TSS_ALPHA_OP}}, /* 4, D3DTSS_ALPHAOP */
{FALSE, {WINED3D_TSS_ALPHA_ARG1}}, /* 5, D3DTSS_ALPHAARG1 */
{FALSE, {WINED3D_TSS_ALPHA_ARG2}}, /* 6, D3DTSS_ALPHAARG2 */
{FALSE, {WINED3D_TSS_BUMPENV_MAT00}}, /* 7, D3DTSS_BUMPENVMAT00 */
{FALSE, {WINED3D_TSS_BUMPENV_MAT01}}, /* 8, D3DTSS_BUMPENVMAT01 */
{FALSE, {WINED3D_TSS_BUMPENV_MAT10}}, /* 9, D3DTSS_BUMPENVMAT10 */
{FALSE, {WINED3D_TSS_BUMPENV_MAT11}}, /* 10, D3DTSS_BUMPENVMAT11 */
{FALSE, {WINED3D_TSS_TEXCOORD_INDEX}}, /* 11, D3DTSS_TEXCOORDINDEX */
{FALSE, {WINED3D_TSS_INVALID}}, /* 12, unused */
{TRUE, {WINED3D_SAMP_ADDRESS_U}}, /* 13, D3DTSS_ADDRESSU */
{TRUE, {WINED3D_SAMP_ADDRESS_V}}, /* 14, D3DTSS_ADDRESSV */
{TRUE, {WINED3D_SAMP_BORDER_COLOR}}, /* 15, D3DTSS_BORDERCOLOR */
{TRUE, {WINED3D_SAMP_MAG_FILTER}}, /* 16, D3DTSS_MAGFILTER */
{TRUE, {WINED3D_SAMP_MIN_FILTER}}, /* 17, D3DTSS_MINFILTER */
{TRUE, {WINED3D_SAMP_MIP_FILTER}}, /* 18, D3DTSS_MIPFILTER */
{TRUE, {WINED3D_SAMP_MIPMAP_LOD_BIAS}}, /* 19, D3DTSS_MIPMAPLODBIAS */
{TRUE, {WINED3D_SAMP_MAX_MIP_LEVEL}}, /* 20, D3DTSS_MAXMIPLEVEL */
{TRUE, {WINED3D_SAMP_MAX_ANISOTROPY}}, /* 21, D3DTSS_MAXANISOTROPY */
{FALSE, {WINED3D_TSS_BUMPENV_LSCALE}}, /* 22, D3DTSS_BUMPENVLSCALE */
{FALSE, {WINED3D_TSS_BUMPENV_LOFFSET}}, /* 23, D3DTSS_BUMPENVLOFFSET */
{FALSE, {WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS}}, /* 24, D3DTSS_TEXTURETRANSFORMFLAGS */
{TRUE, {WINED3D_SAMP_ADDRESS_W}}, /* 25, D3DTSS_ADDRESSW */
{FALSE, {WINED3D_TSS_COLOR_ARG0}}, /* 26, D3DTSS_COLORARG0 */
{FALSE, {WINED3D_TSS_ALPHA_ARG0}}, /* 27, D3DTSS_ALPHAARG0 */
{FALSE, {WINED3D_TSS_RESULT_ARG}}, /* 28, D3DTSS_RESULTARG */
};
static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
@@ -1858,9 +1956,9 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
wined3d_mutex_lock();
if (l->sampler_state)
*value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->state);
*value = wined3d_device_get_sampler_state(device->wined3d_device, stage, l->u.sampler_state);
else
*value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->state);
*value = wined3d_device_get_texture_stage_state(device->wined3d_device, stage, l->u.texture_state);
wined3d_mutex_unlock();
return D3D_OK;
@@ -1884,9 +1982,9 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
wined3d_mutex_lock();
if (l->sampler_state)
wined3d_device_set_sampler_state(device->wined3d_device, stage, l->state, value);
wined3d_device_set_sampler_state(device->wined3d_device, stage, l->u.sampler_state, value);
else
wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->state, value);
wined3d_device_set_texture_stage_state(device->wined3d_device, stage, l->u.texture_state, value);
wined3d_mutex_unlock();
return D3D_OK;
@@ -1957,7 +2055,7 @@ static HRESULT WINAPI d3d8_device_DrawPrimitive(IDirect3DDevice8 *iface,
iface, primitive_type, start_vertex, primitive_count);
wined3d_mutex_lock();
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
hr = wined3d_device_draw_primitive(device->wined3d_device, start_vertex,
vertex_count_from_primitive_count(primitive_type, primitive_count));
wined3d_mutex_unlock();
@@ -1976,7 +2074,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
iface, primitive_type, min_vertex_idx, vertex_count, start_idx, primitive_count);
wined3d_mutex_lock();
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx,
vertex_count_from_primitive_count(primitive_type, primitive_count));
wined3d_mutex_unlock();
@@ -2021,9 +2119,11 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
UINT vtx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
UINT size = vtx_count * stride;
struct wined3d_resource *vb;
UINT vb_pos, align;
BYTE *buffer_data;
TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n",
iface, primitive_type, primitive_count, data, stride);
@@ -2047,19 +2147,21 @@ static HRESULT WINAPI d3d8_device_DrawPrimitiveUP(IDirect3DDevice8 *iface,
else
vb_pos += align;
hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, size, &buffer_data,
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
if (FAILED(hr))
wined3d_box.left = vb_pos;
wined3d_box.right = vb_pos + size;
vb = wined3d_buffer_get_resource(device->vertex_buffer);
if (FAILED(wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
goto done;
memcpy(buffer_data, data, size);
wined3d_buffer_unmap(device->vertex_buffer);
memcpy(wined3d_map_desc.data, data, size);
wined3d_resource_unmap(vb, 0);
device->vertex_buffer_pos = vb_pos + size;
hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, stride);
if (FAILED(hr))
goto done;
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
hr = wined3d_device_draw_primitive(device->wined3d_device, vb_pos / stride, vtx_count);
wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0);
@@ -2103,19 +2205,18 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
UINT primitive_count, const void *index_data, D3DFORMAT index_format,
const void *vertex_data, UINT vertex_stride)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
HRESULT hr;
BYTE *buffer_data;
UINT idx_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
UINT idx_fmt_size = index_format == D3DFMT_INDEX16 ? 2 : 4;
UINT idx_size = idx_count * idx_fmt_size;
UINT ib_pos;
UINT vtx_size = vertex_count * vertex_stride;
UINT vb_pos, align;
UINT idx_size = idx_count * idx_fmt_size;
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
struct wined3d_resource *ib, *vb;
UINT vb_pos, ib_pos, align;
HRESULT hr;
TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u,\n"
TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, primitive_count %u, "
"index_data %p, index_format %#x, vertex_data %p, vertex_stride %u.\n",
iface, primitive_type, min_vertex_idx, vertex_count, primitive_count,
index_data, index_format, vertex_data, vertex_stride);
@@ -2140,12 +2241,14 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
else
vb_pos += align;
hr = wined3d_buffer_map(device->vertex_buffer, vb_pos, vtx_size, &buffer_data,
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
if (FAILED(hr))
wined3d_box.left = vb_pos;
wined3d_box.right = vb_pos + vtx_size;
vb = wined3d_buffer_get_resource(device->vertex_buffer);
if (FAILED(hr = wined3d_resource_map(vb, 0, &wined3d_map_desc, &wined3d_box,
vb_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
goto done;
memcpy(buffer_data, vertex_data, vtx_size);
wined3d_buffer_unmap(device->vertex_buffer);
memcpy(wined3d_map_desc.data, (char *)vertex_data + min_vertex_idx * vertex_stride, vtx_size);
wined3d_resource_unmap(vb, 0);
device->vertex_buffer_pos = vb_pos + vtx_size;
hr = d3d8_device_prepare_index_buffer(device, idx_size);
@@ -2160,12 +2263,14 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
else
ib_pos += align;
hr = wined3d_buffer_map(device->index_buffer, ib_pos, idx_size, &buffer_data,
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
if (FAILED(hr))
wined3d_box.left = ib_pos;
wined3d_box.right = ib_pos + idx_size;
ib = wined3d_buffer_get_resource(device->index_buffer);
if (FAILED(hr = wined3d_resource_map(ib, 0, &wined3d_map_desc, &wined3d_box,
ib_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD)))
goto done;
memcpy(buffer_data, index_data, idx_size);
wined3d_buffer_unmap(device->index_buffer);
memcpy(wined3d_map_desc.data, index_data, idx_size);
wined3d_resource_unmap(ib, 0);
device->index_buffer_pos = ib_pos + idx_size;
hr = wined3d_device_set_stream_source(device->wined3d_device, 0, device->vertex_buffer, 0, vertex_stride);
@@ -2173,14 +2278,14 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
goto done;
wined3d_device_set_index_buffer(device->wined3d_device, device->index_buffer,
wined3dformat_from_d3dformat(index_format));
wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride);
wined3dformat_from_d3dformat(index_format), 0);
wined3d_device_set_base_vertex_index(device->wined3d_device, vb_pos / vertex_stride - min_vertex_idx);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type);
wined3d_device_set_primitive_type(device->wined3d_device, primitive_type, 0);
hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
wined3d_device_set_stream_source(device->wined3d_device, 0, NULL, 0, 0);
wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN);
wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN, 0);
wined3d_device_set_base_vertex_index(device->wined3d_device, 0);
done:
@@ -2429,7 +2534,7 @@ static HRESULT WINAPI d3d8_device_SetVertexShaderConstant(IDirect3DDevice8 *ifac
}
wined3d_mutex_lock();
hr = wined3d_device_set_vs_consts_f(device->wined3d_device, start_register, data, count);
hr = wined3d_device_set_vs_consts_f(device->wined3d_device, start_register, count, data);
wined3d_mutex_unlock();
return hr;
@@ -2452,7 +2557,7 @@ static HRESULT WINAPI d3d8_device_GetVertexShaderConstant(IDirect3DDevice8 *ifac
}
wined3d_mutex_lock();
hr = wined3d_device_get_vs_consts_f(device->wined3d_device, start_register, data, count);
hr = wined3d_device_get_vs_consts_f(device->wined3d_device, start_register, count, data);
wined3d_mutex_unlock();
return hr;
@@ -2545,8 +2650,7 @@ static HRESULT WINAPI d3d8_device_SetIndices(IDirect3DDevice8 *iface,
wined3d_mutex_lock();
wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_idx);
wined3d_device_set_index_buffer(device->wined3d_device,
ib ? ib->wined3d_buffer : NULL,
ib ? ib->format : WINED3DFMT_UNKNOWN);
ib ? ib->wined3d_buffer : NULL, ib ? ib->format : WINED3DFMT_UNKNOWN, 0);
wined3d_mutex_unlock();
return D3D_OK;
@@ -2568,7 +2672,7 @@ static HRESULT WINAPI d3d8_device_GetIndices(IDirect3DDevice8 *iface,
/* The case from UINT to INT is safe because d3d8 will never set negative values */
wined3d_mutex_lock();
*base_vertex_index = wined3d_device_get_base_vertex_index(device->wined3d_device);
if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format)))
if ((wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &wined3d_format, NULL)))
{
buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
*buffer = &buffer_impl->IDirect3DIndexBuffer8_iface;
@@ -2725,7 +2829,7 @@ static HRESULT WINAPI d3d8_device_SetPixelShaderConstant(IDirect3DDevice8 *iface
iface, start_register, data, count);
wined3d_mutex_lock();
hr = wined3d_device_set_ps_consts_f(device->wined3d_device, start_register, data, count);
hr = wined3d_device_set_ps_consts_f(device->wined3d_device, start_register, count, data);
wined3d_mutex_unlock();
return hr;
@@ -2741,7 +2845,7 @@ static HRESULT WINAPI d3d8_device_GetPixelShaderConstant(IDirect3DDevice8 *iface
iface, start_register, data, count);
wined3d_mutex_lock();
hr = wined3d_device_get_ps_consts_f(device->wined3d_device, start_register, data, count);
hr = wined3d_device_get_ps_consts_f(device->wined3d_device, start_register, count, data);
wined3d_mutex_unlock();
return hr;
@@ -3013,17 +3117,19 @@ static HRESULT CDECL device_parent_volume_created(struct wined3d_device_parent *
}
static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_device_parent *device_parent,
void *container_parent, const struct wined3d_resource_desc *desc, struct wined3d_texture **texture)
void *container_parent, const struct wined3d_resource_desc *desc, DWORD texture_flags,
struct wined3d_texture **texture)
{
struct d3d8_device *device = device_from_device_parent(device_parent);
struct d3d8_surface *d3d_surface;
HRESULT hr;
TRACE("device_parent %p, container_parent %p, desc %p, texture %p.\n",
device_parent, container_parent, desc, texture);
TRACE("device_parent %p, container_parent %p, desc %p, texture flags %#x, texture %p.\n",
device_parent, container_parent, desc, texture_flags, texture);
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
NULL, &device->IDirect3DDevice8_iface, &d3d8_null_wined3d_parent_ops, texture)))
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1,
texture_flags | WINED3D_TEXTURE_CREATE_MAPPABLE, NULL, &device->IDirect3DDevice8_iface,
&d3d8_null_wined3d_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#x.\n", hr);
return hr;
+12 -38
View File
@@ -231,27 +231,20 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
usage = usage & (WINED3DUSAGE_MASK | WINED3DUSAGE_QUERY_MASK);
switch (resource_type)
{
case D3DRTYPE_SURFACE:
wined3d_rtype = WINED3D_RTYPE_SURFACE;
break;
case D3DRTYPE_VOLUME:
wined3d_rtype = WINED3D_RTYPE_VOLUME;
break;
case D3DRTYPE_CUBETEXTURE:
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
case D3DRTYPE_TEXTURE:
usage |= WINED3DUSAGE_TEXTURE;
case D3DRTYPE_SURFACE:
wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
break;
case D3DRTYPE_VOLUMETEXTURE:
case D3DRTYPE_VOLUME:
usage |= WINED3DUSAGE_TEXTURE;
wined3d_rtype = WINED3D_RTYPE_TEXTURE_3D;
break;
case D3DRTYPE_CUBETEXTURE:
wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
break;
case D3DRTYPE_VERTEXBUFFER:
case D3DRTYPE_INDEXBUFFER:
wined3d_rtype = WINED3D_RTYPE_BUFFER;
@@ -309,26 +302,10 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte
return hr;
}
void fixup_caps(WINED3DCAPS *caps)
{
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
if (caps->PixelShaderVersion)
caps->PixelShaderVersion = D3DPS_VERSION(1,4);
else
caps->PixelShaderVersion = D3DPS_VERSION(0,0);
if (caps->VertexShaderVersion)
caps->VertexShaderVersion = D3DVS_VERSION(1,1);
else
caps->VertexShaderVersion = D3DVS_VERSION(0,0);
caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst);
caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
}
static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS8 *caps)
{
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
WINED3DCAPS *wined3d_caps;
WINED3DCAPS wined3d_caps;
HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps);
@@ -336,16 +313,11 @@ static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEV
if (!caps)
return D3DERR_INVALIDCALL;
if (!(wined3d_caps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wined3d_caps))))
return D3DERR_INVALIDCALL;
wined3d_mutex_lock();
hr = wined3d_get_device_caps(d3d8->wined3d, adapter, device_type, wined3d_caps);
hr = wined3d_get_device_caps(d3d8->wined3d, adapter, device_type, &wined3d_caps);
wined3d_mutex_unlock();
fixup_caps(wined3d_caps);
WINECAPSTOD3D8CAPS(caps, wined3d_caps)
HeapFree(GetProcessHeap(), 0, wined3d_caps);
d3dcaps_from_wined3dcaps(caps, &wined3d_caps);
return hr;
}
@@ -425,7 +397,9 @@ static const struct IDirect3D8Vtbl d3d8_vtbl =
BOOL d3d8_init(struct d3d8 *d3d8)
{
DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
| WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER;
| WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART
| WINED3D_LEGACY_CUBEMAP_FILTERING;
d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl;
d3d8->refcount = 1;
+10 -4
View File
@@ -114,8 +114,11 @@ HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_d
FIXME("Usage %#x not implemented.\n", usage);
desc.byte_code = byte_code;
desc.input_signature = NULL;
desc.output_signature = NULL;
desc.byte_code_size = ~(size_t)0;
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
desc.max_version = 1;
wined3d_mutex_lock();
@@ -163,8 +166,11 @@ HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_dev
shader->handle = shader_handle;
desc.byte_code = byte_code;
desc.input_signature = NULL;
desc.output_signature = NULL;
desc.byte_code_size = ~(size_t)0;
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
desc.max_version = 1;
wined3d_mutex_lock();
+41 -17
View File
@@ -87,6 +87,12 @@ static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface)
return IDirect3DBaseTexture8_Release(&surface->texture->IDirect3DBaseTexture8_iface);
}
if (!surface->resource.refcount)
{
WARN("Surface does not have any references.\n");
return 0;
}
refcount = InterlockedDecrement(&surface->resource.refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
@@ -172,18 +178,16 @@ static HRESULT WINAPI d3d8_surface_GetContainer(IDirect3DSurface8 *iface, REFIID
static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc)
{
struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *sub_resource;
struct wined3d_sub_resource_desc wined3d_desc;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
sub_resource = wined3d_texture_get_sub_resource(surface->wined3d_texture, surface->sub_resource_idx);
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
wined3d_texture_get_sub_resource_desc(surface->wined3d_texture, surface->sub_resource_idx, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Size = wined3d_desc.size;
@@ -233,15 +237,10 @@ static HRESULT WINAPI d3d8_surface_LockRect(IDirect3DSurface8 *iface,
locked_rect->pBits = NULL;
return D3DERR_INVALIDCALL;
}
box.left = rect->left;
box.top = rect->top;
box.right = rect->right;
box.bottom = rect->bottom;
box.front = 0;
box.back = 1;
wined3d_box_set(&box, rect->left, rect->top, rect->right, rect->bottom, 0, 1);
}
hr = wined3d_resource_sub_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx,
hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx,
&map_desc, rect ? &box : NULL, flags);
wined3d_mutex_unlock();
@@ -267,14 +266,19 @@ static HRESULT WINAPI d3d8_surface_UnlockRect(IDirect3DSurface8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx);
hr = wined3d_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx);
wined3d_mutex_unlock();
switch(hr)
if (hr == WINEDDERR_NOTLOCKED)
{
case WINEDDERR_NOTLOCKED: return D3DERR_INVALIDCALL;
default: return hr;
D3DRESOURCETYPE type;
if (surface->texture)
type = IDirect3DBaseTexture8_GetType(&surface->texture->IDirect3DBaseTexture8_iface);
else
type = D3DRTYPE_SURFACE;
hr = type == D3DRTYPE_TEXTURE ? D3D_OK : D3DERR_INVALIDCALL;
}
return hr;
}
static const IDirect3DSurface8Vtbl d3d8_surface_vtbl =
@@ -352,10 +356,22 @@ static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops =
view_wined3d_object_destroyed,
};
struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface)
struct d3d8_device *d3d8_surface_get_device(const struct d3d8_surface *surface)
{
IDirect3DDevice8 *device;
device = surface->texture ? surface->texture->parent_device : surface->parent_device;
return impl_from_IDirect3DDevice8(device);
}
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface)
{
HRESULT hr;
/* The surface reference count can be equal to 0 when this function is
* called. In order to properly manage the render target view reference
* count, we temporarily increment the surface reference count. */
d3d8_surface_AddRef(&surface->IDirect3DSurface8_iface);
if (surface->wined3d_rtv)
return surface->wined3d_rtv;
@@ -363,6 +379,7 @@ struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8
surface->sub_resource_idx, surface, &d3d8_view_wined3d_parent_ops, &surface->wined3d_rtv)))
{
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
d3d8_surface_Release(&surface->IDirect3DSurface8_iface);
return NULL;
}
@@ -372,6 +389,13 @@ struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8
return surface->wined3d_rtv;
}
void d3d8_surface_release_rendertarget_view(struct d3d8_surface *surface,
struct wined3d_rendertarget_view *rtv)
{
if (rtv)
d3d8_surface_Release(&surface->IDirect3DSurface8_iface);
}
struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface)
{
if (!iface)
+5 -2
View File
@@ -97,9 +97,12 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d8_swapchain_Present(IDirect3DSwapChai
if (device->device_state != D3D8_DEVICE_STATE_OK)
return D3DERR_DEVICELOST;
if (dirty_region)
FIXME("Ignoring dirty_region %p.\n", dirty_region);
wined3d_mutex_lock();
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, src_rect,
dst_rect, dst_window_override, dirty_region, 0);
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
src_rect, dst_rect, dst_window_override, 0);
wined3d_mutex_unlock();
return hr;
+24 -51
View File
@@ -20,17 +20,17 @@
static inline struct d3d8_texture *impl_from_IDirect3DTexture8(IDirect3DTexture8 *iface)
{
return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
return CONTAINING_RECORD((IDirect3DBaseTexture8 *)iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
}
static inline struct d3d8_texture *impl_from_IDirect3DCubeTexture8(IDirect3DCubeTexture8 *iface)
{
return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
return CONTAINING_RECORD((IDirect3DBaseTexture8 *)iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
}
static inline struct d3d8_texture *impl_from_IDirect3DVolumeTexture8(IDirect3DVolumeTexture8 *iface)
{
return CONTAINING_RECORD(iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
return CONTAINING_RECORD((IDirect3DBaseTexture8 *)iface, struct d3d8_texture, IDirect3DBaseTexture8_iface);
}
static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, REFIID riid, void **out)
@@ -184,7 +184,7 @@ static void WINAPI d3d8_texture_2d_PreLoad(IDirect3DTexture8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(texture->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -240,21 +240,16 @@ static DWORD WINAPI d3d8_texture_2d_GetLevelCount(IDirect3DTexture8 *iface)
static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UINT level, D3DSURFACE_DESC *desc)
{
struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK;
struct wined3d_sub_resource_desc wined3d_desc;
HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
{
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Size = wined3d_desc.size;
@@ -342,12 +337,7 @@ static HRESULT WINAPI d3d8_texture_2d_AddDirtyRect(IDirect3DTexture8 *iface, con
{
struct wined3d_box dirty_region;
dirty_region.left = dirty_rect->left;
dirty_region.top = dirty_rect->top;
dirty_region.right = dirty_rect->right;
dirty_region.bottom = dirty_rect->bottom;
dirty_region.front = 0;
dirty_region.back = 1;
wined3d_box_set(&dirty_region, dirty_rect->left, dirty_rect->top, dirty_rect->right, dirty_rect->bottom, 0, 1);
hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, &dirty_region);
}
wined3d_mutex_unlock();
@@ -535,7 +525,7 @@ static void WINAPI d3d8_texture_cube_PreLoad(IDirect3DCubeTexture8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(texture->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -591,8 +581,8 @@ static DWORD WINAPI d3d8_texture_cube_GetLevelCount(IDirect3DCubeTexture8 *iface
static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *iface, UINT level, D3DSURFACE_DESC *desc)
{
struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK;
struct wined3d_sub_resource_desc wined3d_desc;
HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
@@ -603,15 +593,10 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac
return D3DERR_INVALIDCALL;
}
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
{
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Size = wined3d_desc.size;
@@ -716,12 +701,7 @@ static HRESULT WINAPI d3d8_texture_cube_AddDirtyRect(IDirect3DCubeTexture8 *ifac
{
struct wined3d_box dirty_region;
dirty_region.left = dirty_rect->left;
dirty_region.top = dirty_rect->top;
dirty_region.right = dirty_rect->right;
dirty_region.bottom = dirty_rect->bottom;
dirty_region.front = 0;
dirty_region.back = 1;
wined3d_box_set(&dirty_region, dirty_rect->left, dirty_rect->top, dirty_rect->right, dirty_rect->bottom, 0, 1);
hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, &dirty_region);
}
wined3d_mutex_unlock();
@@ -896,7 +876,7 @@ static void WINAPI d3d8_texture_3d_PreLoad(IDirect3DVolumeTexture8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(texture->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -952,21 +932,16 @@ static DWORD WINAPI d3d8_texture_3d_GetLevelCount(IDirect3DVolumeTexture8 *iface
static HRESULT WINAPI d3d8_texture_3d_GetLevelDesc(IDirect3DVolumeTexture8 *iface, UINT level, D3DVOLUME_DESC *desc)
{
struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK;
struct wined3d_sub_resource_desc wined3d_desc;
HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
{
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Size = wined3d_desc.size;
@@ -983,19 +958,17 @@ static HRESULT WINAPI d3d8_texture_3d_GetVolumeLevel(IDirect3DVolumeTexture8 *if
UINT level, IDirect3DVolume8 **volume)
{
struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
struct wined3d_resource *sub_resource;
struct d3d8_volume *volume_impl;
TRACE("iface %p, level %u, volume %p.\n", iface, level, volume);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
{
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
volume_impl = wined3d_resource_get_parent(sub_resource);
*volume = &volume_impl->IDirect3DVolume8_iface;
IDirect3DVolume8_AddRef(*volume);
wined3d_mutex_unlock();
@@ -1145,7 +1118,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
levels = wined3d_log2i(max(width, height)) + 1;
wined3d_mutex_lock();
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
wined3d_mutex_unlock();
if (FAILED(hr))
@@ -1190,7 +1163,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
levels = wined3d_log2i(edge_length) + 1;
wined3d_mutex_lock();
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
wined3d_mutex_unlock();
if (FAILED(hr))
@@ -1231,7 +1204,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
levels = wined3d_log2i(max(max(width, height), depth)) + 1;
wined3d_mutex_lock();
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, 0,
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
wined3d_mutex_unlock();
if (FAILED(hr))
@@ -217,8 +217,8 @@ static const enum wined3d_format_id wined3d_format_lookup[] =
/*WINED3DDECLTYPE_SHORT4N*/ WINED3DFMT_R16G16B16A16_SNORM,
/*WINED3DDECLTYPE_USHORT2N*/ WINED3DFMT_R16G16_UNORM,
/*WINED3DDECLTYPE_USHORT4N*/ WINED3DFMT_R16G16B16A16_UNORM,
/*WINED3DDECLTYPE_UDEC3*/ WINED3DFMT_R10G10B10A2_UINT,
/*WINED3DDECLTYPE_DEC3N*/ WINED3DFMT_R10G10B10A2_SNORM,
/*WINED3DDECLTYPE_UDEC3*/ WINED3DFMT_R10G10B10X2_UINT,
/*WINED3DDECLTYPE_DEC3N*/ WINED3DFMT_R10G10B10X2_SNORM,
/*WINED3DDECLTYPE_FLOAT16_2*/ WINED3DFMT_R16G16_FLOAT,
/*WINED3DDECLTYPE_FLOAT16_4*/ WINED3DFMT_R16G16B16A16_FLOAT,
};
+9 -8
View File
@@ -112,18 +112,16 @@ static HRESULT WINAPI d3d8_volume_GetContainer(IDirect3DVolume8 *iface, REFIID r
static HRESULT WINAPI d3d8_volume_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DESC *desc)
{
struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface);
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *sub_resource;
struct wined3d_sub_resource_desc wined3d_desc;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
sub_resource = wined3d_texture_get_sub_resource(volume->wined3d_texture, volume->sub_resource_idx);
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
wined3d_texture_get_sub_resource_desc(volume->wined3d_texture, volume->sub_resource_idx, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Size = wined3d_desc.size;
@@ -145,8 +143,9 @@ static HRESULT WINAPI d3d8_volume_LockBox(IDirect3DVolume8 *iface,
iface, locked_box, box, flags);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_map(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx,
&map_desc, (const struct wined3d_box *)box, flags);
if (FAILED(hr = wined3d_resource_map(wined3d_texture_get_resource(volume->wined3d_texture),
volume->sub_resource_idx, &map_desc, (const struct wined3d_box *)box, flags)))
map_desc.data = NULL;
wined3d_mutex_unlock();
locked_box->RowPitch = map_desc.row_pitch;
@@ -164,9 +163,11 @@ static HRESULT WINAPI d3d8_volume_UnlockBox(IDirect3DVolume8 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_unmap(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx);
hr = wined3d_resource_unmap(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx);
wined3d_mutex_unlock();
if (hr == WINEDDERR_NOTLOCKED)
return D3DERR_INVALIDCALL;
return hr;
}
+1 -1
View File
@@ -30,6 +30,6 @@ add_library(d3d9 SHARED
set_module_type(d3d9 win32dll UNICODE)
target_link_libraries(d3d9 wine)
add_importlibs(d3d9 d3dwine msvcrt kernel32 ntdll)
add_importlibs(d3d9 d3dwine user32 msvcrt kernel32 ntdll)
add_pch(d3d9 d3d9_private.h SOURCE)
add_cd_file(TARGET d3d9 DESTINATION reactos/system32 FOR all)
+18 -6
View File
@@ -165,7 +165,7 @@ static void WINAPI d3d9_vertexbuffer_PreLoad(IDirect3DVertexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_preload(buffer->wined3d_buffer);
wined3d_resource_preload(wined3d_buffer_get_resource(buffer->wined3d_buffer));
wined3d_mutex_unlock();
}
@@ -180,14 +180,20 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, UINT
void **data, DWORD flags)
{
struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface);
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
HRESULT hr;
TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
iface, offset, size, data, flags);
wined3d_box.left = offset;
wined3d_box.right = offset + size;
wined3d_mutex_lock();
hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, (BYTE **)data, flags);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer),
0, &wined3d_map_desc, &wined3d_box, flags);
wined3d_mutex_unlock();
*data = wined3d_map_desc.data;
return hr;
}
@@ -199,7 +205,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_unmap(buffer->wined3d_buffer);
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0);
wined3d_mutex_unlock();
return D3D_OK;
@@ -441,7 +447,7 @@ static void WINAPI d3d9_indexbuffer_PreLoad(IDirect3DIndexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_preload(buffer->wined3d_buffer);
wined3d_resource_preload(wined3d_buffer_get_resource(buffer->wined3d_buffer));
wined3d_mutex_unlock();
}
@@ -456,14 +462,20 @@ static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface,
UINT offset, UINT size, void **data, DWORD flags)
{
struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface);
struct wined3d_map_desc wined3d_map_desc;
struct wined3d_box wined3d_box = {0};
HRESULT hr;
TRACE("iface %p, offset %u, size %u, data %p, flags %#x.\n",
iface, offset, size, data, flags);
wined3d_box.left = offset;
wined3d_box.right = offset + size;
wined3d_mutex_lock();
hr = wined3d_buffer_map(buffer->wined3d_buffer, offset, size, (BYTE **)data, flags);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer),
0, &wined3d_map_desc, &wined3d_box, flags);
wined3d_mutex_unlock();
*data = wined3d_map_desc.data;
return hr;
}
@@ -475,7 +487,7 @@ static HRESULT WINAPI d3d9_indexbuffer_Unlock(IDirect3DIndexBuffer9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_unmap(buffer->wined3d_buffer);
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0);
wined3d_mutex_unlock();
return D3D_OK;
+14 -81
View File
@@ -37,6 +37,7 @@
#define COBJMACROS
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <wingdi.h>
#include <wine/debug.h>
@@ -45,88 +46,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
#include <d3d9.h>
#include <wine/wined3d.h>
extern HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN;
#define D3DPRESENTFLAGS_MASK 0x00000fffu
extern const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops DECLSPEC_HIDDEN;
HRESULT vdecl_convert_fvf(DWORD FVF, D3DVERTEXELEMENT9 **ppVertexElements) DECLSPEC_HIDDEN;
D3DFORMAT d3dformat_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
BOOL is_gdi_compat_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_HIDDEN;
void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
const struct wined3d_swapchain_desc *swapchain_desc) DECLSPEC_HIDDEN;
#define WINECAPSTOD3D9CAPS(_pD3D9Caps, _pWineCaps) \
_pD3D9Caps->DeviceType = (D3DDEVTYPE) _pWineCaps->DeviceType; \
_pD3D9Caps->AdapterOrdinal = _pWineCaps->AdapterOrdinal; \
_pD3D9Caps->Caps = _pWineCaps->Caps; \
_pD3D9Caps->Caps2 = _pWineCaps->Caps2; \
_pD3D9Caps->Caps3 = _pWineCaps->Caps3; \
_pD3D9Caps->PresentationIntervals = _pWineCaps->PresentationIntervals; \
_pD3D9Caps->CursorCaps = _pWineCaps->CursorCaps; \
_pD3D9Caps->DevCaps = _pWineCaps->DevCaps; \
_pD3D9Caps->PrimitiveMiscCaps = _pWineCaps->PrimitiveMiscCaps; \
_pD3D9Caps->RasterCaps = _pWineCaps->RasterCaps; \
_pD3D9Caps->ZCmpCaps = _pWineCaps->ZCmpCaps; \
_pD3D9Caps->SrcBlendCaps = _pWineCaps->SrcBlendCaps; \
_pD3D9Caps->DestBlendCaps = _pWineCaps->DestBlendCaps; \
_pD3D9Caps->AlphaCmpCaps = _pWineCaps->AlphaCmpCaps; \
_pD3D9Caps->ShadeCaps = _pWineCaps->ShadeCaps; \
_pD3D9Caps->TextureCaps = _pWineCaps->TextureCaps; \
_pD3D9Caps->TextureFilterCaps = _pWineCaps->TextureFilterCaps; \
_pD3D9Caps->CubeTextureFilterCaps = _pWineCaps->CubeTextureFilterCaps; \
_pD3D9Caps->VolumeTextureFilterCaps = _pWineCaps->VolumeTextureFilterCaps; \
_pD3D9Caps->TextureAddressCaps = _pWineCaps->TextureAddressCaps; \
_pD3D9Caps->VolumeTextureAddressCaps = _pWineCaps->VolumeTextureAddressCaps; \
_pD3D9Caps->LineCaps = _pWineCaps->LineCaps; \
_pD3D9Caps->MaxTextureWidth = _pWineCaps->MaxTextureWidth; \
_pD3D9Caps->MaxTextureHeight = _pWineCaps->MaxTextureHeight; \
_pD3D9Caps->MaxVolumeExtent = _pWineCaps->MaxVolumeExtent; \
_pD3D9Caps->MaxTextureRepeat = _pWineCaps->MaxTextureRepeat; \
_pD3D9Caps->MaxTextureAspectRatio = _pWineCaps->MaxTextureAspectRatio; \
_pD3D9Caps->MaxAnisotropy = _pWineCaps->MaxAnisotropy; \
_pD3D9Caps->MaxVertexW = _pWineCaps->MaxVertexW; \
_pD3D9Caps->GuardBandLeft = _pWineCaps->GuardBandLeft; \
_pD3D9Caps->GuardBandTop = _pWineCaps->GuardBandTop; \
_pD3D9Caps->GuardBandRight = _pWineCaps->GuardBandRight; \
_pD3D9Caps->GuardBandBottom = _pWineCaps->GuardBandBottom; \
_pD3D9Caps->ExtentsAdjust = _pWineCaps->ExtentsAdjust; \
_pD3D9Caps->StencilCaps = _pWineCaps->StencilCaps; \
_pD3D9Caps->FVFCaps = _pWineCaps->FVFCaps; \
_pD3D9Caps->TextureOpCaps = _pWineCaps->TextureOpCaps; \
_pD3D9Caps->MaxTextureBlendStages = _pWineCaps->MaxTextureBlendStages; \
_pD3D9Caps->MaxSimultaneousTextures = _pWineCaps->MaxSimultaneousTextures; \
_pD3D9Caps->VertexProcessingCaps = _pWineCaps->VertexProcessingCaps; \
_pD3D9Caps->MaxActiveLights = _pWineCaps->MaxActiveLights; \
_pD3D9Caps->MaxUserClipPlanes = _pWineCaps->MaxUserClipPlanes; \
_pD3D9Caps->MaxVertexBlendMatrices = _pWineCaps->MaxVertexBlendMatrices; \
_pD3D9Caps->MaxVertexBlendMatrixIndex = _pWineCaps->MaxVertexBlendMatrixIndex; \
_pD3D9Caps->MaxPointSize = _pWineCaps->MaxPointSize; \
_pD3D9Caps->MaxPrimitiveCount = _pWineCaps->MaxPrimitiveCount; \
_pD3D9Caps->MaxVertexIndex = _pWineCaps->MaxVertexIndex; \
_pD3D9Caps->MaxStreams = _pWineCaps->MaxStreams; \
_pD3D9Caps->MaxStreamStride = _pWineCaps->MaxStreamStride; \
_pD3D9Caps->VertexShaderVersion = _pWineCaps->VertexShaderVersion; \
_pD3D9Caps->MaxVertexShaderConst = _pWineCaps->MaxVertexShaderConst; \
_pD3D9Caps->PixelShaderVersion = _pWineCaps->PixelShaderVersion; \
_pD3D9Caps->PixelShader1xMaxValue = _pWineCaps->PixelShader1xMaxValue; \
_pD3D9Caps->DevCaps2 = _pWineCaps->DevCaps2; \
_pD3D9Caps->MaxNpatchTessellationLevel = _pWineCaps->MaxNpatchTessellationLevel; \
_pD3D9Caps->MasterAdapterOrdinal = _pWineCaps->MasterAdapterOrdinal; \
_pD3D9Caps->AdapterOrdinalInGroup = _pWineCaps->AdapterOrdinalInGroup; \
_pD3D9Caps->NumberOfAdaptersInGroup = _pWineCaps->NumberOfAdaptersInGroup; \
_pD3D9Caps->DeclTypes = _pWineCaps->DeclTypes; \
_pD3D9Caps->NumSimultaneousRTs = _pWineCaps->NumSimultaneousRTs; \
_pD3D9Caps->StretchRectFilterCaps = _pWineCaps->StretchRectFilterCaps; \
_pD3D9Caps->VS20Caps.Caps = _pWineCaps->VS20Caps.caps; \
_pD3D9Caps->VS20Caps.DynamicFlowControlDepth = _pWineCaps->VS20Caps.dynamic_flow_control_depth; \
_pD3D9Caps->VS20Caps.NumTemps = _pWineCaps->VS20Caps.temp_count; \
_pD3D9Caps->VS20Caps.StaticFlowControlDepth = _pWineCaps->VS20Caps.static_flow_control_depth; \
_pD3D9Caps->PS20Caps.Caps = _pWineCaps->PS20Caps.caps; \
_pD3D9Caps->PS20Caps.DynamicFlowControlDepth = _pWineCaps->PS20Caps.dynamic_flow_control_depth; \
_pD3D9Caps->PS20Caps.NumTemps = _pWineCaps->PS20Caps.temp_count; \
_pD3D9Caps->PS20Caps.StaticFlowControlDepth = _pWineCaps->PS20Caps.static_flow_control_depth; \
_pD3D9Caps->PS20Caps.NumInstructionSlots = _pWineCaps->PS20Caps.instruction_slot_count; \
_pD3D9Caps->VertexTextureFilterCaps = _pWineCaps->VertexTextureFilterCaps; \
_pD3D9Caps->MaxVShaderInstructionsExecuted = _pWineCaps->MaxVShaderInstructionsExecuted; \
_pD3D9Caps->MaxPShaderInstructionsExecuted = _pWineCaps->MaxPShaderInstructionsExecuted; \
_pD3D9Caps->MaxVertexShader30InstructionSlots = _pWineCaps->MaxVertexShader30InstructionSlots; \
_pD3D9Caps->MaxPixelShader30InstructionSlots = _pWineCaps->MaxPixelShader30InstructionSlots;
void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d9
{
@@ -137,7 +67,6 @@ struct d3d9
};
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) DECLSPEC_HIDDEN;
void filter_caps(D3DCAPS9* pCaps) DECLSPEC_HIDDEN;
struct fvf_declaration
{
@@ -173,6 +102,7 @@ struct d3d9_device
LONG device_state;
BOOL in_destruction;
BOOL in_scene;
BOOL has_vertex_declaration;
UINT implicit_swapchain_count;
struct d3d9_swapchain **implicit_swapchains;
@@ -230,10 +160,12 @@ struct d3d9_surface
IDirect3DDevice9Ex *parent_device;
IUnknown *container;
struct d3d9_texture *texture;
BOOL getdc_supported;
};
struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view *d3d9_surface_acquire_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN;
struct d3d9_device *d3d9_surface_get_device(const struct d3d9_surface *surface) DECLSPEC_HIDDEN;
void d3d9_surface_release_rendertarget_view(struct d3d9_surface *surface,
struct wined3d_rendertarget_view *rtv) DECLSPEC_HIDDEN;
void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture,
unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN;
@@ -341,6 +273,7 @@ struct d3d9_query
LONG refcount;
struct wined3d_query *wined3d_query;
IDirect3DDevice9Ex *parent_device;
DWORD data_size;
};
HRESULT query_init(struct d3d9_query *query, struct d3d9_device *device, D3DQUERYTYPE type) DECLSPEC_HIDDEN;
File diff suppressed because it is too large Load Diff
+12 -103
View File
@@ -254,27 +254,20 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
usage = usage & (WINED3DUSAGE_MASK | WINED3DUSAGE_QUERY_MASK);
switch (resource_type)
{
case D3DRTYPE_SURFACE:
wined3d_rtype = WINED3D_RTYPE_SURFACE;
break;
case D3DRTYPE_VOLUME:
wined3d_rtype = WINED3D_RTYPE_VOLUME;
break;
case D3DRTYPE_CUBETEXTURE:
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
case D3DRTYPE_TEXTURE:
usage |= WINED3DUSAGE_TEXTURE;
case D3DRTYPE_SURFACE:
wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
break;
case D3DRTYPE_VOLUMETEXTURE:
case D3DRTYPE_VOLUME:
usage |= WINED3DUSAGE_TEXTURE;
wined3d_rtype = WINED3D_RTYPE_TEXTURE_3D;
break;
case D3DRTYPE_CUBETEXTURE:
wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
break;
case D3DRTYPE_VERTEXBUFFER:
case D3DRTYPE_INDEXBUFFER:
wined3d_rtype = WINED3D_RTYPE_BUFFER;
@@ -350,87 +343,10 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT
return hr;
}
void filter_caps(D3DCAPS9* pCaps)
{
DWORD ps_minor_version[] = {0, 4, 0, 0};
DWORD vs_minor_version[] = {0, 1, 0, 0};
DWORD textureFilterCaps =
D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MINFLINEAR | D3DPTFILTERCAPS_MINFANISOTROPIC |
D3DPTFILTERCAPS_MINFPYRAMIDALQUAD | D3DPTFILTERCAPS_MINFGAUSSIANQUAD|
D3DPTFILTERCAPS_MIPFPOINT | D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT |
D3DPTFILTERCAPS_MAGFLINEAR |D3DPTFILTERCAPS_MAGFANISOTROPIC|D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD|
D3DPTFILTERCAPS_MAGFGAUSSIANQUAD;
pCaps->TextureFilterCaps &= textureFilterCaps;
pCaps->CubeTextureFilterCaps &= textureFilterCaps;
pCaps->VolumeTextureFilterCaps &= textureFilterCaps;
pCaps->DevCaps &=
D3DDEVCAPS_EXECUTESYSTEMMEMORY | D3DDEVCAPS_EXECUTEVIDEOMEMORY | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY |
D3DDEVCAPS_TLVERTEXVIDEOMEMORY | D3DDEVCAPS_TEXTURESYSTEMMEMORY| D3DDEVCAPS_TEXTUREVIDEOMEMORY |
D3DDEVCAPS_DRAWPRIMTLVERTEX | D3DDEVCAPS_CANRENDERAFTERFLIP | D3DDEVCAPS_TEXTURENONLOCALVIDMEM|
D3DDEVCAPS_DRAWPRIMITIVES2 | D3DDEVCAPS_SEPARATETEXTUREMEMORIES |
D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWTRANSFORMANDLIGHT| D3DDEVCAPS_CANBLTSYSTONONLOCAL |
D3DDEVCAPS_HWRASTERIZATION | D3DDEVCAPS_PUREDEVICE | D3DDEVCAPS_QUINTICRTPATCHES |
D3DDEVCAPS_RTPATCHES | D3DDEVCAPS_RTPATCHHANDLEZERO | D3DDEVCAPS_NPATCHES;
pCaps->ShadeCaps &=
D3DPSHADECAPS_COLORGOURAUDRGB | D3DPSHADECAPS_SPECULARGOURAUDRGB |
D3DPSHADECAPS_ALPHAGOURAUDBLEND | D3DPSHADECAPS_FOGGOURAUD;
pCaps->RasterCaps &=
D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_ZTEST | D3DPRASTERCAPS_FOGVERTEX |
D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_MIPMAPLODBIAS | D3DPRASTERCAPS_ZBUFFERLESSHSR |
D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_ANISOTROPY | D3DPRASTERCAPS_WBUFFER |
D3DPRASTERCAPS_WFOG | D3DPRASTERCAPS_ZFOG | D3DPRASTERCAPS_COLORPERSPECTIVE |
D3DPRASTERCAPS_SCISSORTEST | D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS |
D3DPRASTERCAPS_DEPTHBIAS | D3DPRASTERCAPS_MULTISAMPLE_TOGGLE;
pCaps->DevCaps2 &=
D3DDEVCAPS2_STREAMOFFSET | D3DDEVCAPS2_DMAPNPATCH | D3DDEVCAPS2_ADAPTIVETESSRTPATCH |
D3DDEVCAPS2_ADAPTIVETESSNPATCH | D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES |
D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH| D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET;
pCaps->Caps2 &=
D3DCAPS2_FULLSCREENGAMMA | D3DCAPS2_CANCALIBRATEGAMMA | D3DCAPS2_RESERVED |
D3DCAPS2_CANMANAGERESOURCE | D3DCAPS2_DYNAMICTEXTURES | D3DCAPS2_CANAUTOGENMIPMAP;
pCaps->VertexProcessingCaps &=
D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_DIRECTIONALLIGHTS |
D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER | D3DVTXPCAPS_TWEENING |
D3DVTXPCAPS_TEXGEN_SPHEREMAP | D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER;
pCaps->TextureCaps &=
D3DPTEXTURECAPS_PERSPECTIVE | D3DPTEXTURECAPS_POW2 | D3DPTEXTURECAPS_ALPHA |
D3DPTEXTURECAPS_SQUAREONLY | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE |
D3DPTEXTURECAPS_ALPHAPALETTE | D3DPTEXTURECAPS_NONPOW2CONDITIONAL |
D3DPTEXTURECAPS_PROJECTED | D3DPTEXTURECAPS_CUBEMAP | D3DPTEXTURECAPS_VOLUMEMAP |
D3DPTEXTURECAPS_MIPMAP | D3DPTEXTURECAPS_MIPVOLUMEMAP | D3DPTEXTURECAPS_MIPCUBEMAP |
D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2| D3DPTEXTURECAPS_NOPROJECTEDBUMPENV;
pCaps->MaxVertexShaderConst = min(D3D9_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst);
pCaps->NumSimultaneousRTs = min(D3D9_MAX_SIMULTANEOUS_RENDERTARGETS, pCaps->NumSimultaneousRTs);
if (pCaps->PixelShaderVersion > 3)
pCaps->PixelShaderVersion = D3DPS_VERSION(3,0);
else
{
DWORD major = pCaps->PixelShaderVersion;
pCaps->PixelShaderVersion = D3DPS_VERSION(major,ps_minor_version[major]);
}
if (pCaps->VertexShaderVersion > 3)
pCaps->VertexShaderVersion = D3DVS_VERSION(3,0);
else
{
DWORD major = pCaps->VertexShaderVersion;
pCaps->VertexShaderVersion = D3DVS_VERSION(major,vs_minor_version[major]);
}
}
static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps)
{
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
WINED3DCAPS *wined3d_caps;
WINED3DCAPS wined3d_caps;
HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps);
@@ -438,21 +354,13 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD
if (!caps)
return D3DERR_INVALIDCALL;
if (!(wined3d_caps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS))))
return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
memset(caps, 0, sizeof(*caps));
wined3d_mutex_lock();
hr = wined3d_get_device_caps(d3d9->wined3d, adapter, device_type, wined3d_caps);
hr = wined3d_get_device_caps(d3d9->wined3d, adapter, device_type, &wined3d_caps);
wined3d_mutex_unlock();
WINECAPSTOD3D9CAPS(caps, wined3d_caps)
HeapFree(GetProcessHeap(), 0, wined3d_caps);
/* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */
caps->DevCaps2 |= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES;
filter_caps(caps);
d3dcaps_from_wined3dcaps(caps, &wined3d_caps);
return hr;
}
@@ -502,7 +410,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_CreateDevice(IDirect3D9Ex *iface, U
}
TRACE("Created device %p.\n", object);
*device = (IDirect3DDevice9 *)object;
*device = (IDirect3DDevice9 *)&object->IDirect3DDevice9Ex_iface;
return D3D_OK;
}
@@ -668,7 +576,8 @@ static const struct IDirect3D9ExVtbl d3d9_vtbl =
BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
{
DWORD flags = WINED3D_PRESENT_CONVERSION | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
| WINED3D_SRGB_READ_WRITE_CONTROL;
| WINED3D_SRGB_READ_WRITE_CONTROL | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR
| WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING;
if (!extended)
flags |= WINED3D_VIDMEM_ACCOUNTING;
+29 -15
View File
@@ -105,20 +105,10 @@ static D3DQUERYTYPE WINAPI d3d9_query_GetType(IDirect3DQuery9 *iface)
static DWORD WINAPI d3d9_query_GetDataSize(IDirect3DQuery9 *iface)
{
struct d3d9_query *query = impl_from_IDirect3DQuery9(iface);
enum wined3d_query_type type;
DWORD ret;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
type = wined3d_query_get_type(query->wined3d_query);
if (type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT)
ret = sizeof(BOOL);
else
ret = wined3d_query_get_data_size(query->wined3d_query);
wined3d_mutex_unlock();
return ret;
return query->data_size;
}
static HRESULT WINAPI d3d9_query_Issue(IDirect3DQuery9 *iface, DWORD flags)
@@ -154,7 +144,8 @@ static HRESULT WINAPI d3d9_query_GetData(IDirect3DQuery9 *iface, void *data, DWO
size = sizeof(data_disjoint.disjoint);
hr = wined3d_query_get_data(query->wined3d_query, &data_disjoint, sizeof(data_disjoint), flags);
memcpy(data, &data_disjoint.disjoint, size);
if (SUCCEEDED(hr))
memcpy(data, &data_disjoint.disjoint, size);
}
else
{
@@ -162,6 +153,15 @@ static HRESULT WINAPI d3d9_query_GetData(IDirect3DQuery9 *iface, void *data, DWO
}
wined3d_mutex_unlock();
if (hr == D3DERR_INVALIDCALL)
{
if (data)
{
memset(data, 0, size);
memset(data, 0xdd, min(size, query->data_size));
}
return S_OK;
}
return hr;
}
@@ -182,18 +182,32 @@ HRESULT query_init(struct d3d9_query *query, struct d3d9_device *device, D3DQUER
{
HRESULT hr;
if (type > D3DQUERYTYPE_MEMORYPRESSURE)
{
WARN("Invalid query type %#x.\n", type);
return D3DERR_NOTAVAILABLE;
}
query->IDirect3DQuery9_iface.lpVtbl = &d3d9_query_vtbl;
query->refcount = 1;
wined3d_mutex_lock();
hr = wined3d_query_create(device->wined3d_device, type, query, &query->wined3d_query);
wined3d_mutex_unlock();
if (FAILED(hr))
if (FAILED(hr = wined3d_query_create(device->wined3d_device, type,
query, &d3d9_null_wined3d_parent_ops, &query->wined3d_query)))
{
wined3d_mutex_unlock();
WARN("Failed to create wined3d query, hr %#x.\n", hr);
return hr;
}
if (type == D3DQUERYTYPE_OCCLUSION)
query->data_size = sizeof(DWORD);
else if (type == D3DQUERYTYPE_TIMESTAMPDISJOINT)
query->data_size = sizeof(BOOL);
else
query->data_size = wined3d_query_get_data_size(query->wined3d_query);
wined3d_mutex_unlock();
query->parent_device = &device->IDirect3DDevice9Ex_iface;
IDirect3DDevice9Ex_AddRef(query->parent_device);
+10 -4
View File
@@ -140,8 +140,11 @@ HRESULT vertexshader_init(struct d3d9_vertexshader *shader, struct d3d9_device *
shader->IDirect3DVertexShader9_iface.lpVtbl = &d3d9_vertexshader_vtbl;
desc.byte_code = byte_code;
desc.input_signature = NULL;
desc.output_signature = NULL;
desc.byte_code_size = ~(size_t)0;
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
desc.max_version = 3;
wined3d_mutex_lock();
@@ -291,8 +294,11 @@ HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *de
shader->IDirect3DPixelShader9_iface.lpVtbl = &d3d9_pixelshader_vtbl;
desc.byte_code = byte_code;
desc.input_signature = NULL;
desc.output_signature = NULL;
desc.byte_code_size = ~(size_t)0;
desc.format = WINED3D_SHADER_BYTE_CODE_FORMAT_SM1;
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
desc.max_version = 3;
wined3d_mutex_lock();
+38 -51
View File
@@ -90,7 +90,7 @@ static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
if (!surface->resource.refcount)
{
ERR("Surface doesn't have any references.\n");
WARN("Surface does not have any references.\n");
return 0;
}
@@ -179,7 +179,7 @@ static void WINAPI d3d9_surface_PreLoad(IDirect3DSurface9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(surface->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(surface->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -210,18 +210,16 @@ static HRESULT WINAPI d3d9_surface_GetContainer(IDirect3DSurface9 *iface, REFIID
static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_DESC *desc)
{
struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *sub_resource;
struct wined3d_sub_resource_desc wined3d_desc;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
sub_resource = wined3d_texture_get_sub_resource(surface->wined3d_texture, surface->sub_resource_idx);
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
wined3d_texture_get_sub_resource_desc(surface->wined3d_texture, surface->sub_resource_idx, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->MultiSampleType = wined3d_desc.multisample_type;
@@ -244,17 +242,10 @@ static HRESULT WINAPI d3d9_surface_LockRect(IDirect3DSurface9 *iface,
iface, locked_rect, wine_dbgstr_rect(rect), flags);
if (rect)
{
box.left = rect->left;
box.top = rect->top;
box.right = rect->right;
box.bottom = rect->bottom;
box.front = 0;
box.back = 1;
}
wined3d_box_set(&box, rect->left, rect->top, rect->right, rect->bottom, 0, 1);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx,
hr = wined3d_resource_map(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx,
&map_desc, rect ? &box : NULL, flags);
wined3d_mutex_unlock();
@@ -275,14 +266,19 @@ static HRESULT WINAPI d3d9_surface_UnlockRect(IDirect3DSurface9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx);
hr = wined3d_resource_unmap(wined3d_texture_get_resource(surface->wined3d_texture), surface->sub_resource_idx);
wined3d_mutex_unlock();
switch(hr)
if (hr == WINEDDERR_NOTLOCKED)
{
case WINEDDERR_NOTLOCKED: return D3DERR_INVALIDCALL;
default: return hr;
D3DRESOURCETYPE type;
if (surface->texture)
type = IDirect3DBaseTexture9_GetType(&surface->texture->IDirect3DBaseTexture9_iface);
else
type = D3DRTYPE_SURFACE;
hr = type == D3DRTYPE_TEXTURE ? D3D_OK : D3DERR_INVALIDCALL;
}
return hr;
}
static HRESULT WINAPI d3d9_surface_GetDC(IDirect3DSurface9 *iface, HDC *dc)
@@ -292,13 +288,6 @@ static HRESULT WINAPI d3d9_surface_GetDC(IDirect3DSurface9 *iface, HDC *dc)
TRACE("iface %p, dc %p.\n", iface, dc);
if (!surface->getdc_supported)
{
WARN("Surface does not support GetDC, returning D3DERR_INVALIDCALL\n");
/* Don't touch the DC */
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
hr = wined3d_texture_get_dc(surface->wined3d_texture, surface->sub_resource_idx, dc);
wined3d_mutex_unlock();
@@ -317,11 +306,7 @@ static HRESULT WINAPI d3d9_surface_ReleaseDC(IDirect3DSurface9 *iface, HDC dc)
hr = wined3d_texture_release_dc(surface->wined3d_texture, surface->sub_resource_idx, dc);
wined3d_mutex_unlock();
switch (hr)
{
case WINEDDERR_NODC: return D3DERR_INVALIDCALL;
default: return hr;
}
return hr;
}
static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl =
@@ -363,7 +348,6 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops =
void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture,
unsigned int sub_resource_idx, const struct wined3d_parent_ops **parent_ops)
{
struct wined3d_resource_desc desc;
IDirect3DBaseTexture9 *texture;
surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl;
@@ -381,23 +365,6 @@ void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_
IDirect3DBaseTexture9_Release(texture);
}
wined3d_resource_get_desc(wined3d_texture_get_resource(wined3d_texture), &desc);
switch (d3dformat_from_wined3dformat(desc.format))
{
case D3DFMT_A8R8G8B8:
case D3DFMT_X8R8G8B8:
case D3DFMT_R5G6B5:
case D3DFMT_X1R5G5B5:
case D3DFMT_A1R5G5B5:
case D3DFMT_R8G8B8:
surface->getdc_supported = TRUE;
break;
default:
surface->getdc_supported = FALSE;
break;
}
*parent_ops = &d3d9_surface_wined3d_parent_ops;
}
@@ -423,10 +390,22 @@ static const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops =
view_wined3d_object_destroyed,
};
struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface)
struct d3d9_device *d3d9_surface_get_device(const struct d3d9_surface *surface)
{
IDirect3DDevice9Ex *device;
device = surface->texture ? surface->texture->parent_device : surface->parent_device;
return impl_from_IDirect3DDevice9Ex(device);
}
struct wined3d_rendertarget_view *d3d9_surface_acquire_rendertarget_view(struct d3d9_surface *surface)
{
HRESULT hr;
/* The surface reference count can be equal to 0 when this function is
* called. In order to properly manage the render target view reference
* count, we temporarily increment the surface reference count. */
d3d9_surface_AddRef(&surface->IDirect3DSurface9_iface);
if (surface->wined3d_rtv)
return surface->wined3d_rtv;
@@ -434,6 +413,7 @@ struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9
surface->sub_resource_idx, surface, &d3d9_view_wined3d_parent_ops, &surface->wined3d_rtv)))
{
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
d3d9_surface_Release(&surface->IDirect3DSurface9_iface);
return NULL;
}
@@ -443,6 +423,13 @@ struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9
return surface->wined3d_rtv;
}
void d3d9_surface_release_rendertarget_view(struct d3d9_surface *surface,
struct wined3d_rendertarget_view *rtv)
{
if (rtv)
d3d9_surface_Release(&surface->IDirect3DSurface9_iface);
}
struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface)
{
if (!iface)
+14 -6
View File
@@ -87,8 +87,15 @@ static ULONG WINAPI d3d9_swapchain_AddRef(IDirect3DSwapChain9Ex *iface)
static ULONG WINAPI d3d9_swapchain_Release(IDirect3DSwapChain9Ex *iface)
{
struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
ULONG refcount = InterlockedDecrement(&swapchain->refcount);
ULONG refcount;
if (!swapchain->refcount)
{
WARN("Swapchain does not have any references.\n");
return 0;
}
refcount = InterlockedDecrement(&swapchain->refcount);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
@@ -122,9 +129,12 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_swapchain_Present(IDirect3DSwapChai
if (device->device_state != D3D9_DEVICE_STATE_OK)
return device->d3d_parent->extended ? S_PRESENT_OCCLUDED : D3DERR_DEVICELOST;
if (dirty_region)
FIXME("Ignoring dirty_region %p.\n", dirty_region);
wined3d_mutex_lock();
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain, src_rect,
dst_rect, dst_window_override, dirty_region, flags);
hr = wined3d_swapchain_present(swapchain->wined3d_swapchain,
src_rect, dst_rect, dst_window_override, flags);
wined3d_mutex_unlock();
return hr;
@@ -149,7 +159,6 @@ static HRESULT WINAPI d3d9_swapchain_GetBackBuffer(IDirect3DSwapChain9Ex *iface,
UINT backbuffer_idx, D3DBACKBUFFER_TYPE backbuffer_type, IDirect3DSurface9 **backbuffer)
{
struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
struct wined3d_resource *wined3d_resource;
struct wined3d_texture *wined3d_texture;
struct d3d9_surface *surface_impl;
HRESULT hr = D3D_OK;
@@ -168,8 +177,7 @@ static HRESULT WINAPI d3d9_swapchain_GetBackBuffer(IDirect3DSwapChain9Ex *iface,
wined3d_mutex_lock();
if ((wined3d_texture = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain, backbuffer_idx)))
{
wined3d_resource = wined3d_texture_get_sub_resource(wined3d_texture, 0);
surface_impl = wined3d_resource_get_parent(wined3d_resource);
surface_impl = wined3d_texture_get_sub_resource_parent(wined3d_texture, 0);
*backbuffer = &surface_impl->IDirect3DSurface9_iface;
IDirect3DSurface9_AddRef(*backbuffer);
}
+38 -87
View File
@@ -22,17 +22,17 @@
static inline struct d3d9_texture *impl_from_IDirect3DTexture9(IDirect3DTexture9 *iface)
{
return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
return CONTAINING_RECORD((IDirect3DBaseTexture9 *)iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
}
static inline struct d3d9_texture *impl_from_IDirect3DCubeTexture9(IDirect3DCubeTexture9 *iface)
{
return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
return CONTAINING_RECORD((IDirect3DBaseTexture9 *)iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
}
static inline struct d3d9_texture *impl_from_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 *iface)
{
return CONTAINING_RECORD(iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
return CONTAINING_RECORD((IDirect3DBaseTexture9 *)iface, struct d3d9_texture, IDirect3DBaseTexture9_iface);
}
static HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *iface, REFIID riid, void **out)
@@ -186,7 +186,7 @@ static void WINAPI d3d9_texture_2d_PreLoad(IDirect3DTexture9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(texture->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -282,21 +282,16 @@ static void WINAPI d3d9_texture_2d_GenerateMipSubLevels(IDirect3DTexture9 *iface
static HRESULT WINAPI d3d9_texture_2d_GetLevelDesc(IDirect3DTexture9 *iface, UINT level, D3DSURFACE_DESC *desc)
{
struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK;
struct wined3d_sub_resource_desc wined3d_desc;
HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
{
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->MultiSampleType = wined3d_desc.multisample_type;
@@ -313,19 +308,17 @@ static HRESULT WINAPI d3d9_texture_2d_GetSurfaceLevel(IDirect3DTexture9 *iface,
UINT level, IDirect3DSurface9 **surface)
{
struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_surface *surface_impl;
TRACE("iface %p, level %u, surface %p.\n", iface, level, surface);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
{
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
surface_impl = wined3d_resource_get_parent(sub_resource);
*surface = &surface_impl->IDirect3DSurface9_iface;
IDirect3DSurface9_AddRef(*surface);
wined3d_mutex_unlock();
@@ -337,7 +330,6 @@ static HRESULT WINAPI d3d9_texture_2d_LockRect(IDirect3DTexture9 *iface,
UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
{
struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_surface *surface_impl;
HRESULT hr;
@@ -345,13 +337,10 @@ static HRESULT WINAPI d3d9_texture_2d_LockRect(IDirect3DTexture9 *iface,
iface, level, locked_rect, rect, flags);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
{
surface_impl = wined3d_resource_get_parent(sub_resource);
hr = IDirect3DSurface9_LockRect(&surface_impl->IDirect3DSurface9_iface, locked_rect, rect, flags);
}
wined3d_mutex_unlock();
return hr;
@@ -360,20 +349,16 @@ static HRESULT WINAPI d3d9_texture_2d_LockRect(IDirect3DTexture9 *iface,
static HRESULT WINAPI d3d9_texture_2d_UnlockRect(IDirect3DTexture9 *iface, UINT level)
{
struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_surface *surface_impl;
HRESULT hr;
TRACE("iface %p, level %u.\n", iface, level);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
{
surface_impl = wined3d_resource_get_parent(sub_resource);
hr = IDirect3DSurface9_UnlockRect(&surface_impl->IDirect3DSurface9_iface);
}
wined3d_mutex_unlock();
return hr;
@@ -394,12 +379,7 @@ static HRESULT WINAPI d3d9_texture_2d_AddDirtyRect(IDirect3DTexture9 *iface, con
{
struct wined3d_box dirty_region;
dirty_region.left = dirty_rect->left;
dirty_region.top = dirty_rect->top;
dirty_region.right = dirty_rect->right;
dirty_region.bottom = dirty_rect->bottom;
dirty_region.front = 0;
dirty_region.back = 1;
wined3d_box_set(&dirty_region, dirty_rect->left, dirty_rect->top, dirty_rect->right, dirty_rect->bottom, 0, 1);
hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, &dirty_region);
}
wined3d_mutex_unlock();
@@ -590,7 +570,7 @@ static void WINAPI d3d9_texture_cube_PreLoad(IDirect3DCubeTexture9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(texture->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -687,9 +667,9 @@ static void WINAPI d3d9_texture_cube_GenerateMipSubLevels(IDirect3DCubeTexture9
static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *iface, UINT level, D3DSURFACE_DESC *desc)
{
struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK;
struct wined3d_sub_resource_desc wined3d_desc;
DWORD level_count;
HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
@@ -701,15 +681,10 @@ static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *ifac
return D3DERR_INVALIDCALL;
}
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
{
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->MultiSampleType = wined3d_desc.multisample_type;
@@ -726,7 +701,6 @@ static HRESULT WINAPI d3d9_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture9
D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface9 **surface)
{
struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_surface *surface_impl;
UINT sub_resource_idx;
DWORD level_count;
@@ -742,13 +716,12 @@ static HRESULT WINAPI d3d9_texture_cube_GetCubeMapSurface(IDirect3DCubeTexture9
}
sub_resource_idx = level_count * face + level;
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, sub_resource_idx)))
{
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
surface_impl = wined3d_resource_get_parent(sub_resource);
*surface = &surface_impl->IDirect3DSurface9_iface;
IDirect3DSurface9_AddRef(*surface);
wined3d_mutex_unlock();
@@ -761,7 +734,6 @@ static HRESULT WINAPI d3d9_texture_cube_LockRect(IDirect3DCubeTexture9 *iface,
DWORD flags)
{
struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_surface *surface_impl;
UINT sub_resource_idx;
HRESULT hr;
@@ -771,13 +743,10 @@ static HRESULT WINAPI d3d9_texture_cube_LockRect(IDirect3DCubeTexture9 *iface,
wined3d_mutex_lock();
sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level;
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, sub_resource_idx)))
hr = D3DERR_INVALIDCALL;
else
{
surface_impl = wined3d_resource_get_parent(sub_resource);
hr = IDirect3DSurface9_LockRect(&surface_impl->IDirect3DSurface9_iface, locked_rect, rect, flags);
}
wined3d_mutex_unlock();
return hr;
@@ -787,7 +756,6 @@ static HRESULT WINAPI d3d9_texture_cube_UnlockRect(IDirect3DCubeTexture9 *iface,
D3DCUBEMAP_FACES face, UINT level)
{
struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_surface *surface_impl;
UINT sub_resource_idx;
HRESULT hr;
@@ -796,13 +764,10 @@ static HRESULT WINAPI d3d9_texture_cube_UnlockRect(IDirect3DCubeTexture9 *iface,
wined3d_mutex_lock();
sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level;
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx)))
if (!(surface_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, sub_resource_idx)))
hr = D3DERR_INVALIDCALL;
else
{
surface_impl = wined3d_resource_get_parent(sub_resource);
hr = IDirect3DSurface9_UnlockRect(&surface_impl->IDirect3DSurface9_iface);
}
wined3d_mutex_unlock();
return hr;
@@ -824,12 +789,7 @@ static HRESULT WINAPI d3d9_texture_cube_AddDirtyRect(IDirect3DCubeTexture9 *ifa
{
struct wined3d_box dirty_region;
dirty_region.left = dirty_rect->left;
dirty_region.top = dirty_rect->top;
dirty_region.right = dirty_rect->right;
dirty_region.bottom = dirty_rect->bottom;
dirty_region.front = 0;
dirty_region.back = 1;
wined3d_box_set(&dirty_region, dirty_rect->left, dirty_rect->top, dirty_rect->right, dirty_rect->bottom, 0, 1);
hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, &dirty_region);
}
wined3d_mutex_unlock();
@@ -1007,7 +967,7 @@ static void WINAPI d3d9_texture_3d_PreLoad(IDirect3DVolumeTexture9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_texture_preload(texture->wined3d_texture);
wined3d_resource_preload(wined3d_texture_get_resource(texture->wined3d_texture));
wined3d_mutex_unlock();
}
@@ -1104,21 +1064,16 @@ static void WINAPI d3d9_texture_3d_GenerateMipSubLevels(IDirect3DVolumeTexture9
static HRESULT WINAPI d3d9_texture_3d_GetLevelDesc(IDirect3DVolumeTexture9 *iface, UINT level, D3DVOLUME_DESC *desc)
{
struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
struct wined3d_resource *sub_resource;
HRESULT hr = D3D_OK;
struct wined3d_sub_resource_desc wined3d_desc;
HRESULT hr;
TRACE("iface %p, level %u, desc %p.\n", iface, level, desc);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
if (SUCCEEDED(hr = wined3d_texture_get_sub_resource_desc(texture->wined3d_texture, level, &wined3d_desc)))
{
struct wined3d_resource_desc wined3d_desc;
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Width = wined3d_desc.width;
@@ -1134,19 +1089,17 @@ static HRESULT WINAPI d3d9_texture_3d_GetVolumeLevel(IDirect3DVolumeTexture9 *if
UINT level, IDirect3DVolume9 **volume)
{
struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_volume *volume_impl;
TRACE("iface %p, level %u, volume %p.\n", iface, level, volume);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
{
wined3d_mutex_unlock();
return D3DERR_INVALIDCALL;
}
volume_impl = wined3d_resource_get_parent(sub_resource);
*volume = &volume_impl->IDirect3DVolume9_iface;
IDirect3DVolume9_AddRef(*volume);
wined3d_mutex_unlock();
@@ -1158,7 +1111,6 @@ static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface,
UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags)
{
struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_volume *volume_impl;
HRESULT hr;
@@ -1166,13 +1118,10 @@ static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface,
iface, level, locked_box, box, flags);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
{
volume_impl = wined3d_resource_get_parent(sub_resource);
hr = IDirect3DVolume9_LockBox(&volume_impl->IDirect3DVolume9_iface, locked_box, box, flags);
}
wined3d_mutex_unlock();
return hr;
@@ -1181,20 +1130,16 @@ static HRESULT WINAPI d3d9_texture_3d_LockBox(IDirect3DVolumeTexture9 *iface,
static HRESULT WINAPI d3d9_texture_3d_UnlockBox(IDirect3DVolumeTexture9 *iface, UINT level)
{
struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
struct wined3d_resource *sub_resource;
struct d3d9_volume *volume_impl;
HRESULT hr;
TRACE("iface %p, level %u.\n", iface, level);
wined3d_mutex_lock();
if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level)))
if (!(volume_impl = wined3d_texture_get_sub_resource_parent(texture->wined3d_texture, level)))
hr = D3DERR_INVALIDCALL;
else
{
volume_impl = wined3d_resource_get_parent(sub_resource);
hr = IDirect3DVolume9_UnlockBox(&volume_impl->IDirect3DVolume9_iface);
}
wined3d_mutex_unlock();
return hr;
@@ -1299,6 +1244,9 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
flags |= WINED3D_TEXTURE_CREATE_MAPPABLE;
if (is_gdi_compat_wined3dformat(desc.format))
flags |= WINED3D_TEXTURE_CREATE_GET_DC;
if (!levels)
{
if (usage & D3DUSAGE_AUTOGENMIPMAP)
@@ -1308,7 +1256,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
}
wined3d_mutex_lock();
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
wined3d_mutex_unlock();
if (FAILED(hr))
@@ -1349,6 +1297,9 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
if (pool != D3DPOOL_DEFAULT || (usage & D3DUSAGE_DYNAMIC))
flags |= WINED3D_TEXTURE_CREATE_MAPPABLE;
if (is_gdi_compat_wined3dformat(desc.format))
flags |= WINED3D_TEXTURE_CREATE_GET_DC;
if (!levels)
{
if (usage & D3DUSAGE_AUTOGENMIPMAP)
@@ -1358,7 +1309,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
}
wined3d_mutex_lock();
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
wined3d_mutex_unlock();
if (FAILED(hr))
@@ -1404,7 +1355,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
}
wined3d_mutex_lock();
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, 0,
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
wined3d_mutex_unlock();
if (FAILED(hr))
@@ -42,8 +42,8 @@ d3d_dtype_lookup[] =
/* D3DDECLTYPE_SHORT4N */ {WINED3DFMT_R16G16B16A16_SNORM, 4, sizeof(short int)},
/* D3DDECLTYPE_USHORT2N */ {WINED3DFMT_R16G16_UNORM, 2, sizeof(short int)},
/* D3DDECLTYPE_USHORT4N */ {WINED3DFMT_R16G16B16A16_UNORM, 4, sizeof(short int)},
/* D3DDECLTYPE_UDEC3 */ {WINED3DFMT_R10G10B10A2_UINT, 3, sizeof(short int)},
/* D3DDECLTYPE_DEC3N */ {WINED3DFMT_R10G10B10A2_SNORM, 3, sizeof(short int)},
/* D3DDECLTYPE_UDEC3 */ {WINED3DFMT_R10G10B10X2_UINT, 3, sizeof(short int)},
/* D3DDECLTYPE_DEC3N */ {WINED3DFMT_R10G10B10X2_SNORM, 3, sizeof(short int)},
/* D3DDECLTYPE_FLOAT16_2 */ {WINED3DFMT_R16G16_FLOAT, 2, sizeof(short int)},
/* D3DDECLTYPE_FLOAT16_4 */ {WINED3DFMT_R16G16B16A16_FLOAT, 4, sizeof(short int)}
};
+9 -8
View File
@@ -113,18 +113,16 @@ static HRESULT WINAPI d3d9_volume_GetContainer(IDirect3DVolume9 *iface, REFIID r
static HRESULT WINAPI d3d9_volume_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DESC *desc)
{
struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface);
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *sub_resource;
struct wined3d_sub_resource_desc wined3d_desc;
TRACE("iface %p, desc %p.\n", iface, desc);
wined3d_mutex_lock();
sub_resource = wined3d_texture_get_sub_resource(volume->wined3d_texture, volume->sub_resource_idx);
wined3d_resource_get_desc(sub_resource, &wined3d_desc);
wined3d_texture_get_sub_resource_desc(volume->wined3d_texture, volume->sub_resource_idx, &wined3d_desc);
wined3d_mutex_unlock();
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = wined3d_desc.resource_type;
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = wined3d_desc.usage & WINED3DUSAGE_MASK;
desc->Pool = wined3d_desc.pool;
desc->Width = wined3d_desc.width;
@@ -145,8 +143,9 @@ static HRESULT WINAPI d3d9_volume_LockBox(IDirect3DVolume9 *iface,
iface, locked_box, box, flags);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_map(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx,
&map_desc, (const struct wined3d_box *)box, flags);
if (FAILED(hr = wined3d_resource_map(wined3d_texture_get_resource(volume->wined3d_texture),
volume->sub_resource_idx, &map_desc, (const struct wined3d_box *)box, flags)))
map_desc.data = NULL;
wined3d_mutex_unlock();
locked_box->RowPitch = map_desc.row_pitch;
@@ -164,9 +163,11 @@ static HRESULT WINAPI d3d9_volume_UnlockBox(IDirect3DVolume9 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = wined3d_resource_sub_resource_unmap(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx);
hr = wined3d_resource_unmap(wined3d_texture_get_resource(volume->wined3d_texture), volume->sub_resource_idx);
wined3d_mutex_unlock();
if (hr == WINEDDERR_NOTLOCKED)
return D3DERR_INVALIDCALL;
return hr;
}
+150 -55
View File
@@ -23,6 +23,8 @@
#include "ddraw_private.h"
#include <wine/exception.h>
static const struct ddraw *exclusive_ddraw;
static HWND exclusive_window;
@@ -358,7 +360,7 @@ static ULONG WINAPI d3d1_AddRef(IDirect3D *iface)
return ddraw1_AddRef(&This->IDirectDraw_iface);
}
void ddraw_destroy_swapchain(struct ddraw *ddraw)
static void ddraw_destroy_swapchain(struct ddraw *ddraw)
{
TRACE("Destroying the swapchain.\n");
@@ -630,6 +632,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_COPY;
swapchain_desc.device_window = window;
swapchain_desc.windowed = windowed;
swapchain_desc.flags = WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH;
if (!(ddraw->flags & DDRAW_NO3D))
hr = ddraw_attach_d3d_device(ddraw, &swapchain_desc);
@@ -651,6 +654,9 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
wined3d_swapchain_incref(ddraw->wined3d_swapchain);
ddraw_set_swapchain_window(ddraw, window);
if (ddraw->primary && ddraw->primary->palette)
wined3d_swapchain_set_palette(ddraw->wined3d_swapchain, ddraw->primary->palette->wined3d_palette);
return DD_OK;
}
@@ -688,6 +694,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface)
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, NULL)))
ddraw->flags &= ~DDRAW_RESTORE_MODE;
InterlockedCompareExchange(&ddraw->device_state, DDRAW_DEVICE_STATE_NOT_RESTORED, DDRAW_DEVICE_STATE_OK);
wined3d_mutex_unlock();
return hr;
@@ -888,7 +896,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
if ((cooplevel & DDSCL_FULLSCREEN) != (ddraw->cooperative_level & DDSCL_FULLSCREEN) || window != ddraw->dest_window)
{
if (ddraw->cooperative_level & DDSCL_FULLSCREEN)
wined3d_device_restore_fullscreen_window(ddraw->wined3d_device, ddraw->dest_window);
wined3d_device_restore_fullscreen_window(ddraw->wined3d_device, ddraw->dest_window, NULL);
if (cooplevel & DDSCL_FULLSCREEN)
{
@@ -1120,7 +1128,21 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW
/* 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. */
if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode)))
{
if (ddraw->primary)
{
DDSURFACEDESC2 *surface_desc = &ddraw->primary->surface_desc;
if (FAILED(hr = wined3d_swapchain_resize_buffers(ddraw->wined3d_swapchain, 0,
surface_desc->dwWidth, surface_desc->dwHeight, mode.format_id, WINED3D_MULTISAMPLE_NONE, 0)))
ERR("Failed to resize buffers, hr %#x.\n", hr);
else
ddrawformat_from_wined3dformat(&ddraw->primary->surface_desc.u4.ddpfPixelFormat, mode.format_id);
}
ddraw->flags |= DDRAW_RESTORE_MODE;
}
InterlockedCompareExchange(&ddraw->device_state, DDRAW_DEVICE_STATE_NOT_RESTORED, DDRAW_DEVICE_STATE_OK);
wined3d_mutex_unlock();
@@ -1487,7 +1509,7 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
hr = wined3d_device_get_device_caps(ddraw->wined3d_device, &winecaps);
if (FAILED(hr))
{
WARN("IWineD3DDevice::GetDeviceCaps failed\n");
WARN("Failed to get device caps, %#x.\n", hr);
wined3d_mutex_unlock();
return hr;
}
@@ -1527,6 +1549,8 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
caps.dwCaps |= DDCAPS_ALIGNSTRIDE;
caps.dwAlignStrideAlign = DDRAW_STRIDE_ALIGNMENT;
caps.ddsOldCaps.dwCaps = caps.ddsCaps.dwCaps;
IDirect3D7_EnumZBufferFormats(&ddraw->IDirect3D7_iface, &IID_IDirect3DHALDevice, enum_zbuffer, &caps);
if(DriverCaps)
@@ -1627,7 +1651,7 @@ static HRESULT WINAPI ddraw1_Compact(IDirectDraw *iface)
*
* Returns information about the current display mode
*
* Exists in Version 1, 2, 4 and 7
* Exists in versions 1, 2, 4 and 7
*
* Params:
* DDSD: Address of a surface description structure to write the info to
@@ -1718,7 +1742,7 @@ static HRESULT WINAPI ddraw1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *s
*
* Returns an array of supported FourCC codes.
*
* Exists in Version 1, 2, 4 and 7
* Exists in versions 1, 2, 4 and 7
*
* Params:
* NumCodes: Contains the number of Codes that Codes can carry. Returns the number
@@ -1756,7 +1780,7 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i)
{
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
mode.format_id, 0, WINED3D_RTYPE_SURFACE, formats[i])))
mode.format_id, 0, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
{
if (count < outsize)
Codes[count] = formats[i];
@@ -1905,7 +1929,7 @@ static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *st
* Returns the total and free video memory
*
* Params:
* Caps: Specifies the memory type asked for
* caps: Specifies the memory type asked for
* total: Pointer to a DWORD to be filled with the total memory
* free: Pointer to a DWORD to be filled with the free memory
*
@@ -1914,18 +1938,23 @@ static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *st
* DDERR_INVALIDPARAMS if free and total are NULL
*
*****************************************************************************/
static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *Caps, DWORD *total,
static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *caps, DWORD *total,
DWORD *free)
{
unsigned int framebuffer_size, total_vidmem, free_vidmem;
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
struct wined3d_display_mode mode;
HRESULT hr = DD_OK;
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, Caps, total, free);
TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free);
if (!total && !free)
return DDERR_INVALIDPARAMS;
if (TRACE_ON(ddraw))
{
TRACE("Asked for memory with description: ");
DDRAW_dump_DDSCAPS2(Caps);
DDRAW_dump_DDSCAPS2(caps);
}
wined3d_mutex_lock();
@@ -1934,20 +1963,34 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C
* resources, but that's not important
*/
if( (!total) && (!free) )
/* Some applications (e.g. 3DMark 2000) assume that the reported amount of
* video memory doesn't include the memory used by the default framebuffer.
*/
if (FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode, NULL)))
{
WARN("Failed to get display mode, hr %#x.\n", hr);
wined3d_mutex_unlock();
return DDERR_INVALIDPARAMS;
return hr;
}
framebuffer_size = wined3d_calculate_format_pitch(ddraw->wined3d, WINED3DADAPTER_DEFAULT,
mode.format_id, mode.width);
framebuffer_size *= mode.height;
if (free)
*free = wined3d_device_get_available_texture_mem(ddraw->wined3d_device);
{
free_vidmem = wined3d_device_get_available_texture_mem(ddraw->wined3d_device);
*free = framebuffer_size > free_vidmem ? 0 : free_vidmem - framebuffer_size;
TRACE("Free video memory %#x.\n", *free);
}
if (total)
{
struct wined3d_adapter_identifier desc = {0};
hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0, &desc);
*total = min(UINT_MAX, desc.video_memory);
total_vidmem = min(UINT_MAX, desc.video_memory);
*total = framebuffer_size > total_vidmem ? 0 : total_vidmem - framebuffer_size;
TRACE("Total video memory %#x.\n", *total);
}
wined3d_mutex_unlock();
@@ -2058,7 +2101,14 @@ static HRESULT WINAPI d3d1_Initialize(IDirect3D *iface, REFIID riid)
*****************************************************************************/
static HRESULT WINAPI ddraw7_FlipToGDISurface(IDirectDraw7 *iface)
{
FIXME("iface %p stub!\n", iface);
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
TRACE("iface %p.\n", iface);
ddraw->flags |= DDRAW_GDI_FLIP;
if (ddraw->primary)
ddraw_surface_update_frontbuffer(ddraw->primary, NULL, FALSE);
return DD_OK;
}
@@ -2797,6 +2847,18 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
return DDERR_INVALIDPARAMS;
}
__TRY
{
*surface = NULL;
}
__EXCEPT_PAGE_FAULT
{
WARN("Surface pointer %p is invalid.\n", surface);
wined3d_mutex_unlock();
return DDERR_INVALIDPARAMS;
}
__ENDTRY;
if(surface_desc->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER))
{
if (TRACE_ON(ddraw))
@@ -2813,10 +2875,7 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *
hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 7);
wined3d_mutex_unlock();
if (FAILED(hr))
{
*surface = NULL;
return hr;
}
*surface = &impl->IDirectDrawSurface7_iface;
IDirectDraw7_AddRef(iface);
@@ -2851,6 +2910,18 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
return DDERR_INVALIDPARAMS;
}
__TRY
{
*surface = NULL;
}
__EXCEPT_PAGE_FAULT
{
WARN("Surface pointer %p is invalid.\n", surface);
wined3d_mutex_unlock();
return DDERR_INVALIDPARAMS;
}
__ENDTRY;
if(surface_desc->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER))
{
if (TRACE_ON(ddraw))
@@ -2867,10 +2938,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 4);
wined3d_mutex_unlock();
if (FAILED(hr))
{
*surface = NULL;
return hr;
}
*surface = &impl->IDirectDrawSurface4_iface;
IDirectDraw4_AddRef(iface);
@@ -2906,6 +2974,18 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
return DDERR_INVALIDPARAMS;
}
__TRY
{
*surface = NULL;
}
__EXCEPT_PAGE_FAULT
{
WARN("Surface pointer %p is invalid.\n", surface);
wined3d_mutex_unlock();
return DDERR_INVALIDPARAMS;
}
__ENDTRY;
DDSD_to_DDSD2(surface_desc, &surface_desc2);
if(surface_desc->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER))
{
@@ -2923,10 +3003,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
hr = ddraw_surface_create(ddraw, &surface_desc2, &impl, outer_unknown, 2);
wined3d_mutex_unlock();
if (FAILED(hr))
{
*surface = NULL;
return hr;
}
*surface = &impl->IDirectDrawSurface_iface;
impl->ifaceToRelease = NULL;
@@ -2961,6 +3038,18 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
return DDERR_INVALIDPARAMS;
}
__TRY
{
*surface = NULL;
}
__EXCEPT_PAGE_FAULT
{
WARN("Surface pointer %p is invalid.\n", surface);
wined3d_mutex_unlock();
return DDERR_INVALIDPARAMS;
}
__ENDTRY;
if ((surface_desc->ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER))
== (DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER)
|| (surface_desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_FRONTBUFFER))
@@ -2975,10 +3064,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
hr = ddraw_surface_create(ddraw, &surface_desc2, &impl, outer_unknown, 1);
wined3d_mutex_unlock();
if (FAILED(hr))
{
*surface = NULL;
return hr;
}
*surface = &impl->IDirectDrawSurface_iface;
impl->ifaceToRelease = NULL;
@@ -2986,9 +3072,6 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
return hr;
}
#define DDENUMSURFACES_SEARCHTYPE (DDENUMSURFACES_CANBECREATED|DDENUMSURFACES_DOESEXIST)
#define DDENUMSURFACES_MATCHTYPE (DDENUMSURFACES_ALL|DDENUMSURFACES_MATCH|DDENUMSURFACES_NOMATCH)
static BOOL
Main_DirectDraw_DDPIXELFORMAT_Match(const DDPIXELFORMAT *requested,
const DDPIXELFORMAT *provided)
@@ -3095,9 +3178,6 @@ static BOOL ddraw_match_surface_desc(const DDSURFACEDESC2 *requested, const DDSU
return TRUE;
}
#undef DDENUMSURFACES_SEARCHTYPE
#undef DDENUMSURFACES_MATCHTYPE
struct surfacescallback2_context
{
LPDDENUMSURFACESCALLBACK2 func;
@@ -3696,7 +3776,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
* Enumerates all supported Direct3DDevice interfaces. This is the
* implementation for Direct3D 1 to Direc3D 3, Version 7 has its own.
*
* Version 1, 2 and 3
* Versions 1, 2 and 3
*
* Params:
* callback: Application-provided routine to call for each enumerated device
@@ -3838,7 +3918,7 @@ static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBAC
* by the DIRECT3DLIGHT7 structure. Wine's Direct3DLight implementation
* uses the IDirect3DDevice7 interface with D3D7 lights.
*
* Version 1, 2 and 3
* Versions 1, 2 and 3
*
* Params:
* light: Address to store the new interface pointer
@@ -3901,7 +3981,7 @@ static HRESULT WINAPI d3d1_CreateLight(IDirect3D *iface, IDirect3DLight **light,
* and older versions. The IDirect3DMaterial implementation wraps its
* functionality to IDirect3DDevice7::SetMaterial and friends.
*
* Version 1, 2 and 3
* Versions 1, 2 and 3
*
* Params:
* material: Address to store the new interface's pointer to
@@ -4050,7 +4130,7 @@ static HRESULT WINAPI d3d1_CreateViewport(IDirect3D *iface, IDirect3DViewport **
* This method finds a device with the requested properties and returns a
* device description
*
* Verion 1, 2 and 3
* Versions 1, 2 and 3
* Params:
* fds: Describes the requested device characteristics
* fdr: Returns the device description
@@ -4071,8 +4151,8 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
if (!fds || !fdr) return DDERR_INVALIDPARAMS;
if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH)
|| fdr->dwSize != sizeof(D3DFINDDEVICERESULT))
if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH) || (fdr->dwSize != sizeof(D3DFINDDEVICERESULT1) &&
fdr->dwSize != sizeof(D3DFINDDEVICERESULT2) && fdr->dwSize != sizeof(D3DFINDDEVICERESULT)))
return DDERR_INVALIDPARAMS;
if ((fds->dwFlags & D3DFDS_COLORMODEL)
@@ -4101,8 +4181,24 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
/* Now return our own GUID */
ddraw_d3dcaps1_from_7(&desc1, &desc7);
fdr->guid = IID_D3DDEVICE_WineD3D;
fdr->ddHwDesc = desc1;
fdr->ddSwDesc = desc1;
if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT1))
{
D3DFINDDEVICERESULT1 *fdr1 = (D3DFINDDEVICERESULT1 *)fdr;
memcpy(&fdr1->ddHwDesc, &desc1, sizeof(fdr1->ddHwDesc));
memcpy(&fdr1->ddSwDesc, &desc1, sizeof(fdr1->ddSwDesc));
}
else if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT2))
{
D3DFINDDEVICERESULT2 *fdr2 = (D3DFINDDEVICERESULT2 *)fdr;
memcpy(&fdr2->ddHwDesc, &desc1, sizeof(fdr2->ddHwDesc));
memcpy(&fdr2->ddSwDesc, &desc1, sizeof(fdr2->ddSwDesc));
}
else
{
fdr->ddHwDesc = desc1;
fdr->ddSwDesc = desc1;
}
TRACE("Returning Wine's wined3d device with (undumped) capabilities.\n");
@@ -4132,7 +4228,7 @@ static HRESULT WINAPI d3d1_FindDevice(IDirect3D *iface, D3DFINDDEVICESEARCH *fds
*
* Creates an IDirect3DDevice7 interface.
*
* Version 2, 3 and 7. IDirect3DDevice 1 interfaces are interfaces to
* Versions 2, 3 and 7. IDirect3DDevice 1 interfaces are interfaces to
* DirectDraw surfaces and are created with
* IDirectDrawSurface::QueryInterface. This method uses CreateDevice to
* create the device object and QueryInterfaces for IDirect3DDevice
@@ -4234,7 +4330,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
* Creates a new vertex buffer object and returns a IDirect3DVertexBuffer7
* interface.
*
* Version 3 and 7
* Versions 3 and 7
*
* Params:
* desc: Requested Vertex buffer properties
@@ -4244,7 +4340,6 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid,
* Returns
* D3D_OK on success
* DDERR_OUTOFMEMORY if memory allocation failed
* The return value of IWineD3DDevice::CreateVertexBuffer if this call fails
* DDERR_INVALIDPARAMS if desc or vertex_buffer is NULL
*
*****************************************************************************/
@@ -4291,7 +4386,7 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER
if (hr == D3D_OK)
{
TRACE("Created vertex buffer %p.\n", object);
*vertex_buffer = &object->IDirect3DVertexBuffer_iface;
*vertex_buffer = (IDirect3DVertexBuffer *)&object->IDirect3DVertexBuffer7_iface;
}
else
WARN("Failed to create vertex buffer, hr %#x.\n", hr);
@@ -4304,7 +4399,7 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER
*
* Enumerates all supported Z buffer pixel formats
*
* Version 3 and 7
* Versions 3 and 7
*
* Params:
* device_iid:
@@ -4314,7 +4409,6 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if callback is NULL
* For details, see IWineD3DDevice::EnumZBufferFormats
*
*****************************************************************************/
static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device_iid,
@@ -4389,7 +4483,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i)
{
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, formats[i])))
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
{
DDPIXELFORMAT pformat;
@@ -4413,7 +4507,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
* 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) */
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_SURFACE, WINED3DFMT_X8D24_UNORM)))
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_TEXTURE_2D, WINED3DFMT_X8D24_UNORM)))
{
DDPIXELFORMAT x8d24 =
{
@@ -4448,7 +4542,7 @@ static HRESULT WINAPI d3d3_EnumZBufferFormats(IDirect3D3 *iface, REFCLSID device
* Removes all managed textures (=surfaces with DDSCAPS2_TEXTUREMANAGE or
* DDSCAPS2_D3DTEXTUREMANAGE caps) to be removed from video memory.
*
* Version 3 and 7
* Versions 3 and 7
*
* Returns:
* D3D_OK, because it's a stub
@@ -4889,13 +4983,14 @@ static const struct wined3d_parent_ops ddraw_frontbuffer_parent_ops =
};
static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_device_parent *device_parent,
void *container_parent, const struct wined3d_resource_desc *desc, struct wined3d_texture **texture)
void *container_parent, const struct wined3d_resource_desc *desc, DWORD texture_flags,
struct wined3d_texture **texture)
{
struct ddraw *ddraw = ddraw_from_device_parent(device_parent);
HRESULT hr;
TRACE("device_parent %p, container_parent %p, desc %p, texture %p.\n",
device_parent, container_parent, desc, texture);
TRACE("device_parent %p, container_parent %p, desc %p, texture flags %#x, texture %p.\n",
device_parent, container_parent, desc, texture_flags, texture);
if (ddraw->wined3d_frontbuffer)
{
@@ -4903,8 +4998,8 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
return E_FAIL;
}
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, desc, 1,
WINED3D_TEXTURE_CREATE_MAPPABLE, NULL, ddraw, &ddraw_frontbuffer_parent_ops, texture)))
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, desc, 1, 1,
texture_flags | WINED3D_TEXTURE_CREATE_MAPPABLE, NULL, ddraw, &ddraw_frontbuffer_parent_ops, texture)))
{
WARN("Failed to create texture, hr %#x.\n", hr);
return hr;
+1 -1
View File
@@ -15,7 +15,7 @@
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()
@ stub GetNextMipMap
@ stub GetSurfaceFromDC
@ stdcall GetSurfaceFromDC(ptr ptr ptr)
@ stub HeapVidMemAllocAligned
@ stub InternalLock
@ stub InternalUnlock
+18 -15
View File
@@ -62,11 +62,14 @@ struct FvfToDecl
#define DDRAW_NO3D 0x00000008
#define DDRAW_SCL_DDRAW1 0x00000010
#define DDRAW_SCL_RECURSIVE 0x00000020
#define DDRAW_GDI_FLIP 0x00000040
#define DDRAW_STRIDE_ALIGNMENT 8
#define DDRAW_WINED3D_FLAGS (WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING \
| WINED3D_RESTORE_MODE_ON_ACTIVATE | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER)
| WINED3D_RESTORE_MODE_ON_ACTIVATE | WINED3D_FOCUS_MESSAGES | WINED3D_PIXEL_CENTER_INTEGER \
| WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART \
| WINED3D_LEGACY_CUBEMAP_FILTERING)
enum ddraw_device_state
{
@@ -131,7 +134,6 @@ struct ddraw
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type) DECLSPEC_HIDDEN;
void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7) DECLSPEC_HIDDEN;
void ddraw_destroy_swapchain(struct ddraw *ddraw) DECLSPEC_HIDDEN;
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps) DECLSPEC_HIDDEN;
void ddraw_update_lost_surfaces(struct ddraw *ddraw) DECLSPEC_HIDDEN;
@@ -185,7 +187,7 @@ struct ddraw_surface
*/
#define MAX_COMPLEX_ATTACHED 6
struct ddraw_surface *complex_array[MAX_COMPLEX_ATTACHED];
/* You can't traverse the tree upwards. Only a flag for Surface::Release because its needed there,
/* You can't traverse the tree upwards. Only a flag for Surface::Release because it's needed there,
* but no pointer to prevent temptations to traverse it in the wrong direction.
*/
BOOL is_complex_root;
@@ -211,6 +213,7 @@ struct ddraw_texture
DDSURFACEDESC2 surface_desc;
struct ddraw_surface *root;
struct wined3d_device *wined3d_device;
};
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc,
@@ -219,7 +222,6 @@ struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddr
void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
const RECT *rect, BOOL read) DECLSPEC_HIDDEN;
@@ -402,7 +404,7 @@ struct ddraw_palette
IDirectDrawPalette IDirectDrawPalette_iface;
LONG ref;
struct wined3d_palette *wineD3DPalette;
struct wined3d_palette *wined3d_palette;
struct ddraw *ddraw;
IUnknown *ifaceToRelease;
DWORD flags;
@@ -529,10 +531,9 @@ struct d3d_execute_buffer
D3DEXECUTEDATA data;
/* This buffer will store the transformed vertices */
void *vertex_data;
WORD *indices;
unsigned int nb_indices;
unsigned int nb_vertices;
unsigned int index_size, index_pos;
unsigned int vertex_size, src_vertex_pos;
struct wined3d_buffer *src_vertex_buffer, *dst_vertex_buffer, *index_buffer;
/* This flags is set to TRUE if we allocated ourselves the
* data buffer
@@ -554,12 +555,12 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *execute_buffer,
struct d3d_vertex_buffer
{
IDirect3DVertexBuffer7 IDirect3DVertexBuffer7_iface;
IDirect3DVertexBuffer IDirect3DVertexBuffer_iface;
LONG ref;
unsigned int version;
/*** WineD3D and ddraw links ***/
struct wined3d_buffer *wineD3DVertexBuffer;
struct wined3d_vertex_declaration *wineD3DVertexDeclaration;
struct wined3d_buffer *wined3d_buffer;
struct wined3d_vertex_declaration *wined3d_declaration;
struct ddraw *ddraw;
/*** Storage for D3D7 specific things ***/
@@ -586,6 +587,8 @@ struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVerte
void ddrawformat_from_wined3dformat(DDPIXELFORMAT *ddraw_format,
enum wined3d_format_id wined3d_format) DECLSPEC_HIDDEN;
BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddraw_palette *palette,
DWORD colour, struct wined3d_color *wined3d_colour) DECLSPEC_HIDDEN;
enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *format) DECLSPEC_HIDDEN;
void DDRAW_dump_surface_desc(const DDSURFACEDESC2 *lpddsd) DECLSPEC_HIDDEN;
void dump_D3DMATRIX(const D3DMATRIX *mat) DECLSPEC_HIDDEN;
@@ -632,10 +635,10 @@ struct member_info
/* Structure copy */
#define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) }
#define DD_STRUCT_COPY_BYSIZE_(to,from,from_size) \
#define DD_STRUCT_COPY_BYSIZE_(to,from,to_size,from_size) \
do { \
DWORD __size = (to)->dwSize; \
DWORD __resetsize = min(__size, sizeof(*to)); \
DWORD __resetsize = min(to_size, sizeof(*to)); \
DWORD __copysize = min(__resetsize, from_size); \
assert(to != from); \
memcpy(to, from, __copysize); \
@@ -643,7 +646,7 @@ struct member_info
(to)->dwSize = __size; /* restore size */ \
} while (0)
#define DD_STRUCT_COPY_BYSIZE(to,from) DD_STRUCT_COPY_BYSIZE_(to,from,(from)->dwSize)
#define DD_STRUCT_COPY_BYSIZE(to,from) DD_STRUCT_COPY_BYSIZE_(to,from,(to)->dwSize,(from)->dwSize)
HRESULT hr_ddraw_from_wined3d(HRESULT hr) DECLSPEC_HIDDEN;
File diff suppressed because it is too large Load Diff
+242 -160
View File
@@ -43,27 +43,15 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) {
TRACE("lpData : %p\n", lpDesc->lpData);
}
static void transform_vertex(D3DTLVERTEX *dst, const D3DMATRIX *mat,
const D3DVIEWPORT *vp, float x, float y, float z)
{
dst->u1.sx = (x * mat->_11) + (y * mat->_21) + (z * mat->_31) + mat->_41;
dst->u2.sy = (x * mat->_12) + (y * mat->_22) + (z * mat->_32) + mat->_42;
dst->u3.sz = (x * mat->_13) + (y * mat->_23) + (z * mat->_33) + mat->_43;
dst->u4.rhw = (x * mat->_14) + (y * mat->_24) + (z * mat->_34) + mat->_44;
dst->u1.sx = dst->u1.sx / dst->u4.rhw * vp->dvScaleX + vp->dwX + vp->dwWidth / 2;
dst->u2.sy = -dst->u2.sy / dst->u4.rhw * vp->dvScaleY + vp->dwY + vp->dwHeight / 2;
dst->u3.sz /= dst->u4.rhw;
dst->u4.rhw = 1.0f / dst->u4.rhw;
}
HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
struct d3d_device *device, struct d3d_viewport *viewport)
{
DWORD vs = buffer->data.dwVertexOffset;
DWORD is = buffer->data.dwInstructionOffset;
char *instr = (char *)buffer->desc.lpData + is;
unsigned int i;
unsigned int i, primitive_size;
struct wined3d_map_desc map_desc;
struct wined3d_box box = {0};
HRESULT hr;
if (viewport->active_device != device)
{
@@ -82,41 +70,88 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
for (;;)
{
D3DINSTRUCTION *current = (D3DINSTRUCTION *)instr;
BYTE size;
WORD count;
count = current->wCount;
size = current->bSize;
instr += sizeof(D3DINSTRUCTION);
switch (current->bOpcode) {
case D3DOP_POINT: {
WARN("POINT-s (%d)\n", count);
instr += count * size;
} break;
BYTE size;
WORD count;
case D3DOP_LINE: {
WARN("LINE-s (%d)\n", count);
instr += count * size;
} break;
count = current->wCount;
size = current->bSize;
instr += sizeof(*current);
primitive_size = 0;
switch (current->bOpcode)
{
case D3DOP_POINT:
{
const D3DPOINT *p = (D3DPOINT *)instr;
wined3d_device_set_primitive_type(device->wined3d_device, WINED3D_PT_POINTLIST, 0);
wined3d_device_set_stream_source(device->wined3d_device, 0,
buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
wined3d_device_set_vertex_declaration(device->wined3d_device,
ddraw_find_decl(device->ddraw, D3DFVF_TLVERTEX));
for (i = 0; i < count; ++i)
wined3d_device_draw_primitive(device->wined3d_device, p[i].wFirst, p[i].wCount);
instr += sizeof(*p) * count;
break;
}
case D3DOP_LINE:
primitive_size = 2;
wined3d_device_set_primitive_type(device->wined3d_device, WINED3D_PT_LINELIST, 0);
/* Drop through. */
case D3DOP_TRIANGLE:
{
D3DTLVERTEX *tl_vx = buffer->vertex_data;
TRACE("TRIANGLE (%d)\n", count);
WORD *indices;
unsigned int index_pos = buffer->index_pos, index_count;
TRACE("TRIANGLE (%d)\n", count);
if (buffer->nb_indices < count * 3)
if (!count)
break;
if (!primitive_size)
{
buffer->nb_indices = count * 3;
HeapFree(GetProcessHeap(), 0, buffer->indices);
buffer->indices = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->indices) * buffer->nb_indices);
wined3d_device_set_primitive_type(device->wined3d_device, WINED3D_PT_TRIANGLELIST, 0);
primitive_size = 3;
}
index_count = count * primitive_size;
if (buffer->index_size < index_count)
{
struct wined3d_buffer *new_buffer;
unsigned int new_size = max(buffer->index_size * 2, index_count);
hr = wined3d_buffer_create_ib(device->wined3d_device, new_size * sizeof(*indices),
WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, WINED3D_POOL_DEFAULT,
NULL, &ddraw_null_wined3d_parent_ops, &new_buffer);
if (FAILED(hr))
return hr;
buffer->index_size = new_size;
if (buffer->index_buffer)
wined3d_buffer_decref(buffer->index_buffer);
buffer->index_buffer = new_buffer;
index_pos = 0;
}
else if (buffer->index_size - index_count < index_pos)
{
index_pos = 0;
}
box.left = index_pos * sizeof(*indices);
box.right = (index_pos + index_count) * sizeof(*indices);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->index_buffer), 0,
&map_desc, &box, index_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
if (FAILED(hr))
return hr;
indices = map_desc.data;
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 : ");
TRACE(" v1: %d v2: %d v3: %d\n",ci->u1.v1, ci->u2.v2, ci->u3.v3);
TRACE(" Flags : ");
if (TRACE_ON(ddraw))
{
/* Wireframe */
@@ -137,21 +172,36 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
TRACE("STARTFLAT(%u) ", ci->wFlags);
TRACE("\n");
}
buffer->indices[(i * 3) ] = ci->u1.v1;
buffer->indices[(i * 3) + 1] = ci->u2.v2;
buffer->indices[(i * 3) + 2] = ci->u3.v3;
switch (primitive_size)
{
case 3:
indices[(i * primitive_size) + 2] = ci->u3.v3;
/* Drop through. */
case 2:
indices[(i * primitive_size) + 1] = ci->u2.v2;
indices[(i * primitive_size) ] = ci->u1.v1;
}
instr += size;
}
if (count)
IDirect3DDevice7_DrawIndexedPrimitive(&device->IDirect3DDevice7_iface,
D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, buffer->nb_vertices,
buffer->indices, count * 3, 0);
} break;
case D3DOP_MATRIXLOAD:
WARN("MATRIXLOAD-s (%d)\n", count);
instr += count * size;
break;
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->index_buffer), 0);
wined3d_device_set_stream_source(device->wined3d_device, 0,
buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
wined3d_device_set_vertex_declaration(device->wined3d_device,
ddraw_find_decl(device->ddraw, D3DFVF_TLVERTEX));
wined3d_device_set_index_buffer(device->wined3d_device, buffer->index_buffer, WINED3DFMT_R16_UINT, 0);
wined3d_device_draw_indexed_primitive(device->wined3d_device, index_pos, index_count);
buffer->index_pos = index_pos + index_count;
break;
}
case D3DOP_MATRIXLOAD:
WARN("MATRIXLOAD-s (%u)\n", count);
instr += count * size;
break;
case D3DOP_MATRIXMULTIPLY:
TRACE("MATRIXMULTIPLY (%d)\n", count);
@@ -199,7 +249,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
device->view = ci->u2.dwArg[0];
if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_PROJECTION)
device->proj = ci->u2.dwArg[0];
IDirect3DDevice7_SetTransform(&device->IDirect3DDevice7_iface,
IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface,
ci->u1.dtstTransformStateType, m);
}
@@ -236,97 +286,59 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
break;
case D3DOP_PROCESSVERTICES:
{
/* TODO: Share code with d3d_vertex_buffer7_ProcessVertices()
* and / or wined3d_device_process_vertices(). */
D3DMATRIX view_mat, world_mat, proj_mat, mat;
TRACE("PROCESSVERTICES (%d)\n", count);
/* Get the transform and world matrix */
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
wined3d_device_get_transform(device->wined3d_device,
D3DTRANSFORMSTATE_VIEW, (struct wined3d_matrix *)&view_mat);
wined3d_device_get_transform(device->wined3d_device,
D3DTRANSFORMSTATE_PROJECTION, (struct wined3d_matrix *)&proj_mat);
wined3d_device_get_transform(device->wined3d_device,
WINED3D_TS_WORLD_MATRIX(0), (struct wined3d_matrix *)&world_mat);
if (TRACE_ON(ddraw))
{
TRACE(" Projection Matrix:\n");
dump_D3DMATRIX(&proj_mat);
TRACE(" View Matrix:\n");
dump_D3DMATRIX(&view_mat);
TRACE(" World Matrix:\n");
dump_D3DMATRIX(&world_mat);
}
multiply_matrix(&mat, &view_mat, &world_mat);
multiply_matrix(&mat, &proj_mat, &mat);
for (i = 0; i < count; ++i)
{
D3DPROCESSVERTICES *ci = (D3DPROCESSVERTICES *)instr;
D3DTLVERTEX *dst = (D3DTLVERTEX *)buffer->vertex_data + ci->wDest;
DWORD op = ci->dwFlags & D3DPROCESSVERTICES_OPMASK;
TRACE(" start %u, dest %u, count %u, flags %#x.\n",
ci->wStart, ci->wDest, ci->dwCount, ci->dwFlags);
if (ci->dwFlags & D3DPROCESSVERTICES_UPDATEEXTENTS)
FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
{
static int once;
if (!once++) FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
}
if (ci->dwFlags & D3DPROCESSVERTICES_NOCOLOR)
FIXME("D3DPROCESSVERTICES_NOCOLOR not implemented.\n");
switch (op)
{
case D3DPROCESSVERTICES_TRANSFORMLIGHT:
{
const D3DVERTEX *src = (D3DVERTEX *)((char *)buffer->desc.lpData + vs) + ci->wStart;
unsigned int vtx_idx;
static unsigned int once;
if (!once++)
FIXME("Lighting not implemented.\n");
for (vtx_idx = 0; vtx_idx < ci->dwCount; ++vtx_idx)
{
transform_vertex(&dst[vtx_idx], &mat, &viewport->viewports.vp1,
src[vtx_idx].u1.x, src[vtx_idx].u2.y, src[vtx_idx].u3.z);
/* No lighting yet */
dst[vtx_idx].u5.color = 0xffffffff; /* Opaque white */
dst[vtx_idx].u6.specular = 0xff000000; /* No specular and no fog factor */
dst[vtx_idx].u7.tu = src[vtx_idx].u7.tu;
dst[vtx_idx].u8.tv = src[vtx_idx].u8.tv;
}
break;
}
case D3DPROCESSVERTICES_TRANSFORM:
{
const D3DLVERTEX *src = (D3DLVERTEX *)((char *)buffer->desc.lpData + vs) + ci->wStart;
unsigned int vtx_idx;
for (vtx_idx = 0; vtx_idx < ci->dwCount; ++vtx_idx)
wined3d_device_set_stream_source(device->wined3d_device, 0,
buffer->src_vertex_buffer, buffer->src_vertex_pos, sizeof(D3DVERTEX));
if (op == D3DPROCESSVERTICES_TRANSFORMLIGHT)
{
transform_vertex(&dst[vtx_idx], &mat, &viewport->viewports.vp1,
src[vtx_idx].u1.x, src[vtx_idx].u2.y, src[vtx_idx].u3.z);
dst[vtx_idx].u5.color = src[vtx_idx].u4.color;
dst[vtx_idx].u6.specular = src[vtx_idx].u5.specular;
dst[vtx_idx].u7.tu = src[vtx_idx].u6.tu;
dst[vtx_idx].u8.tv = src[vtx_idx].u7.tv;
wined3d_device_set_vertex_declaration(device->wined3d_device,
ddraw_find_decl(device->ddraw, D3DFVF_VERTEX));
wined3d_device_set_render_state(device->wined3d_device,
WINED3D_RS_LIGHTING, TRUE);
}
else
{
wined3d_device_set_vertex_declaration(device->wined3d_device,
ddraw_find_decl(device->ddraw, D3DFVF_LVERTEX));
wined3d_device_set_render_state(device->wined3d_device,
WINED3D_RS_LIGHTING, FALSE);
}
wined3d_device_process_vertices(device->wined3d_device, ci->wStart, ci->wDest,
ci->dwCount, buffer->dst_vertex_buffer, NULL, 0, D3DFVF_TLVERTEX);
break;
}
case D3DPROCESSVERTICES_COPY:
{
const D3DTLVERTEX *src = (D3DTLVERTEX *)((char *)buffer->desc.lpData + vs) + ci->wStart;
memcpy(dst, src, ci->dwCount * sizeof(*dst));
box.left = (buffer->src_vertex_pos + ci->wStart) * sizeof(D3DTLVERTEX);
box.right = box.left + ci->dwCount * sizeof(D3DTLVERTEX);
box.top = box.front = 0;
box.bottom = box.back = 1;
wined3d_device_copy_sub_resource_region(device->wined3d_device,
wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0,
ci->wDest * sizeof(D3DTLVERTEX), 0, 0,
wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0, &box);
break;
}
default:
FIXME("Unhandled vertex processing op %#x.\n", op);
@@ -336,21 +348,38 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
instr += size;
}
break;
}
case D3DOP_TEXTURELOAD: {
WARN("TEXTURELOAD-s (%d)\n", count);
case D3DOP_TEXTURELOAD:
TRACE("TEXTURELOAD (%u)\n", count);
instr += count * size;
} break;
for (i = 0; i < count; ++i)
{
D3DTEXTURELOAD *ci = (D3DTEXTURELOAD *)instr;
struct ddraw_surface *dst, *src;
case D3DOP_EXIT: {
TRACE("EXIT (%d)\n", count);
/* We did this instruction */
instr += size;
/* Exit this loop */
goto end_of_buffer;
} break;
instr += size;
if (!(dst = ddraw_get_object(&device->handle_table,
ci->hDestTexture - 1, DDRAW_HANDLE_SURFACE)))
{
WARN("Invalid destination texture handle %#x.\n", ci->hDestTexture);
continue;
}
if (!(src = ddraw_get_object(&device->handle_table,
ci->hSrcTexture - 1, DDRAW_HANDLE_SURFACE)))
{
WARN("Invalid source texture handle %#x.\n", ci->hSrcTexture);
continue;
}
IDirect3DTexture2_Load(&dst->IDirect3DTexture2_iface, &src->IDirect3DTexture2_iface);
}
break;
case D3DOP_EXIT:
TRACE("EXIT (%u)\n", count);
instr += size;
goto end_of_buffer;
case D3DOP_BRANCHFORWARD:
TRACE("BRANCHFORWARD (%d)\n", count);
@@ -367,26 +396,28 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
instr = (char*)current + ci->dwOffset;
break;
}
}
} else {
if (ci->bNegate) {
}
}
else
{
if (ci->bNegate)
{
TRACE(" Branch to %d\n", ci->dwOffset);
if (ci->dwOffset) {
instr = (char*)current + ci->dwOffset;
break;
}
}
}
}
}
instr += size;
instr += size;
}
break;
case D3DOP_SPAN: {
WARN("SPAN-s (%d)\n", count);
instr += count * size;
} break;
case D3DOP_SPAN:
WARN("SPAN-s (%u)\n", count);
instr += count * size;
break;
case D3DOP_SETSTATUS:
TRACE("SETSTATUS (%d)\n", count);
@@ -397,12 +428,11 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
}
break;
default:
ERR("Unhandled OpCode %d !!!\n",current->bOpcode);
/* Try to save ... */
instr += count * size;
break;
}
default:
ERR("Unhandled OpCode %#x.\n",current->bOpcode);
instr += count * size;
break;
}
}
end_of_buffer:
@@ -471,8 +501,13 @@ static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
{
if (buffer->need_free)
HeapFree(GetProcessHeap(), 0, buffer->desc.lpData);
HeapFree(GetProcessHeap(), 0, buffer->vertex_data);
HeapFree(GetProcessHeap(), 0, buffer->indices);
if (buffer->index_buffer)
wined3d_buffer_decref(buffer->index_buffer);
if (buffer->dst_vertex_buffer)
{
wined3d_buffer_decref(buffer->src_vertex_buffer);
wined3d_buffer_decref(buffer->dst_vertex_buffer);
}
HeapFree(GetProcessHeap(), 0, buffer);
}
@@ -561,20 +596,67 @@ static HRESULT WINAPI d3d_execute_buffer_Unlock(IDirect3DExecuteBuffer *iface)
static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
{
struct d3d_execute_buffer *buffer = impl_from_IDirect3DExecuteBuffer(iface);
DWORD nbvert;
struct wined3d_map_desc map_desc;
struct wined3d_box box = {0};
HRESULT hr;
TRACE("iface %p, data %p.\n", iface, data);
/* Skip past previous vertex data. */
buffer->src_vertex_pos += buffer->data.dwVertexCount;
if (buffer->vertex_size < data->dwVertexCount)
{
unsigned int new_size = max(data->dwVertexCount, buffer->vertex_size * 2);
struct wined3d_buffer *src_buffer, *dst_buffer;
hr = wined3d_buffer_create_vb(buffer->d3ddev->wined3d_device, new_size * sizeof(D3DVERTEX),
WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY, WINED3D_POOL_SYSTEM_MEM,
NULL, &ddraw_null_wined3d_parent_ops, &src_buffer);
if (FAILED(hr))
return hr;
hr = wined3d_buffer_create_vb(buffer->d3ddev->wined3d_device, new_size * sizeof(D3DTLVERTEX),
WINED3DUSAGE_STATICDECL, WINED3D_POOL_DEFAULT,
NULL, &ddraw_null_wined3d_parent_ops, &dst_buffer);
if (FAILED(hr))
{
wined3d_buffer_decref(src_buffer);
return hr;
}
if (buffer->dst_vertex_buffer)
{
wined3d_buffer_decref(buffer->src_vertex_buffer);
wined3d_buffer_decref(buffer->dst_vertex_buffer);
}
buffer->src_vertex_buffer = src_buffer;
buffer->dst_vertex_buffer = dst_buffer;
buffer->vertex_size = new_size;
buffer->src_vertex_pos = 0;
}
else if (buffer->vertex_size - data->dwVertexCount < buffer->src_vertex_pos)
{
buffer->src_vertex_pos = 0;
}
if (data->dwVertexCount)
{
box.left = buffer->src_vertex_pos * sizeof(D3DVERTEX);
box.right = box.left + data->dwVertexCount * sizeof(D3DVERTEX);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0,
&map_desc, &box, buffer->src_vertex_pos ? WINED3D_MAP_NOOVERWRITE : WINED3D_MAP_DISCARD);
if (FAILED(hr))
return hr;
memcpy(map_desc.data, ((BYTE *)buffer->desc.lpData) + data->dwVertexOffset,
data->dwVertexCount * sizeof(D3DVERTEX));
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0);
}
memcpy(&buffer->data, data, data->dwSize);
/* Get the number of vertices in the execute buffer */
nbvert = buffer->data.dwVertexCount;
/* 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);
+46 -104
View File
@@ -194,6 +194,40 @@ void *ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_ha
return entry->object;
}
HRESULT WINAPI GetSurfaceFromDC(HDC dc, IDirectDrawSurface4 **surface, HDC *device_dc)
{
struct ddraw *ddraw;
TRACE("dc %p, surface %p, device_dc %p.\n", dc, surface, device_dc);
if (!surface)
return E_INVALIDARG;
if (!device_dc)
{
*surface = NULL;
return E_INVALIDARG;
}
wined3d_mutex_lock();
LIST_FOR_EACH_ENTRY(ddraw, &global_ddraw_list, struct ddraw, ddraw_list_entry)
{
if (FAILED(IDirectDraw4_GetSurfaceFromDC(&ddraw->IDirectDraw4_iface, dc, surface)))
continue;
*device_dc = NULL; /* FIXME */
wined3d_mutex_unlock();
return DD_OK;
}
wined3d_mutex_unlock();
*surface = NULL;
*device_dc = NULL;
return DDERR_NOTFOUND;
}
/***********************************************************************
*
* Helper function for DirectDrawCreate and friends
@@ -742,68 +776,16 @@ HRESULT WINAPI DllCanUnloadNow(void)
}
/***********************************************************************
* DllRegisterServer (DDRAW.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (DDRAW.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}
/*******************************************************************************
* DestroyCallback
*
* Callback function for the EnumSurfaces call in DllMain.
* Dumps some surface info and releases the surface
*
* Params:
* surf: The enumerated surface
* desc: it's description
* context: Pointer to the ddraw impl
*
* Returns:
* DDENUMRET_OK;
*******************************************************************************/
static HRESULT WINAPI
DestroyCallback(IDirectDrawSurface7 *surf,
DDSURFACEDESC2 *desc,
void *context)
{
struct ddraw_surface *Impl = impl_from_IDirectDrawSurface7(surf);
ULONG ref7, ref4, ref3, ref2, ref1, gamma_count, iface_count;
ref7 = IDirectDrawSurface7_Release(surf); /* For the EnumSurfaces */
ref4 = Impl->ref4;
ref3 = Impl->ref3;
ref2 = Impl->ref2;
ref1 = Impl->ref1;
gamma_count = Impl->gamma_count;
WARN("Surface %p has an reference counts of 7: %u 4: %u 3: %u 2: %u 1: %u gamma: %u\n",
Impl, ref7, ref4, ref3, ref2, ref1, gamma_count);
/* Skip surfaces which are attached somewhere or which are
* part of a complex compound. They will get released when destroying
* the root
*/
if( (!Impl->is_complex_root) || (Impl->first_attached != Impl) )
return DDENUMRET_OK;
/* Destroy the surface */
iface_count = ddraw_surface_release_iface(Impl);
while (iface_count) iface_count = ddraw_surface_release_iface(Impl);
return DDENUMRET_OK;
}
/***********************************************************************
* DllMain (DDRAW.0)
*
@@ -891,66 +873,26 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
}
case DLL_PROCESS_DETACH:
if(!list_empty(&global_ddraw_list))
if (WARN_ON(ddraw))
{
struct list *entry, *entry2;
WARN("There are still existing DirectDraw interfaces. Wine bug or buggy application?\n");
struct ddraw *ddraw;
/* We remove elements from this loop */
LIST_FOR_EACH_SAFE(entry, entry2, &global_ddraw_list)
LIST_FOR_EACH_ENTRY(ddraw, &global_ddraw_list, struct ddraw, ddraw_list_entry)
{
struct ddraw *ddraw = LIST_ENTRY(entry, struct ddraw, ddraw_list_entry);
HRESULT hr;
DDSURFACEDESC2 desc;
int i;
struct ddraw_surface *surface;
WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref3 + ddraw->ref2 + ddraw->ref1);
WARN("DirectDraw object %p has reference counts {%u, %u, %u, %u, %u}.\n",
ddraw, ddraw->ref7, ddraw->ref4, ddraw->ref3, ddraw->ref2, ddraw->ref1);
/* Add references to each interface to avoid freeing them unexpectedly */
IDirectDraw_AddRef(&ddraw->IDirectDraw_iface);
IDirectDraw2_AddRef(&ddraw->IDirectDraw2_iface);
IDirectDraw4_AddRef(&ddraw->IDirectDraw4_iface);
IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
if (ddraw->d3ddevice)
WARN("DirectDraw object %p has Direct3D device %p attached.\n", ddraw, ddraw->d3ddevice);
/* Does a D3D device exist? Destroy it
* TODO: Destroy all Vertex buffers, Lights, Materials
* and execute buffers too
*/
if(ddraw->d3ddevice)
LIST_FOR_EACH_ENTRY(surface, &ddraw->surface_list, struct ddraw_surface, surface_list_entry)
{
WARN("DDraw %p has d3ddevice %p attached\n", ddraw, ddraw->d3ddevice);
while(IDirect3DDevice7_Release(&ddraw->d3ddevice->IDirect3DDevice7_iface));
WARN("Surface %p has reference counts {%u, %u, %u, %u, %u, %u}.\n",
surface, surface->ref7, surface->ref4, surface->ref3,
surface->ref2, surface->ref1, surface->gamma_count);
}
/* Destroy the swapchain after any 3D device. The 3D device
* cleanup code needs a swapchain. Specifically, it tries to
* set the current render target to the front buffer. */
if (ddraw->wined3d_swapchain)
ddraw_destroy_swapchain(ddraw);
/* Try to release the objects
* Do an EnumSurfaces to find any hanging surfaces
*/
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
for(i = 0; i <= 1; i++)
{
hr = IDirectDraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface,
DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &desc, ddraw, DestroyCallback);
if(hr != D3D_OK)
ERR("(%p) EnumSurfaces failed, prepare for trouble\n", ddraw);
}
if (!list_empty(&ddraw->surface_list))
ERR("DDraw %p still has surfaces attached.\n", ddraw);
/* Release all hanging references to destroy the objects. This
* restores the screen mode too
*/
while(IDirectDraw_Release(&ddraw->IDirectDraw_iface));
while(IDirectDraw2_Release(&ddraw->IDirectDraw2_iface));
while(IDirectDraw4_Release(&ddraw->IDirectDraw4_iface));
while(IDirectDraw7_Release(&ddraw->IDirectDraw7_iface));
}
}
+12 -14
View File
@@ -80,22 +80,22 @@ static ULONG WINAPI ddraw_palette_AddRef(IDirectDrawPalette *iface)
*****************************************************************************/
static ULONG WINAPI ddraw_palette_Release(IDirectDrawPalette *iface)
{
struct ddraw_palette *This = impl_from_IDirectDrawPalette(iface);
ULONG ref = InterlockedDecrement(&This->ref);
struct ddraw_palette *palette = impl_from_IDirectDrawPalette(iface);
ULONG ref = InterlockedDecrement(&palette->ref);
TRACE("%p decreasing refcount to %u.\n", This, ref);
TRACE("%p decreasing refcount to %u.\n", palette, ref);
if (ref == 0)
{
wined3d_mutex_lock();
wined3d_palette_decref(This->wineD3DPalette);
if ((This->flags & DDPCAPS_PRIMARYSURFACE) && This->ddraw->primary)
This->ddraw->primary->palette = NULL;
if (This->ifaceToRelease)
IUnknown_Release(This->ifaceToRelease);
wined3d_palette_decref(palette->wined3d_palette);
if ((palette->flags & DDPCAPS_PRIMARYSURFACE) && palette->ddraw->primary)
palette->ddraw->primary->palette = NULL;
if (palette->ifaceToRelease)
IUnknown_Release(palette->ifaceToRelease);
wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, This);
HeapFree(GetProcessHeap(), 0, palette);
}
return ref;
@@ -153,7 +153,6 @@ static HRESULT WINAPI ddraw_palette_GetCaps(IDirectDrawPalette *iface, DWORD *ca
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if PalEnt is NULL
* For details, see IWineD3DDevice::SetEntries
*
*****************************************************************************/
static HRESULT WINAPI ddraw_palette_SetEntries(IDirectDrawPalette *iface,
@@ -169,7 +168,7 @@ static HRESULT WINAPI ddraw_palette_SetEntries(IDirectDrawPalette *iface,
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
hr = wined3d_palette_set_entries(palette->wineD3DPalette, flags, start, count, entries);
hr = wined3d_palette_set_entries(palette->wined3d_palette, flags, start, count, entries);
if (SUCCEEDED(hr) && palette->flags & DDPCAPS_PRIMARYSURFACE)
ddraw_surface_update_frontbuffer(palette->ddraw->primary, NULL, FALSE);
@@ -193,7 +192,6 @@ static HRESULT WINAPI ddraw_palette_SetEntries(IDirectDrawPalette *iface,
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if PalEnt is NULL
* For details, see IWineD3DDevice::SetEntries
*
*****************************************************************************/
static HRESULT WINAPI ddraw_palette_GetEntries(IDirectDrawPalette *iface,
@@ -209,7 +207,7 @@ static HRESULT WINAPI ddraw_palette_GetEntries(IDirectDrawPalette *iface,
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
hr = wined3d_palette_get_entries(palette->wineD3DPalette, flags, start, count, entries);
hr = wined3d_palette_get_entries(palette->wined3d_palette, flags, start, count, entries);
wined3d_mutex_unlock();
return hr;
@@ -277,7 +275,7 @@ HRESULT ddraw_palette_init(struct ddraw_palette *palette,
palette->flags = flags;
if (FAILED(hr = wined3d_palette_create(ddraw->wined3d_device,
wined3d_flags, entry_count, entries, &palette->wineD3DPalette)))
wined3d_flags, entry_count, entries, &palette->wined3d_palette)))
{
WARN("Failed to create wined3d palette, hr %#x.\n", hr);
return hr;
File diff suppressed because it is too large Load Diff
+89 -3
View File
@@ -481,19 +481,19 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix
{
case 16:
if (DDPixelFormat->u2.dwStencilBitDepth == 1) return WINED3DFMT_S1_UINT_D15_UNORM;
WARN("Unknown depth stenil format: 16 z bits, %u stencil bits\n",
WARN("Unknown depth stencil format: 16 z bits, %u stencil bits.\n",
DDPixelFormat->u2.dwStencilBitDepth);
return WINED3DFMT_UNKNOWN;
case 32:
if (DDPixelFormat->u2.dwStencilBitDepth == 8) return WINED3DFMT_D24_UNORM_S8_UINT;
else if (DDPixelFormat->u2.dwStencilBitDepth == 4) return WINED3DFMT_S4X4_UINT_D24_UNORM;
WARN("Unknown depth stenil format: 32 z bits, %u stencil bits\n",
WARN("Unknown depth stencil format: 32 z bits, %u stencil bits.\n",
DDPixelFormat->u2.dwStencilBitDepth);
return WINED3DFMT_UNKNOWN;
default:
WARN("Unknown depth stenil format: %u z bits, %u stencil bits\n",
WARN("Unknown depth stencil format: %u z bits, %u stencil bits.\n",
DDPixelFormat->u1.dwZBufferBitDepth, DDPixelFormat->u2.dwStencilBitDepth);
return WINED3DFMT_UNKNOWN;
}
@@ -556,6 +556,92 @@ enum wined3d_format_id wined3dformat_from_ddrawformat(const DDPIXELFORMAT *DDPix
return WINED3DFMT_UNKNOWN;
}
static float colour_to_float(DWORD colour, DWORD mask)
{
if (!mask)
return 0.0f;
return (float)(colour & mask) / (float)mask;
}
BOOL wined3d_colour_from_ddraw_colour(const DDPIXELFORMAT *pf, const struct ddraw_palette *palette,
DWORD colour, struct wined3d_color *wined3d_colour)
{
if (pf->dwFlags & DDPF_ALPHA)
{
DWORD size, mask;
size = pf->u1.dwAlphaBitDepth;
mask = size < 32 ? (1u << size) - 1 : ~0u;
wined3d_colour->r = 0.0f;
wined3d_colour->g = 0.0f;
wined3d_colour->b = 0.0f;
wined3d_colour->a = colour_to_float(colour, mask);
return TRUE;
}
if (pf->dwFlags & DDPF_FOURCC)
{
WARN("FourCC formats not supported.\n");
goto fail;
}
if (pf->dwFlags & DDPF_PALETTEINDEXED8)
{
PALETTEENTRY entry;
colour &= 0xff;
if (!palette || FAILED(wined3d_palette_get_entries(palette->wined3d_palette, 0, colour, 1, &entry)))
{
wined3d_colour->r = 0.0f;
wined3d_colour->g = 0.0f;
wined3d_colour->b = 0.0f;
}
else
{
wined3d_colour->r = entry.peRed / 255.0f;
wined3d_colour->g = entry.peGreen / 255.0f;
wined3d_colour->b = entry.peBlue / 255.0f;
}
wined3d_colour->a = colour / 255.0f;
return TRUE;
}
if (pf->dwFlags & DDPF_RGB)
{
wined3d_colour->r = colour_to_float(colour, pf->u2.dwRBitMask);
wined3d_colour->g = colour_to_float(colour, pf->u3.dwGBitMask);
wined3d_colour->b = colour_to_float(colour, pf->u4.dwBBitMask);
if (pf->dwFlags & DDPF_ALPHAPIXELS)
wined3d_colour->a = colour_to_float(colour, pf->u5.dwRGBAlphaBitMask);
else
wined3d_colour->a = 0.0f;
return TRUE;
}
if (pf->dwFlags & DDPF_ZBUFFER)
{
wined3d_colour->r = colour_to_float(colour, pf->u3.dwZBitMask);
if (pf->dwFlags & DDPF_STENCILBUFFER)
wined3d_colour->g = colour_to_float(colour, pf->u4.dwStencilBitMask);
else
wined3d_colour->g = 0.0f;
wined3d_colour->b = 0.0f;
wined3d_colour->a = 0.0f;
return TRUE;
}
FIXME("Unhandled pixel format.\n");
DDRAW_dump_pixelformat(pf);
fail:
wined3d_colour->r = 0.0f;
wined3d_colour->g = 0.0f;
wined3d_colour->b = 0.0f;
wined3d_colour->a = 0.0f;
return FALSE;
}
/*****************************************************************************
* Various dumping functions.
*
+42 -186
View File
@@ -19,11 +19,6 @@
#include "ddraw_private.h"
static inline struct d3d_vertex_buffer *impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface)
{
return CONTAINING_RECORD(iface, struct d3d_vertex_buffer, IDirect3DVertexBuffer_iface);
}
static inline struct d3d_vertex_buffer *impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
{
return CONTAINING_RECORD(iface, struct d3d_vertex_buffer, IDirect3DVertexBuffer7_iface);
@@ -33,75 +28,37 @@ static inline struct d3d_vertex_buffer *impl_from_IDirect3DVertexBuffer7(IDirect
* IUnknown Methods
*****************************************************************************/
/*****************************************************************************
* IDirect3DVertexBuffer7::QueryInterface
*
* The QueryInterface Method for Vertex Buffers
* For a link to QueryInterface rules, see IDirectDraw7::QueryInterface
*
* Params
* riid: Queried Interface id
* obj: Address to return the interface pointer
*
* Returns:
* S_OK on success
* E_NOINTERFACE if the interface wasn't found
*
*****************************************************************************/
static HRESULT WINAPI d3d_vertex_buffer7_QueryInterface(IDirect3DVertexBuffer7 *iface, REFIID riid, void **obj)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer7(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
/* By default, set the object pointer to NULL */
*obj = NULL;
if ( IsEqualGUID( &IID_IUnknown, riid ) )
if (IsEqualGUID(&IID_IUnknown, riid))
{
IDirect3DVertexBuffer7_AddRef(iface);
*obj = iface;
TRACE(" Creating IUnknown interface at %p.\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer, riid ) )
{
IDirect3DVertexBuffer7_AddRef(iface);
*obj = &buffer->IDirect3DVertexBuffer_iface;
TRACE(" Creating IDirect3DVertexBuffer interface %p\n", *obj);
return S_OK;
}
if ( IsEqualGUID( &IID_IDirect3DVertexBuffer7, riid ) )
if (IsEqualGUID(&IID_IDirect3DVertexBuffer7, riid) && buffer->version == 7)
{
IDirect3DVertexBuffer7_AddRef(iface);
*obj = iface;
return S_OK;
}
if (IsEqualGUID(&IID_IDirect3DVertexBuffer, riid) && buffer->version == 3)
{
IDirect3DVertexBuffer7_AddRef(iface);
*obj = iface;
TRACE(" Creating IDirect3DVertexBuffer7 interface %p\n", *obj);
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static HRESULT WINAPI d3d_vertex_buffer1_QueryInterface(IDirect3DVertexBuffer *iface, REFIID riid, void **obj)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj);
return d3d_vertex_buffer7_QueryInterface(&buffer->IDirect3DVertexBuffer7_iface, riid, obj);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::AddRef
*
* AddRef for Vertex Buffers
*
* Returns:
* The new refcount
*
*****************************************************************************/
static ULONG WINAPI d3d_vertex_buffer7_AddRef(IDirect3DVertexBuffer7 *iface)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer7(iface);
@@ -112,25 +69,6 @@ static ULONG WINAPI d3d_vertex_buffer7_AddRef(IDirect3DVertexBuffer7 *iface)
return ref;
}
static ULONG WINAPI d3d_vertex_buffer1_AddRef(IDirect3DVertexBuffer *iface)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
TRACE("iface %p.\n", iface);
return d3d_vertex_buffer7_AddRef(&buffer->IDirect3DVertexBuffer7_iface);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::Release
*
* Release for Vertex Buffers
*
* Returns:
* The new refcount
*
*****************************************************************************/
static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer7(iface);
@@ -138,40 +76,33 @@ static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface)
TRACE("%p decreasing refcount to %u.\n", buffer, ref);
if (ref == 0)
if (!ref)
{
struct wined3d_buffer *curVB = NULL;
struct wined3d_buffer *vb = NULL;
UINT offset, stride;
/* D3D7 Vertex buffers don't stay bound in the device, they are passed
* as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the
* stream source in wined3d, and they should get unset there before
/* D3D7 vertex buffers don't stay bound in the device, they are passed
* as a parameter to DrawPrimitiveVB. DrawPrimitiveVB sets them as the
* stream source in wined3d and they should get unset there before
* they are destroyed. */
wined3d_mutex_lock();
wined3d_device_get_stream_source(buffer->ddraw->wined3d_device,
0, &curVB, &offset, &stride);
if (curVB == buffer->wineD3DVertexBuffer)
wined3d_device_get_stream_source(buffer->ddraw->wined3d_device, 0, &vb, &offset, &stride);
if (vb == buffer->wined3d_buffer)
wined3d_device_set_stream_source(buffer->ddraw->wined3d_device, 0, NULL, 0, 0);
wined3d_vertex_declaration_decref(buffer->wineD3DVertexDeclaration);
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
wined3d_vertex_declaration_decref(buffer->wined3d_declaration);
wined3d_buffer_decref(buffer->wined3d_buffer);
wined3d_mutex_unlock();
if (buffer->version == 7)
IDirectDraw7_Release(&buffer->ddraw->IDirectDraw7_iface);
HeapFree(GetProcessHeap(), 0, buffer);
}
return ref;
}
static ULONG WINAPI d3d_vertex_buffer1_Release(IDirect3DVertexBuffer *iface)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
TRACE("iface %p.\n", iface);
return d3d_vertex_buffer7_Release(&buffer->IDirect3DVertexBuffer7_iface);
}
/*****************************************************************************
* IDirect3DVertexBuffer Methods
*****************************************************************************/
@@ -222,6 +153,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer7(iface);
struct wined3d_resource_desc wined3d_desc;
struct wined3d_resource *wined3d_resource;
struct wined3d_map_desc wined3d_map_desc;
HRESULT hr;
DWORD wined3d_flags = 0;
@@ -248,8 +180,8 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
if (SUCCEEDED(hr))
{
buffer->dynamic = TRUE;
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
buffer->wineD3DVertexBuffer = new_buffer;
wined3d_buffer_decref(buffer->wined3d_buffer);
buffer->wined3d_buffer = new_buffer;
}
else
{
@@ -263,28 +195,20 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
if (data_size)
{
/* Get the size, for returning it, and for locking */
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer);
wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
*data_size = wined3d_desc.size;
}
hr = wined3d_buffer_map(buffer->wineD3DVertexBuffer, 0, 0, (BYTE **)data, wined3d_flags);
hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->wined3d_buffer),
0, &wined3d_map_desc, NULL, wined3d_flags);
*data = wined3d_map_desc.data;
wined3d_mutex_unlock();
return hr;
}
static HRESULT WINAPI d3d_vertex_buffer1_Lock(IDirect3DVertexBuffer *iface,
DWORD flags, void **data, DWORD *data_size)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
TRACE("iface %p, flags %#x, data %p, data_size %p.\n", iface, flags, data, data_size);
return d3d_vertex_buffer7_Lock(&buffer->IDirect3DVertexBuffer7_iface, flags, data, data_size);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::Unlock
*
@@ -301,22 +225,12 @@ static HRESULT WINAPI d3d_vertex_buffer7_Unlock(IDirect3DVertexBuffer7 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
wined3d_buffer_unmap(buffer->wineD3DVertexBuffer);
wined3d_resource_unmap(wined3d_buffer_get_resource(buffer->wined3d_buffer), 0);
wined3d_mutex_unlock();
return D3D_OK;
}
static HRESULT WINAPI d3d_vertex_buffer1_Unlock(IDirect3DVertexBuffer *iface)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
TRACE("iface %p.\n", iface);
return d3d_vertex_buffer7_Unlock(&buffer->IDirect3DVertexBuffer7_iface);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::ProcessVertices
*
@@ -345,7 +259,9 @@ static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7
{
struct d3d_vertex_buffer *dst_buffer_impl = impl_from_IDirect3DVertexBuffer7(iface);
struct d3d_vertex_buffer *src_buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer7(src_buffer);
struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice7(device);
struct d3d_device *device_impl = dst_buffer_impl->version == 7
? unsafe_impl_from_IDirect3DDevice7(device)
: unsafe_impl_from_IDirect3DDevice3((IDirect3DDevice3 *)device);
BOOL oldClip, doClip;
HRESULT hr;
@@ -377,10 +293,10 @@ static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7
wined3d_device_set_render_state(device_impl->wined3d_device, WINED3D_RS_CLIPPING, doClip);
wined3d_device_set_stream_source(device_impl->wined3d_device,
0, src_buffer_impl->wineD3DVertexBuffer, 0, get_flexible_vertex_size(src_buffer_impl->fvf));
wined3d_device_set_vertex_declaration(device_impl->wined3d_device, src_buffer_impl->wineD3DVertexDeclaration);
0, src_buffer_impl->wined3d_buffer, 0, get_flexible_vertex_size(src_buffer_impl->fvf));
wined3d_device_set_vertex_declaration(device_impl->wined3d_device, src_buffer_impl->wined3d_declaration);
hr = wined3d_device_process_vertices(device_impl->wined3d_device, src_idx, dst_idx,
count, dst_buffer_impl->wineD3DVertexBuffer, NULL, flags, dst_buffer_impl->fvf);
count, dst_buffer_impl->wined3d_buffer, NULL, flags, dst_buffer_impl->fvf);
/* Restore the states if needed */
if (doClip != oldClip)
@@ -391,22 +307,6 @@ static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7
return hr;
}
static HRESULT WINAPI d3d_vertex_buffer1_ProcessVertices(IDirect3DVertexBuffer *iface,
DWORD vertex_op, DWORD dst_idx, DWORD count, IDirect3DVertexBuffer *src_buffer,
DWORD src_idx, IDirect3DDevice3 *device, DWORD flags)
{
struct d3d_vertex_buffer *dst_buffer_impl = impl_from_IDirect3DVertexBuffer(iface);
struct d3d_vertex_buffer *src_buffer_impl = unsafe_impl_from_IDirect3DVertexBuffer(src_buffer);
struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice3(device);
TRACE("iface %p, vertex_op %#x, dst_idx %u, count %u, src_buffer %p, src_idx %u, device %p, flags %#x.\n",
iface, vertex_op, dst_idx, count, src_buffer, src_idx, device, flags);
return d3d_vertex_buffer7_ProcessVertices(&dst_buffer_impl->IDirect3DVertexBuffer7_iface, vertex_op,
dst_idx, count, &src_buffer_impl->IDirect3DVertexBuffer7_iface, src_idx,
device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, flags);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::GetVertexBufferDesc
*
@@ -431,7 +331,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_GetVertexBufferDesc(IDirect3DVertexBuff
if (!desc) return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer);
wined3d_resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
wined3d_resource_get_desc(wined3d_resource, &wined3d_desc);
wined3d_mutex_unlock();
@@ -443,16 +343,6 @@ static HRESULT WINAPI d3d_vertex_buffer7_GetVertexBufferDesc(IDirect3DVertexBuff
return D3D_OK;
}
static HRESULT WINAPI d3d_vertex_buffer1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface, D3DVERTEXBUFFERDESC *desc)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
TRACE("iface %p, desc %p.\n", iface, desc);
return d3d_vertex_buffer7_GetVertexBufferDesc(&buffer->IDirect3DVertexBuffer7_iface, desc);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::Optimize
*
@@ -490,18 +380,6 @@ static HRESULT WINAPI d3d_vertex_buffer7_Optimize(IDirect3DVertexBuffer7 *iface,
return DD_OK;
}
static HRESULT WINAPI d3d_vertex_buffer1_Optimize(IDirect3DVertexBuffer *iface,
IDirect3DDevice3 *device, DWORD flags)
{
struct d3d_vertex_buffer *buffer = impl_from_IDirect3DVertexBuffer(iface);
struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice3(device);
TRACE("iface %p, device %p, flags %#x.\n", iface, device, flags);
return d3d_vertex_buffer7_Optimize(&buffer->IDirect3DVertexBuffer7_iface,
device_impl ? &device_impl->IDirect3DDevice7_iface : NULL, flags);
}
/*****************************************************************************
* IDirect3DVertexBuffer7::ProcessVerticesStrided
*
@@ -551,18 +429,6 @@ static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl =
d3d_vertex_buffer7_ProcessVerticesStrided,
};
static const struct IDirect3DVertexBufferVtbl d3d_vertex_buffer1_vtbl =
{
d3d_vertex_buffer1_QueryInterface,
d3d_vertex_buffer1_AddRef,
d3d_vertex_buffer1_Release,
d3d_vertex_buffer1_Lock,
d3d_vertex_buffer1_Unlock,
d3d_vertex_buffer1_ProcessVertices,
d3d_vertex_buffer1_GetVertexBufferDesc,
d3d_vertex_buffer1_Optimize,
};
HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
struct ddraw *ddraw, D3DVERTEXBUFFERDESC *desc)
{
@@ -580,9 +446,10 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
return DDERR_OUTOFMEMORY;
buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
buffer->IDirect3DVertexBuffer_iface.lpVtbl = &d3d_vertex_buffer1_vtbl;
buffer->ref = 1;
buffer->version = ddraw->d3dversion;
if (buffer->version == 7)
IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
buffer->ddraw = ddraw;
buffer->Caps = desc->dwCaps;
buffer->fvf = desc->dwFVF;
@@ -590,8 +457,7 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
wined3d_mutex_lock();
hr = d3d_vertex_buffer_create_wined3d_buffer(buffer, FALSE, &buffer->wineD3DVertexBuffer);
if (FAILED(hr))
if (FAILED(hr = d3d_vertex_buffer_create_wined3d_buffer(buffer, FALSE, &buffer->wined3d_buffer)))
{
WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);
if (hr == WINED3DERR_INVALIDCALL)
@@ -599,15 +465,14 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
goto end;
}
buffer->wineD3DVertexDeclaration = ddraw_find_decl(ddraw, desc->dwFVF);
if (!buffer->wineD3DVertexDeclaration)
if (!(buffer->wined3d_declaration = ddraw_find_decl(ddraw, desc->dwFVF)))
{
ERR("Failed to find vertex declaration for fvf %#x.\n", desc->dwFVF);
wined3d_buffer_decref(buffer->wineD3DVertexBuffer);
wined3d_buffer_decref(buffer->wined3d_buffer);
hr = DDERR_INVALIDPARAMS;
goto end;
}
wined3d_vertex_declaration_incref(buffer->wineD3DVertexDeclaration);
wined3d_vertex_declaration_incref(buffer->wined3d_declaration);
end:
wined3d_mutex_unlock();
@@ -619,15 +484,6 @@ end:
return hr;
}
struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer(IDirect3DVertexBuffer *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d_vertex_buffer1_vtbl);
return impl_from_IDirect3DVertexBuffer(iface);
}
struct d3d_vertex_buffer *unsafe_impl_from_IDirect3DVertexBuffer7(IDirect3DVertexBuffer7 *iface)
{
if (!iface)
+78 -67
View File
@@ -267,7 +267,6 @@ static HRESULT WINAPI d3d_viewport_GetViewport(IDirect3DViewport3 *iface, D3DVIE
wined3d_mutex_lock();
dwSize = lpData->dwSize;
memset(lpData, 0, dwSize);
if (!This->use_vp2)
memcpy(lpData, &(This->viewports.vp1), dwSize);
else {
@@ -366,10 +365,10 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE
*
* Params:
* dwVertexCount: The number of vertices to be transformed
* lpData: Pointer to the vertex data
* data: Pointer to the vertex input / output data.
* dwFlags: D3DTRANSFORM_CLIPPED or D3DTRANSFORM_UNCLIPPED
* lpOffScreen: Set to the clipping plane clipping the vertex, if only one
* vertex is transformed and clipping is on. 0 otherwise
* offscreen: Logical AND of the planes that clipped the vertices if clipping
* is on. 0 if clipping is off.
*
* Returns:
* D3D_OK on success
@@ -377,76 +376,105 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE
* DDERR_INVALIDPARAMS if no clipping flag is specified
*
*****************************************************************************/
struct transform_vertices_vertex
{
float x, y, z, w; /* w is unused in input data. */
struct
{
DWORD p[4];
} payload;
};
static HRESULT WINAPI d3d_viewport_TransformVertices(IDirect3DViewport3 *iface,
DWORD dwVertexCount, D3DTRANSFORMDATA *lpData, DWORD dwFlags, DWORD *lpOffScreen)
DWORD dwVertexCount, D3DTRANSFORMDATA *data, DWORD dwFlags, DWORD *offscreen)
{
struct d3d_viewport *viewport = impl_from_IDirect3DViewport3(iface);
D3DVIEWPORT vp = viewport->viewports.vp1;
D3DMATRIX view_mat, world_mat, mat;
float *in;
float *out;
D3DMATRIX view_mat, world_mat, proj_mat, mat;
struct transform_vertices_vertex *in, *out;
float x, y, z, w;
unsigned int i;
D3DHVERTEX *outH;
struct d3d_device *device = viewport->active_device;
BOOL activate = device->current_viewport != viewport;
TRACE("iface %p, vertex_count %u, vertex_data %p, flags %#x, clip_plane %p.\n",
iface, dwVertexCount, lpData, dwFlags, lpOffScreen);
TRACE("iface %p, vertex_count %u, data %p, flags %#x, offscreen %p.\n",
iface, dwVertexCount, data, dwFlags, offscreen);
/* Tests on windows show that Windows crashes when this occurs,
* so don't return the (intuitive) return value
if (!viewport->active_device)
if (!device)
{
WARN("No device active, returning D3DERR_VIEWPORTHASNODEVICE\n");
return D3DERR_VIEWPORTHASNODEVICE;
}
*/
if(!(dwFlags & (D3DTRANSFORM_UNCLIPPED | D3DTRANSFORM_CLIPPED)))
if (!data || data->dwSize != sizeof(*data))
{
WARN("Transform data is NULL or size is incorrect, returning DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS;
}
if (!(dwFlags & (D3DTRANSFORM_UNCLIPPED | D3DTRANSFORM_CLIPPED)))
{
WARN("No clipping flag passed, returning DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS;
}
wined3d_mutex_lock();
wined3d_device_get_transform(viewport->active_device->wined3d_device,
D3DTRANSFORMSTATE_VIEW, (struct wined3d_matrix *)&view_mat);
wined3d_device_get_transform(viewport->active_device->wined3d_device,
WINED3D_TS_WORLD_MATRIX(0), (struct wined3d_matrix *)&world_mat);
multiply_matrix(&mat, &view_mat, &world_mat);
multiply_matrix(&mat, &viewport->active_device->legacy_projection, &mat);
if (activate)
viewport_activate(viewport, TRUE);
in = lpData->lpIn;
out = lpData->lpOut;
outH = lpData->lpHOut;
wined3d_device_get_transform(device->wined3d_device,
D3DTRANSFORMSTATE_VIEW, (struct wined3d_matrix *)&view_mat);
wined3d_device_get_transform(device->wined3d_device,
WINED3D_TS_WORLD_MATRIX(0), (struct wined3d_matrix *)&world_mat);
wined3d_device_get_transform(device->wined3d_device,
WINED3D_TS_PROJECTION, (struct wined3d_matrix *)&proj_mat);
multiply_matrix(&mat, &view_mat, &world_mat);
multiply_matrix(&mat, &proj_mat, &mat);
/* The pointer is not tested against NULL on Windows. */
if (dwFlags & D3DTRANSFORM_CLIPPED)
*offscreen = ~0U;
else
*offscreen = 0;
outH = data->lpHOut;
for(i = 0; i < dwVertexCount; i++)
{
x = (in[0] * mat._11) + (in[1] * mat._21) + (in[2] * mat._31) + mat._41;
y = (in[0] * mat._12) + (in[1] * mat._22) + (in[2] * mat._32) + mat._42;
z = (in[0] * mat._13) + (in[1] * mat._23) + (in[2] * mat._33) + mat._43;
w = (in[0] * mat._14) + (in[1] * mat._24) + (in[2] * mat._34) + mat._44;
in = (struct transform_vertices_vertex *)((char *)data->lpIn + data->dwInSize * i);
out = (struct transform_vertices_vertex *)((char *)data->lpOut + data->dwOutSize * i);
x = (in->x * mat._11) + (in->y * mat._21) + (in->z * mat._31) + mat._41;
y = (in->x * mat._12) + (in->y * mat._22) + (in->z * mat._32) + mat._42;
z = (in->x * mat._13) + (in->y * mat._23) + (in->z * mat._33) + mat._43;
w = (in->x * mat._14) + (in->y * mat._24) + (in->z * mat._34) + mat._44;
if(dwFlags & D3DTRANSFORM_CLIPPED)
{
/* If clipping is enabled, Windows assumes that outH is
* a valid pointer
*/
outH[i].u1.hx = x; outH[i].u2.hy = y; outH[i].u3.hz = z;
* a valid pointer. */
outH[i].u1.hx = (x - device->legacy_clipspace._41 * w) / device->legacy_clipspace._11;
outH[i].u2.hy = (y - device->legacy_clipspace._42 * w) / device->legacy_clipspace._22;
outH[i].u3.hz = (z - device->legacy_clipspace._43 * w) / device->legacy_clipspace._33;
outH[i].dwFlags = 0;
if(x * vp.dvScaleX > ((float) vp.dwWidth * 0.5))
if (x > w)
outH[i].dwFlags |= D3DCLIP_RIGHT;
if(x * vp.dvScaleX <= -((float) vp.dwWidth) * 0.5)
if (x < -w)
outH[i].dwFlags |= D3DCLIP_LEFT;
if(y * vp.dvScaleY > ((float) vp.dwHeight * 0.5))
if (y > w)
outH[i].dwFlags |= D3DCLIP_TOP;
if(y * vp.dvScaleY <= -((float) vp.dwHeight) * 0.5)
if (y < -w)
outH[i].dwFlags |= D3DCLIP_BOTTOM;
if(z < 0.0)
if (z < 0.0f)
outH[i].dwFlags |= D3DCLIP_FRONT;
if(z > 1.0)
if (z > w)
outH[i].dwFlags |= D3DCLIP_BACK;
*offscreen &= outH[i].dwFlags;
if(outH[i].dwFlags)
{
/* Looks like native just drops the vertex, leaves whatever data
@@ -454,12 +482,10 @@ static HRESULT WINAPI d3d_viewport_TransformVertices(IDirect3DViewport3 *iface,
* The exact scheme hasn't been figured out yet, but windows
* definitely writes something there.
*/
out[0] = x;
out[1] = y;
out[2] = z;
out[3] = w;
in = (float *) ((char *) in + lpData->dwInSize);
out = (float *) ((char *) out + lpData->dwOutSize);
out->x = x;
out->y = y;
out->z = z;
out->w = w;
continue;
}
}
@@ -467,30 +493,16 @@ static HRESULT WINAPI d3d_viewport_TransformVertices(IDirect3DViewport3 *iface,
w = 1 / w;
x *= w; y *= w; z *= w;
out[0] = vp.dwWidth / 2 + vp.dwX + x * vp.dvScaleX;
out[1] = vp.dwHeight / 2 + vp.dwY - y * vp.dvScaleY;
out[2] = z;
out[3] = w;
in = (float *) ((char *) in + lpData->dwInSize);
out = (float *) ((char *) out + lpData->dwOutSize);
out->x = (x + 1.0f) * vp.dwWidth * 0.5 + vp.dwX;
out->y = (-y + 1.0f) * vp.dwHeight * 0.5 + vp.dwY;
out->z = z;
out->w = w;
out->payload = in->payload;
}
/* According to the d3d test, the offscreen flag is set only
* if exactly one vertex is transformed. Its not documented,
* but the test shows that the lpOffscreen flag is set to the
* flag combination of clipping planes that clips the vertex.
*
* If clipping is requested, Windows assumes that the offscreen
* param is a valid pointer.
*/
if(dwVertexCount == 1 && dwFlags & D3DTRANSFORM_CLIPPED)
{
*lpOffScreen = outH[0].dwFlags;
}
else if(*lpOffScreen)
{
*lpOffScreen = 0;
}
if (activate && device->current_viewport)
viewport_activate(device->current_viewport, TRUE);
wined3d_mutex_unlock();
TRACE("All done\n");
@@ -576,7 +588,7 @@ static HRESULT WINAPI d3d_viewport_GetBackground(IDirect3DViewport3 *iface,
/*****************************************************************************
* IDirect3DViewport3::SetBackgroundDepth
*
* Sets a surface that represents the background depth. It's contents are
* Sets a surface that represents the background depth. Its contents are
* used to set the depth buffer in IDirect3DViewport3::Clear
*
* Params:
@@ -890,7 +902,6 @@ static HRESULT WINAPI d3d_viewport_GetViewport2(IDirect3DViewport3 *iface, D3DVI
wined3d_mutex_lock();
dwSize = lpData->dwSize;
memset(lpData, 0, dwSize);
if (This->use_vp2)
memcpy(lpData, &(This->viewports.vp2), dwSize);
else {
@@ -1116,7 +1127,7 @@ struct d3d_viewport *unsafe_impl_from_IDirect3DViewport2(IDirect3DViewport2 *ifa
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
if (!iface) return NULL;
assert(iface->lpVtbl == (IDirect3DViewport2Vtbl *)&d3d_viewport_vtbl);
return CONTAINING_RECORD(iface, struct d3d_viewport, IDirect3DViewport3_iface);
return CONTAINING_RECORD((IDirect3DViewport3 *)iface, struct d3d_viewport, IDirect3DViewport3_iface);
}
struct d3d_viewport *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface)
@@ -1124,7 +1135,7 @@ struct d3d_viewport *unsafe_impl_from_IDirect3DViewport(IDirect3DViewport *iface
/* IDirect3DViewport and IDirect3DViewport3 use the same iface. */
if (!iface) return NULL;
assert(iface->lpVtbl == (IDirect3DViewportVtbl *)&d3d_viewport_vtbl);
return CONTAINING_RECORD(iface, struct d3d_viewport, IDirect3DViewport3_iface);
return CONTAINING_RECORD((IDirect3DViewport3 *)iface, struct d3d_viewport, IDirect3DViewport3_iface);
}
void d3d_viewport_init(struct d3d_viewport *viewport, struct ddraw *ddraw)
@@ -39,7 +39,6 @@ list(APPEND SOURCE
utils.c
vertexdeclaration.c
view.c
volume.c
wined3d_main.c
wined3d_private.h)
File diff suppressed because it is too large Load Diff
@@ -47,7 +47,7 @@ struct atifs_ffp_desc
struct ffp_frag_desc parent;
GLuint shader;
unsigned int num_textures_used;
enum atifs_constant_value constants[8];
enum atifs_constant_value constants[MAX_TEXTURES];
};
struct atifs_private_data
@@ -932,7 +932,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES],
constants[ATIFS_CONST_TFACTOR - GL_CON_0_ATI] = ATIFS_CONSTANT_TFACTOR;
/* Assign unused constants to avoid reloading due to unused <-> bump matrix switches. */
for (stage = 0; stage < 8; ++stage)
for (stage = 0; stage < MAX_TEXTURES; ++stage)
{
if (constants[stage] == ATIFS_CONSTANT_UNUSED)
constants[stage] = ATIFS_CONSTANT_BUMP;
@@ -947,16 +947,16 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES],
static void atifs_tfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
float col[4];
struct atifs_context_private_data *ctx_priv = context->fragment_pipe_data;
struct wined3d_color color;
if (!ctx_priv->last_shader
|| ctx_priv->last_shader->constants[ATIFS_CONST_TFACTOR - GL_CON_0_ATI] != ATIFS_CONSTANT_TFACTOR)
return;
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
GL_EXTCALL(glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR, col));
checkGLcall("glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR, col)");
wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_TEXTUREFACTOR]);
GL_EXTCALL(glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR, &color.r));
checkGLcall("glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR, &color.r)");
}
static void set_bumpmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@@ -992,21 +992,21 @@ static void atifs_stage_constant(struct wined3d_context *context, const struct w
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
const struct wined3d_gl_info *gl_info = context->gl_info;
float col[4];
struct atifs_context_private_data *ctx_priv = context->fragment_pipe_data;
struct wined3d_color color;
if (!ctx_priv->last_shader
|| ctx_priv->last_shader->constants[stage] != ATIFS_CONSTANT_STAGE)
return;
D3DCOLORTOGLFLOAT4(state->texture_states[stage][WINED3D_TSS_CONSTANT], col);
GL_EXTCALL(glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage), col));
checkGLcall("glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage), col)");
wined3d_color_from_d3dcolor(&color, state->texture_states[stage][WINED3D_TSS_CONSTANT]);
GL_EXTCALL(glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage), &color.r));
checkGLcall("glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage), &color.r)");
}
static void set_tex_op_atifs(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_device *device = context->swapchain->device;
const struct wined3d_device *device = context->device;
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
struct atifs_context_private_data *ctx_priv = context->fragment_pipe_data;
@@ -1018,7 +1018,8 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
gen_ffp_frag_op(context, state, &settings, TRUE);
desc = (const struct atifs_ffp_desc *)find_ffp_frag_shader(&priv->fragment_shaders, &settings);
if(!desc) {
if (!desc)
{
struct atifs_ffp_desc *new_desc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*new_desc));
if (!new_desc)
{
@@ -1030,13 +1031,13 @@ 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 + 1;
++new_desc->num_textures_used;
}
new_desc->parent.settings = settings;
new_desc->shader = gen_ati_shader(settings.op, gl_info, new_desc->constants);
add_ffp_frag_shader(&priv->fragment_shaders, &new_desc->parent);
TRACE("Allocated fixed function replacement shader descriptor %p\n", new_desc);
TRACE("Allocated fixed function replacement shader descriptor %p.\n", new_desc);
desc = new_desc;
}
@@ -1056,7 +1057,7 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
GL_EXTCALL(glBindFragmentShaderATI(desc->shader));
ctx_priv->last_shader = desc;
for (i = 0; i < 8; i++)
for (i = 0; i < MAX_TEXTURES; i++)
{
if (last_shader && last_shader->constants[i] == desc->constants[i])
continue;
@@ -1301,7 +1302,7 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
* The proper fix for this is not to use GL_ATI_fragment_shader on cards newer than the
* r200 series and use an ARB or GLSL shader instead
*/
caps->MaxTextureBlendStages = 8;
caps->MaxTextureBlendStages = MAX_TEXTURES;
caps->MaxSimultaneousTextures = 6;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -642,10 +642,10 @@ static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3
static void nvrc_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
float col[4];
struct wined3d_color color;
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_TEXTUREFACTOR]);
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &color.r));
}
/* Context activation is done by the caller. */
+6 -1
View File
@@ -32,6 +32,11 @@ ULONG CDECL wined3d_palette_incref(struct wined3d_palette *palette)
return refcount;
}
static void wined3d_palette_destroy_object(void *object)
{
HeapFree(GetProcessHeap(), 0, object);
}
ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette)
{
ULONG refcount = InterlockedDecrement(&palette->ref);
@@ -39,7 +44,7 @@ ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette)
TRACE("%p decreasing refcount to %u.\n", palette, refcount);
if (!refcount)
HeapFree(GetProcessHeap(), 0, palette);
wined3d_cs_destroy_object(palette->device->cs, wined3d_palette_destroy_object, palette);
return refcount;
}
File diff suppressed because it is too large Load Diff
+90 -683
View File
@@ -55,6 +55,7 @@ static void resource_check_usage(DWORD usage)
| WINED3DUSAGE_AUTOGENMIPMAP
| WINED3DUSAGE_STATICDECL
| WINED3DUSAGE_OVERLAY
| WINED3DUSAGE_PRIVATE
| WINED3DUSAGE_LEGACY_CUBEMAP
| WINED3DUSAGE_TEXTURE;
@@ -95,6 +96,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource_types[] =
{
{WINED3D_RTYPE_BUFFER, 0, WINED3D_GL_RES_TYPE_BUFFER},
{WINED3D_RTYPE_TEXTURE_1D, 0, WINED3D_GL_RES_TYPE_TEX_1D},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_TEX_2D},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_TEX_RECT},
{WINED3D_RTYPE_TEXTURE_2D, 0, WINED3D_GL_RES_TYPE_RB},
@@ -211,92 +213,65 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
ERR("Failed to allocate system memory.\n");
return E_OUTOFMEMORY;
}
#if defined(STAGING_CSMT)
resource->heap_memory = resource->map_heap_memory;
#endif /* STAGING_CSMT */
}
else
{
resource->heap_memory = NULL;
}
/* Check that we have enough video ram left */
if (pool == WINED3D_POOL_DEFAULT && device->wined3d->flags & WINED3D_VIDMEM_ACCOUNTING)
if (!(usage & WINED3DUSAGE_PRIVATE))
{
if (size > wined3d_device_get_available_texture_mem(device))
/* Check that we have enough video ram left */
if (pool == WINED3D_POOL_DEFAULT && device->wined3d->flags & WINED3D_VIDMEM_ACCOUNTING)
{
ERR("Out of adapter memory\n");
wined3d_resource_free_sysmem(resource);
return WINED3DERR_OUTOFVIDEOMEMORY;
if (size > wined3d_device_get_available_texture_mem(device))
{
ERR("Out of adapter memory\n");
wined3d_resource_free_sysmem(resource);
return WINED3DERR_OUTOFVIDEOMEMORY;
}
adapter_adjust_memory(device->adapter, size);
}
adapter_adjust_memory(device->adapter, size);
}
device_resource_add(device, resource);
device_resource_add(device, resource);
}
return WINED3D_OK;
}
#if defined(STAGING_CSMT)
void wined3d_resource_free_bo(struct wined3d_resource *resource)
static void wined3d_resource_destroy_object(void *object)
{
struct wined3d_context *context = context_acquire(resource->device, NULL);
if (resource->buffer != resource->map_buffer)
ERR("Releasing resource buffer with buffer != map_buffer.\n");
wined3d_device_release_bo(resource->device, resource->buffer, context);
resource->buffer = NULL;
resource->map_buffer = NULL;
context_release(context);
}
void wined3d_resource_cleanup_cs(struct wined3d_resource *resource)
{
context_resource_released(resource->device, resource, resource->type);
if (resource->buffer)
wined3d_resource_free_bo(resource);
struct wined3d_resource *resource = object;
wined3d_resource_free_sysmem(resource);
resource->map_heap_memory = NULL;
context_resource_released(resource->device, resource, resource->type);
wined3d_resource_release(resource);
}
#endif /* STAGING_CSMT */
void resource_cleanup(struct wined3d_resource *resource)
{
const struct wined3d *d3d = resource->device->wined3d;
TRACE("Cleaning up resource %p.\n", resource);
if (resource->pool == WINED3D_POOL_DEFAULT && d3d->flags & WINED3D_VIDMEM_ACCOUNTING)
if (!(resource->usage & WINED3DUSAGE_PRIVATE))
{
TRACE("Decrementing device memory pool by %u.\n", resource->size);
adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size);
if (resource->pool == WINED3D_POOL_DEFAULT && d3d->flags & WINED3D_VIDMEM_ACCOUNTING)
{
TRACE("Decrementing device memory pool by %u.\n", resource->size);
adapter_adjust_memory(resource->device->adapter, (INT64)0 - resource->size);
}
device_resource_released(resource->device, resource);
}
#if defined(STAGING_CSMT)
wined3d_cs_emit_resource_cleanup(resource->device->cs, resource);
#else /* STAGING_CSMT */
wined3d_resource_free_sysmem(resource);
#endif /* STAGING_CSMT */
device_resource_released(resource->device, resource);
wined3d_resource_acquire(resource);
wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource);
}
void resource_unload(struct wined3d_resource *resource)
{
if (resource->map_count)
ERR("Resource %p is being unloaded while mapped.\n", resource);
#if defined(STAGING_CSMT)
if (resource->buffer)
wined3d_resource_free_bo(resource);
#endif /* STAGING_CSMT */
context_resource_unloaded(resource->device,
resource, resource->type);
}
DWORD CDECL wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority)
@@ -345,55 +320,7 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st
desc->size = resource->size;
}
HRESULT CDECL wined3d_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
resource, sub_resource_idx, map_desc, debug_box(box), flags);
return resource->resource_ops->resource_sub_resource_map(resource, sub_resource_idx, map_desc, box, flags);
}
HRESULT CDECL wined3d_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
return resource->resource_ops->resource_sub_resource_unmap(resource, sub_resource_idx);
}
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
{
void **p;
SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
void *mem;
if (!(mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, resource->size + align)))
return FALSE;
p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1;
*p = mem;
#if defined(STAGING_CSMT)
resource->map_heap_memory = ++p;
#else /* STAGING_CSMT */
resource->heap_memory = ++p;
#endif /* STAGING_CSMT */
return TRUE;
}
void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
{
void **p = resource->heap_memory;
if (!p)
return;
HeapFree(GetProcessHeap(), 0, *(--p));
resource->heap_memory = NULL;
}
DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags)
static DWORD wined3d_resource_sanitise_map_flags(const struct wined3d_resource *resource, DWORD flags)
{
/* Not all flags make sense together, but Windows never returns an error.
* Catch the cases that could cause issues. */
@@ -426,6 +353,66 @@ DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resourc
return flags;
}
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
TRACE("resource %p, sub_resource_idx %u, map_desc %p, box %s, flags %#x.\n",
resource, sub_resource_idx, map_desc, debug_box(box), flags);
flags = wined3d_resource_sanitise_map_flags(resource, flags);
wined3d_resource_wait_idle(resource);
return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
}
HRESULT CDECL wined3d_resource_map_info(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_info *info, DWORD flags)
{
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
return resource->resource_ops->resource_map_info(resource, sub_resource_idx, info, flags);
}
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
return wined3d_cs_unmap(resource->device->cs, resource, sub_resource_idx);
}
void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
{
wined3d_cs_emit_preload_resource(resource->device->cs, resource);
}
BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource)
{
void **p;
SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p);
void *mem;
if (!(mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, resource->size + align)))
return FALSE;
p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1;
*p = mem;
resource->heap_memory = ++p;
return TRUE;
}
void wined3d_resource_free_sysmem(struct wined3d_resource *resource)
{
void **p = resource->heap_memory;
if (!p)
return;
HeapFree(GetProcessHeap(), 0, *(--p));
resource->heap_memory = NULL;
}
GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
{
GLbitfield ret = 0;
@@ -443,11 +430,7 @@ GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags)
return ret;
}
#if defined(STAGING_CSMT)
static GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
#else /* STAGING_CSMT */
GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags)
#endif /* STAGING_CSMT */
{
if (d3d_flags & WINED3D_MAP_READONLY)
return GL_READ_ONLY_ARB;
@@ -465,7 +448,7 @@ BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource)
return TRUE;
/* Not on a swapchain - must be offscreen */
if (!(swapchain = wined3d_texture_from_resource(resource)->swapchain))
if (!(swapchain = texture_from_resource(resource)->swapchain))
return TRUE;
/* The front buffer is always onscreen */
@@ -488,579 +471,3 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource)
else
resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
}
#if defined(STAGING_CSMT)
void wined3d_resource_get_pitch(const struct wined3d_resource *resource, UINT *row_pitch,
UINT *slice_pitch)
{
unsigned int alignment;
const struct wined3d_format *format = resource->format;
if (resource->custom_row_pitch)
{
*row_pitch = resource->custom_row_pitch;
*slice_pitch = resource->custom_slice_pitch;
return;
}
alignment = resource->device->surface_alignment;
*row_pitch = wined3d_format_calculate_pitch(resource->format, resource->width);
*row_pitch = (*row_pitch + alignment - 1) & ~(alignment - 1);
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_BLOCKS)
{
/* Since compressed formats are block based, pitch means the amount of
* bytes to the next row of block rather than the next row of pixels. */
UINT slice_block_count = (resource->height + format->block_height - 1) / format->block_height;
*slice_pitch = *row_pitch * slice_block_count;
}
else
{
*slice_pitch = *row_pitch * resource->height;
}
TRACE("Returning row pitch %u, slice pitch %u.\n", *row_pitch, *slice_pitch);
}
void wined3d_resource_validate_location(struct wined3d_resource *resource, DWORD location)
{
TRACE("Resource %p, setting %s.\n", resource, wined3d_debug_location(location));
resource->locations |= location;
TRACE("new location flags are %s.\n", wined3d_debug_location(resource->locations));
}
void wined3d_resource_invalidate_location(struct wined3d_resource *resource, DWORD location)
{
TRACE("Resource %p, setting %s.\n", resource, wined3d_debug_location(location));
resource->locations &= ~location;
TRACE("new location flags are %s.\n", wined3d_debug_location(resource->locations));
resource->resource_ops->resource_location_invalidated(resource, location);
}
DWORD wined3d_resource_access_from_location(DWORD location)
{
switch (location)
{
case WINED3D_LOCATION_DISCARDED:
return 0;
case WINED3D_LOCATION_SYSMEM:
case WINED3D_LOCATION_USER_MEMORY:
case WINED3D_LOCATION_DIB:
return WINED3D_RESOURCE_ACCESS_CPU;
case WINED3D_LOCATION_BUFFER:
case WINED3D_LOCATION_TEXTURE_RGB:
case WINED3D_LOCATION_TEXTURE_SRGB:
case WINED3D_LOCATION_DRAWABLE:
case WINED3D_LOCATION_RB_MULTISAMPLE:
case WINED3D_LOCATION_RB_RESOLVED:
return WINED3D_RESOURCE_ACCESS_GPU;
default:
FIXME("Unhandled location %#x.\n", location);
return 0;
}
}
void wined3d_resource_get_memory(const struct wined3d_resource *resource,
DWORD location, struct wined3d_bo_address *data)
{
if (location & WINED3D_LOCATION_BUFFER)
{
data->buffer_object = resource->buffer->name;
data->addr = NULL;
return;
}
if (location & WINED3D_LOCATION_USER_MEMORY)
{
data->buffer_object = 0;
data->addr = resource->user_memory;
return;
}
if (location & WINED3D_LOCATION_DIB)
{
data->buffer_object = 0;
data->addr = resource->bitmap_data;
return;
}
if (location & WINED3D_LOCATION_SYSMEM)
{
data->buffer_object = 0;
data->addr = resource->heap_memory;
return;
}
ERR("Unexpected location %s.\n", wined3d_debug_location(location));
}
/* Context activation is optionally by the caller. Context may be NULL. */
static void wined3d_resource_copy_simple_location(struct wined3d_resource *resource,
struct wined3d_context *context, DWORD location)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_bo_address dst, src;
UINT size = resource->size;
wined3d_resource_get_memory(resource, location, &dst);
wined3d_resource_get_memory(resource, resource->locations, &src);
if (dst.buffer_object)
{
gl_info = context->gl_info;
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, dst.buffer_object));
GL_EXTCALL(glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, size, src.addr));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Upload PBO");
return;
}
if (src.buffer_object)
{
gl_info = context->gl_info;
GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, src.buffer_object));
GL_EXTCALL(glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0, size, dst.addr));
GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
checkGLcall("Download PBO");
return;
}
memcpy(dst.addr, src.addr, size);
}
/* Context activation is optionally by the caller. Context may be NULL. */
void wined3d_resource_load_location(struct wined3d_resource *resource,
struct wined3d_context *context, DWORD location)
{
DWORD required_access = wined3d_resource_access_from_location(location);
DWORD simple_locations = WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_USER_MEMORY
| WINED3D_LOCATION_DIB | WINED3D_LOCATION_BUFFER;
if ((resource->locations & location) == location)
{
TRACE("Location(s) already up to date.\n");
return;
}
/* Keep this a WARN for now until surfaces are cleaned up. */
if ((resource->access_flags & required_access) != required_access)
WARN("Operation requires %#x access, but resource only has %#x.\n",
required_access, resource->access_flags);
if (location & simple_locations)
{
if (resource->locations & WINED3D_LOCATION_DISCARDED)
{
TRACE("Resource was discarded, nothing to do.\n");
resource->locations |= location;
return;
}
if (resource->locations & simple_locations)
{
wined3d_resource_copy_simple_location(resource, context, location);
resource->locations |= location;
return;
}
}
/* Context is NULL in ddraw-only operation without OpenGL. */
if (!context)
ERR("A context is required for non-sysmem operation.\n");
resource->resource_ops->resource_load_location(resource, context, location);
}
BYTE *wined3d_resource_get_map_ptr(const struct wined3d_resource *resource,
const struct wined3d_context *context, DWORD flags)
{
const struct wined3d_gl_info *gl_info;
BYTE *ptr;
switch (resource->map_binding)
{
case WINED3D_LOCATION_BUFFER:
gl_info = context->gl_info;
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, resource->map_buffer->name));
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
GLbitfield mapflags = wined3d_resource_gl_map_flags(flags);
mapflags &= ~GL_MAP_FLUSH_EXPLICIT_BIT;
ptr = GL_EXTCALL(glMapBufferRange(GL_PIXEL_UNPACK_BUFFER,
0, resource->size, mapflags));
}
else
{
GLenum access = wined3d_resource_gl_legacy_map_flags(flags);
ptr = GL_EXTCALL(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, access));
}
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Map GL buffer");
return ptr;
case WINED3D_LOCATION_SYSMEM:
return resource->map_heap_memory;
case WINED3D_LOCATION_DIB:
return resource->bitmap_data;
case WINED3D_LOCATION_USER_MEMORY:
return resource->user_memory;
default:
ERR("Unexpected map binding %s.\n", wined3d_debug_location(resource->map_binding));
return NULL;
}
}
void wined3d_resource_release_map_ptr(const struct wined3d_resource *resource,
const struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info;
switch (resource->map_binding)
{
case WINED3D_LOCATION_BUFFER:
gl_info = context->gl_info;
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, resource->map_buffer->name));
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Unmap GL buffer");
return;
case WINED3D_LOCATION_SYSMEM:
case WINED3D_LOCATION_DIB:
case WINED3D_LOCATION_USER_MEMORY:
return;
default:
ERR("Unexpected map binding %s.\n", wined3d_debug_location(resource->map_binding));
return;
}
}
/* Context activation is done by the caller. */
static void wined3d_resource_prepare_bo(struct wined3d_resource *resource, struct wined3d_context *context)
{
if (resource->buffer)
return;
resource->buffer = wined3d_device_get_bo(resource->device, resource->size,
GL_STREAM_DRAW, GL_PIXEL_UNPACK_BUFFER, context);
resource->map_buffer = resource->buffer;
TRACE("Created GL buffer %u for resource %p.\n", resource->buffer->name, resource);
resource->map_heap_memory = NULL;
}
BOOL wined3d_resource_prepare_system_memory(struct wined3d_resource *resource)
{
if (resource->heap_memory)
return TRUE;
if (!wined3d_resource_allocate_sysmem(resource))
{
ERR("Failed to allocate system memory.\n");
return FALSE;
}
resource->heap_memory = resource->map_heap_memory;
return TRUE;
}
/* Context activation is done by the caller. */
BOOL wined3d_resource_prepare_map_memory(struct wined3d_resource *resource, struct wined3d_context *context)
{
switch (resource->map_binding)
{
case WINED3D_LOCATION_BUFFER:
wined3d_resource_prepare_bo(resource, context);
return TRUE;
case WINED3D_LOCATION_SYSMEM:
return wined3d_resource_prepare_system_memory(resource);
case WINED3D_LOCATION_USER_MEMORY:
if (!resource->user_memory)
ERR("Map binding is set to WINED3D_LOCATION_USER_MEMORY but resource->user_memory is NULL.\n");
return TRUE;
case WINED3D_LOCATION_DIB:
if (!resource->bitmap_data)
ERR("Map binding is set to WINED3D_LOCATION_DIB but resource->bitmap_data is NULL.\n");
return TRUE;
default:
ERR("Unexpected map binding %s.\n", wined3d_debug_location(resource->map_binding));
return FALSE;
}
}
BOOL wined3d_resource_check_block_align(const struct wined3d_resource *resource,
const struct wined3d_box *box)
{
UINT width_mask, height_mask;
const struct wined3d_format *format = resource->format;
if (!box)
return TRUE;
/* This assumes power of two block sizes, but NPOT block sizes would be
* silly anyway.
*
* This also assumes that the format's block depth is 1. */
width_mask = format->block_width - 1;
height_mask = format->block_height - 1;
if (box->left & width_mask)
return FALSE;
if (box->top & height_mask)
return FALSE;
if (box->right & width_mask && box->right != resource->width)
return FALSE;
if (box->bottom & height_mask && box->bottom != resource->height)
return FALSE;
return TRUE;
}
void *wined3d_resource_map_internal(struct wined3d_resource *resource, DWORD flags)
{
struct wined3d_device *device = resource->device;
struct wined3d_context *context = NULL;
void *mem;
if (device->d3d_initialized)
context = context_acquire(device, NULL);
if (!wined3d_resource_prepare_map_memory(resource, context))
{
WARN("Out of memory.\n");
context_release(context);
return NULL;
}
if (flags & WINED3D_MAP_DISCARD)
{
switch (resource->map_binding)
{
case WINED3D_LOCATION_BUFFER:
resource->map_buffer = wined3d_device_get_bo(device, resource->size,
GL_STREAM_DRAW, GL_PIXEL_UNPACK_BUFFER, context);
break;
case WINED3D_LOCATION_SYSMEM:
wined3d_resource_allocate_sysmem(resource);
break;
default:
if (resource->access_fence)
ERR("Location %s does not support DISCARD maps.\n",
wined3d_debug_location(resource->map_binding));
if (resource->pool != WINED3D_POOL_DEFAULT)
FIXME("Discard used on %s pool resource.\n", debug_d3dpool(resource->pool));
}
wined3d_resource_validate_location(resource, resource->map_binding);
}
else
{
wined3d_resource_load_location(resource, context, resource->map_binding);
}
mem = wined3d_resource_get_map_ptr(resource, context, flags);
if (context)
context_release(context);
return mem;
}
static void wined3d_resource_sync(struct wined3d_resource *resource)
{
struct wined3d_resource *real_res = resource;
struct wined3d_surface *surface;
struct wined3d_volume *volume;
switch (resource->type)
{
case WINED3D_RTYPE_SURFACE:
surface = surface_from_resource(resource);
if (surface->container)
real_res = &surface->container->resource;
break;
case WINED3D_RTYPE_VOLUME:
volume = volume_from_resource(resource);
real_res = &volume->container->resource;
break;
default:
break;
}
wined3d_resource_wait_fence(real_res);
}
HRESULT wined3d_resource_map(struct wined3d_resource *resource,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
struct wined3d_device *device = resource->device;
BYTE *base_memory;
const struct wined3d_format *format = resource->format;
const unsigned int fmt_flags = resource->format->flags[WINED3D_GL_RES_TYPE_TEX_2D];
TRACE("resource %p, map_desc %p, box %s, flags %#x.\n",
resource, map_desc, debug_box(box), flags);
if (resource->usage & WINED3DUSAGE_RENDERTARGET && wined3d_settings.ignore_rt_map)
{
WARN("Ignoring render target map, only finishing CS.\n");
wined3d_cs_emit_glfinish(device->cs);
map_desc->row_pitch = 0;
map_desc->slice_pitch = 0;
map_desc->data = NULL;
device->cs->ops->finish(device->cs);
return WINED3D_OK;
}
if (resource->map_count)
{
WARN("Volume is already mapped.\n");
return WINED3DERR_INVALIDCALL;
}
flags = wined3d_resource_sanitize_map_flags(resource, flags);
if (flags & WINED3D_MAP_NOOVERWRITE)
FIXME("WINED3D_MAP_NOOVERWRITE are not implemented yet.\n");
if (flags & WINED3D_MAP_DISCARD)
{
switch (resource->map_binding)
{
case WINED3D_LOCATION_BUFFER:
case WINED3D_LOCATION_SYSMEM:
break;
default:
FIXME("Implement discard maps with %s map binding.\n",
wined3d_debug_location(resource->map_binding));
wined3d_resource_sync(resource);
}
}
else
wined3d_resource_sync(resource);
base_memory = wined3d_cs_emit_resource_map(device->cs, resource, flags);
if (!base_memory)
{
WARN("Map failed.\n");
return WINED3DERR_INVALIDCALL;
}
TRACE("Base memory pointer %p.\n", base_memory);
if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
{
map_desc->row_pitch = resource->width * format->byte_count;
map_desc->slice_pitch = map_desc->row_pitch * resource->height;
}
else
{
wined3d_resource_get_pitch(resource, &map_desc->row_pitch, &map_desc->slice_pitch);
}
if (!box)
{
map_desc->data = base_memory;
}
else
{
if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
{
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the locked rectangle. */
map_desc->data = base_memory
+ (box->front * map_desc->slice_pitch)
+ ((box->top / format->block_height) * map_desc->row_pitch)
+ ((box->left / format->block_width) * format->block_byte_count);
}
else
{
map_desc->data = base_memory
+ (map_desc->slice_pitch * box->front)
+ (map_desc->row_pitch * box->top)
+ (box->left * format->byte_count);
}
}
if (!(flags & WINED3D_MAP_READONLY))
resource->unmap_dirtify = TRUE;
resource->map_count++;
TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n",
map_desc->data, map_desc->row_pitch, map_desc->slice_pitch);
return WINED3D_OK;
}
void wined3d_resource_unmap_internal(struct wined3d_resource *resource)
{
struct wined3d_device *device = resource->device;
struct wined3d_context *context = NULL;
if (device->d3d_initialized)
context = context_acquire(device, NULL);
wined3d_resource_release_map_ptr(resource, context);
if (context)
context_release(context);
}
HRESULT wined3d_resource_unmap(struct wined3d_resource *resource)
{
struct wined3d_device *device = resource->device;
TRACE("resource %p.\n", resource);
if (resource->usage & WINED3DUSAGE_RENDERTARGET && wined3d_settings.ignore_rt_map)
{
WARN("Ignoring render target unmap.\n");
return WINED3D_OK;
}
if (!resource->map_count)
{
WARN("Trying to unlock an unlocked resource %p.\n", resource);
return WINEDDERR_NOTLOCKED;
}
wined3d_cs_emit_resource_unmap(device->cs, resource);
if (resource->unmap_dirtify)
{
wined3d_cs_emit_resource_changed(device->cs, resource,
resource->map_buffer, resource->map_heap_memory);
}
resource->unmap_dirtify = FALSE;
resource->map_count--;
return WINED3D_OK;
}
void wined3d_resource_changed(struct wined3d_resource *resource, struct wined3d_gl_bo *swap_buffer,
void *swap_heap_memory)
{
struct wined3d_device *device = resource->device;
if (swap_buffer && swap_buffer != resource->buffer)
{
struct wined3d_context *context = context_acquire(device, NULL);
wined3d_device_release_bo(device, resource->buffer, context);
context_release(context);
resource->buffer = swap_buffer;
}
if (swap_heap_memory && swap_heap_memory != resource->heap_memory)
{
wined3d_resource_free_sysmem(resource);
resource->heap_memory = swap_heap_memory;
}
wined3d_resource_invalidate_location(resource, ~resource->map_binding);
}
#endif /* STAGING_CSMT */
+82 -39
View File
@@ -30,14 +30,19 @@ ULONG CDECL wined3d_sampler_incref(struct wined3d_sampler *sampler)
return refcount;
}
#if defined(STAGING_CSMT)
void wined3d_sampler_destroy(struct wined3d_sampler *sampler)
static void wined3d_sampler_destroy_object(void *object)
{
struct wined3d_context *context = context_acquire(sampler->device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_sampler *sampler = object;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
context_release(context);
if (sampler->name)
{
context = context_acquire(sampler->device, NULL, 0);
gl_info = context->gl_info;
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
context_release(context);
}
HeapFree(GetProcessHeap(), 0, sampler);
}
@@ -50,26 +55,8 @@ ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
if (!refcount)
{
struct wined3d_device *device = sampler->device;
wined3d_cs_emit_sampler_destroy(device->cs, sampler);
#else /* STAGING_CSMT */
ULONG CDECL wined3d_sampler_decref(struct wined3d_sampler *sampler)
{
ULONG refcount = InterlockedDecrement(&sampler->refcount);
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
TRACE("%p decreasing refcount to %u.\n", sampler, refcount);
if (!refcount)
{
context = context_acquire(sampler->device, NULL);
gl_info = context->gl_info;
GL_EXTCALL(glDeleteSamplers(1, &sampler->name));
context_release(context);
HeapFree(GetProcessHeap(), 0, sampler);
#endif /* STAGING_CSMT */
sampler->parent_ops->wined3d_object_destroyed(sampler->parent);
wined3d_cs_destroy_object(sampler->device->cs, wined3d_sampler_destroy_object, sampler);
}
return refcount;
@@ -82,20 +69,17 @@ void * CDECL wined3d_sampler_get_parent(const struct wined3d_sampler *sampler)
return sampler->parent;
}
static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d_device *device,
const struct wined3d_sampler_desc *desc, void *parent)
static void wined3d_sampler_cs_init(void *object)
{
struct wined3d_sampler *sampler = object;
const struct wined3d_sampler_desc *desc;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
sampler->refcount = 1;
sampler->device = device;
sampler->parent = parent;
sampler->desc = *desc;
context = context_acquire(device, NULL);
context = context_acquire(sampler->device, NULL, 0);
gl_info = context->gl_info;
desc = &sampler->desc;
GL_EXTCALL(glGenSamplers(1, &sampler->name));
GL_EXTCALL(glSamplerParameteri(sampler->name, GL_TEXTURE_WRAP_S,
gl_info->wrap_lookup[desc->address_u - WINED3D_TADDRESS_WRAP]));
@@ -127,16 +111,26 @@ static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d
context_release(context);
}
static void wined3d_sampler_init(struct wined3d_sampler *sampler, struct wined3d_device *device,
const struct wined3d_sampler_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
sampler->refcount = 1;
sampler->device = device;
sampler->parent = parent;
sampler->parent_ops = parent_ops;
sampler->desc = *desc;
if (device->adapter->gl_info.supported[ARB_SAMPLER_OBJECTS])
wined3d_cs_init_object(device->cs, wined3d_sampler_cs_init, sampler);
}
HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct wined3d_sampler_desc *desc,
void *parent, struct wined3d_sampler **sampler)
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_sampler **sampler)
{
struct wined3d_sampler *object;
TRACE("device %p, desc %p, parent %p, sampler %p.\n", device, desc, parent, sampler);
if (!device->adapter->gl_info.supported[ARB_SAMPLER_OBJECTS])
return WINED3DERR_INVALIDCALL;
if (desc->address_u < WINED3D_TADDRESS_WRAP || desc->address_u > WINED3D_TADDRESS_MIRROR_ONCE
|| desc->address_v < WINED3D_TADDRESS_WRAP || desc->address_v > WINED3D_TADDRESS_MIRROR_ONCE
|| desc->address_w < WINED3D_TADDRESS_WRAP || desc->address_w > WINED3D_TADDRESS_MIRROR_ONCE)
@@ -150,10 +144,59 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
wined3d_sampler_init(object, device, desc, parent);
wined3d_sampler_init(object, device, desc, parent, parent_ops);
TRACE("Created sampler %p.\n", object);
*sampler = object;
return WINED3D_OK;
}
static void texture_apply_base_level(struct wined3d_texture *texture,
const struct wined3d_sampler_desc *desc, const struct wined3d_gl_info *gl_info)
{
struct gl_texture *gl_tex;
unsigned int base_level;
if (texture->flags & WINED3D_TEXTURE_COND_NP2)
base_level = 0;
else if (desc->mip_filter == WINED3D_TEXF_NONE)
base_level = texture->lod;
else
base_level = min(max(desc->mip_base_level, texture->lod), texture->level_count - 1);
gl_tex = wined3d_texture_get_gl_texture(texture, texture->flags & WINED3D_TEXTURE_IS_SRGB);
if (base_level != gl_tex->base_level)
{
/* Note that WINED3D_SAMP_MAX_MIP_LEVEL specifies the largest mipmap
* (default 0), while GL_TEXTURE_MAX_LEVEL specifies the smallest
* mipmap used (default 1000). So WINED3D_SAMP_MAX_MIP_LEVEL
* corresponds to GL_TEXTURE_BASE_LEVEL. */
gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level);
gl_tex->base_level = base_level;
}
}
/* This function relies on the correct texture being bound and loaded. */
void wined3d_sampler_bind(struct wined3d_sampler *sampler, unsigned int unit,
struct wined3d_texture *texture, const struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
{
GL_EXTCALL(glBindSampler(unit, sampler->name));
checkGLcall("bind sampler");
}
else if (texture)
{
wined3d_texture_apply_sampler_desc(texture, &sampler->desc, context);
}
else
{
ERR("Could not apply sampler state.\n");
}
if (texture)
texture_apply_base_level(texture, &sampler->desc, gl_info);
}
File diff suppressed because it is too large Load Diff
+54 -39
View File
@@ -199,8 +199,8 @@ enum wined3d_sm1_opcode
struct wined3d_sm1_opcode_info
{
enum wined3d_sm1_opcode opcode;
UINT dst_count;
UINT param_count;
unsigned int dst_count;
unsigned int param_count;
enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx;
DWORD min_version;
DWORD max_version;
@@ -210,6 +210,7 @@ struct wined3d_sm1_data
{
struct wined3d_shader_version shader_version;
const struct wined3d_sm1_opcode_info *opcode_table;
const DWORD *start;
struct wined3d_shader_src_param src_rel_addr[4];
struct wined3d_shader_src_param pred_rel_addr;
@@ -395,9 +396,10 @@ static const enum wined3d_shader_resource_type resource_type_table[] =
/* Read a parameter opcode from the input stream,
* and possibly a relative addressing token.
* Return the number of tokens read */
static int shader_get_param(const struct wined3d_sm1_data *priv, const DWORD *ptr, DWORD *token, DWORD *addr_token)
static unsigned int shader_get_param(const struct wined3d_sm1_data *priv, const DWORD *ptr,
DWORD *token, DWORD *addr_token)
{
UINT count = 1;
unsigned int count = 1;
*token = *ptr;
@@ -424,15 +426,15 @@ static int shader_get_param(const struct wined3d_sm1_data *priv, const DWORD *pt
return count;
}
static const struct wined3d_sm1_opcode_info *shader_get_opcode(const struct wined3d_sm1_data *priv, DWORD code)
static const struct wined3d_sm1_opcode_info *shader_get_opcode(const struct wined3d_sm1_data *priv, DWORD token)
{
DWORD shader_version = WINED3D_SHADER_VERSION(priv->shader_version.major, priv->shader_version.minor);
const struct wined3d_sm1_opcode_info *opcode_table = priv->opcode_table;
DWORD i = 0;
unsigned int i = 0;
while (opcode_table[i].handler_idx != WINED3DSIH_TABLE_SIZE)
{
if ((code & WINED3D_SM1_OPCODE_MASK) == opcode_table[i].opcode
if ((token & WINED3D_SM1_OPCODE_MASK) == opcode_table[i].opcode
&& shader_version >= opcode_table[i].min_version
&& (!opcode_table[i].max_version || shader_version <= opcode_table[i].max_version))
{
@@ -441,19 +443,20 @@ static const struct wined3d_sm1_opcode_info *shader_get_opcode(const struct wine
++i;
}
FIXME("Unsupported opcode %#x(%d) masked %#x, shader version %#x\n",
code, code, code & WINED3D_SM1_OPCODE_MASK, shader_version);
FIXME("Unsupported opcode %#x, token 0x%08x, shader version %#x.\n",
token & WINED3D_SM1_OPCODE_MASK, token, shader_version);
return NULL;
}
/* Return the number of parameters to skip for an opcode */
static int shader_skip_opcode(const struct wined3d_sm1_data *priv,
static unsigned int shader_skip_opcode(const struct wined3d_sm1_data *priv,
const struct wined3d_sm1_opcode_info *opcode_info, DWORD opcode_token)
{
unsigned int length;
/* Shaders >= 2.0 may contain address tokens, but fortunately they
* have a useful length mask - use it here. Shaders 1.0 contain no such tokens */
DWORD length = (opcode_token & WINED3D_SM1_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT;
length = (opcode_token & WINED3D_SM1_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM1_INSTRUCTION_LENGTH_SHIFT;
return (priv->shader_version.major >= 2) ? length : opcode_info->param_count;
}
@@ -492,10 +495,9 @@ static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_
* Note: This function assumes source or destination token format.
* It will not work with specially-formatted tokens like DEF or DCL,
* but hopefully those would be recognized */
static int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const DWORD *ptr)
static unsigned int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const DWORD *ptr)
{
int tokens_read = 0;
int i = 0;
unsigned int tokens_read = 0, i = 0;
/* TODO: Think of a good name for 0x80000000 and replace it with a constant */
while (*ptr & 0x80000000)
@@ -506,9 +508,10 @@ static int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const D
tokens_read += shader_get_param(priv, ptr, &token, &addr_token);
ptr += tokens_read;
FIXME("Unrecognized opcode param: token=0x%08x addr_token=0x%08x name=", token, addr_token);
FIXME("Unrecognized opcode param: token=0x%08x addr_token=0x%08x.\n", token, addr_token);
if (token & WINED3D_SM1_ADDRESS_MODE_RELATIVE) shader_parse_src_param(addr_token, NULL, &rel_addr);
if (token & WINED3D_SM1_ADDRESS_MODE_RELATIVE)
shader_parse_src_param(addr_token, NULL, &rel_addr);
if (!i)
{
@@ -522,17 +525,19 @@ static int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const D
shader_parse_src_param(token, token & WINED3D_SM1_ADDRESS_MODE_RELATIVE ? &rel_addr : NULL, &src);
}
FIXME("\n");
++i;
}
return tokens_read;
}
static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature)
static void *shader_sm1_init(const DWORD *byte_code, size_t byte_code_size,
const struct wined3d_shader_signature *output_signature)
{
struct wined3d_sm1_data *priv;
BYTE major, minor;
TRACE("Version: 0x%08x.\n", *byte_code);
major = WINED3D_SM1_VERSION_MAJOR(*byte_code);
minor = WINED3D_SM1_VERSION_MINOR(*byte_code);
if (WINED3D_SHADER_VERSION(major, minor) > WINED3D_SHADER_VERSION(3, 0))
@@ -541,14 +546,11 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader
return NULL;
}
priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv));
if (!priv)
if (!(priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv))))
return NULL;
if (output_signature)
{
if (output_signature->element_count)
FIXME("SM 1-3 shader shouldn't have output signatures.\n");
}
switch (*byte_code >> 16)
{
@@ -563,10 +565,14 @@ static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader
break;
default:
FIXME("Unrecognized shader type %#x\n", *byte_code >> 16);
FIXME("Unrecognized shader type %#x.\n", *byte_code >> 16);
HeapFree(GetProcessHeap(), 0, priv);
return NULL;
}
priv->shader_version.major = WINED3D_SM1_VERSION_MAJOR(*byte_code);
priv->shader_version.minor = WINED3D_SM1_VERSION_MINOR(*byte_code);
priv->start = &byte_code[1];
return priv;
}
@@ -579,13 +585,8 @@ static void shader_sm1_free(void *data)
static void shader_sm1_read_header(void *data, const DWORD **ptr, struct wined3d_shader_version *shader_version)
{
struct wined3d_sm1_data *priv = data;
DWORD version_token;
version_token = *(*ptr)++;
TRACE("version: 0x%08x\n", version_token);
priv->shader_version.major = WINED3D_SM1_VERSION_MAJOR(version_token);
priv->shader_version.minor = WINED3D_SM1_VERSION_MINOR(version_token);
*ptr = priv->start;
*shader_version = priv->shader_version;
}
@@ -648,7 +649,7 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se
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;
unsigned int 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;
@@ -656,7 +657,7 @@ static void shader_sm1_read_immconst(const DWORD **ptr, struct wined3d_shader_sr
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));
memcpy(src_param->reg.u.immconst_data, *ptr, count * sizeof(DWORD));
src_param->swizzle = WINED3DSP_NOSWIZZLE;
src_param->modifiers = 0;
@@ -705,6 +706,19 @@ static void shader_sm1_read_comment(const DWORD **ptr)
}
}
static void shader_sm1_validate_instruction(struct wined3d_shader_instruction *ins)
{
if (ins->handler_idx == WINED3DSIH_BREAKP || ins->handler_idx == WINED3DSIH_IF)
{
if (ins->flags)
{
FIXME("Ignoring unexpected instruction flags %#x for %s.\n",
ins->flags, debug_d3dshaderinstructionhandler(ins->handler_idx));
ins->flags = 0;
}
}
}
static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wined3d_shader_instruction *ins)
{
const struct wined3d_sm1_opcode_info *opcode_info;
@@ -732,6 +746,7 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
ins->dst = &priv->dst_param;
ins->src_count = opcode_info->param_count - opcode_info->dst_count;
ins->src = priv->src_param;
memset(&ins->texel_offset, 0, sizeof(ins->texel_offset));
p = *ptr;
*ptr += shader_skip_opcode(priv, opcode_info, opcode_token);
@@ -745,16 +760,16 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
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 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
{
/* Destination token */
@@ -767,10 +782,10 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
/* 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]);
}
}
shader_sm1_validate_instruction(ins);
}
static BOOL shader_sm1_is_end(void *data, const DWORD **ptr)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+108 -218
View File
@@ -36,9 +36,9 @@ static const DWORD pixel_states_render[] =
WINED3D_RS_BLENDFACTOR,
WINED3D_RS_BLENDOP,
WINED3D_RS_BLENDOPALPHA,
WINED3D_RS_CCW_STENCILFAIL,
WINED3D_RS_CCW_STENCILPASS,
WINED3D_RS_CCW_STENCILZFAIL,
WINED3D_RS_BACK_STENCILFAIL,
WINED3D_RS_BACK_STENCILPASS,
WINED3D_RS_BACK_STENCILZFAIL,
WINED3D_RS_COLORWRITEENABLE,
WINED3D_RS_COLORWRITEENABLE1,
WINED3D_RS_COLORWRITEENABLE2,
@@ -187,40 +187,6 @@ static const DWORD vertex_states_sampler[] =
WINED3D_SAMP_DMAP_OFFSET,
};
/* Allocates the correct amount of space for pixel and vertex shader constants,
* along with their set/changed flags on the given stateblock object
*/
static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *object)
{
const struct wined3d_d3d_info *d3d_info = &object->device->adapter->d3d_info;
object->changed.pixelShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(BOOL) * d3d_info->limits.ps_uniform_count);
if (!object->changed.pixelShaderConstantsF) goto fail;
object->changed.vertexShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(BOOL) * d3d_info->limits.vs_uniform_count);
if (!object->changed.vertexShaderConstantsF) goto fail;
object->contained_vs_consts_f = HeapAlloc(GetProcessHeap(), 0,
sizeof(DWORD) * d3d_info->limits.vs_uniform_count);
if (!object->contained_vs_consts_f) goto fail;
object->contained_ps_consts_f = HeapAlloc(GetProcessHeap(), 0,
sizeof(DWORD) * d3d_info->limits.ps_uniform_count);
if (!object->contained_ps_consts_f) goto fail;
return WINED3D_OK;
fail:
ERR("Failed to allocate memory\n");
HeapFree(GetProcessHeap(), 0, object->changed.pixelShaderConstantsF);
HeapFree(GetProcessHeap(), 0, object->changed.vertexShaderConstantsF);
HeapFree(GetProcessHeap(), 0, object->contained_vs_consts_f);
HeapFree(GetProcessHeap(), 0, object->contained_ps_consts_f);
return E_OUTOFMEMORY;
}
static inline void stateblock_set_bits(DWORD *map, UINT map_size)
{
DWORD mask = (1u << (map_size & 0x1f)) - 1;
@@ -234,7 +200,6 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
unsigned int i;
/* Single values */
states->primitive_type = 1;
states->indices = 1;
states->material = 1;
states->viewport = 1;
@@ -258,8 +223,8 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states,
states->vertexShaderConstantsI = 0xffff;
/* Dynamically sized arrays */
memset(states->pixelShaderConstantsF, TRUE, sizeof(BOOL) * ps_consts);
memset(states->vertexShaderConstantsF, TRUE, sizeof(BOOL) * vs_consts);
memset(states->ps_consts_f, TRUE, sizeof(BOOL) * ps_consts);
memset(states->vs_consts_f, TRUE, sizeof(BOOL) * vs_consts);
}
static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states, const DWORD num_constants)
@@ -285,7 +250,7 @@ static void stateblock_savedstates_set_pixel(struct wined3d_saved_states *states
states->pixelShaderConstantsB = 0xffff;
states->pixelShaderConstantsI = 0xffff;
memset(states->pixelShaderConstantsF, TRUE, sizeof(BOOL) * num_constants);
memset(states->ps_consts_f, TRUE, sizeof(BOOL) * num_constants);
}
static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *states, const DWORD num_constants)
@@ -312,7 +277,7 @@ static void stateblock_savedstates_set_vertex(struct wined3d_saved_states *state
states->vertexShaderConstantsB = 0xffff;
states->vertexShaderConstantsI = 0xffff;
memset(states->vertexShaderConstantsF, TRUE, sizeof(BOOL) * num_constants);
memset(states->vs_consts_f, TRUE, sizeof(BOOL) * num_constants);
}
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
@@ -346,14 +311,14 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for (i = 0; i < d3d_info->limits.vs_uniform_count; ++i)
{
if (stateblock->changed.vertexShaderConstantsF[i])
if (stateblock->changed.vs_consts_f[i])
{
stateblock->contained_vs_consts_f[stateblock->num_contained_vs_consts_f] = i;
++stateblock->num_contained_vs_consts_f;
}
}
for (i = 0; i < MAX_CONST_I; ++i)
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
{
if (stateblock->changed.vertexShaderConstantsI & (1u << i))
{
@@ -362,7 +327,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
}
}
for (i = 0; i < MAX_CONST_B; ++i)
for (i = 0; i < WINED3D_MAX_CONSTS_B; ++i)
{
if (stateblock->changed.vertexShaderConstantsB & (1u << i))
{
@@ -373,14 +338,14 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
for (i = 0; i < d3d_info->limits.ps_uniform_count; ++i)
{
if (stateblock->changed.pixelShaderConstantsF[i])
if (stateblock->changed.ps_consts_f[i])
{
stateblock->contained_ps_consts_f[stateblock->num_contained_ps_consts_f] = i;
++stateblock->num_contained_ps_consts_f;
}
}
for (i = 0; i < MAX_CONST_I; ++i)
for (i = 0; i < WINED3D_MAX_CONSTS_I; ++i)
{
if (stateblock->changed.pixelShaderConstantsI & (1u << i))
{
@@ -389,7 +354,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
}
}
for (i = 0; i < MAX_CONST_B; ++i)
for (i = 0; i < WINED3D_MAX_CONSTS_B; ++i)
{
if (stateblock->changed.pixelShaderConstantsB & (1u << i))
{
@@ -456,15 +421,13 @@ ULONG CDECL wined3d_stateblock_incref(struct wined3d_stateblock *stateblock)
void state_unbind_resources(struct wined3d_state *state)
{
struct wined3d_unordered_access_view *uav;
struct wined3d_shader_resource_view *srv;
struct wined3d_vertex_declaration *decl;
struct wined3d_sampler *sampler;
struct wined3d_texture *texture;
struct wined3d_buffer *buffer;
struct wined3d_shader *shader;
#if defined(STAGING_CSMT)
struct wined3d_rendertarget_view *view;
#endif /* STAGING_CSMT */
unsigned int i, j;
if ((decl = state->vertex_declaration))
@@ -482,7 +445,7 @@ void state_unbind_resources(struct wined3d_state *state)
}
}
for (i = 0; i < MAX_STREAM_OUT; ++i)
for (i = 0; i < WINED3D_MAX_STREAM_OUTPUT_BUFFERS; ++i)
{
if ((buffer = state->stream_output[i].buffer))
{
@@ -541,33 +504,18 @@ void state_unbind_resources(struct wined3d_state *state)
}
}
}
#if defined(STAGING_CSMT)
if (state->fb.depth_stencil)
for (i = 0; i < WINED3D_PIPELINE_COUNT; ++i)
{
view = state->fb.depth_stencil;
TRACE("Releasing depth/stencil buffer %p.\n", view);
state->fb.depth_stencil = NULL;
wined3d_rendertarget_view_decref(view);
}
if (state->fb.render_targets)
{
for (i = 0; i < state->fb.rt_size; i++)
for (j = 0; j < MAX_UNORDERED_ACCESS_VIEWS; ++j)
{
view = state->fb.render_targets[i];
TRACE("Setting rendertarget %u to NULL\n", i);
state->fb.render_targets[i] = NULL;
if (view)
if ((uav = state->unordered_access_view[i][j]))
{
TRACE("Releasing the rendertarget view at %p\n", view);
wined3d_rendertarget_view_decref(view);
state->unordered_access_view[i][j] = NULL;
wined3d_unordered_access_view_decref(uav);
}
}
}
#endif /* STAGING_CSMT */
}
void state_cleanup(struct wined3d_state *state)
@@ -592,12 +540,6 @@ void state_cleanup(struct wined3d_state *state)
HeapFree(GetProcessHeap(), 0, light);
}
}
HeapFree(GetProcessHeap(), 0, state->vs_consts_f);
HeapFree(GetProcessHeap(), 0, state->ps_consts_f);
#if defined(STAGING_CSMT)
HeapFree(GetProcessHeap(), 0, state->fb.render_targets);
#endif /* STAGING_CSMT */
}
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
@@ -609,17 +551,72 @@ ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
if (!refcount)
{
state_cleanup(&stateblock->state);
HeapFree(GetProcessHeap(), 0, stateblock->changed.vertexShaderConstantsF);
HeapFree(GetProcessHeap(), 0, stateblock->changed.pixelShaderConstantsF);
HeapFree(GetProcessHeap(), 0, stateblock->contained_vs_consts_f);
HeapFree(GetProcessHeap(), 0, stateblock->contained_ps_consts_f);
HeapFree(GetProcessHeap(), 0, stateblock);
}
return refcount;
}
struct wined3d_light_info *wined3d_state_get_light(const struct wined3d_state *state, unsigned int idx)
{
struct wined3d_light_info *light_info;
unsigned int hash_idx;
hash_idx = LIGHTMAP_HASHFUNC(idx);
LIST_FOR_EACH_ENTRY(light_info, &state->light_map[hash_idx], struct wined3d_light_info, entry)
{
if (light_info->OriginalIndex == idx)
return light_info;
}
return NULL;
}
void wined3d_state_enable_light(struct wined3d_state *state, const struct wined3d_d3d_info *d3d_info,
struct wined3d_light_info *light_info, BOOL enable)
{
unsigned int light_count, i;
if (!(light_info->enabled = enable))
{
if (light_info->glIndex == -1)
{
TRACE("Light already disabled, nothing to do.\n");
return;
}
state->lights[light_info->glIndex] = NULL;
light_info->glIndex = -1;
return;
}
if (light_info->glIndex != -1)
{
TRACE("Light already enabled, nothing to do.\n");
return;
}
/* Find a free light. */
light_count = d3d_info->limits.active_light_count;
for (i = 0; i < light_count; ++i)
{
if (state->lights[i])
continue;
state->lights[i] = light_info;
light_info->glIndex = i;
return;
}
/* Our tests show that Windows returns D3D_OK in this situation, even with
* D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE devices.
* This is consistent among ddraw, d3d8 and d3d9. GetLightEnable returns
* TRUE * as well for those lights.
*
* TODO: Test how this affects rendering. */
WARN("Too many concurrently active lights.\n");
}
static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state)
{
UINT i;
@@ -706,16 +703,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
{
unsigned int idx = stateblock->contained_vs_consts_f[i];
TRACE("Setting vs_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx,
src_state->vs_consts_f[idx * 4 + 0],
src_state->vs_consts_f[idx * 4 + 1],
src_state->vs_consts_f[idx * 4 + 2],
src_state->vs_consts_f[idx * 4 + 3]);
TRACE("Setting vs_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->vs_consts_f[idx]));
stateblock->state.vs_consts_f[idx * 4 + 0] = src_state->vs_consts_f[idx * 4 + 0];
stateblock->state.vs_consts_f[idx * 4 + 1] = src_state->vs_consts_f[idx * 4 + 1];
stateblock->state.vs_consts_f[idx * 4 + 2] = src_state->vs_consts_f[idx * 4 + 2];
stateblock->state.vs_consts_f[idx * 4 + 3] = src_state->vs_consts_f[idx * 4 + 3];
stateblock->state.vs_consts_f[idx] = src_state->vs_consts_f[idx];
}
/* Vertex shader integer constants. */
@@ -723,16 +713,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
{
unsigned int idx = stateblock->contained_vs_consts_i[i];
TRACE("Setting vs_consts[%u] to {%d, %d, %d, %d}.\n", idx,
src_state->vs_consts_i[idx * 4 + 0],
src_state->vs_consts_i[idx * 4 + 1],
src_state->vs_consts_i[idx * 4 + 2],
src_state->vs_consts_i[idx * 4 + 3]);
TRACE("Setting vs_consts[%u] to %s.\n", idx, debug_ivec4(&src_state->vs_consts_i[idx]));
stateblock->state.vs_consts_i[idx * 4 + 0] = src_state->vs_consts_i[idx * 4 + 0];
stateblock->state.vs_consts_i[idx * 4 + 1] = src_state->vs_consts_i[idx * 4 + 1];
stateblock->state.vs_consts_i[idx * 4 + 2] = src_state->vs_consts_i[idx * 4 + 2];
stateblock->state.vs_consts_i[idx * 4 + 3] = src_state->vs_consts_i[idx * 4 + 3];
stateblock->state.vs_consts_i[idx] = src_state->vs_consts_i[idx];
}
/* Vertex shader boolean constants. */
@@ -751,32 +734,19 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
{
unsigned int idx = stateblock->contained_ps_consts_f[i];
TRACE("Setting ps_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx,
src_state->ps_consts_f[idx * 4 + 0],
src_state->ps_consts_f[idx * 4 + 1],
src_state->ps_consts_f[idx * 4 + 2],
src_state->ps_consts_f[idx * 4 + 3]);
TRACE("Setting ps_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->ps_consts_f[idx]));
stateblock->state.ps_consts_f[idx * 4 + 0] = src_state->ps_consts_f[idx * 4 + 0];
stateblock->state.ps_consts_f[idx * 4 + 1] = src_state->ps_consts_f[idx * 4 + 1];
stateblock->state.ps_consts_f[idx * 4 + 2] = src_state->ps_consts_f[idx * 4 + 2];
stateblock->state.ps_consts_f[idx * 4 + 3] = src_state->ps_consts_f[idx * 4 + 3];
stateblock->state.ps_consts_f[idx] = src_state->ps_consts_f[idx];
}
/* Pixel shader integer constants. */
for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
{
unsigned int idx = stateblock->contained_ps_consts_i[i];
TRACE("Setting ps_consts_i[%u] to {%d, %d, %d, %d}.\n", idx,
src_state->ps_consts_i[idx * 4 + 0],
src_state->ps_consts_i[idx * 4 + 1],
src_state->ps_consts_i[idx * 4 + 2],
src_state->ps_consts_i[idx * 4 + 3]);
stateblock->state.ps_consts_i[idx * 4 + 0] = src_state->ps_consts_i[idx * 4 + 0];
stateblock->state.ps_consts_i[idx * 4 + 1] = src_state->ps_consts_i[idx * 4 + 1];
stateblock->state.ps_consts_i[idx * 4 + 2] = src_state->ps_consts_i[idx * 4 + 2];
stateblock->state.ps_consts_i[idx * 4 + 3] = src_state->ps_consts_i[idx * 4 + 3];
TRACE("Setting ps_consts_i[%u] to %s.\n", idx, debug_ivec4(&src_state->ps_consts_i[idx]));
stateblock->state.ps_consts_i[idx] = src_state->ps_consts_i[idx];
}
/* Pixel shader boolean constants. */
@@ -799,13 +769,11 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
stateblock->state.transforms[transform] = src_state->transforms[transform];
}
if (stateblock->changed.primitive_type)
stateblock->state.gl_primitive_type = src_state->gl_primitive_type;
if (stateblock->changed.indices
&& ((stateblock->state.index_buffer != src_state->index_buffer)
|| (stateblock->state.base_vertex_index != src_state->base_vertex_index)
|| (stateblock->state.index_format != src_state->index_format)))
|| (stateblock->state.index_format != src_state->index_format)
|| (stateblock->state.index_offset != src_state->index_offset)))
{
TRACE("Updating index buffer to %p, base vertex index to %d.\n",
src_state->index_buffer, src_state->base_vertex_index);
@@ -817,6 +785,7 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
stateblock->state.index_buffer = src_state->index_buffer;
stateblock->state.base_vertex_index = src_state->base_vertex_index;
stateblock->state.index_format = src_state->index_format;
stateblock->state.index_offset = src_state->index_offset;
}
if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration != src_state->vertex_declaration)
@@ -1001,17 +970,17 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
{
wined3d_device_set_vs_consts_f(device, stateblock->contained_vs_consts_f[i],
stateblock->state.vs_consts_f + stateblock->contained_vs_consts_f[i] * 4, 1);
1, &stateblock->state.vs_consts_f[stateblock->contained_vs_consts_f[i]]);
}
for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
{
wined3d_device_set_vs_consts_i(device, stateblock->contained_vs_consts_i[i],
stateblock->state.vs_consts_i + stateblock->contained_vs_consts_i[i] * 4, 1);
1, &stateblock->state.vs_consts_i[stateblock->contained_vs_consts_i[i]]);
}
for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
{
wined3d_device_set_vs_consts_b(device, stateblock->contained_vs_consts_b[i],
stateblock->state.vs_consts_b + stateblock->contained_vs_consts_b[i], 1);
1, &stateblock->state.vs_consts_b[stateblock->contained_vs_consts_b[i]]);
}
apply_lights(device, &stateblock->state);
@@ -1023,17 +992,17 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
{
wined3d_device_set_ps_consts_f(device, stateblock->contained_ps_consts_f[i],
stateblock->state.ps_consts_f + stateblock->contained_ps_consts_f[i] * 4, 1);
1, &stateblock->state.ps_consts_f[stateblock->contained_ps_consts_f[i]]);
}
for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
{
wined3d_device_set_ps_consts_i(device, stateblock->contained_ps_consts_i[i],
stateblock->state.ps_consts_i + stateblock->contained_ps_consts_i[i] * 4, 1);
1, &stateblock->state.ps_consts_i[stateblock->contained_ps_consts_i[i]]);
}
for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i)
{
wined3d_device_set_ps_consts_b(device, stateblock->contained_ps_consts_b[i],
stateblock->state.ps_consts_b + stateblock->contained_ps_consts_b[i], 1);
1, &stateblock->state.ps_consts_b[stateblock->contained_ps_consts_b[i]]);
}
/* Render states. */
@@ -1070,27 +1039,10 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
&stateblock->state.transforms[stateblock->contained_transform_states[i]]);
}
if (stateblock->changed.primitive_type)
{
GLenum gl_primitive_type, prev;
if (device->recording)
device->recording->changed.primitive_type = TRUE;
gl_primitive_type = stateblock->state.gl_primitive_type;
prev = device->update_state->gl_primitive_type;
device->update_state->gl_primitive_type = gl_primitive_type;
#if defined(STAGING_CSMT)
if (gl_primitive_type != prev)
wined3d_cs_emit_set_primitive_type(device->cs, gl_primitive_type);
#else /* STAGING_CSMT */
if (gl_primitive_type != prev && (gl_primitive_type == GL_POINTS || prev == GL_POINTS))
device_invalidate_state(device, STATE_POINT_ENABLE);
#endif /* STAGING_CSMT */
}
if (stateblock->changed.indices)
{
wined3d_device_set_index_buffer(device, stateblock->state.index_buffer, stateblock->state.index_format);
wined3d_device_set_index_buffer(device, stateblock->state.index_buffer,
stateblock->state.index_format, stateblock->state.index_offset);
wined3d_device_set_base_vertex_index(device, stateblock->state.base_vertex_index);
}
@@ -1163,6 +1115,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
get_identity_matrix(&identity);
state->gl_primitive_type = ~0u;
state->gl_patch_vertices = 0;
/* Set some of the defaults for lights, transforms etc */
state->transforms[WINED3D_TS_PROJECTION] = identity;
@@ -1185,7 +1138,7 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->render_states[WINED3D_RS_LASTPIXEL] = TRUE;
state->render_states[WINED3D_RS_SRCBLEND] = WINED3D_BLEND_ONE;
state->render_states[WINED3D_RS_DESTBLEND] = WINED3D_BLEND_ZERO;
state->render_states[WINED3D_RS_CULLMODE] = WINED3D_CULL_CCW;
state->render_states[WINED3D_RS_CULLMODE] = WINED3D_CULL_BACK;
state->render_states[WINED3D_RS_ZFUNC] = WINED3D_CMP_LESSEQUAL;
state->render_states[WINED3D_RS_ALPHAFUNC] = WINED3D_CMP_ALWAYS;
state->render_states[WINED3D_RS_ALPHAREF] = 0;
@@ -1278,10 +1231,10 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->render_states[WINED3D_RS_ADAPTIVETESS_W] = tmpfloat.d;
state->render_states[WINED3D_RS_ENABLEADAPTIVETESSELLATION] = FALSE;
state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE] = FALSE;
state->render_states[WINED3D_RS_CCW_STENCILFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_CCW_STENCILZFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_CCW_STENCILPASS] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_CCW_STENCILFUNC] = WINED3D_CMP_ALWAYS;
state->render_states[WINED3D_RS_BACK_STENCILFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_BACK_STENCILZFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_BACK_STENCILPASS] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_BACK_STENCILFUNC] = WINED3D_CMP_ALWAYS;
state->render_states[WINED3D_RS_COLORWRITEENABLE1] = 0x0000000f;
state->render_states[WINED3D_RS_COLORWRITEENABLE2] = 0x0000000f;
state->render_states[WINED3D_RS_COLORWRITEENABLE3] = 0x0000000f;
@@ -1343,29 +1296,10 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
state->sampler_states[i][WINED3D_SAMP_ELEMENT_INDEX] = 0;
/* TODO: Vertex offset in the presampled displacement map. */
state->sampler_states[i][WINED3D_SAMP_DMAP_OFFSET] = 0;
#if defined(STAGING_CSMT)
state->textures[i] = NULL;
}
state->index_buffer = NULL;
for (i = 0; i < sizeof(state->streams) / sizeof(*state->streams); i++)
memset(&state->streams[i], 0, sizeof(state->streams[i]));
state->shader[WINED3D_SHADER_TYPE_VERTEX] = NULL;
state->shader[WINED3D_SHADER_TYPE_PIXEL] = NULL;
}
HRESULT state_init(struct wined3d_state *state, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info, DWORD flags)
{
unsigned int i;
state->flags = flags;
#else /* STAGING_CSMT */
}
}
HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
DWORD flags)
{
@@ -1373,68 +1307,24 @@ HRESULT state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
state->flags = flags;
state->fb = fb;
#endif /* STAGING_CSMT */
for (i = 0; i < LIGHTMAP_SIZE; i++)
{
list_init(&state->light_map[i]);
}
if (!(state->vs_consts_f = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
4 * sizeof(float) * d3d_info->limits.vs_uniform_count)))
return E_OUTOFMEMORY;
if (!(state->ps_consts_f = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
4 * sizeof(float) * d3d_info->limits.ps_uniform_count)))
{
HeapFree(GetProcessHeap(), 0, state->vs_consts_f);
return E_OUTOFMEMORY;
}
#if defined(STAGING_CSMT)
if (!(state->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*state->fb.render_targets) * gl_info->limits.buffers)))
{
HeapFree(GetProcessHeap(), 0, state->ps_consts_f);
HeapFree(GetProcessHeap(), 0, state->vs_consts_f);
return E_OUTOFMEMORY;
}
state->fb.rt_size = gl_info->limits.buffers;
#endif /* STAGING_CSMT */
if (flags & WINED3D_STATE_INIT_DEFAULT)
state_init_default(state, gl_info);
return WINED3D_OK;
}
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
struct wined3d_device *device, enum wined3d_stateblock_type type)
{
HRESULT hr;
#if defined(STAGING_CSMT)
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
stateblock->ref = 1;
stateblock->device = device;
if (FAILED(hr = state_init(&stateblock->state, gl_info, d3d_info, 0)))
#else /* STAGING_CSMT */
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
stateblock->ref = 1;
stateblock->device = device;
if (FAILED(hr = state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0)))
#endif /* STAGING_CSMT */
return hr;
if (FAILED(hr = stateblock_allocate_shader_constants(stateblock)))
{
state_cleanup(&stateblock->state);
return hr;
}
state_init(&stateblock->state, NULL, &device->adapter->gl_info, d3d_info, 0);
if (type == WINED3D_SBT_RECORDED)
return WINED3D_OK;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -48,14 +48,14 @@ ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration
return refcount;
}
#if defined(STAGING_CSMT)
void wined3d_vertex_declaration_destroy(struct wined3d_vertex_declaration *declaration)
static void wined3d_vertex_declaration_destroy_object(void *object)
{
struct wined3d_vertex_declaration *declaration = object;
HeapFree(GetProcessHeap(), 0, declaration->elements);
HeapFree(GetProcessHeap(), 0, declaration);
}
#endif /* STAGING_CSMT */
ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration)
{
ULONG refcount = InterlockedDecrement(&declaration->ref);
@@ -64,15 +64,9 @@ ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration
if (!refcount)
{
#if defined(STAGING_CSMT)
const struct wined3d_device *device = declaration->device;
declaration->parent_ops->wined3d_object_destroyed(declaration->parent);
wined3d_cs_emit_vertex_declaration_destroy(device->cs, declaration);
#else /* STAGING_CSMT */
HeapFree(GetProcessHeap(), 0, declaration->elements);
declaration->parent_ops->wined3d_object_destroyed(declaration->parent);
HeapFree(GetProcessHeap(), 0, declaration);
#endif /* STAGING_CSMT */
wined3d_cs_destroy_object(declaration->device->cs,
wined3d_vertex_declaration_destroy_object, declaration);
}
return refcount;
@@ -192,8 +186,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
declaration->parent = parent;
declaration->parent_ops = parent_ops;
declaration->device = device;
declaration->elements = HeapAlloc(GetProcessHeap(), 0, sizeof(*declaration->elements) * element_count);
if (!declaration->elements)
if (!(declaration->elements = wined3d_calloc(element_count, sizeof(*declaration->elements))))
{
ERR("Failed to allocate elements memory.\n");
return E_OUTOFMEMORY;
@@ -206,7 +199,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
{
struct wined3d_vertex_declaration_element *e = &declaration->elements[i];
e->format = wined3d_get_format(gl_info, elements[i].format);
e->format = wined3d_get_format(gl_info, elements[i].format, 0);
e->ffp_valid = declaration_element_valid_ffp(&elements[i]);
e->input_slot = elements[i].input_slot;
e->offset = elements[i].offset;
@@ -319,8 +312,8 @@ static void append_decl_element(struct wined3d_fvf_convert_state *state,
elements[idx].usage = usage;
elements[idx].usage_idx = usage_idx;
format = wined3d_get_format(state->gl_info, format_id);
state->offset += format->component_count * format->component_size;
format = wined3d_get_format(state->gl_info, format_id, 0);
state->offset += format->attribute_size;
++state->idx;
}
@@ -351,8 +344,8 @@ static unsigned int convert_fvf_to_declaration(const struct wined3d_gl_info *gl_
has_psize + has_diffuse + has_specular + num_textures;
state.gl_info = gl_info;
state.elements = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*state.elements));
if (!state.elements) return ~0U;
if (!(state.elements = wined3d_calloc(size, sizeof(*state.elements))))
return ~0u;
state.offset = 0;
state.idx = 0;
File diff suppressed because it is too large Load Diff
-948
View File
@@ -1,948 +0,0 @@
/*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2009-2011 Henri Verbeet for CodeWeavers
* Copyright 2013 Stefan Dösinger 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 "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
BOOL volume_prepare_system_memory(struct wined3d_volume *volume)
{
if (volume->resource.heap_memory)
return TRUE;
if (!wined3d_resource_allocate_sysmem(&volume->resource))
{
ERR("Failed to allocate system memory.\n");
return FALSE;
}
return TRUE;
}
/* This call just uploads data, the caller is responsible for binding the
* correct texture. */
/* Context activation is done by the caller. */
void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wined3d_context *context,
const struct wined3d_const_bo_address *data)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_format *format = volume->resource.format;
UINT width = volume->resource.width;
UINT height = volume->resource.height;
UINT depth = volume->resource.depth;
const void *mem = data->addr;
void *converted_mem = NULL;
TRACE("volume %p, context %p, level %u, format %s (%#x).\n",
volume, context, volume->texture_level, debug_d3dformat(format->id),
format->id);
if (format->convert)
{
UINT dst_row_pitch, dst_slice_pitch;
UINT src_row_pitch, src_slice_pitch;
if (data->buffer_object)
ERR("Loading a converted volume from a PBO.\n");
if (volume->container->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
ERR("Converting a block-based format.\n");
dst_row_pitch = width * format->conv_byte_count;
dst_slice_pitch = dst_row_pitch * height;
#if defined(STAGING_CSMT)
wined3d_resource_get_pitch(&volume->resource, &src_row_pitch, &src_slice_pitch);
#else /* STAGING_CSMT */
wined3d_texture_get_pitch(volume->container, volume->texture_level, &src_row_pitch, &src_slice_pitch);
#endif /* STAGING_CSMT */
converted_mem = HeapAlloc(GetProcessHeap(), 0, dst_slice_pitch * depth);
format->convert(data->addr, converted_mem, src_row_pitch, src_slice_pitch,
dst_row_pitch, dst_slice_pitch, width, height, depth);
mem = converted_mem;
}
if (data->buffer_object)
{
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, data->buffer_object));
checkGLcall("glBindBuffer");
}
GL_EXTCALL(glTexSubImage3D(GL_TEXTURE_3D, volume->texture_level, 0, 0, 0,
width, height, depth,
format->glFormat, format->glType, mem));
checkGLcall("glTexSubImage3D");
if (data->buffer_object)
{
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("glBindBuffer");
}
HeapFree(GetProcessHeap(), 0, converted_mem);
}
#if !defined(STAGING_CSMT)
void wined3d_volume_validate_location(struct wined3d_volume *volume, DWORD location)
{
TRACE("Volume %p, setting %s.\n", volume, wined3d_debug_location(location));
volume->locations |= location;
TRACE("new location flags are %s.\n", wined3d_debug_location(volume->locations));
}
void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location)
{
TRACE("Volume %p, clearing %s.\n", volume, wined3d_debug_location(location));
volume->locations &= ~location;
TRACE("new location flags are %s.\n", wined3d_debug_location(volume->locations));
}
#endif /* STAGING_CSMT */
/* Context activation is done by the caller. */
static void wined3d_volume_download_data(struct wined3d_volume *volume,
const struct wined3d_context *context, const struct wined3d_bo_address *data)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_format *format = volume->resource.format;
if (format->convert)
{
FIXME("Attempting to download a converted volume, format %s.\n",
debug_d3dformat(format->id));
return;
}
if (data->buffer_object)
{
GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, data->buffer_object));
checkGLcall("glBindBuffer");
}
gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_3D, volume->texture_level,
format->glFormat, format->glType, data->addr);
checkGLcall("glGetTexImage");
if (data->buffer_object)
{
GL_EXTCALL(glBindBuffer(GL_PIXEL_PACK_BUFFER, 0));
checkGLcall("glBindBuffer");
}
}
static void wined3d_volume_evict_sysmem(struct wined3d_volume *volume)
{
wined3d_resource_free_sysmem(&volume->resource);
#if defined(STAGING_CSMT)
volume->resource.map_heap_memory = NULL;
wined3d_resource_invalidate_location(&volume->resource, WINED3D_LOCATION_SYSMEM);
#else /* STAGING_CSMT */
wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_SYSMEM);
}
static DWORD volume_access_from_location(DWORD location)
{
switch (location)
{
case WINED3D_LOCATION_DISCARDED:
return 0;
case WINED3D_LOCATION_SYSMEM:
return WINED3D_RESOURCE_ACCESS_CPU;
case WINED3D_LOCATION_BUFFER:
case WINED3D_LOCATION_TEXTURE_RGB:
case WINED3D_LOCATION_TEXTURE_SRGB:
return WINED3D_RESOURCE_ACCESS_GPU;
default:
FIXME("Unhandled location %#x.\n", location);
return 0;
}
#endif /* STAGING_CSMT */
}
/* Context activation is done by the caller. */
static void wined3d_volume_srgb_transfer(struct wined3d_volume *volume,
struct wined3d_context *context, BOOL dest_is_srgb)
{
struct wined3d_bo_address data;
/* Optimizations are possible, but the effort should be put into either
* implementing EXT_SRGB_DECODE in the driver or finding out why we
* picked the wrong copy for the original upload and fixing that.
*
* Also keep in mind that we want to avoid using resource.heap_memory
* for DEFAULT pool surfaces. */
WARN_(d3d_perf)("Performing slow rgb/srgb volume transfer.\n");
data.buffer_object = 0;
data.addr = HeapAlloc(GetProcessHeap(), 0, volume->resource.size);
if (!data.addr)
return;
wined3d_texture_bind_and_dirtify(volume->container, context, !dest_is_srgb);
wined3d_volume_download_data(volume, context, &data);
wined3d_texture_bind_and_dirtify(volume->container, context, dest_is_srgb);
wined3d_volume_upload_data(volume, context, wined3d_const_bo_address(&data));
HeapFree(GetProcessHeap(), 0, data.addr);
}
static BOOL wined3d_volume_can_evict(const struct wined3d_volume *volume)
{
if (volume->resource.pool != WINED3D_POOL_MANAGED)
return FALSE;
if (volume->download_count >= 10)
return FALSE;
if (volume->resource.format->convert)
return FALSE;
return TRUE;
}
#if defined(STAGING_CSMT)
/* Context activation is done by the caller. */
static void wined3d_volume_load_location(struct wined3d_resource *resource,
struct wined3d_context *context, DWORD location)
{
struct wined3d_volume *volume = volume_from_resource(resource);
DWORD required_access = wined3d_resource_access_from_location(location);
TRACE("Volume %p, loading %s, have %s.\n", volume, wined3d_debug_location(location),
wined3d_debug_location(volume->resource.locations));
#else /* STAGING_CSMT */
/* Context activation is done by the caller. */
static void wined3d_volume_load_location(struct wined3d_volume *volume,
struct wined3d_context *context, DWORD location)
{
DWORD required_access = volume_access_from_location(location);
TRACE("Volume %p, loading %s, have %s.\n", volume, wined3d_debug_location(location),
wined3d_debug_location(volume->locations));
if ((volume->locations & location) == location)
{
TRACE("Location(s) already up to date.\n");
return;
}
#endif /* STAGING_CSMT */
if ((volume->resource.access_flags & required_access) != required_access)
{
ERR("Operation requires %#x access, but volume only has %#x.\n",
required_access, volume->resource.access_flags);
return;
}
switch (location)
{
case WINED3D_LOCATION_TEXTURE_RGB:
case WINED3D_LOCATION_TEXTURE_SRGB:
if ((location == WINED3D_LOCATION_TEXTURE_RGB
&& !(volume->container->flags & WINED3D_TEXTURE_RGB_ALLOCATED))
|| (location == WINED3D_LOCATION_TEXTURE_SRGB
&& !(volume->container->flags & WINED3D_TEXTURE_SRGB_ALLOCATED)))
ERR("Trying to load (s)RGB texture without prior allocation.\n");
#if defined(STAGING_CSMT)
if (volume->resource.locations & WINED3D_LOCATION_DISCARDED)
{
TRACE("Volume previously discarded, nothing to do.\n");
wined3d_resource_invalidate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
}
else if (volume->resource.locations & WINED3D_LOCATION_SYSMEM)
{
struct wined3d_const_bo_address data = {0, volume->resource.heap_memory};
wined3d_texture_bind_and_dirtify(volume->container, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_volume_upload_data(volume, context, &data);
}
else if (volume->resource.locations & WINED3D_LOCATION_BUFFER)
{
struct wined3d_const_bo_address data = {volume->resource.buffer->name, NULL};
wined3d_texture_bind_and_dirtify(volume->container, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_volume_upload_data(volume, context, &data);
}
else if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
{
wined3d_volume_srgb_transfer(volume, context, TRUE);
}
else if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_SRGB)
{
wined3d_volume_srgb_transfer(volume, context, FALSE);
}
else
{
FIXME("Implement texture loading from %s.\n", wined3d_debug_location(volume->resource.locations));
return;
}
wined3d_resource_validate_location(&volume->resource, location);
#else /* STAGING_CSMT */
if (volume->locations & WINED3D_LOCATION_DISCARDED)
{
TRACE("Volume previously discarded, nothing to do.\n");
wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
}
else if (volume->locations & WINED3D_LOCATION_SYSMEM)
{
struct wined3d_const_bo_address data = {0, volume->resource.heap_memory};
wined3d_texture_bind_and_dirtify(volume->container, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_volume_upload_data(volume, context, &data);
}
else if (volume->locations & WINED3D_LOCATION_BUFFER)
{
struct wined3d_const_bo_address data = {volume->pbo, NULL};
wined3d_texture_bind_and_dirtify(volume->container, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_volume_upload_data(volume, context, &data);
}
else if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
{
wined3d_volume_srgb_transfer(volume, context, TRUE);
}
else if (volume->locations & WINED3D_LOCATION_TEXTURE_SRGB)
{
wined3d_volume_srgb_transfer(volume, context, FALSE);
}
else
{
FIXME("Implement texture loading from %s.\n", wined3d_debug_location(volume->locations));
return;
}
wined3d_volume_validate_location(volume, location);
#endif /* STAGING_CSMT */
if (wined3d_volume_can_evict(volume))
wined3d_volume_evict_sysmem(volume);
break;
case WINED3D_LOCATION_SYSMEM:
if (!volume->resource.heap_memory)
ERR("Trying to load WINED3D_LOCATION_SYSMEM without setting it up first.\n");
#if defined(STAGING_CSMT)
if (volume->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
struct wined3d_bo_address data = {0, volume->resource.heap_memory};
if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
#else /* STAGING_CSMT */
if (volume->locations & WINED3D_LOCATION_DISCARDED)
{
TRACE("Volume previously discarded, nothing to do.\n");
wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
}
else if (volume->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
struct wined3d_bo_address data = {0, volume->resource.heap_memory};
if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
#endif /* STAGING_CSMT */
wined3d_texture_bind_and_dirtify(volume->container, context, FALSE);
else
wined3d_texture_bind_and_dirtify(volume->container, context, TRUE);
volume->download_count++;
wined3d_volume_download_data(volume, context, &data);
}
else
{
FIXME("Implement WINED3D_LOCATION_SYSMEM loading from %s.\n",
#if defined(STAGING_CSMT)
wined3d_debug_location(volume->resource.locations));
return;
}
wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_SYSMEM);
break;
case WINED3D_LOCATION_BUFFER:
if (!volume->resource.buffer)
ERR("Trying to load WINED3D_LOCATION_BUFFER without setting it up first.\n");
if (volume->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
struct wined3d_bo_address data = {volume->resource.buffer->name, NULL};
if (volume->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
#else /* STAGING_CSMT */
wined3d_debug_location(volume->locations));
return;
}
wined3d_volume_validate_location(volume, WINED3D_LOCATION_SYSMEM);
break;
case WINED3D_LOCATION_BUFFER:
if (!volume->pbo)
ERR("Trying to load WINED3D_LOCATION_BUFFER without setting it up first.\n");
if (volume->locations & WINED3D_LOCATION_DISCARDED)
{
TRACE("Volume previously discarded, nothing to do.\n");
wined3d_volume_invalidate_location(volume, WINED3D_LOCATION_DISCARDED);
}
else if (volume->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
struct wined3d_bo_address data = {volume->pbo, NULL};
if (volume->locations & WINED3D_LOCATION_TEXTURE_RGB)
#endif /* STAGING_CSMT */
wined3d_texture_bind_and_dirtify(volume->container, context, FALSE);
else
wined3d_texture_bind_and_dirtify(volume->container, context, TRUE);
wined3d_volume_download_data(volume, context, &data);
}
else
{
FIXME("Implement WINED3D_LOCATION_BUFFER loading from %s.\n",
#if defined(STAGING_CSMT)
wined3d_debug_location(volume->resource.locations));
return;
}
wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_BUFFER);
break;
default:
FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
wined3d_debug_location(volume->resource.locations));
#else /* STAGING_CSMT */
wined3d_debug_location(volume->locations));
return;
}
wined3d_volume_validate_location(volume, WINED3D_LOCATION_BUFFER);
break;
default:
FIXME("Implement %s loading from %s.\n", wined3d_debug_location(location),
wined3d_debug_location(volume->locations));
#endif /* STAGING_CSMT */
}
}
/* Context activation is done by the caller. */
void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode)
{
wined3d_texture_prepare_texture(volume->container, context, srgb_mode);
#if defined(STAGING_CSMT)
wined3d_resource_load_location(&volume->resource, context,
srgb_mode ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB);
}
void wined3d_volume_destroy(struct wined3d_volume *volume)
{
struct wined3d_device *device = volume->resource.device;
TRACE("volume %p.\n", volume);
resource_cleanup(&volume->resource);
volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent);
wined3d_cs_emit_volume_cleanup(device->cs, volume);
#else /* STAGING_CSMT */
wined3d_volume_load_location(volume, context,
srgb_mode ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB);
}
/* Context activation is done by the caller. */
static void wined3d_volume_prepare_pbo(struct wined3d_volume *volume, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
if (volume->pbo)
return;
GL_EXTCALL(glGenBuffers(1, &volume->pbo));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
GL_EXTCALL(glBufferData(GL_PIXEL_UNPACK_BUFFER, volume->resource.size, NULL, GL_STREAM_DRAW));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Create PBO");
TRACE("Created PBO %u for volume %p.\n", volume->pbo, volume);
}
static void wined3d_volume_free_pbo(struct wined3d_volume *volume)
{
struct wined3d_context *context = context_acquire(volume->resource.device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Deleting PBO %u belonging to volume %p.\n", volume->pbo, volume);
GL_EXTCALL(glDeleteBuffers(1, &volume->pbo));
checkGLcall("glDeleteBuffers");
volume->pbo = 0;
context_release(context);
}
void wined3d_volume_destroy(struct wined3d_volume *volume)
{
TRACE("volume %p.\n", volume);
if (volume->pbo)
wined3d_volume_free_pbo(volume);
resource_cleanup(&volume->resource);
volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent);
HeapFree(GetProcessHeap(), 0, volume);
#endif /* STAGING_CSMT */
}
static void volume_unload(struct wined3d_resource *resource)
{
struct wined3d_volume *volume = volume_from_resource(resource);
struct wined3d_device *device = volume->resource.device;
struct wined3d_context *context;
if (volume->resource.pool == WINED3D_POOL_DEFAULT)
ERR("Unloading DEFAULT pool volume.\n");
TRACE("texture %p.\n", resource);
#if defined(STAGING_CSMT)
if (wined3d_resource_prepare_system_memory(&volume->resource))
{
context = context_acquire(device, NULL);
wined3d_resource_load_location(&volume->resource, context, WINED3D_LOCATION_SYSMEM);
context_release(context);
wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_SYSMEM);
}
else
{
ERR("Out of memory when unloading volume %p.\n", volume);
wined3d_resource_validate_location(&volume->resource, WINED3D_LOCATION_DISCARDED);
wined3d_resource_invalidate_location(&volume->resource, ~WINED3D_LOCATION_DISCARDED);
#else /* STAGING_CSMT */
if (volume_prepare_system_memory(volume))
{
context = context_acquire(device, NULL);
wined3d_volume_load_location(volume, context, WINED3D_LOCATION_SYSMEM);
context_release(context);
wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_SYSMEM);
}
else
{
ERR("Out of memory when unloading volume %p.\n", volume);
wined3d_volume_validate_location(volume, WINED3D_LOCATION_DISCARDED);
wined3d_volume_invalidate_location(volume, ~WINED3D_LOCATION_DISCARDED);
}
if (volume->pbo)
{
/* Should not happen because only dynamic default pool volumes
* have a buffer, and those are not evicted by device_evit_managed_resources
* and must be freed before a non-ex device reset. */
ERR("Unloading a volume with a buffer\n");
wined3d_volume_free_pbo(volume);
#endif /* STAGING_CSMT */
}
/* The texture name is managed by the container. */
resource_unload(resource);
}
static BOOL wined3d_volume_check_box_dimensions(const struct wined3d_volume *volume,
const struct wined3d_box *box)
{
if (!box)
return TRUE;
if (box->left >= box->right)
return FALSE;
if (box->top >= box->bottom)
return FALSE;
if (box->front >= box->back)
return FALSE;
if (box->right > volume->resource.width)
return FALSE;
if (box->bottom > volume->resource.height)
return FALSE;
if (box->back > volume->resource.depth)
return FALSE;
return TRUE;
}
HRESULT wined3d_volume_map(struct wined3d_volume *volume,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
#if defined(STAGING_CSMT)
HRESULT hr;
const struct wined3d_format *format = volume->resource.format;
const unsigned int fmt_flags = volume->container->resource.format_flags;
map_desc->data = NULL;
if (!(volume->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
{
WARN("Volume %p is not CPU accessible.\n", volume);
return WINED3DERR_INVALIDCALL;
}
if (!wined3d_volume_check_box_dimensions(volume, box))
{
WARN("Map box is invalid.\n");
return WINED3DERR_INVALIDCALL;
}
if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && !wined3d_resource_check_block_align(&volume->resource, box))
{
WARN("Map box %s is misaligned for %ux%u blocks.\n",
debug_box(box), format->block_width, format->block_height);
return WINED3DERR_INVALIDCALL;
}
hr = wined3d_resource_map(&volume->resource, map_desc, box, flags);
if (FAILED(hr))
return hr;
return hr;
}
HRESULT wined3d_volume_unmap(struct wined3d_volume *volume)
{
HRESULT hr;
if (volume->resource.unmap_dirtify)
wined3d_texture_set_dirty(volume->container);
hr = wined3d_resource_unmap(&volume->resource);
if (hr == WINEDDERR_NOTLOCKED)
return WINED3DERR_INVALIDCALL;
return hr;
#else /* STAGING_CSMT */
struct wined3d_device *device = volume->resource.device;
struct wined3d_context *context;
const struct wined3d_gl_info *gl_info;
BYTE *base_memory;
const struct wined3d_format *format = volume->resource.format;
const unsigned int fmt_flags = volume->container->resource.format_flags;
TRACE("volume %p, map_desc %p, box %s, flags %#x.\n",
volume, map_desc, debug_box(box), flags);
map_desc->data = NULL;
if (!(volume->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU))
{
WARN("Volume %p is not CPU accessible.\n", volume);
return WINED3DERR_INVALIDCALL;
}
if (volume->resource.map_count)
{
WARN("Volume is already mapped.\n");
return WINED3DERR_INVALIDCALL;
}
if (!wined3d_volume_check_box_dimensions(volume, box))
{
WARN("Map box is invalid.\n");
return WINED3DERR_INVALIDCALL;
}
if ((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && box
&& !wined3d_texture_check_block_align(volume->container, volume->texture_level, box))
{
WARN("Map box %s is misaligned for %ux%u blocks.\n",
debug_box(box), format->block_width, format->block_height);
return WINED3DERR_INVALIDCALL;
}
flags = wined3d_resource_sanitize_map_flags(&volume->resource, flags);
if (volume->resource.map_binding == WINED3D_LOCATION_BUFFER)
{
context = context_acquire(device, NULL);
gl_info = context->gl_info;
wined3d_volume_prepare_pbo(volume, context);
if (flags & WINED3D_MAP_DISCARD)
wined3d_volume_validate_location(volume, WINED3D_LOCATION_BUFFER);
else
wined3d_volume_load_location(volume, context, WINED3D_LOCATION_BUFFER);
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
GLbitfield mapflags = wined3d_resource_gl_map_flags(flags);
mapflags &= ~GL_MAP_FLUSH_EXPLICIT_BIT;
base_memory = GL_EXTCALL(glMapBufferRange(GL_PIXEL_UNPACK_BUFFER,
0, volume->resource.size, mapflags));
}
else
{
GLenum access = wined3d_resource_gl_legacy_map_flags(flags);
base_memory = GL_EXTCALL(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, access));
}
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Map PBO");
context_release(context);
}
else
{
if (!volume_prepare_system_memory(volume))
{
WARN("Out of memory.\n");
map_desc->data = NULL;
return E_OUTOFMEMORY;
}
if (flags & WINED3D_MAP_DISCARD)
{
wined3d_volume_validate_location(volume, WINED3D_LOCATION_SYSMEM);
}
else if (!(volume->locations & WINED3D_LOCATION_SYSMEM))
{
context = context_acquire(device, NULL);
wined3d_volume_load_location(volume, context, WINED3D_LOCATION_SYSMEM);
context_release(context);
}
base_memory = volume->resource.heap_memory;
}
TRACE("Base memory pointer %p.\n", base_memory);
if (fmt_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
{
map_desc->row_pitch = volume->resource.width * format->byte_count;
map_desc->slice_pitch = map_desc->row_pitch * volume->resource.height;
}
else
{
wined3d_texture_get_pitch(volume->container, volume->texture_level,
&map_desc->row_pitch, &map_desc->slice_pitch);
}
if (!box)
{
map_desc->data = base_memory;
}
else
{
if ((fmt_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
{
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the locked rectangle. */
map_desc->data = base_memory
+ (box->front * map_desc->slice_pitch)
+ ((box->top / format->block_height) * map_desc->row_pitch)
+ ((box->left / format->block_width) * format->block_byte_count);
}
else
{
map_desc->data = base_memory
+ (map_desc->slice_pitch * box->front)
+ (map_desc->row_pitch * box->top)
+ (box->left * volume->resource.format->byte_count);
}
}
if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
{
wined3d_texture_set_dirty(volume->container);
wined3d_volume_invalidate_location(volume, ~volume->resource.map_binding);
}
volume->resource.map_count++;
TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n",
map_desc->data, map_desc->row_pitch, map_desc->slice_pitch);
return WINED3D_OK;
}
HRESULT wined3d_volume_unmap(struct wined3d_volume *volume)
{
TRACE("volume %p.\n", volume);
if (!volume->resource.map_count)
{
WARN("Trying to unlock an unlocked volume %p.\n", volume);
return WINED3DERR_INVALIDCALL;
}
if (volume->resource.map_binding == WINED3D_LOCATION_BUFFER)
{
struct wined3d_device *device = volume->resource.device;
struct wined3d_context *context = context_acquire(device, NULL);
const struct wined3d_gl_info *gl_info = context->gl_info;
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, volume->pbo));
GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));
GL_EXTCALL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0));
checkGLcall("Unmap PBO");
context_release(context);
}
volume->resource.map_count--;
return WINED3D_OK;
#endif /* STAGING_CSMT */
}
static ULONG volume_resource_incref(struct wined3d_resource *resource)
{
struct wined3d_volume *volume = volume_from_resource(resource);
TRACE("Forwarding to container %p.\n", volume->container);
return wined3d_texture_incref(volume->container);
}
#if defined(STAGING_CSMT)
void wined3d_volume_cleanup_cs(struct wined3d_volume *volume)
{
HeapFree(GetProcessHeap(), 0, volume);
}
#endif /* STAGING_CSMT */
static ULONG volume_resource_decref(struct wined3d_resource *resource)
{
struct wined3d_volume *volume = volume_from_resource(resource);
TRACE("Forwarding to container %p.\n", volume->container);
return wined3d_texture_decref(volume->container);
}
static HRESULT volume_resource_sub_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx,
struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags)
{
ERR("Not supported on sub-resources.\n");
return WINED3DERR_INVALIDCALL;
}
static HRESULT volume_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
ERR("Not supported on sub-resources.\n");
return WINED3DERR_INVALIDCALL;
}
#if defined(STAGING_CSMT)
static void wined3d_volume_location_invalidated(struct wined3d_resource *resource, DWORD location)
{
struct wined3d_volume *volume = volume_from_resource(resource);
if (location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
wined3d_texture_set_dirty(volume->container);
}
#endif /* STAGING_CSMT */
static const struct wined3d_resource_ops volume_resource_ops =
{
volume_resource_incref,
volume_resource_decref,
volume_unload,
volume_resource_sub_resource_map,
volume_resource_sub_resource_unmap,
#if defined(STAGING_CSMT)
wined3d_volume_location_invalidated,
wined3d_volume_load_location,
#endif /* STAGING_CSMT */
};
static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture *container,
const struct wined3d_resource_desc *desc, UINT level)
{
struct wined3d_device *device = container->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, desc->format);
HRESULT hr;
UINT size;
/* TODO: Write tests for other resources and move this check
* to resource_init, if applicable. */
if (desc->usage & WINED3DUSAGE_DYNAMIC
&& (desc->pool == WINED3D_POOL_MANAGED || desc->pool == WINED3D_POOL_SCRATCH))
{
WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool));
return WINED3DERR_INVALIDCALL;
}
size = wined3d_format_calculate_size(format, device->surface_alignment, desc->width, desc->height, desc->depth);
if (FAILED(hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, format,
WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->pool, desc->width, desc->height, desc->depth,
size, NULL, &wined3d_null_parent_ops, &volume_resource_ops)))
{
WARN("Failed to initialize resource, returning %#x.\n", hr);
return hr;
}
volume->texture_level = level;
#if defined(STAGING_CSMT)
volume->resource.locations = WINED3D_LOCATION_DISCARDED;
#else /* STAGING_CSMT */
volume->locations = WINED3D_LOCATION_DISCARDED;
#endif /* STAGING_CSMT */
if (desc->pool == WINED3D_POOL_DEFAULT && desc->usage & WINED3DUSAGE_DYNAMIC
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
&& !format->convert)
{
wined3d_resource_free_sysmem(&volume->resource);
volume->resource.map_binding = WINED3D_LOCATION_BUFFER;
#if defined(STAGING_CSMT)
volume->resource.map_heap_memory = NULL;
#endif /* STAGING_CSMT */
}
volume->container = container;
return WINED3D_OK;
}
HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc,
unsigned int level, struct wined3d_volume **volume)
{
struct wined3d_device_parent *device_parent = container->resource.device->device_parent;
const struct wined3d_parent_ops *parent_ops;
struct wined3d_volume *object;
void *parent;
HRESULT hr;
TRACE("container %p, width %u, height %u, depth %u, level %u, format %s, "
"usage %#x, pool %s, volume %p.\n",
container, desc->width, desc->height, desc->depth, level, debug_d3dformat(desc->format),
desc->usage, debug_d3dpool(desc->pool), volume);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = volume_init(object, container, desc, level)))
{
WARN("Failed to initialize volume, returning %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
if (FAILED(hr = device_parent->ops->volume_created(device_parent,
container, level, &parent, &parent_ops)))
{
WARN("Failed to create volume parent, hr %#x.\n", hr);
wined3d_volume_destroy(object);
return hr;
}
TRACE("Created volume %p, parent %p, parent_ops %p.\n", object, parent, parent_ops);
object->resource.parent = parent;
object->resource.parent_ops = parent_ops;
*volume = object;
return WINED3D_OK;
}
+80 -31
View File
@@ -5,11 +5,13 @@
@ cdecl wined3d_check_depth_stencil_match(ptr 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_format_support(ptr long ptr)
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
@ cdecl wined3d_check_device_type(ptr long long long long long)
@ cdecl wined3d_create(long)
@ cdecl wined3d_decref(ptr)
@ cdecl wined3d_enum_adapter_modes(ptr long long long long ptr)
@ cdecl wined3d_find_closest_matching_adapter_mode(ptr long ptr)
@ cdecl wined3d_get_adapter_count(ptr)
@ cdecl wined3d_get_adapter_display_mode(ptr long ptr ptr)
@ cdecl wined3d_get_adapter_identifier(ptr long long ptr)
@@ -28,19 +30,18 @@
@ cdecl wined3d_buffer_get_parent(ptr)
@ cdecl wined3d_buffer_get_resource(ptr)
@ cdecl wined3d_buffer_incref(ptr)
@ cdecl wined3d_buffer_map(ptr long long ptr long)
@ cdecl wined3d_buffer_preload(ptr)
@ cdecl wined3d_buffer_unmap(ptr)
@ cdecl wined3d_device_acquire_focus_window(ptr ptr)
@ cdecl wined3d_device_begin_scene(ptr)
@ cdecl wined3d_device_begin_stateblock(ptr)
@ cdecl wined3d_device_clear(ptr long ptr long ptr float long)
@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr ptr)
@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long)
@ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr)
@ cdecl wined3d_device_copy_resource(ptr ptr ptr)
@ cdecl wined3d_device_copy_sub_resource_region(ptr ptr long long long long ptr long ptr)
@ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr)
@ cdecl wined3d_device_decref(ptr)
@ cdecl wined3d_device_dispatch_compute(ptr long long long)
@ cdecl wined3d_device_draw_indexed_primitive(ptr long long)
@ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long)
@ cdecl wined3d_device_draw_primitive(ptr long long)
@@ -52,30 +53,44 @@
@ cdecl wined3d_device_get_base_vertex_index(ptr)
@ cdecl wined3d_device_get_clip_plane(ptr long ptr)
@ cdecl wined3d_device_get_clip_status(ptr ptr)
@ cdecl wined3d_device_get_compute_shader(ptr)
@ cdecl wined3d_device_get_creation_parameters(ptr ptr)
@ cdecl wined3d_device_get_cs_cb(ptr long)
@ cdecl wined3d_device_get_cs_resource_view(ptr long)
@ cdecl wined3d_device_get_cs_sampler(ptr long)
@ cdecl wined3d_device_get_cs_uav(ptr long)
@ cdecl wined3d_device_get_depth_stencil_view(ptr)
@ cdecl wined3d_device_get_device_caps(ptr ptr)
@ cdecl wined3d_device_get_display_mode(ptr long ptr ptr)
@ cdecl wined3d_device_get_domain_shader(ptr)
@ cdecl wined3d_device_get_ds_cb(ptr long)
@ cdecl wined3d_device_get_ds_resource_view(ptr long)
@ cdecl wined3d_device_get_ds_sampler(ptr long)
@ 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_resource_view(ptr long)
@ cdecl wined3d_device_get_gs_sampler(ptr long)
@ cdecl wined3d_device_get_index_buffer(ptr ptr)
@ cdecl wined3d_device_get_hs_cb(ptr long)
@ cdecl wined3d_device_get_hs_resource_view(ptr long)
@ cdecl wined3d_device_get_hs_sampler(ptr long)
@ cdecl wined3d_device_get_hull_shader(ptr)
@ cdecl wined3d_device_get_index_buffer(ptr ptr ptr)
@ cdecl wined3d_device_get_light(ptr long ptr)
@ cdecl wined3d_device_get_light_enable(ptr long ptr)
@ cdecl wined3d_device_get_material(ptr ptr)
@ cdecl wined3d_device_get_npatch_mode(ptr)
@ cdecl wined3d_device_get_pixel_shader(ptr)
@ cdecl wined3d_device_get_predication(ptr ptr)
@ cdecl wined3d_device_get_primitive_type(ptr ptr)
@ cdecl wined3d_device_get_primitive_type(ptr 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_consts_b(ptr long long ptr)
@ cdecl wined3d_device_get_ps_consts_f(ptr long long ptr)
@ cdecl wined3d_device_get_ps_consts_i(ptr long long ptr)
@ cdecl wined3d_device_get_ps_resource_view(ptr long)
@ cdecl wined3d_device_get_ps_sampler(ptr long)
@ cdecl wined3d_device_get_raster_status(ptr long ptr)
@ cdecl wined3d_device_get_rasterizer_state(ptr)
@ cdecl wined3d_device_get_render_state(ptr long)
@ cdecl wined3d_device_get_rendertarget_view(ptr long)
@ cdecl wined3d_device_get_sampler_state(ptr long long)
@@ -89,13 +104,14 @@
@ 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_unordered_access_view(ptr long)
@ 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_vs_consts_b(ptr long long ptr)
@ cdecl wined3d_device_get_vs_consts_f(ptr long long ptr)
@ cdecl wined3d_device_get_vs_consts_i(ptr long long ptr)
@ cdecl wined3d_device_get_vs_resource_view(ptr long)
@ cdecl wined3d_device_get_vs_sampler(ptr long)
@ cdecl wined3d_device_get_wined3d(ptr)
@@ -106,20 +122,33 @@
@ 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 long)
@ cdecl wined3d_device_restore_fullscreen_window(ptr ptr)
@ cdecl wined3d_device_restore_fullscreen_window(ptr ptr ptr)
@ cdecl wined3d_device_set_base_vertex_index(ptr long)
@ cdecl wined3d_device_set_clip_plane(ptr long ptr)
@ cdecl wined3d_device_set_clip_status(ptr ptr)
@ cdecl wined3d_device_set_compute_shader(ptr ptr)
@ cdecl wined3d_device_set_cs_cb(ptr long ptr)
@ cdecl wined3d_device_set_cs_resource_view(ptr long ptr)
@ cdecl wined3d_device_set_cs_sampler(ptr long ptr)
@ cdecl wined3d_device_set_cs_uav(ptr long ptr)
@ cdecl wined3d_device_set_cursor_position(ptr long long long)
@ cdecl wined3d_device_set_cursor_properties(ptr long long ptr long)
@ cdecl wined3d_device_set_depth_stencil_view(ptr ptr)
@ cdecl wined3d_device_set_dialog_box_mode(ptr long)
@ cdecl wined3d_device_set_domain_shader(ptr ptr)
@ cdecl wined3d_device_set_ds_cb(ptr long ptr)
@ cdecl wined3d_device_set_ds_resource_view(ptr long ptr)
@ cdecl wined3d_device_set_ds_sampler(ptr long ptr)
@ 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_resource_view(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_hs_cb(ptr long ptr)
@ cdecl wined3d_device_set_hs_resource_view(ptr long ptr)
@ cdecl wined3d_device_set_hs_sampler(ptr long ptr)
@ cdecl wined3d_device_set_hull_shader(ptr ptr)
@ cdecl wined3d_device_set_index_buffer(ptr ptr long long)
@ cdecl wined3d_device_set_light(ptr long ptr)
@ cdecl wined3d_device_set_light_enable(ptr long long)
@ cdecl wined3d_device_set_material(ptr ptr)
@@ -127,13 +156,14 @@
@ cdecl wined3d_device_set_npatch_mode(ptr float)
@ cdecl wined3d_device_set_pixel_shader(ptr ptr)
@ cdecl wined3d_device_set_predication(ptr ptr long)
@ cdecl wined3d_device_set_primitive_type(ptr long)
@ cdecl wined3d_device_set_primitive_type(ptr long 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_consts_b(ptr long long ptr)
@ cdecl wined3d_device_set_ps_consts_f(ptr long long ptr)
@ cdecl wined3d_device_set_ps_consts_i(ptr long long ptr)
@ cdecl wined3d_device_set_ps_resource_view(ptr long ptr)
@ cdecl wined3d_device_set_ps_sampler(ptr long ptr)
@ cdecl wined3d_device_set_rasterizer_state(ptr ptr)
@ cdecl wined3d_device_set_render_state(ptr long long)
@ cdecl wined3d_device_set_rendertarget_view(ptr long ptr long)
@ cdecl wined3d_device_set_sampler_state(ptr long long long)
@@ -145,13 +175,14 @@
@ cdecl wined3d_device_set_texture(ptr long ptr)
@ cdecl wined3d_device_set_texture_stage_state(ptr long long long)
@ cdecl wined3d_device_set_transform(ptr long ptr)
@ cdecl wined3d_device_set_unordered_access_view(ptr long ptr)
@ 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_consts_b(ptr long long ptr)
@ cdecl wined3d_device_set_vs_consts_f(ptr long long ptr)
@ cdecl wined3d_device_set_vs_consts_i(ptr long long ptr)
@ cdecl wined3d_device_set_vs_resource_view(ptr long ptr)
@ cdecl wined3d_device_set_vs_sampler(ptr long ptr)
@ cdecl wined3d_device_setup_fullscreen_window(ptr ptr long long)
@@ -169,7 +200,7 @@
@ cdecl wined3d_palette_incref(ptr)
@ cdecl wined3d_palette_set_entries(ptr long long long ptr)
@ cdecl wined3d_query_create(ptr long ptr ptr)
@ cdecl wined3d_query_create(ptr long ptr ptr ptr)
@ cdecl wined3d_query_decref(ptr)
@ cdecl wined3d_query_get_data(ptr ptr long long)
@ cdecl wined3d_query_get_data_size(ptr)
@@ -178,13 +209,20 @@
@ cdecl wined3d_query_incref(ptr)
@ cdecl wined3d_query_issue(ptr long)
@ cdecl wined3d_rasterizer_state_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_rasterizer_state_decref(ptr)
@ cdecl wined3d_rasterizer_state_get_parent(ptr)
@ cdecl wined3d_rasterizer_state_incref(ptr)
@ cdecl wined3d_resource_get_desc(ptr ptr)
@ cdecl wined3d_resource_get_parent(ptr)
@ cdecl wined3d_resource_get_priority(ptr)
@ cdecl wined3d_resource_map(ptr long ptr ptr long)
@ cdecl wined3d_resource_map_info(ptr long ptr long)
@ cdecl wined3d_resource_preload(ptr)
@ cdecl wined3d_resource_set_parent(ptr ptr)
@ cdecl wined3d_resource_set_priority(ptr long)
@ cdecl wined3d_resource_sub_resource_map(ptr long ptr ptr long)
@ cdecl wined3d_resource_sub_resource_unmap(ptr long)
@ cdecl wined3d_resource_unmap(ptr long)
@ cdecl wined3d_rendertarget_view_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_rendertarget_view_create_from_sub_resource(ptr long ptr ptr ptr)
@@ -195,12 +233,15 @@
@ cdecl wined3d_rendertarget_view_incref(ptr)
@ cdecl wined3d_rendertarget_view_set_parent(ptr ptr)
@ cdecl wined3d_sampler_create(ptr ptr ptr ptr)
@ cdecl wined3d_sampler_create(ptr ptr ptr 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)
@ cdecl wined3d_shader_create_cs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_ds(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_gs(ptr ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_hs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_ps(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_vs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_decref(ptr)
@@ -209,7 +250,7 @@
@ cdecl wined3d_shader_incref(ptr)
@ cdecl wined3d_shader_set_local_constants_float(ptr long ptr long)
@ cdecl wined3d_shader_resource_view_create(ptr ptr ptr ptr)
@ cdecl wined3d_shader_resource_view_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_resource_view_decref(ptr)
@ cdecl wined3d_shader_resource_view_get_parent(ptr)
@ cdecl wined3d_shader_resource_view_incref(ptr)
@@ -233,16 +274,19 @@
@ cdecl wined3d_swapchain_get_desc(ptr ptr)
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr ptr long)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr long)
@ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long)
@ cdecl wined3d_swapchain_resize_target(ptr ptr)
@ cdecl wined3d_swapchain_set_fullscreen(ptr ptr ptr)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
@ cdecl wined3d_swapchain_set_window(ptr ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
@ cdecl wined3d_texture_create(ptr ptr long long ptr ptr ptr ptr)
@ cdecl wined3d_texture_create(ptr ptr long long long ptr ptr ptr ptr)
@ cdecl wined3d_texture_decref(ptr)
@ cdecl wined3d_texture_from_resource(ptr)
@ cdecl wined3d_texture_generate_mipmaps(ptr)
@ cdecl wined3d_texture_get_autogen_filter_type(ptr)
@ cdecl wined3d_texture_get_dc(ptr long ptr)
@@ -252,18 +296,23 @@
@ cdecl wined3d_texture_get_parent(ptr)
@ cdecl wined3d_texture_get_pitch(ptr long ptr ptr)
@ cdecl wined3d_texture_get_resource(ptr)
@ cdecl wined3d_texture_get_sub_resource(ptr long)
@ cdecl wined3d_texture_get_sub_resource_desc(ptr long ptr)
@ cdecl wined3d_texture_get_sub_resource_parent(ptr long)
@ cdecl wined3d_texture_incref(ptr)
@ cdecl wined3d_texture_preload(ptr)
@ cdecl wined3d_texture_release_dc(ptr long ptr)
@ cdecl wined3d_texture_set_autogen_filter_type(ptr long)
@ cdecl wined3d_texture_set_color_key(ptr long ptr)
@ cdecl wined3d_texture_set_lod(ptr long)
@ cdecl wined3d_texture_set_overlay_position(ptr long long long)
@ cdecl wined3d_texture_set_sub_resource_parent(ptr long ptr)
@ cdecl wined3d_texture_update_desc(ptr long long long long long ptr long)
@ cdecl wined3d_texture_update_overlay(ptr long ptr ptr long ptr long)
@ cdecl wined3d_unordered_access_view_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_unordered_access_view_decref(ptr)
@ cdecl wined3d_unordered_access_view_get_parent(ptr)
@ cdecl wined3d_unordered_access_view_incref(ptr)
@ cdecl wined3d_vertex_declaration_create(ptr ptr long ptr ptr ptr)
@ cdecl wined3d_vertex_declaration_create_from_fvf(ptr long ptr ptr ptr)
@ cdecl wined3d_vertex_declaration_decref(ptr)
+41 -2
View File
@@ -44,19 +44,30 @@ enum wined3d_gl_extension
APPLE_YCBCR_422,
/* ARB */
ARB_BLEND_FUNC_EXTENDED,
ARB_CLEAR_BUFFER_OBJECT,
ARB_CLEAR_TEXTURE,
ARB_CLIP_CONTROL,
ARB_COLOR_BUFFER_FLOAT,
ARB_COMPUTE_SHADER,
ARB_COPY_BUFFER,
ARB_DEBUG_OUTPUT,
ARB_DEPTH_BUFFER_FLOAT,
ARB_DEPTH_TEXTURE,
ARB_DERIVATIVE_CONTROL,
ARB_DRAW_BUFFERS,
ARB_DRAW_ELEMENTS_BASE_VERTEX,
ARB_DRAW_INSTANCED,
ARB_ES2_COMPATIBILITY,
ARB_ES3_COMPATIBILITY,
ARB_EXPLICIT_ATTRIB_LOCATION,
ARB_FRAGMENT_COORD_CONVENTIONS,
ARB_FRAGMENT_LAYER_VIEWPORT,
ARB_FRAGMENT_PROGRAM,
ARB_FRAGMENT_SHADER,
ARB_FRAMEBUFFER_OBJECT,
ARB_FRAMEBUFFER_SRGB,
ARB_GEOMETRY_SHADER4,
ARB_GPU_SHADER5,
ARB_HALF_FLOAT_PIXEL,
ARB_HALF_FLOAT_VERTEX,
ARB_INSTANCED_ARRAYS,
@@ -67,23 +78,38 @@ enum wined3d_gl_extension
ARB_MULTISAMPLE,
ARB_MULTITEXTURE,
ARB_OCCLUSION_QUERY,
ARB_PIPELINE_STATISTICS_QUERY,
ARB_PIXEL_BUFFER_OBJECT,
ARB_POINT_PARAMETERS,
ARB_POINT_SPRITE,
ARB_PROVOKING_VERTEX,
ARB_SAMPLER_OBJECTS,
ARB_SEAMLESS_CUBE_MAP,
ARB_SHADER_ATOMIC_COUNTERS,
ARB_SHADER_BIT_ENCODING,
ARB_SHADER_IMAGE_LOAD_STORE,
ARB_SHADER_IMAGE_SIZE,
ARB_SHADER_STORAGE_BUFFER_OBJECT,
ARB_SHADER_TEXTURE_LOD,
ARB_SHADING_LANGUAGE_100,
ARB_SHADING_LANGUAGE_420PACK,
ARB_SHADING_LANGUAGE_PACKING,
ARB_SHADOW,
ARB_STENCIL_TEXTURING,
ARB_SYNC,
ARB_TESSELLATION_SHADER,
ARB_TEXTURE_BORDER_CLAMP,
ARB_TEXTURE_BUFFER_OBJECT,
ARB_TEXTURE_BUFFER_RANGE,
ARB_TEXTURE_COMPRESSION,
ARB_TEXTURE_COMPRESSION_BPTC,
ARB_TEXTURE_COMPRESSION_RGTC,
ARB_TEXTURE_CUBE_MAP,
ARB_TEXTURE_CUBE_MAP_ARRAY,
ARB_TEXTURE_ENV_COMBINE,
ARB_TEXTURE_ENV_DOT3,
ARB_TEXTURE_FLOAT,
ARB_TEXTURE_GATHER,
ARB_TEXTURE_MIRRORED_REPEAT,
ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE,
ARB_TEXTURE_NON_POWER_OF_TWO,
@@ -91,13 +117,20 @@ enum wined3d_gl_extension
ARB_TEXTURE_RECTANGLE,
ARB_TEXTURE_RG,
ARB_TEXTURE_RGB10_A2UI,
ARB_TEXTURE_STORAGE,
ARB_TEXTURE_SWIZZLE,
ARB_TEXTURE_VIEW,
ARB_TIMER_QUERY,
ARB_TRANSFORM_FEEDBACK2,
ARB_TRANSFORM_FEEDBACK3,
ARB_UNIFORM_BUFFER_OBJECT,
ARB_VERTEX_ARRAY_BGRA,
ARB_VERTEX_BLEND,
ARB_VERTEX_BUFFER_OBJECT,
ARB_VERTEX_PROGRAM,
ARB_VERTEX_SHADER,
ARB_VERTEX_TYPE_2_10_10_10_REV,
ARB_VIEWPORT_ARRAY,
/* ATI */
ATI_FRAGMENT_SHADER,
ATI_SEPARATE_STENCIL,
@@ -119,12 +152,14 @@ enum wined3d_gl_extension
EXT_GPU_PROGRAM_PARAMETERS,
EXT_GPU_SHADER4,
EXT_PACKED_DEPTH_STENCIL,
EXT_PACKED_FLOAT,
EXT_POINT_PARAMETERS,
EXT_PROVOKING_VERTEX,
EXT_SECONDARY_COLOR,
EXT_STENCIL_TWO_SIDE,
EXT_STENCIL_WRAP,
EXT_TEXTURE3D,
EXT_TEXTURE_ARRAY,
EXT_TEXTURE_COMPRESSION_RGTC,
EXT_TEXTURE_COMPRESSION_S3TC,
EXT_TEXTURE_ENV_COMBINE,
@@ -133,6 +168,7 @@ enum wined3d_gl_extension
EXT_TEXTURE_INTEGER,
EXT_TEXTURE_LOD_BIAS,
EXT_TEXTURE_MIRROR_CLAMP,
EXT_TEXTURE_SHARED_EXPONENT,
EXT_TEXTURE_SNORM,
EXT_TEXTURE_SRGB,
EXT_TEXTURE_SRGB_DECODE,
@@ -164,13 +200,16 @@ enum wined3d_gl_extension
WGL_ARB_PIXEL_FORMAT,
WGL_EXT_SWAP_CONTROL,
WGL_WINE_PIXEL_FORMAT_PASSTHROUGH,
WGL_WINE_GPU_INFO,
WGL_WINE_QUERY_RENDERER,
/* Internally used */
WINED3D_GL_BLEND_EQUATION,
WINED3D_GL_NORMALIZED_TEXRECT,
WINED3D_GL_LEGACY_CONTEXT,
WINED3D_GL_NORMALIZED_TEXRECT,
WINED3D_GL_PRIMITIVE_QUERY,
WINED3D_GL_VERSION_2_0,
WINED3D_GL_VERSION_3_2,
WINED3D_GL_VERSION_4_3,
WINED3D_GLSL_130,
WINED3D_GL_EXT_COUNT,
};
+47 -72
View File
@@ -41,7 +41,7 @@ struct wined3d_wndproc_table
{
struct wined3d_wndproc *entries;
unsigned int count;
unsigned int size;
SIZE_T size;
};
static struct wined3d_wndproc_table wndproc_table;
@@ -70,6 +70,11 @@ static CRITICAL_SECTION wined3d_wndproc_cs = {&wined3d_wndproc_cs_debug, -1, 0,
* where appropriate. */
struct wined3d_settings wined3d_settings =
{
#if !defined(STAGING_CSMT)
FALSE, /* No multithreaded CS by default. */
#else /* STAGING_CSMT */
TRUE, /* Multithreaded CS by default. */
#endif /* STAGING_CSMT */
MAKEDWORD_VERSION(1, 0), /* Default to legacy OpenGL */
TRUE, /* Use of GLSL enabled by default */
ORM_FBO, /* Use FBOs to do offscreen rendering */
@@ -77,17 +82,16 @@ struct wined3d_settings wined3d_settings =
PCI_DEVICE_NONE,/* PCI Device ID */
0, /* The default of memory is set in init_driver_info */
NULL, /* No wine logo by default */
TRUE, /* Multisampling enabled by default. */
~0u, /* Don't force a specific sample count by default. */
FALSE, /* No strict draw ordering. */
TRUE, /* Don't try to render onscreen by default. */
FALSE, /* Don't range check relative addressing indices in float constants. */
~0U, /* No VS shader model limit by default. */
~0U, /* No HS shader model limit by default. */
~0U, /* No DS shader model limit by default. */
~0U, /* No GS shader model limit by default. */
~0U, /* No PS shader model limit by default. */
~0u, /* No CS shader model limit by default. */
FALSE, /* 3D support enabled by default. */
#if defined(STAGING_CSMT)
TRUE, /* Multithreaded CS by default. */
FALSE, /* Do not ignore render target maps. */
#endif /* STAGING_CSMT */
};
struct wined3d * CDECL wined3d_create(DWORD flags)
@@ -125,13 +129,20 @@ static DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *bu
return ERROR_FILE_NOT_FOUND;
}
static DWORD get_config_key_dword(HKEY defkey, HKEY appkey, const char *name, DWORD *data)
static DWORD get_config_key_dword(HKEY defkey, HKEY appkey, const char *name, DWORD *value)
{
DWORD type;
DWORD size = sizeof(DWORD);
if (appkey && !RegQueryValueExA(appkey, name, 0, &type, (BYTE *)data, &size) && (type == REG_DWORD)) return 0;
if (defkey && !RegQueryValueExA(defkey, name, 0, &type, (BYTE *)data, &size) && (type == REG_DWORD)) return 0;
DWORD type, data, size;
size = sizeof(data);
if (appkey && !RegQueryValueExA(appkey, name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD) goto success;
size = sizeof(data);
if (defkey && !RegQueryValueExA(defkey, name, 0, &type, (BYTE *)&data, &size) && type == REG_DWORD) goto success;
return ERROR_FILE_NOT_FOUND;
success:
*value = data;
return 0;
}
static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
@@ -202,6 +213,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
if (hkey || appkey)
{
if (!get_config_key_dword(hkey, appkey, "csmt", &wined3d_settings.cs_multithreaded))
ERR_(winediag)("Setting multithreaded command stream to %#x.\n", wined3d_settings.cs_multithreaded);
if (!get_config_key_dword(hkey, appkey, "MaxVersionGL", &tmpvalue))
{
if (tmpvalue != wined3d_settings.max_gl_version)
@@ -220,19 +233,9 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
wined3d_settings.glslRequested = FALSE;
}
}
if ( !get_config_key( hkey, appkey, "OffscreenRenderingMode", buffer, size) )
{
if (!strcmp(buffer,"backbuffer"))
{
TRACE("Using the backbuffer for offscreen rendering\n");
wined3d_settings.offscreen_rendering_mode = ORM_BACKBUFFER;
}
else if (!strcmp(buffer,"fbo"))
{
TRACE("Using FBOs for offscreen rendering\n");
wined3d_settings.offscreen_rendering_mode = ORM_FBO;
}
}
if (!get_config_key(hkey, appkey, "OffscreenRenderingMode", buffer, size)
&& !strcmp(buffer,"backbuffer"))
wined3d_settings.offscreen_rendering_mode = ORM_BACKBUFFER;
if ( !get_config_key_dword( hkey, appkey, "VideoPciDeviceID", &tmpvalue) )
{
int pci_device_id = tmpvalue;
@@ -284,59 +287,42 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
if (!wined3d_settings.logo) ERR("Failed to allocate logo path memory.\n");
else memcpy(wined3d_settings.logo, buffer, len);
}
if ( !get_config_key( hkey, appkey, "Multisampling", buffer, size) )
{
if (!strcmp(buffer, "disabled"))
{
TRACE("Multisampling disabled.\n");
wined3d_settings.allow_multisampling = FALSE;
}
}
if (!get_config_key_dword(hkey, appkey, "SampleCount", &wined3d_settings.sample_count))
ERR_(winediag)("Forcing sample count to %u. This may not be compatible with all applications.\n",
wined3d_settings.sample_count);
if (!get_config_key(hkey, appkey, "StrictDrawOrdering", buffer, size)
&& !strcmp(buffer,"enabled"))
{
ERR_(winediag)("\"StrictDrawOrdering\" is deprecated, please use \"csmt\" instead.");
TRACE("Enforcing strict draw ordering.\n");
wined3d_settings.strict_draw_ordering = TRUE;
}
if (!get_config_key(hkey, appkey, "AlwaysOffscreen", buffer, size)
&& !strcmp(buffer,"disabled"))
if (!get_config_key(hkey, appkey, "CheckFloatConstants", buffer, size)
&& !strcmp(buffer, "enabled"))
{
TRACE("Not always rendering backbuffers offscreen.\n");
wined3d_settings.always_offscreen = FALSE;
TRACE("Checking relative addressing indices in float constants.\n");
wined3d_settings.check_float_constants = TRUE;
}
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, "MaxShaderModelHS", &wined3d_settings.max_sm_hs))
TRACE("Limiting HS shader model to %u.\n", wined3d_settings.max_sm_hs);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelDS", &wined3d_settings.max_sm_ds))
TRACE("Limiting DS shader model to %u.\n", wined3d_settings.max_sm_ds);
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 (!get_config_key_dword(hkey, appkey, "MaxShaderModelCS", &wined3d_settings.max_sm_cs))
TRACE("Limiting CS shader model to %u.\n", wined3d_settings.max_sm_cs);
if (!get_config_key(hkey, appkey, "DirectDrawRenderer", buffer, size)
&& !strcmp(buffer, "gdi"))
{
TRACE("Disabling 3D support.\n");
wined3d_settings.no_3d = TRUE;
}
#if defined(STAGING_CSMT)
if (!get_config_key(hkey, appkey, "CSMT", buffer, size)
&& !strcmp(buffer,"disabled"))
{
TRACE("Disabling multithreaded command stream.\n");
wined3d_settings.cs_multithreaded = FALSE;
}
if (!get_config_key(hkey, appkey, "ignore_rt_map", buffer, size)
&& !strcmp(buffer,"enabled"))
{
TRACE("Ignoring render target maps.\n");
wined3d_settings.ignore_rt_map = TRUE;
}
}
FIXME_(winediag)("Experimental wined3d CSMT feature is currently %s.\n",
wined3d_settings.cs_multithreaded ? "enabled" : "disabled");
#else /* STAGING_CSMT */
}
#endif /* STAGING_CSMT */
if (appkey) RegCloseKey( appkey );
if (hkey) RegCloseKey( hkey );
@@ -456,23 +442,12 @@ BOOL wined3d_register_window(HWND window, struct wined3d_device *device)
return TRUE;
}
if (wndproc_table.size == wndproc_table.count)
if (!wined3d_array_reserve((void **)&wndproc_table.entries, &wndproc_table.size,
wndproc_table.count + 1, sizeof(*entry)))
{
unsigned int new_size = max(1, wndproc_table.size * 2);
struct wined3d_wndproc *new_entries;
if (!wndproc_table.entries) new_entries = HeapAlloc(GetProcessHeap(), 0, new_size * sizeof(*new_entries));
else new_entries = HeapReAlloc(GetProcessHeap(), 0, wndproc_table.entries, new_size * sizeof(*new_entries));
if (!new_entries)
{
wined3d_wndproc_mutex_unlock();
ERR("Failed to grow table.\n");
return FALSE;
}
wndproc_table.entries = new_entries;
wndproc_table.size = new_size;
wined3d_wndproc_mutex_unlock();
ERR("Failed to grow table.\n");
return FALSE;
}
entry = &wndproc_table.entries[wndproc_table.count++];
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -22,13 +22,13 @@ reactos/sdk/tools/wpp # Synced to WineStaging-2.9
The following libraries are shared with Wine.
reactos/dll/directx/wine/amstream # Synced to WineStaging-2.9
reactos/dll/directx/wine/d3d8 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3d9 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3d8 # Synced to WineStaging-2.9
reactos/dll/directx/wine/d3d9 # Synced to WineStaging-2.9
reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3drm # Synced to WineStaging-2.9
reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-2.9
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/ddraw # Synced to WineStaging-2.9
reactos/dll/directx/wine/devenum # Synced to WineStaging-2.9
reactos/dll/directx/wine/dinput # Synced to WineStaging-2.9
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-2.9
@@ -40,7 +40,7 @@ reactos/dll/directx/wine/dxdiagn # Synced to WineStaging-2.9
reactos/dll/directx/wine/msdmo # Synced to WineStaging-2.9
reactos/dll/directx/wine/qedit # Synced to WineStaging-2.9
reactos/dll/directx/wine/quartz # Synced to WineStaging-2.9
reactos/dll/directx/wine/wined3d # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/wined3d # Synced to WineStaging-2.9
reactos/dll/win32/activeds # Synced to WineStaging-2.9
reactos/dll/win32/actxprxy # Synced to WineStaging-2.9
File diff suppressed because it is too large Load Diff
+50 -5
View File
@@ -7,7 +7,7 @@
#define WINE_GLAPI
#endif
#define WINE_WGL_DRIVER_VERSION 13
#define WINE_WGL_DRIVER_VERSION 15
struct wgl_context;
struct wgl_pbuffer;
@@ -381,6 +381,7 @@ struct opengl_funcs
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);
void (WINE_GLAPI *p_glAlphaFuncxOES)(GLenum,GLfixed);
void (WINE_GLAPI *p_glApplyFramebufferAttachmentCMAAINTEL)(void);
void (WINE_GLAPI *p_glApplyTextureEXT)(GLenum);
GLboolean (WINE_GLAPI *p_glAreProgramsResidentNV)(GLsizei,const GLuint*,GLboolean*);
GLboolean (WINE_GLAPI *p_glAreTexturesResidentEXT)(GLsizei,const GLuint*,GLboolean*);
@@ -526,7 +527,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glClearNamedBufferDataEXT)(GLuint,GLenum,GLenum,GLenum,const void*);
void (WINE_GLAPI *p_glClearNamedBufferSubData)(GLuint,GLenum,GLintptr,GLsizeiptr,GLenum,GLenum,const void*);
void (WINE_GLAPI *p_glClearNamedBufferSubDataEXT)(GLuint,GLenum,GLsizeiptr,GLsizeiptr,GLenum,GLenum,const void*);
void (WINE_GLAPI *p_glClearNamedFramebufferfi)(GLuint,GLenum,const GLfloat,GLint);
void (WINE_GLAPI *p_glClearNamedFramebufferfi)(GLuint,GLenum,GLint,GLfloat,GLint);
void (WINE_GLAPI *p_glClearNamedFramebufferfv)(GLuint,GLenum,GLint,const GLfloat*);
void (WINE_GLAPI *p_glClearNamedFramebufferiv)(GLuint,GLenum,GLint,const GLint*);
void (WINE_GLAPI *p_glClearNamedFramebufferuiv)(GLuint,GLenum,GLint,const GLuint*);
@@ -617,6 +618,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glCompressedTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*);
void (WINE_GLAPI *p_glCompressedTextureSubImage3D)(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*);
void (WINE_GLAPI *p_glCompressedTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*);
void (WINE_GLAPI *p_glConservativeRasterParameterfNV)(GLenum,GLfloat);
void (WINE_GLAPI *p_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
void (WINE_GLAPI *p_glConvolutionFilter1DEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
void (WINE_GLAPI *p_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*);
@@ -836,6 +838,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glEvalCoord2xOES)(GLfixed,GLfixed);
void (WINE_GLAPI *p_glEvalCoord2xvOES)(const GLfixed*);
void (WINE_GLAPI *p_glEvalMapsNV)(GLenum,GLenum);
void (WINE_GLAPI *p_glEvaluateDepthValuesARB)(void);
void (WINE_GLAPI *p_glExecuteProgramNV)(GLenum,GLuint,const GLfloat*);
void (WINE_GLAPI *p_glExtractComponentEXT)(GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glFeedbackBufferxOES)(GLsizei,GLenum,const GLfixed*);
@@ -894,6 +897,7 @@ struct opengl_funcs
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);
void (WINE_GLAPI *p_glFramebufferSampleLocationsfvARB)(GLenum,GLuint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glFramebufferSampleLocationsfvNV)(GLenum,GLuint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glFramebufferTexture)(GLenum,GLenum,GLuint,GLint);
void (WINE_GLAPI *p_glFramebufferTexture1D)(GLenum,GLenum,GLenum,GLuint,GLint);
@@ -909,6 +913,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glFramebufferTextureLayer)(GLenum,GLenum,GLuint,GLint,GLint);
void (WINE_GLAPI *p_glFramebufferTextureLayerARB)(GLenum,GLenum,GLuint,GLint,GLint);
void (WINE_GLAPI *p_glFramebufferTextureLayerEXT)(GLenum,GLenum,GLuint,GLint,GLint);
void (WINE_GLAPI *p_glFramebufferTextureMultiviewOVR)(GLenum,GLenum,GLuint,GLint,GLint,GLsizei);
void (WINE_GLAPI *p_glFreeObjectBufferATI)(GLuint);
void (WINE_GLAPI *p_glFrustumfOES)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat);
void (WINE_GLAPI *p_glFrustumxOES)(GLfixed,GLfixed,GLfixed,GLfixed,GLfixed,GLfixed);
@@ -1268,9 +1273,11 @@ struct opengl_funcs
void (WINE_GLAPI *p_glGetUniformdv)(GLuint,GLint,GLdouble*);
void (WINE_GLAPI *p_glGetUniformfv)(GLuint,GLint,GLfloat*);
void (WINE_GLAPI *p_glGetUniformfvARB)(GLhandleARB,GLint,GLfloat*);
void (WINE_GLAPI *p_glGetUniformi64vARB)(GLuint,GLint,GLint64*);
void (WINE_GLAPI *p_glGetUniformi64vNV)(GLuint,GLint,GLint64EXT*);
void (WINE_GLAPI *p_glGetUniformiv)(GLuint,GLint,GLint*);
void (WINE_GLAPI *p_glGetUniformivARB)(GLhandleARB,GLint,GLint*);
void (WINE_GLAPI *p_glGetUniformui64vARB)(GLuint,GLint,GLuint64*);
void (WINE_GLAPI *p_glGetUniformui64vNV)(GLuint,GLint,GLuint64EXT*);
void (WINE_GLAPI *p_glGetUniformuiv)(GLuint,GLint,GLuint*);
void (WINE_GLAPI *p_glGetUniformuivEXT)(GLuint,GLint,GLuint*);
@@ -1351,8 +1358,10 @@ struct opengl_funcs
void (WINE_GLAPI *p_glGetnUniformdvARB)(GLuint,GLint,GLsizei,GLdouble*);
void (WINE_GLAPI *p_glGetnUniformfv)(GLuint,GLint,GLsizei,GLfloat*);
void (WINE_GLAPI *p_glGetnUniformfvARB)(GLuint,GLint,GLsizei,GLfloat*);
void (WINE_GLAPI *p_glGetnUniformi64vARB)(GLuint,GLint,GLsizei,GLint64*);
void (WINE_GLAPI *p_glGetnUniformiv)(GLuint,GLint,GLsizei,GLint*);
void (WINE_GLAPI *p_glGetnUniformivARB)(GLuint,GLint,GLsizei,GLint*);
void (WINE_GLAPI *p_glGetnUniformui64vARB)(GLuint,GLint,GLsizei,GLuint64*);
void (WINE_GLAPI *p_glGetnUniformuiv)(GLuint,GLint,GLsizei,GLuint*);
void (WINE_GLAPI *p_glGetnUniformuivARB)(GLuint,GLint,GLsizei,GLuint*);
void (WINE_GLAPI *p_glGlobalAlphaFactorbSUN)(GLbyte);
@@ -1521,6 +1530,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glMatrixScalefEXT)(GLenum,GLfloat,GLfloat,GLfloat);
void (WINE_GLAPI *p_glMatrixTranslatedEXT)(GLenum,GLdouble,GLdouble,GLdouble);
void (WINE_GLAPI *p_glMatrixTranslatefEXT)(GLenum,GLfloat,GLfloat,GLfloat);
void (WINE_GLAPI *p_glMaxShaderCompilerThreadsARB)(GLuint);
void (WINE_GLAPI *p_glMemoryBarrier)(GLbitfield);
void (WINE_GLAPI *p_glMemoryBarrierByRegion)(GLbitfield);
void (WINE_GLAPI *p_glMemoryBarrierEXT)(GLbitfield);
@@ -1723,6 +1733,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glNamedFramebufferReadBuffer)(GLuint,GLenum);
void (WINE_GLAPI *p_glNamedFramebufferRenderbuffer)(GLuint,GLenum,GLenum,GLuint);
void (WINE_GLAPI *p_glNamedFramebufferRenderbufferEXT)(GLuint,GLenum,GLenum,GLuint);
void (WINE_GLAPI *p_glNamedFramebufferSampleLocationsfvARB)(GLuint,GLuint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glNamedFramebufferSampleLocationsfvNV)(GLuint,GLuint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glNamedFramebufferTexture)(GLuint,GLenum,GLuint,GLint);
void (WINE_GLAPI *p_glNamedFramebufferTexture1DEXT)(GLuint,GLenum,GLenum,GLuint,GLint);
@@ -1847,6 +1858,7 @@ struct opengl_funcs
void (WINE_GLAPI *p_glPopGroupMarkerEXT)(void);
void (WINE_GLAPI *p_glPresentFrameDualFillNV)(GLuint,GLuint64EXT,GLuint,GLuint,GLenum,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint,GLenum,GLuint);
void (WINE_GLAPI *p_glPresentFrameKeyedNV)(GLuint,GLuint64EXT,GLuint,GLuint,GLenum,GLenum,GLuint,GLuint,GLenum,GLuint,GLuint);
void (WINE_GLAPI *p_glPrimitiveBoundingBoxARB)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat);
void (WINE_GLAPI *p_glPrimitiveRestartIndex)(GLuint);
void (WINE_GLAPI *p_glPrimitiveRestartIndexNV)(GLuint);
void (WINE_GLAPI *p_glPrimitiveRestartNV)(void);
@@ -1903,13 +1915,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glProgramUniform1fv)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform1fvEXT)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform1i)(GLuint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform1i64ARB)(GLuint,GLint,GLint64);
void (WINE_GLAPI *p_glProgramUniform1i64NV)(GLuint,GLint,GLint64EXT);
void (WINE_GLAPI *p_glProgramUniform1i64vARB)(GLuint,GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glProgramUniform1i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glProgramUniform1iEXT)(GLuint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform1iv)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform1ivEXT)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform1ui)(GLuint,GLint,GLuint);
void (WINE_GLAPI *p_glProgramUniform1ui64ARB)(GLuint,GLint,GLuint64);
void (WINE_GLAPI *p_glProgramUniform1ui64NV)(GLuint,GLint,GLuint64EXT);
void (WINE_GLAPI *p_glProgramUniform1ui64vARB)(GLuint,GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glProgramUniform1ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glProgramUniform1uiEXT)(GLuint,GLint,GLuint);
void (WINE_GLAPI *p_glProgramUniform1uiv)(GLuint,GLint,GLsizei,const GLuint*);
@@ -1923,13 +1939,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glProgramUniform2fv)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform2fvEXT)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform2i)(GLuint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform2i64ARB)(GLuint,GLint,GLint64,GLint64);
void (WINE_GLAPI *p_glProgramUniform2i64NV)(GLuint,GLint,GLint64EXT,GLint64EXT);
void (WINE_GLAPI *p_glProgramUniform2i64vARB)(GLuint,GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glProgramUniform2i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glProgramUniform2iEXT)(GLuint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform2iv)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform2ivEXT)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform2ui)(GLuint,GLint,GLuint,GLuint);
void (WINE_GLAPI *p_glProgramUniform2ui64ARB)(GLuint,GLint,GLuint64,GLuint64);
void (WINE_GLAPI *p_glProgramUniform2ui64NV)(GLuint,GLint,GLuint64EXT,GLuint64EXT);
void (WINE_GLAPI *p_glProgramUniform2ui64vARB)(GLuint,GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glProgramUniform2ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glProgramUniform2uiEXT)(GLuint,GLint,GLuint,GLuint);
void (WINE_GLAPI *p_glProgramUniform2uiv)(GLuint,GLint,GLsizei,const GLuint*);
@@ -1943,13 +1963,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glProgramUniform3fv)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform3fvEXT)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform3i)(GLuint,GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform3i64ARB)(GLuint,GLint,GLint64,GLint64,GLint64);
void (WINE_GLAPI *p_glProgramUniform3i64NV)(GLuint,GLint,GLint64EXT,GLint64EXT,GLint64EXT);
void (WINE_GLAPI *p_glProgramUniform3i64vARB)(GLuint,GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glProgramUniform3i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glProgramUniform3iEXT)(GLuint,GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform3iv)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform3ivEXT)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform3ui)(GLuint,GLint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glProgramUniform3ui64ARB)(GLuint,GLint,GLuint64,GLuint64,GLuint64);
void (WINE_GLAPI *p_glProgramUniform3ui64NV)(GLuint,GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT);
void (WINE_GLAPI *p_glProgramUniform3ui64vARB)(GLuint,GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glProgramUniform3ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glProgramUniform3uiEXT)(GLuint,GLint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glProgramUniform3uiv)(GLuint,GLint,GLsizei,const GLuint*);
@@ -1963,13 +1987,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glProgramUniform4fv)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform4fvEXT)(GLuint,GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glProgramUniform4i)(GLuint,GLint,GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform4i64ARB)(GLuint,GLint,GLint64,GLint64,GLint64,GLint64);
void (WINE_GLAPI *p_glProgramUniform4i64NV)(GLuint,GLint,GLint64EXT,GLint64EXT,GLint64EXT,GLint64EXT);
void (WINE_GLAPI *p_glProgramUniform4i64vARB)(GLuint,GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glProgramUniform4i64vNV)(GLuint,GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glProgramUniform4iEXT)(GLuint,GLint,GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glProgramUniform4iv)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform4ivEXT)(GLuint,GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glProgramUniform4ui)(GLuint,GLint,GLuint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glProgramUniform4ui64ARB)(GLuint,GLint,GLuint64,GLuint64,GLuint64,GLuint64);
void (WINE_GLAPI *p_glProgramUniform4ui64NV)(GLuint,GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT,GLuint64EXT);
void (WINE_GLAPI *p_glProgramUniform4ui64vARB)(GLuint,GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glProgramUniform4ui64vNV)(GLuint,GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glProgramUniform4uiEXT)(GLuint,GLint,GLuint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glProgramUniform4uiv)(GLuint,GLint,GLsizei,const GLuint*);
@@ -2080,7 +2108,6 @@ struct opengl_funcs
void (WINE_GLAPI *p_glRotatexOES)(GLfixed,GLfixed,GLfixed,GLfixed);
void (WINE_GLAPI *p_glSampleCoverage)(GLfloat,GLboolean);
void (WINE_GLAPI *p_glSampleCoverageARB)(GLfloat,GLboolean);
void (WINE_GLAPI *p_glSampleCoverageOES)(GLfixed,GLboolean);
void (WINE_GLAPI *p_glSampleMapATI)(GLuint,GLuint,GLenum);
void (WINE_GLAPI *p_glSampleMaskEXT)(GLclampf,GLboolean);
void (WINE_GLAPI *p_glSampleMaskIndexedNV)(GLuint,GLbitfield);
@@ -2355,13 +2382,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glUniform1fv)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform1fvARB)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform1i)(GLint,GLint);
void (WINE_GLAPI *p_glUniform1i64ARB)(GLint,GLint64);
void (WINE_GLAPI *p_glUniform1i64NV)(GLint,GLint64EXT);
void (WINE_GLAPI *p_glUniform1i64vARB)(GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glUniform1i64vNV)(GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glUniform1iARB)(GLint,GLint);
void (WINE_GLAPI *p_glUniform1iv)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform1ivARB)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform1ui)(GLint,GLuint);
void (WINE_GLAPI *p_glUniform1ui64ARB)(GLint,GLuint64);
void (WINE_GLAPI *p_glUniform1ui64NV)(GLint,GLuint64EXT);
void (WINE_GLAPI *p_glUniform1ui64vARB)(GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glUniform1ui64vNV)(GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glUniform1uiEXT)(GLint,GLuint);
void (WINE_GLAPI *p_glUniform1uiv)(GLint,GLsizei,const GLuint*);
@@ -2373,13 +2404,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glUniform2fv)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform2fvARB)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform2i)(GLint,GLint,GLint);
void (WINE_GLAPI *p_glUniform2i64ARB)(GLint,GLint64,GLint64);
void (WINE_GLAPI *p_glUniform2i64NV)(GLint,GLint64EXT,GLint64EXT);
void (WINE_GLAPI *p_glUniform2i64vARB)(GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glUniform2i64vNV)(GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glUniform2iARB)(GLint,GLint,GLint);
void (WINE_GLAPI *p_glUniform2iv)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform2ivARB)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform2ui)(GLint,GLuint,GLuint);
void (WINE_GLAPI *p_glUniform2ui64ARB)(GLint,GLuint64,GLuint64);
void (WINE_GLAPI *p_glUniform2ui64NV)(GLint,GLuint64EXT,GLuint64EXT);
void (WINE_GLAPI *p_glUniform2ui64vARB)(GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glUniform2ui64vNV)(GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glUniform2uiEXT)(GLint,GLuint,GLuint);
void (WINE_GLAPI *p_glUniform2uiv)(GLint,GLsizei,const GLuint*);
@@ -2391,13 +2426,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glUniform3fv)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform3fvARB)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform3i)(GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glUniform3i64ARB)(GLint,GLint64,GLint64,GLint64);
void (WINE_GLAPI *p_glUniform3i64NV)(GLint,GLint64EXT,GLint64EXT,GLint64EXT);
void (WINE_GLAPI *p_glUniform3i64vARB)(GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glUniform3i64vNV)(GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glUniform3iARB)(GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glUniform3iv)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform3ivARB)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform3ui)(GLint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glUniform3ui64ARB)(GLint,GLuint64,GLuint64,GLuint64);
void (WINE_GLAPI *p_glUniform3ui64NV)(GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT);
void (WINE_GLAPI *p_glUniform3ui64vARB)(GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glUniform3ui64vNV)(GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glUniform3uiEXT)(GLint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glUniform3uiv)(GLint,GLsizei,const GLuint*);
@@ -2409,13 +2448,17 @@ struct opengl_funcs
void (WINE_GLAPI *p_glUniform4fv)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform4fvARB)(GLint,GLsizei,const GLfloat*);
void (WINE_GLAPI *p_glUniform4i)(GLint,GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glUniform4i64ARB)(GLint,GLint64,GLint64,GLint64,GLint64);
void (WINE_GLAPI *p_glUniform4i64NV)(GLint,GLint64EXT,GLint64EXT,GLint64EXT,GLint64EXT);
void (WINE_GLAPI *p_glUniform4i64vARB)(GLint,GLsizei,const GLint64*);
void (WINE_GLAPI *p_glUniform4i64vNV)(GLint,GLsizei,const GLint64EXT*);
void (WINE_GLAPI *p_glUniform4iARB)(GLint,GLint,GLint,GLint,GLint);
void (WINE_GLAPI *p_glUniform4iv)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform4ivARB)(GLint,GLsizei,const GLint*);
void (WINE_GLAPI *p_glUniform4ui)(GLint,GLuint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glUniform4ui64ARB)(GLint,GLuint64,GLuint64,GLuint64,GLuint64);
void (WINE_GLAPI *p_glUniform4ui64NV)(GLint,GLuint64EXT,GLuint64EXT,GLuint64EXT,GLuint64EXT);
void (WINE_GLAPI *p_glUniform4ui64vARB)(GLint,GLsizei,const GLuint64*);
void (WINE_GLAPI *p_glUniform4ui64vNV)(GLint,GLsizei,const GLuint64EXT*);
void (WINE_GLAPI *p_glUniform4uiEXT)(GLint,GLuint,GLuint,GLuint,GLuint);
void (WINE_GLAPI *p_glUniform4uiv)(GLint,GLsizei,const GLuint*);
@@ -2897,14 +2940,16 @@ struct opengl_funcs
BOOL (WINE_GLAPI *p_wglGetPixelFormatAttribivARB)(HDC,int,int,UINT,const int*,int*);
int (WINE_GLAPI *p_wglGetSwapIntervalEXT)(void);
BOOL (WINE_GLAPI *p_wglMakeContextCurrentARB)(HDC,HDC,struct wgl_context *);
BOOL (WINE_GLAPI *p_wglQueryCurrentRendererIntegerWINE)(GLenum,GLuint *);
const GLchar * (WINE_GLAPI *p_wglQueryCurrentRendererStringWINE)(GLenum);
BOOL (WINE_GLAPI *p_wglQueryPbufferARB)(struct wgl_pbuffer *,int,int*);
BOOL (WINE_GLAPI *p_wglQueryRendererIntegerWINE)(HDC,GLint,GLenum,GLuint *);
const GLchar * (WINE_GLAPI *p_wglQueryRendererStringWINE)(HDC,GLint,GLenum);
int (WINE_GLAPI *p_wglReleasePbufferDCARB)(struct wgl_pbuffer *,HDC);
BOOL (WINE_GLAPI *p_wglReleaseTexImageARB)(struct wgl_pbuffer *,int);
BOOL (WINE_GLAPI *p_wglSetPbufferAttribARB)(struct wgl_pbuffer *,const int*);
BOOL (WINE_GLAPI *p_wglSetPixelFormatWINE)(HDC,int);
BOOL (WINE_GLAPI *p_wglSwapIntervalEXT)(int);
BOOL (WINE_GLAPI *p_wglGetPCIInfoWINE)(unsigned int *, unsigned int *);
BOOL (WINE_GLAPI *p_wglGetMemoryInfoWINE)(unsigned int *);
} ext;
};
File diff suppressed because it is too large Load Diff