device.c revision 35dfd86e4de7b13cc0bc6dedfd6900b898c52c82
/*
* Copyright 2002 Lionel Ulmer
* Copyright 2002-2005 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
* Copyright 2006-2008 Stefan Dösinger for CodeWeavers
* Copyright 2006-2008 Henri Verbeet
* Copyright 2007 Andrew Riedi
* Copyright 2009-2011 Henri Verbeet for CodeWeavers
*
* 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
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include <stdio.h>
#ifdef HAVE_FLOAT_H
# include <float.h>
#endif
#include "wined3d_private.h"
/* Define the default light parameters as specified by MSDN. */
const struct wined3d_light WINED3D_default_light =
{
WINED3D_LIGHT_DIRECTIONAL, /* Type */
{ 1.0f, 1.0f, 1.0f, 0.0f }, /* Diffuse r,g,b,a */
{ 0.0f, 0.0f, 0.0f, 0.0f }, /* Specular r,g,b,a */
{ 0.0f, 0.0f, 0.0f, 0.0f }, /* Ambient r,g,b,a, */
{ 0.0f, 0.0f, 0.0f }, /* Position x,y,z */
{ 0.0f, 0.0f, 1.0f }, /* Direction x,y,z */
0.0f, /* Range */
0.0f, /* Falloff */
0.0f, 0.0f, 0.0f, /* Attenuation 0,1,2 */
0.0f, /* Theta */
0.0f /* Phi */
};
/* Note that except for WINED3DPT_POINTLIST and WINED3DPT_LINELIST these
* actually have the same values in GL and D3D. */
{
switch(primitive_type)
{
case WINED3D_PT_POINTLIST:
return GL_POINTS;
case WINED3D_PT_LINELIST:
return GL_LINES;
case WINED3D_PT_LINESTRIP:
return GL_LINE_STRIP;
case WINED3D_PT_TRIANGLELIST:
return GL_TRIANGLES;
case WINED3D_PT_TRIANGLESTRIP:
return GL_TRIANGLE_STRIP;
case WINED3D_PT_TRIANGLEFAN:
return GL_TRIANGLE_FAN;
case WINED3D_PT_LINELIST_ADJ:
return GL_LINES_ADJACENCY_ARB;
case WINED3D_PT_LINESTRIP_ADJ:
return GL_LINE_STRIP_ADJACENCY_ARB;
return GL_TRIANGLES_ADJACENCY_ARB;
return GL_TRIANGLE_STRIP_ADJACENCY_ARB;
default:
return GL_NONE;
}
}
{
switch(primitive_type)
{
case GL_POINTS:
return WINED3D_PT_POINTLIST;
case GL_LINES:
return WINED3D_PT_LINELIST;
case GL_LINE_STRIP:
return WINED3D_PT_LINESTRIP;
case GL_TRIANGLES:
return WINED3D_PT_TRIANGLELIST;
case GL_TRIANGLE_STRIP:
return WINED3D_PT_TRIANGLESTRIP;
case GL_TRIANGLE_FAN:
return WINED3D_PT_TRIANGLEFAN;
case GL_LINES_ADJACENCY_ARB:
return WINED3D_PT_LINELIST_ADJ;
return WINED3D_PT_LINESTRIP_ADJ;
return WINED3D_PT_TRIANGLELIST_ADJ;
return WINED3D_PT_TRIANGLESTRIP_ADJ;
default:
return WINED3D_PT_UNDEFINED;
}
}
{
else
{
*regnum = ~0U;
return FALSE;
}
return TRUE;
}
/* Context activation is done by the caller. */
static void device_stream_info_from_declaration(struct wined3d_device *device, struct wined3d_stream_info *stream_info)
{
/* We need to deal with frequency data! */
unsigned int i;
stream_info->use_map = 0;
stream_info->swizzle_map = 0;
/* Check for transformed vertices, disable vertex shader if present. */
/* Translate the declaration into strided data. */
for (i = 0; i < declaration->element_count; ++i)
{
struct wined3d_bo_address data;
unsigned int idx;
if (!buffer) continue;
/* We can't use VBOs if the base vertex index is negative. OpenGL
* doesn't accept negative offsets (or rather offsets bigger than the
* VBO, because the pointer is unsigned), so use system memory
* sources. In most sane cases the pointer - offset will still be > 0,
* otherwise it will wrap around to some big value. Hope that with the
* indices, the driver wraps it back internally. If not,
* drawStridedSlow() is needed, including a vertex buffer path. */
if (state->load_base_vertex_index < 0)
{
WARN_(d3d_perf)("load_base_vertex_index is < 0 (%d), not using VBOs.\n", state->load_base_vertex_index);
data.buffer_object = 0;
FIXME("System memory vertex data load offset is negative!\n");
}
TRACE("offset %u input_slot %u usage_idx %d\n", element->offset, element->input_slot, element->usage_idx);
if (use_vshader)
{
if (element->output_slot == ~0U)
{
/* TODO: Assuming vertexdeclarations are usually used with the
* same or a similar shader, it might be worth it to store the
* last used output slot and try that one first. */
}
else
{
stride_used = TRUE;
}
}
else
{
{
WARN("Skipping unsupported fixed function element of format %s and usage %s\n",
stride_used = FALSE;
}
else
{
}
}
if (stride_used)
{
TRACE("Load %s array %u [usage %s, usage_idx %u, "
"input_slot %u, offset %u, stride %u, format %s, buffer_object %u]\n",
#ifdef VBOX_WITH_WINE_FIX_BUFOFFSET
#endif
{
}
}
}
/* Preload the vertex buffers. */
device->num_buffer_queries = 0;
{
struct wined3d_stream_info_element *element;
struct wined3d_buffer *buffer;
if (!(map & 1))
continue;
/* If the preload dropped the buffer object, update the stream info. */
if (
#endif
{
element->data.addr = buffer_get_sysmem(buffer, &device->adapter->gl_info) + (ptrdiff_t)element->data.addr;
}
if (!buffer->buffer_object)
stream_info->all_vbo = 0;
}
}
/* Context activation is done by the caller. */
void device_update_stream_info(struct wined3d_device *device, const struct wined3d_gl_info *gl_info)
{
TRACE("============================= Vertex Declaration =============================\n");
{
{
TRACE("Using drawStridedSlow with vertex shaders for FLOAT16 conversion.\n");
}
else
{
}
}
else
{
else
}
}
{
struct wined3d_texture *texture;
enum WINED3DSRGB srgb;
}
{
unsigned int i;
{
for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i)
{
}
}
{
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
{
}
}
else
{
{
if (ffu_map & 1)
}
}
}
{
struct wined3d_context **new_array;
if (!new_array)
{
ERR("Failed to grow the context array.\n");
return FALSE;
}
return TRUE;
}
{
struct wined3d_context **new_array;
UINT i;
for (i = 0; i < device->context_count; ++i)
{
{
break;
}
}
if (!found)
{
return;
}
if (!--device->context_count)
{
return;
}
memmove(&device->contexts[i], &device->contexts[i + 1], (device->context_count - i) * sizeof(*device->contexts));
new_array = HeapReAlloc(GetProcessHeap(), 0, device->contexts, device->context_count * sizeof(*device->contexts));
if (!new_array)
{
ERR("Failed to shrink context array. Oh well.\n");
return;
}
}
/* Do not call while under the GL lock. */
{
if (device->onscreen_depth_stencil)
{
}
}
static BOOL is_full_clear(const struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect)
{
/* partial draw rect */
return FALSE;
/* partial clear rect */
return FALSE;
return TRUE;
}
{
RECT current_rect, r;
{
/* Depth buffer was discarded, make it entirely current in its new location since
* there is no other place where we would get data anyway. */
return;
}
SetRect(¤t_rect, 0, 0,
else
{
/* current_rect ⊇ draw_rect, modify only. */
return;
}
if (EqualRect(&r, ¤t_rect))
{
/* draw_rect ⊇ current_rect, test if we're doing a full clear. */
if (!clear_rect)
{
/* Full clear, modify only. */
return;
}
{
/* clear_rect ⊇ draw_rect, modify only. */
return;
}
}
/* Full load. */
}
/* Do not call while under the GL lock. */
void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color,
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
GLbitfield clear_mask = 0;
unsigned int i;
/* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the
* drawable. After the clear we'll mark the drawable up to date, so we have to make sure that this is true
* for the cleared parts, and the untouched parts.
*
* If we're clearing the whole target there is no need to copy it into the drawable, it will be overwritten
* anyway. If we're not clearing the color buffer we don't have to copy either since we're not going to set
* the drawable up to date. We have to check all settings that limit the clear area though. Do not bother
* checking all this if the dest surface is in the drawable anyway. */
{
for (i = 0; i < rt_count; ++i)
{
if (rt)
}
}
{
WARN("Invalid context, skipping clear.\n");
return;
}
if (target)
{
}
else
{
}
if (flags & WINED3DCLEAR_ZBUFFER)
{
}
{
WARN("Failed to apply clear state, skipping clear.\n");
return;
}
/* Only set the values up once, as they are not changing. */
if (flags & WINED3DCLEAR_STENCIL)
{
{
}
checkGLcall("glClearStencil");
}
if (flags & WINED3DCLEAR_ZBUFFER)
{
checkGLcall("glClearDepth");
}
if (flags & WINED3DCLEAR_TARGET)
{
for (i = 0; i < rt_count; ++i)
{
if (rt)
}
checkGLcall("glClearColor");
}
if (!clear_rect)
{
if (render_offscreen)
{
}
else
{
}
checkGLcall("glScissor");
checkGLcall("glClear");
}
else
{
/* Now process each rect in turn. */
for (i = 0; i < rect_count; ++i)
{
TRACE("clear_rect[%u] %s, current_rect %s.\n", i,
wine_dbgstr_rect(&clear_rect[i]),
/* Tests show that rectangles where x1 > x2 or y1 > y2 are ignored silently.
* The rectangle is not cleared, no error is returned, but further rectangles are
* still cleared if they are valid. */
{
TRACE("Rectangle with negative dimensions, ignoring.\n");
continue;
}
if (render_offscreen)
{
}
else
{
}
checkGLcall("glScissor");
checkGLcall("glClear");
}
}
}
{
return refcount;
}
{
if (!refcount)
{
struct wined3d_stateblock *stateblock;
UINT i;
FIXME("Something's still holding the update stateblock.\n");
FIXME("Something's still holding the stateblock.\n");
{
}
{
struct wined3d_resource *resource;
FIXME("Device released with resources still bound, acceptable but unexpected.\n");
{
FIXME("Leftover resource %p with type %s (%#x).\n",
}
}
ERR("Context array not freed!\n");
if (device->hardwareCursor)
device->hardwareCursor = 0;
}
return refcount;
}
{
return device->swapchain_count;
}
struct wined3d_swapchain * CDECL wined3d_device_get_swapchain(const struct wined3d_device *device, UINT swapchain_idx)
{
{
WARN("swapchain_idx %u >= swapchain_count %u.\n",
return NULL;
}
}
#ifndef VBOX
{
struct wined3d_color_key color_key;
if(hbm)
{
}
else
{
/* Create a 32x32 white surface to indicate that wined3d is used, but the specified image
* couldn't be loaded
*/
}
{
goto out;
}
if (dcb)
{
goto out;
}
else
{
/* Fill the surface with a white color to show that wined3d is there */
}
out:
}
#endif
/* Context activation is done by the caller. */
{
unsigned int i, j, count;
/* Under DirectX you can sample even if no texture is bound, whereas
* OpenGL will only allow that when a valid texture is bound.
* We emulate this by creating dummy textures and binding them
* to each texture stage when the currently set D3D texture is NULL. */
{
/* The dummy texture does not have client storage backing */
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
}
for (i = 0; i < count; ++i)
{
/* Make appropriate texture active */
checkGLcall("glGenTextures");
checkGLcall("glBindTexture");
checkGLcall("glTexImage2D");
{
checkGLcall("glGenTextures");
checkGLcall("glBindTexture");
checkGLcall("glTexImage2D");
}
{
checkGLcall("glGenTextures");
checkGLcall("glBindTexture");
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, 0, GL_RGBA8, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &color));
checkGLcall("glTexImage3D");
}
{
checkGLcall("glGenTextures");
checkGLcall("glBindTexture");
for (j = GL_TEXTURE_CUBE_MAP_POSITIVE_X; j <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; ++j)
{
checkGLcall("glTexImage2D");
}
}
}
{
/* Re-enable because if supported it is enabled by default */
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
}
/* Context activation is done by the caller. */
static void destroy_dummy_textures(struct wined3d_device *device, const struct wined3d_gl_info *gl_info)
{
{
checkGLcall("glDeleteTextures(count, device->dummy_texture_cube)");
}
{
checkGLcall("glDeleteTextures(count, device->dummy_texture_3d)");
}
{
checkGLcall("glDeleteTextures(count, device->dummy_texture_rect)");
}
checkGLcall("glDeleteTextures(count, device->dummy_texture_2d)");
}
{
/* Make sure the window is managed, otherwise we won't get keyboard input. */
return style;
}
{
/* Filter out window decorations. */
return exstyle;
}
void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h)
{
{
ERR("Changing the window style for window %p, but another style (%08x, %08x) is already stored.\n",
}
TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n",
}
{
/* These flags are set by wined3d_device_setup_fullscreen_window, not the
* application, and we want to ignore them in the test below, since it's
* not the application's fault that they changed. Additionally, we want to
* preserve the current status of these flags (i.e. don't restore them) to
* more closely emulate the behavior of Direct3D, which leaves these flags
* alone when returning to windowed mode. */
TRACE("Restoring window style of window %p to %08x, %08x.\n",
/* Only restore the style if the application didn't modify it during the
* fullscreen phase. Some applications change it before calling Reset()
* when switching between windowed and fullscreen modes (HL2), some
* depend on the original style (Eve Online). */
{
}
SetWindowPos(window, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
/* Delete the old values. */
}
{
#ifndef VBOX_WITH_WDDM
{
return E_FAIL;
}
return WINED3D_OK;
#else
ERR("unsupported!");
return E_FAIL;
#endif
}
{
#ifndef VBOX_WITH_WDDM
#else
ERR("unsupported!");
#endif
}
struct wined3d_swapchain_desc *swapchain_desc)
{
struct wined3d_context *context;
if (device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
return WINED3DERR_INVALIDCALL;
#ifdef VBOX_WITH_WDDM
if (!swapchain_desc->pHgsmi)
{
ERR("hgsmi not specified!");
return WINED3DERR_INVALIDCALL;
}
#endif
/* Initialize the texture unit mapping to a 1:1 mapping */
{
{
}
else
{
}
}
{
TRACE("Shader private data couldn't be allocated\n");
goto err_out;
}
{
TRACE("Blitter private data couldn't be allocated\n");
goto err_out;
}
/* Setup the implicit swapchain. This also initializes a context. */
TRACE("Creating implicit swapchain\n");
{
WARN("Failed to create implicit swapchain\n");
goto err_out;
}
device->swapchains = HeapAlloc(GetProcessHeap(), 0, device->swapchain_count * sizeof(*device->swapchains));
if (!device->swapchains)
{
ERR("Out of memory!\n");
goto err_out;
}
{
}
else
{
}
/* Depth Stencil support */
/* Set up some starting GL setup */
/* Setup all the devices defaults */
switch (wined3d_settings.offscreen_rendering_mode)
{
case ORM_FBO:
break;
case ORM_BACKBUFFER:
{
if (context_get_current()->aux_buffers > 0)
{
TRACE("Using auxiliary buffer for offscreen rendering\n");
}
else
{
TRACE("Using back buffer for offscreen rendering\n");
}
}
}
TRACE("All defaults now set up, leaving 3D init.\n");
/* Clear the screen */
&black, 1.0f, 0);
#ifndef VBOX
if (wined3d_settings.logo)
#endif
return WINED3D_OK;
device->swapchain_count = 0;
if (swapchain)
if (device->shader_priv)
return hr;
}
struct wined3d_swapchain_desc *swapchain_desc)
{
/* Setup the implicit swapchain */
TRACE("Creating implicit swapchain\n");
{
WARN("Failed to create implicit swapchain\n");
goto err_out;
}
device->swapchains = HeapAlloc(GetProcessHeap(), 0, device->swapchain_count * sizeof(*device->swapchains));
if (!device->swapchains)
{
ERR("Out of memory!\n");
goto err_out;
}
return WINED3D_OK;
return hr;
}
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
struct wined3d_surface *surface;
UINT i;
if (!device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
#ifdef VBOX_WINE_WITH_PROFILE
#endif
/* Force making the context current again, to verify it is still valid
* (workaround for broken drivers) */
/* I don't think that the interface guarantees that the device is destroyed from the same thread
* it was created. Thus make sure a context is active for the glDelete* calls
*/
if (device->logo_surface)
/* Unload resources */
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
}
/* Delete the mouse cursor texture */
if (device->cursorTexture)
{
device->cursorTexture = 0;
}
/* Destroy the depth blt resources, they will be invalid after the reset. Also free shader
* private data, it might contain opengl pointers
*/
if (device->depth_blt_texture)
{
device->depth_blt_texture = 0;
}
#ifdef VBOX_WINE_WITH_SHADER_CACHE
#endif
/* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */
/* Release the buffers (with sanity checks)*/
if (device->onscreen_depth_stencil)
{
}
{
}
if (device->auto_depth_stencil)
{
}
{
}
TRACE("Setting rendertarget 0 to NULL\n");
for (i = 0; i < device->swapchain_count; ++i)
{
TRACE("Releasing the implicit swapchain %u.\n", i);
FIXME("Something's still holding the implicit swapchain.\n");
}
while (device->context_count)
{
}
#endif
device->swapchain_count = 0;
return WINED3D_OK;
}
{
unsigned int i;
for (i = 0; i < device->swapchain_count; ++i)
{
TRACE("Releasing the implicit swapchain %u.\n", i);
FIXME("Something's still holding the implicit swapchain.\n");
}
device->swapchain_count = 0;
return WINED3D_OK;
}
/* Enables thread safety in the wined3d device and its resources. Called by DirectDraw
* from SetCooperativeLevel if DDSCL_MULTITHREADED is specified, and by d3d8/9 from
* CreateDevice if D3DCREATE_MULTITHREADED is passed.
*
* There is no way to deactivate thread safety once it is enabled.
*/
{
/* For now just store the flag (needed in case of ddraw). */
}
{
#ifndef VBOX_WITH_WDDM
TRACE("Emulating %d MB, returning %d MB left.\n",
#else
ERR("unsupported!");
return ~0UL;
#endif
}
{
struct wined3d_buffer *prev_buffer;
if (idx >= MAX_STREAM_OUT)
{
return;
}
if (device->isRecordingState)
{
if (buffer)
if (prev_buffer)
return;
}
if (prev_buffer != buffer)
{
if (buffer)
{
}
if (prev_buffer)
{
}
}
}
{
if (idx >= MAX_STREAM_OUT)
{
return NULL;
}
}
{
struct wined3d_stream_state *stream;
struct wined3d_buffer *prev_buffer;
TRACE("device %p, stream_idx %u, buffer %p, offset %u, stride %u.\n",
if (stream_idx >= MAX_STREAMS)
{
return WINED3DERR_INVALIDCALL;
}
else if (offset & 0x3)
{
return WINED3DERR_INVALIDCALL;
}
if (prev_buffer == buffer
{
TRACE("Application is setting the old values over, nothing to do.\n");
return WINED3D_OK;
}
if (buffer)
{
}
/* Handle recording of state blocks. */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
if (buffer)
if (prev_buffer)
return WINED3D_OK;
}
if (buffer)
{
}
if (prev_buffer)
{
}
return WINED3D_OK;
}
{
struct wined3d_stream_state *stream;
TRACE("device %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
if (stream_idx >= MAX_STREAMS)
{
return WINED3DERR_INVALIDCALL;
}
if (*buffer)
if (offset)
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider)
{
struct wined3d_stream_state *stream;
/* Verify input. At least in d3d9 this is invalid. */
{
WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
{
WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
if (!divider)
{
WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
{
struct wined3d_stream_state *stream;
return WINED3D_OK;
}
{
TRACE("device %p, state %s, matrix %p.\n",
/* Handle recording of state blocks. */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
/* If the new matrix is the same as the current one,
* we cut off any further processing. this seems to be a reasonable
* optimization because as was noticed, some apps (warcraft3 for example)
* tend towards setting the same matrix repeatedly for some reason.
*
* From here on we assume that the new matrix is different, wherever it matters. */
{
TRACE("The application is setting the same matrix over again.\n");
return;
}
}
{
}
{
const struct wined3d_matrix *mat;
struct wined3d_matrix temp;
/* Note: Using 'updateStateBlock' rather than 'stateblock' in the code
* below means it will be recorded in a state block change, but it
* works regardless where it is recorded.
* If this is found to be wrong, change to StateBlock. */
if (state > HIGHEST_TRANSFORMSTATE)
{
return;
}
/* Apply change via set transform - will reapply to eg. lights this way. */
}
/* Note lights are real special cases. Although the device caps state only
* e.g. 8 are supported, you can reference any indexes you want as long as
* that number max are enabled at any one point in time. Therefore since the
* indices can be anything, we need a hashmap of them. However, this causes
* stateblock problems. When capturing the state block, I duplicate the
* hashmap, but when recording, just build a chain pretty much of commands to
* be replayed. */
{
struct list *e;
float rho;
/* Check the parameter range. Need for speed most wanted sets junk lights
* which confuse the GL driver. */
if (!light)
return WINED3DERR_INVALIDCALL;
{
case WINED3D_LIGHT_POINT:
case WINED3D_LIGHT_SPOT:
case WINED3D_LIGHT_GLSPOT:
/* Incorrect attenuation values can cause the gl driver to crash.
* Happens with Need for speed most wanted. */
{
WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
break;
/* Ignores attenuation */
break;
default:
WARN("Light type out of range, returning WINED3DERR_INVALIDCALL\n");
return WINED3DERR_INVALIDCALL;
}
{
break;
}
if (!object)
{
TRACE("Adding new light\n");
if (!object)
return E_OUTOFMEMORY;
}
/* Initialize the object. */
TRACE("Light %d setting to type %d, Diffuse(%f,%f,%f,%f), Specular(%f,%f,%f,%f), Ambient(%f,%f,%f,%f)\n",
TRACE("... Pos(%f,%f,%f), Dir(%f,%f,%f)\n", light->position.x, light->position.y, light->position.z,
TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n",
/* Update the live definitions if the light is currently assigned a glIndex. */
{
}
/* Save away the information. */
{
case WINED3D_LIGHT_POINT:
/* Position */
/* FIXME: Range */
break;
/* Direction */
break;
case WINED3D_LIGHT_SPOT:
/* Position */
/* Direction */
/* opengl-ish and d3d-ish spot lights use too different models
* for the light "intensity" as a function of the angle towards
* the main light direction, so we only can approximate very
* roughly. However, spot lights are rather rarely used in games
* (if ever used at all). Furthermore if still used, probably
* nobody pays attention to such details. */
{
/* Falloff = 0 is easy, because d3d's and opengl's spot light
* equations have the falloff resp. exponent parameter as an
* exponent, so the spot light lighting will always be 1.0 for
* both of them, and we don't have to care for the rest of the
* rather complex calculation. */
}
else
{
if (rho < 0.0001f)
rho = 0.0001f;
#ifdef VBOX_WITH_WINE_FIXES
#else
#endif
}
/* FIXME: Range */
break;
default:
}
return WINED3D_OK;
}
{
struct list *e;
{
break;
light_info = NULL;
}
if (!light_info)
{
TRACE("Light information requested but light not defined\n");
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable)
{
struct list *e;
{
break;
light_info = NULL;
}
/* Special case - enabling an undefined light creates one with a strict set of parameters. */
if (!light_info)
{
TRACE("Light enabled requested but light not defined, so defining one!\n");
/* Search for it again! Should be fairly quick as near head of list. */
{
break;
light_info = NULL;
}
if (!light_info)
{
FIXME("Adding default lights has failed dismally\n");
return WINED3DERR_INVALIDCALL;
}
}
if (!enable)
{
{
if (!device->isRecordingState)
{
}
}
else
{
TRACE("Light already disabled, nothing to do\n");
}
}
else
{
{
TRACE("Nothing to do as light was enabled\n");
}
else
{
unsigned int i;
/* Find a free GL light. */
{
{
light_info->glIndex = i;
break;
}
}
{
/* 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");
return WINED3D_OK;
}
/* i == light_info->glIndex */
if (!device->isRecordingState)
{
}
}
}
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable)
{
struct list *e;
{
break;
light_info = NULL;
}
if (!light_info)
{
TRACE("Light enabled state requested but light not defined.\n");
return WINED3DERR_INVALIDCALL;
}
/* true is 128 according to SetLightEnable */
return WINED3D_OK;
}
{
/* Validate plane_idx. */
{
TRACE("Application has requested clipplane this device doesn't support.\n");
return WINED3DERR_INVALIDCALL;
}
{
TRACE("Application is setting old values over, nothing to do.\n");
return WINED3D_OK;
}
/* Handle recording of state blocks. */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return WINED3D_OK;
}
return WINED3D_OK;
}
{
/* Validate plane_idx. */
{
TRACE("Application has requested clipplane this device doesn't support.\n");
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
const struct wined3d_clip_status *clip_status)
{
if (!clip_status)
return WINED3DERR_INVALIDCALL;
return WINED3D_OK;
}
struct wined3d_clip_status *clip_status)
{
if (!clip_status)
return WINED3DERR_INVALIDCALL;
return WINED3D_OK;
}
void CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material)
{
/* Handle recording of state blocks */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
}
void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material)
{
TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n",
TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n",
TRACE("specular {%.8e, %.8e, %.8e, %.8e}\n",
TRACE("emissive {%.8e, %.8e, %.8e, %.8e}\n",
}
{
struct wined3d_buffer *prev_buffer;
TRACE("device %p, buffer %p, format %s.\n",
/* Handle recording of state blocks. */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
if (buffer)
if (prev_buffer)
return;
}
if (prev_buffer != buffer)
{
if (buffer)
{
}
if (prev_buffer)
{
}
}
}
enum wined3d_format_id *format)
{
}
{
}
{
}
void CDECL wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport)
{
TRACE("x %u, y %u, w %u, h %u, min_z %.8e, max_z %.8e.\n",
/* Handle recording of state blocks */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything\n");
return;
}
}
void CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport)
{
}
{
return;
if (!depth_stencil)
return;
}
{
TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value);
/* Handle recording of state blocks. */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
/* Compared here and not before the assignment to allow proper stateblock recording. */
TRACE("Application is setting the old value over, nothing to do.\n");
else
{
TRACE("RESZ multisampled depth buffer resolve triggered.\n");
}
}
DWORD CDECL wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state)
{
}
{
TRACE("device %p, sampler_idx %u, state %s, value %#x.\n",
{
return; /* Windows accepts overflowing this array ... we do not. */
}
/* Handle recording of state blocks. */
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
{
TRACE("Application is setting the old value over, nothing to do.\n");
return;
}
}
{
TRACE("device %p, sampler_idx %u, state %s.\n",
{
return 0; /* Windows accepts overflowing this array ... we do not. */
}
}
{
{
TRACE("App is setting the old scissor rectangle over, nothing to do.\n");
return;
}
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
}
{
}
struct wined3d_vertex_declaration *declaration)
{
if (declaration)
if (prev)
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
if (declaration == prev)
{
/* Checked after the assignment to allow proper stateblock recording. */
TRACE("Application is setting the old declaration over, nothing to do.\n");
return;
}
}
struct wined3d_vertex_declaration * CDECL wined3d_device_get_vertex_declaration(const struct wined3d_device *device)
{
}
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
if (shader)
if (prev)
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
{
TRACE("Application is setting the old shader over, nothing to do.\n");
return;
}
}
{
}
void CDECL wined3d_device_set_vs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer)
{
struct wined3d_buffer *prev;
if (idx >= MAX_CONSTANT_BUFFERS)
{
return;
}
if (device->isRecordingState)
{
if (buffer)
if (prev)
return;
}
{
if (buffer)
{
}
if (prev)
{
}
}
}
struct wined3d_buffer * CDECL wined3d_device_get_vs_cb(const struct wined3d_device *device, UINT idx)
{
if (idx >= MAX_CONSTANT_BUFFERS)
{
return NULL;
}
}
void CDECL wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler)
{
struct wined3d_sampler *prev;
if (idx >= MAX_SAMPLER_OBJECTS)
{
return;
}
if (sampler)
if (prev)
}
struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx)
{
if (idx >= MAX_SAMPLER_OBJECTS)
{
return NULL;
}
}
{
UINT i;
TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(&device->updateStateBlock->state.vs_consts_b[start_register], constants, count * sizeof(BOOL));
for (i = 0; i < count; ++i)
if (!device->isRecordingState)
return WINED3D_OK;
}
{
TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
return WINED3DERR_INVALIDCALL;
return WINED3D_OK;
}
{
UINT i;
TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(&device->updateStateBlock->state.vs_consts_i[start_register * 4], constants, count * sizeof(int) * 4);
for (i = 0; i < count; ++i)
if (!device->isRecordingState)
return WINED3D_OK;
}
{
TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->stateBlock->state.vs_consts_i[start_register * 4], count * sizeof(int) * 4);
return WINED3D_OK;
}
{
UINT i;
TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
/* Specifically test start_register > limit to catch MAX_UINT overflows
* when adding start_register + vector4f_count. */
if (!constants
return WINED3DERR_INVALIDCALL;
{
for (i = 0; i < vector4f_count; ++i)
}
if (!device->isRecordingState)
{
device->shader_backend->shader_update_float_vertex_constants(device, start_register, vector4f_count);
}
return WINED3D_OK;
}
{
TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->stateBlock->state.vs_consts_f[start_register * 4], count * sizeof(float) * 4);
return WINED3D_OK;
}
{
DWORD i;
for (i = 0; i <= WINED3D_HIGHEST_TEXTURE_STATE; ++i)
{
}
}
{
if (i != WINED3D_UNMAPPED_STAGE && i != stage)
if (j != WINED3D_UNMAPPED_STAGE && j != unit)
}
{
UINT i;
for (i = 0; i < MAX_TEXTURES; ++i)
{
/* Not used, and disable higher stages. */
if (color_op == WINED3D_TOP_DISABLE)
break;
|| ((color_arg3 == WINED3DTA_TEXTURE)
|| ((alpha_arg3 == WINED3DTA_TEXTURE)
&& i < MAX_TEXTURES - 1)
}
}
static void device_map_fixed_function_samplers(struct wined3d_device *device, const struct wined3d_d3d_info *d3d_info)
{
unsigned int i, tex;
{
{
if (!(ffu_map & 1)) continue;
if (device->texUnitMap[i] != i)
{
device_map_stage(device, i, i);
}
}
return;
}
/* Now work out the mapping */
tex = 0;
{
if (!(ffu_map & 1)) continue;
{
}
++tex;
}
}
static void device_map_psamplers(struct wined3d_device *device, const struct wined3d_d3d_info *d3d_info)
{
const enum wined3d_sampler_texture_type *sampler_type =
unsigned int i;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
{
{
device_map_stage(device, i, i);
}
}
}
const enum wined3d_sampler_texture_type *pshader_sampler_tokens,
{
/* Not currently used */
if (current_mapping < MAX_FRAGMENT_SAMPLERS) {
/* Used by a fragment sampler */
if (!pshader_sampler_tokens) {
/* No pixel shader, check fixed function */
return current_mapping >= MAX_TEXTURES || !(device->fixed_function_usage_map & (1 << current_mapping));
}
/* Pixel shader, check the shader's sampler map */
return !pshader_sampler_tokens[current_mapping];
}
/* Used by a vertex sampler */
}
static void device_map_vsamplers(struct wined3d_device *device, BOOL ps, const struct wined3d_gl_info *gl_info)
{
const enum wined3d_sampler_texture_type *vshader_sampler_type =
int i;
if (ps)
{
/* Note that we only care if a sampler is sampled or not, not the sampler's specific type.
* Otherwise we'd need to call shader_update_samplers() here for 1.x pixelshaders. */
}
for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i) {
if (vshader_sampler_type[i])
{
{
/* Already mapped somewhere */
continue;
}
while (start >= 0)
{
{
--start;
break;
}
--start;
}
}
}
}
{
/*
* Rules are:
* -> Pixel shaders need a 1:1 map. In theory the shader input could be mapped too, but
* that would be really messy and require shader recompilation
* -> When the mapping of a stage is changed, sampler and ALL texture stage states have
* to be reset. Because of that try to work with a 1:1 mapping as much as possible
*/
if (ps)
else
if (vs)
}
void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
if (shader)
if (prev)
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
{
TRACE("Application is setting the old shader over, nothing to do.\n");
return;
}
}
{
}
void CDECL wined3d_device_set_ps_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer)
{
struct wined3d_buffer *prev;
if (idx >= MAX_CONSTANT_BUFFERS)
{
return;
}
if (device->isRecordingState)
{
if (buffer)
if (prev)
return;
}
{
if (buffer)
{
}
if (prev)
{
}
}
}
struct wined3d_buffer * CDECL wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx)
{
if (idx >= MAX_CONSTANT_BUFFERS)
{
return NULL;
}
}
void CDECL wined3d_device_set_ps_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler)
{
struct wined3d_sampler *prev;
if (idx >= MAX_SAMPLER_OBJECTS)
{
return;
}
if (sampler)
if (prev)
}
struct wined3d_sampler * CDECL wined3d_device_get_ps_sampler(const struct wined3d_device *device, UINT idx)
{
if (idx >= MAX_SAMPLER_OBJECTS)
{
return NULL;
}
}
{
UINT i;
TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(&device->updateStateBlock->state.ps_consts_b[start_register], constants, count * sizeof(BOOL));
for (i = 0; i < count; ++i)
if (!device->isRecordingState)
return WINED3D_OK;
}
{
TRACE("device %p, start_register %u, constants %p, bool_count %u.\n",
return WINED3DERR_INVALIDCALL;
return WINED3D_OK;
}
{
UINT i;
TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(&device->updateStateBlock->state.ps_consts_i[start_register * 4], constants, count * sizeof(int) * 4);
for (i = 0; i < count; ++i)
if (!device->isRecordingState)
return WINED3D_OK;
}
{
TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->stateBlock->state.ps_consts_i[start_register * 4], count * sizeof(int) * 4);
return WINED3D_OK;
}
{
UINT i;
TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
/* Specifically test start_register > limit to catch MAX_UINT overflows
* when adding start_register + vector4f_count. */
if (!constants
return WINED3DERR_INVALIDCALL;
{
for (i = 0; i < vector4f_count; ++i)
}
if (!device->isRecordingState)
{
device->shader_backend->shader_update_float_pixel_constants(device, start_register, vector4f_count);
}
return WINED3D_OK;
}
{
TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n",
return WINED3DERR_INVALIDCALL;
memcpy(constants, &device->stateBlock->state.ps_consts_f[start_register * 4], count * sizeof(float) * 4);
return WINED3D_OK;
}
void CDECL wined3d_device_set_geometry_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
if (shader)
if (prev)
return;
}
struct wined3d_shader * CDECL wined3d_device_get_geometry_shader(const struct wined3d_device *device)
{
}
void CDECL wined3d_device_set_gs_cb(struct wined3d_device *device, UINT idx, struct wined3d_buffer *buffer)
{
struct wined3d_buffer *prev;
if (idx >= MAX_CONSTANT_BUFFERS)
{
return;
}
if (device->isRecordingState)
{
if (buffer)
if (prev)
return;
}
{
if (buffer)
{
}
if (prev)
{
}
}
}
struct wined3d_buffer * CDECL wined3d_device_get_gs_cb(const struct wined3d_device *device, UINT idx)
{
if (idx >= MAX_CONSTANT_BUFFERS)
{
return NULL;
}
}
void CDECL wined3d_device_set_gs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler)
{
struct wined3d_sampler *prev;
if (idx >= MAX_SAMPLER_OBJECTS)
{
return;
}
if (sampler)
if (prev)
}
struct wined3d_sampler * CDECL wined3d_device_get_gs_sampler(const struct wined3d_device *device, UINT idx)
{
if (idx >= MAX_SAMPLER_OBJECTS)
{
return NULL;
}
}
/* Context activation is done by the caller. */
/* Do not call while under the GL lock. */
static HRESULT process_vertices_strided(const struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount,
{
struct wined3d_viewport vp;
unsigned int i;
{
WARN(" lighting state not saved yet... Some strange stuff may happen !\n");
}
{
ERR("Source has no position mask\n");
return WINED3DERR_INVALIDCALL;
}
{
/*
* The clipping code is not quite correct. Some things need
* to be checked against IDirect3DDevice3 (!), d3d8 and d3d9,
* so disable clipping for now.
* (The graphics in Half-Life are broken, and my processvertices
* test crashes with IDirect3DDevice3)
doClip = TRUE;
*/
if(!warned) {
FIXME("Clipping is broken and disabled for now\n");
}
}
else
if (FAILED(hr = wined3d_buffer_map(dest, dwDestIndex * vertex_size, dwCount * vertex_size, &dest_ptr, 0)))
{
return hr;
}
TRACE("View mat:\n");
TRACE("Proj mat:\n");
TRACE("World mat:\n");
/* Get the viewport */
TRACE("viewport x %u, y %u, width %u, height %u, min_z %.8e, max_z %.8e.\n",
for (i = 0; i < dwCount; i+= 1) {
unsigned int tex_index;
/* The position first */
float x, y, z, rhw;
/* Multiplication with world, view and projection matrix */
/* WARNING: The following things are taken from d3d7 and were not yet checked
* against d3d8 or d3d9!
*/
/* Clipping conditions: From msdn
*
* A vertex is clipped if it does not match the following requirements
* -rhw < x <= rhw
* -rhw < y <= rhw
* 0 < z <= rhw
* 0 < rhw ( Not in d3d7, but tested in d3d7)
*
* If clipping is on is determined by the D3DVOP_CLIP flag in D3D7, and
* by the D3DRS_CLIPPING in D3D9(according to the msdn, not checked)
*
*/
if( !doClip ||
/* "Normal" viewport transformation (not clipped)
* 1) The values are divided by rhw
* 2) The y axis is negative, so multiply it with -1
* 3) Screen coordinates go from -(Width/2) to +(Width/2) and
* -(Height/2) to +(Height/2). The z range is MinZ to MaxZ
* 4) Multiply x with Width/2 and add Width/2
* 5) The same for the height
* 6) Add the viewpoint X and Y to the 2D coordinates and
* The minimum Z value to z
* 7) rhw = 1 / rhw Reciprocal of Homogeneous W....
*
* Well, basically it's simply a linear transformation into viewport
* coordinates
*/
x /= rhw;
y /= rhw;
z /= rhw;
y *= -1;
} else {
/* That vertex got clipped
* Contrary to OpenGL it is not dropped completely, it just
* undergoes a different calculation.
*/
TRACE("Vertex got clipped\n");
x += rhw;
y += rhw;
x /= 2;
y /= 2;
/* Msdn mentions that Direct3D9 keeps a list of clipped vertices
* outside of the main vertex buffer memory. That needs some more
* investigation...
*/
}
( (float *) dest_ptr)[0] = x;
( (float *) dest_ptr)[1] = y;
( (float *) dest_ptr)[2] = z;
dest_ptr += 3 * sizeof(float);
dest_ptr += sizeof(float);
}
if (DestFVF & WINED3DFVF_PSIZE)
if (DestFVF & WINED3DFVF_NORMAL)
{
/* AFAIK this should go into the lighting information */
FIXME("Didn't expect the destination to have a normal\n");
}
if (DestFVF & WINED3DFVF_DIFFUSE)
{
{
if(!warned) {
ERR("No diffuse color in source, but destination has one\n");
}
}
else
{
}
}
if (DestFVF & WINED3DFVF_SPECULAR)
{
/* What's the color value in the feedback buffer? */
{
if(!warned) {
ERR("No specular color in source, but destination has one\n");
}
}
else
{
}
}
{
const struct wined3d_stream_info_element *element = &stream_info->elements[WINED3D_FFP_TEXCOORD0 + tex_index];
{
ERR("No source texture, but destination requests one\n");
}
else
{
}
}
}
return WINED3D_OK;
}
/* Do not call while under the GL lock. */
{
struct wined3d_stream_info stream_info;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
struct wined3d_shader *vs;
unsigned int i;
TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, "
"dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n",
if (declaration)
FIXME("Output vertex declaration not implemented yet.\n");
/* Need any context to write to the vbo. */
/* We can't convert FROM a VBO, and vertex buffers used to source into
* process_vertices() are unlikely to ever be used for drawing. Release
* VBOs in those buffers and fix up the stream_info structure.
*
* Also apply the start index. */
{
struct wined3d_stream_info_element *e;
continue;
e = &stream_info.elements[i];
if (e->data.buffer_object)
{
e->data.buffer_object = 0;
vb->buffer_object = 0;
}
}
return hr;
}
{
TRACE("device %p, stage %u, state %s, value %#x.\n",
{
return;
}
{
WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n",
return;
}
if (device->isRecordingState)
{
TRACE("Recording... not performing anything.\n");
return;
}
/* Checked after the assignments to allow proper stateblock recording. */
{
TRACE("Application is setting the old value over, nothing to do.\n");
return;
}
{
/* Colorop change above lowest disabled stage? That won't change
* anything in the GL setup. Changes in other states are important on
* disabled stages too. */
return;
}
if (state == WINED3D_TSS_COLOR_OP)
{
unsigned int i;
{
/* Previously enabled stage disabled now. Make sure to dirtify
* all enabled stages above stage, they have to be disabled.
*
* The current stage is dirtified below. */
{
TRACE("Additionally dirtifying stage %u.\n", i);
}
}
{
/* Previously disabled stage enabled. Stages above it may need
* enabling. Stage must be lowest_disabled_stage here, if it's
* bigger success is returned above, and stages below the lowest
* disabled stage can't be enabled (because they are enabled
* already).
*
* Again stage stage doesn't need to be dirtified here, it is
* handled below. */
{
break;
TRACE("Additionally dirtifying stage %u due to enable.\n", i);
}
TRACE("New lowest disabled: %u.\n", i);
}
}
}
{
TRACE("device %p, stage %u, state %s.\n",
{
return 0;
}
}
{
struct wined3d_texture *prev;
/* Windows accepts overflowing this array... we do not. */
if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures))
{
return WINED3D_OK;
}
{
WARN("Rejecting attempt to set scratch texture.\n");
return WINED3DERR_INVALIDCALL;
}
{
TRACE("App is setting the same texture again, nothing to do.\n");
return WINED3D_OK;
}
if (device->isRecordingState)
{
TRACE("Recording... not performing anything\n");
return WINED3D_OK;
}
if (texture)
{
{
/* The source arguments for color and alpha ops have different
* meanings when a NULL texture is bound, so the COLOR_OP and
* ALPHA_OP have to be dirtified. */
}
if (bind_count == 1)
}
if (prev)
{
{
}
{
unsigned int i;
/* Search for other stages the texture is bound to. Shouldn't
* happen if applications bind textures to a single stage only. */
TRACE("Searching for other stages the texture is bound to.\n");
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
{
{
TRACE("Texture is also bound to stage %u.\n", i);
break;
}
}
}
}
return WINED3D_OK;
}
struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_device *device, UINT stage)
{
if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures))
{
return NULL; /* Windows accepts overflowing this array ... we do not. */
}
}
HRESULT CDECL wined3d_device_get_back_buffer(const struct wined3d_device *device, UINT swapchain_idx,
UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type, struct wined3d_surface **backbuffer)
{
struct wined3d_swapchain *swapchain;
TRACE("device %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
return WINED3DERR_INVALIDCALL;
return WINED3DERR_INVALIDCALL;
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps)
{
}
HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx,
{
struct wined3d_swapchain *swapchain;
TRACE("device %p, swapchain_idx %u, mode %p, rotation %p.\n",
return WINED3DERR_INVALIDCALL;
}
{
struct wined3d_stateblock *stateblock;
if (device->isRecordingState)
return WINED3DERR_INVALIDCALL;
return hr;
return WINED3D_OK;
}
struct wined3d_stateblock **stateblock)
{
if (!device->isRecordingState)
{
WARN("Not recording.\n");
*stateblock = NULL;
return WINED3DERR_INVALIDCALL;
}
*stateblock = object;
return WINED3D_OK;
}
{
/* At the moment we have no need for any functionality at the beginning
* of a scene. */
{
WARN("Already in scene, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
{
struct wined3d_context *context;
{
WARN("Not in scene, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
/* We only have to do this if we need to read the, swapbuffers performs a flush for us */
/* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever
* fails. */
return WINED3D_OK;
}
{
UINT i;
TRACE("device %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n",
for (i = 0; i < device->swapchain_count; ++i)
{
}
return WINED3D_OK;
}
/* Do not call while under the GL lock. */
{
TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n",
if (!rect_count && rects)
{
return WINED3D_OK;
}
{
if (!ds)
{
WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n");
/* TODO: What about depth stencil buffers without stencil bits? */
return WINED3DERR_INVALIDCALL;
}
else if (flags & WINED3DCLEAR_TARGET)
{
{
WARN("Silently ignoring depth and target clear with mismatching sizes\n");
return WINED3D_OK;
}
}
}
return WINED3D_OK;
}
{
}
{
}
HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count)
{
{
WARN("Called without a valid vertex declaration set.\n");
return WINED3DERR_INVALIDCALL;
}
{
}
/* Account for the loading offset due to index buffers. Instead of
* reloading all sources correct it with the startvertex parameter. */
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
{
{
/* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
* without an index buffer set. (The first time at least...)
* D3D8 simply dies, but I doubt it can do much harm to return
* D3DERR_INVALIDCALL there as well. */
WARN("Called without a valid index buffer set, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
{
WARN("Called without a valid vertex declaration set.\n");
return WINED3DERR_INVALIDCALL;
}
{
}
return WINED3D_OK;
}
{
}
/* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */
{
struct wined3d_map_desc src;
struct wined3d_map_desc dst;
TRACE("device %p, src_volume %p, dst_volume %p.\n",
/* TODO: Implement direct loading into the gl volume instead of using
* memcpy and dirtification to improve loading performance. */
return hr;
{
return hr;
}
else
return hr;
}
{
enum wined3d_resource_type type;
unsigned int level_count, i;
/* Verify that the source and destination textures are non-NULL. */
if (!src_texture || !dst_texture)
{
WARN("Source and destination textures must be non-NULL, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
if (src_texture == dst_texture)
{
WARN("Source and destination are the same object, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
/* Verify that the source and destination textures are the same type. */
{
WARN("Source and destination have different types, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
/* Check that both textures have the identical numbers of levels. */
{
WARN("Source and destination have different level counts, returning WINED3DERR_INVALIDCALL.\n");
return WINED3DERR_INVALIDCALL;
}
/* Make sure that the destination texture is loaded. */
/* Update every surface level of the texture. */
switch (type)
{
case WINED3D_RTYPE_TEXTURE:
{
struct wined3d_surface *src_surface;
struct wined3d_surface *dst_surface;
for (i = 0; i < level_count; ++i)
{
{
return hr;
}
}
break;
}
{
struct wined3d_surface *src_surface;
struct wined3d_surface *dst_surface;
for (i = 0; i < level_count * 6; ++i)
{
{
return hr;
}
}
break;
}
{
for (i = 0; i < level_count; ++i)
{
{
return hr;
}
}
break;
}
default:
return WINED3DERR_INVALIDCALL;
}
return WINED3D_OK;
}
{
struct wined3d_swapchain *swapchain;
return WINED3DERR_INVALIDCALL;
}
HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes)
{
struct wined3d_texture *texture;
DWORD i;
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
{
{
WARN("Sampler state %u has minfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i);
}
{
WARN("Sampler state %u has magfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i);
}
{
WARN("Non-filterable texture and mag filter enabled on samper %u, returning E_FAIL\n", i);
return E_FAIL;
}
{
WARN("Non-filterable texture and min filter enabled on samper %u, returning E_FAIL\n", i);
return E_FAIL;
}
{
WARN("Non-filterable texture and mip filter enabled on samper %u, returning E_FAIL\n", i);
return E_FAIL;
}
}
{
{
WARN("Depth stencil is smaller than the color buffer, returning D3DERR_CONFLICTINGRENDERSTATE\n");
}
}
/* return a sensible default */
*num_passes = 1;
TRACE("returning D3D_OK\n");
return WINED3D_OK;
}
void CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software)
{
if (!warned)
{
}
}
{
if (!warned)
{
}
return device->softwareVertexProcessing;
}
{
struct wined3d_swapchain *swapchain;
TRACE("device %p, swapchain_idx %u, raster_status %p.\n",
return WINED3DERR_INVALIDCALL;
}
{
if (segments != 0.0f)
{
if (!warned)
{
}
}
return WINED3D_OK;
}
{
if (!warned)
{
}
return 0.0f;
}
{
TRACE("device %p, src_surface %p, src_rect %s, dst_surface %p, dst_point %s.\n",
if (src_surface->resource.pool != WINED3D_POOL_SYSTEM_MEM || dst_surface->resource.pool != WINED3D_POOL_DEFAULT)
{
WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT, returning WINED3DERR_INVALIDCALL\n",
return WINED3DERR_INVALIDCALL;
}
}
/* Do not call while under the GL lock. */
{
RECT r;
TRACE("device %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
if (surface->resource.pool != WINED3D_POOL_DEFAULT && surface->resource.pool != WINED3D_POOL_SYSTEM_MEM)
{
return WINED3DERR_INVALIDCALL;
}
if (!rect)
{
rect = &r;
}
}
/* Do not call while under the GL lock. */
{
struct wined3d_resource *resource;
{
FIXME("Only supported on surface resources\n");
return;
}
}
struct wined3d_surface * CDECL wined3d_device_get_render_target(const struct wined3d_device *device,
{
{
return NULL;
}
}
struct wined3d_surface * CDECL wined3d_device_get_depth_stencil(const struct wined3d_device *device)
{
}
{
struct wined3d_surface *prev;
TRACE("device %p, render_target_idx %u, render_target %p, set_viewport %#x.\n",
{
return WINED3DERR_INVALIDCALL;
}
/* Render target 0 can't be set to NULL. */
if (!render_target && !render_target_idx)
{
WARN("Trying to set render target 0 to NULL.\n");
return WINED3DERR_INVALIDCALL;
}
{
return WINED3DERR_INVALIDCALL;
}
/* Set the viewport and scissor rectangles, if requested. Tests show that
* stateblock recording is ignored, the change goes directly into the
* primary stateblock. */
if (!render_target_idx && set_viewport)
{
}
if (render_target == prev)
return WINED3D_OK;
if (render_target)
/* Release after the assignment, to prevent device_resource_released()
* from seeing the surface as still in use. */
if (prev)
return WINED3D_OK;
}
void CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil)
{
TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n",
if (prev == depth_stencil)
{
TRACE("Trying to do a NOP SetRenderTarget operation.\n");
return;
}
if (prev)
{
{
{
}
}
}
if (depth_stencil)
if (!prev != !depth_stencil)
{
/* Swapping NULL / non NULL depth stencil affects the depth and tests */
}
{
}
if (prev)
return;
}
{
TRACE("device %p, x_hotspot %u, y_hotspot %u, cursor_image %p.\n",
/* some basic validation checks */
if (device->cursorTexture)
{
device->cursorTexture = 0;
}
if (cursor_image)
{
struct wined3d_display_mode mode;
struct wined3d_map_desc map_desc;
/* MSDN: Cursor must be A8R8G8B8 */
{
return WINED3DERR_INVALIDCALL;
}
if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, device->adapter->ordinal, &mode, NULL)))
{
return WINED3DERR_INVALIDCALL;
}
/* MSDN: Cursor must be smaller than the display mode */
{
WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n",
return WINED3DERR_INVALIDCALL;
}
/* TODO: MSDN: Cursor sizes must be a power of 2 */
/* Do not store the surface's pointer because the application may
* release it after setting the cursor image. Windows doesn't
* addref the set surface, so we can't do this either without
* creating circular refcount dependencies. Copy out the gl texture
* instead. */
{
struct wined3d_context *context;
INT i;
/* Reformat the texture memory (pitch and width can be
* different) */
for (i = 0; i < height; ++i)
{
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
}
/* Create a new cursor texture */
checkGLcall("glGenTextures");
/* Copy the bitmap memory into the cursor texture */
gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, gl_format, type, mem);
checkGLcall("glTexImage2D");
{
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
}
}
else
{
FIXME("A cursor texture was not returned.\n");
device->cursorTexture = 0;
}
{
/* 32-bit user32 cursors ignore the alpha channel if it's all
* zeroes, and use the mask instead. Fill the mask with all ones
* to ensure we still get a fully transparent cursor. */
/* Create our cursor and clean up. */
}
}
return WINED3D_OK;
}
{
TRACE("device %p, x %d, y %d, flags %#x.\n",
if (device->hardwareCursor)
{
GetCursorPos( &pt );
return;
/* Switch to the software cursor if position diverges from the hardware one. */
GetCursorPos( &pt );
{
device->hardwareCursor = 0;
}
}
}
{
/*
* When ShowCursor is first called it should make the cursor appear at the OS's last
* known cursor position.
*/
if (show && !oldVisible)
{
GetCursorPos(&pt);
}
if (device->hardwareCursor)
{
if (show)
else
}
else
{
if (device->cursorTexture)
}
return oldVisible;
}
{
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
{
}
}
/* Invalidate stream sources, the buffer(s) may have been evicted. */
}
#ifndef VBOX_WITH_WDDM
/* Do not call while under the GL lock. */
static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
{
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
struct wined3d_shader *shader;
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
}
{
}
if (device->depth_blt_texture)
{
device->depth_blt_texture = 0;
}
if (device->cursorTexture)
{
device->cursorTexture = 0;
}
while (device->context_count)
{
#ifndef VBOX_WINE_WITH_SINGLE_CONTEXT
#else
#endif
}
#ifndef VBOX_WINE_WITH_SINGLE_CONTEXT
#else
#endif
}
/* Do not call while under the GL lock. */
static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
{
struct wined3d_context *context;
struct wined3d_surface *target;
{
return hr;
}
{
return hr;
}
/* Recreate the primary swapchain's context */
#ifndef VBOX_WINE_WITH_SINGLE_CONTEXT
#else
#endif
{
ERR("Failed to allocate memory for swapchain context array.\n");
return E_OUTOFMEMORY;
}
{
WARN("Failed to create context.\n");
#ifndef VBOX_WINE_WITH_SINGLE_CONTEXT
#else
#endif
return E_FAIL;
}
#ifndef VBOX_WINE_WITH_SINGLE_CONTEXT
#endif
return WINED3D_OK;
}
#endif
/* Do not call while under the GL lock. */
{
#ifndef VBOX_WITH_WDDM
struct wined3d_swapchain *swapchain;
struct wined3d_display_mode m;
unsigned int i;
TRACE("device %p, swapchain_desc %p, mode %p, callback %p.\n", device, swapchain_desc, mode, callback);
{
ERR("Failed to get the first implicit swapchain.\n");
return WINED3DERR_INVALIDCALL;
}
if (reset_state)
{
else
{
}
}
if (device->onscreen_depth_stencil)
{
}
if (reset_state)
{
LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry)
{
return hr;
}
}
/* Is it necessary to recreate the gl context? Actually every setting can be changed
* on an existing gl context, so there's no real need for recreation.
*
* TODO: Figure out how Reset influences resources in D3DPOOL_DEFAULT, D3DPOOL_SYSTEMMEMORY and D3DPOOL_MANAGED
*
* TODO: Figure out what happens to explicit swapchains, or if we have more than one implicit swapchain
*/
TRACE("New params:\n");
TRACE("auto_depth_stencil_format %s\n", debug_d3dformat(swapchain_desc->auto_depth_stencil_format));
/* No special treatment of these parameters. Just store them */
/* What to do about these? */
FIXME("Cannot change the back buffer count yet.\n");
{
TRACE("Changing the device window from %p to %p.\n",
}
{
struct wined3d_resource_desc surface_desc;
TRACE("Creating the depth stencil buffer\n");
surface_desc.size = 0;
{
return WINED3DERR_INVALIDCALL;
}
}
/* Reset the depth stencil */
if (mode)
{
m = *mode;
}
else if (swapchain_desc->windowed)
{
m.refresh_rate = 0;
}
else
{
}
if (!backbuffer_width || !backbuffer_height)
{
/* The application is requesting that either the swapchain width or
* height be set to the corresponding dimension in the window's
* client rect. */
if (!swapchain_desc->windowed)
return WINED3DERR_INVALIDCALL;
{
return WINED3DERR_INVALIDCALL;
}
if (!backbuffer_width)
if (!backbuffer_height)
}
{
if (!swapchain_desc->windowed)
update_desc = TRUE;
}
{
update_desc = TRUE;
}
{
update_desc = TRUE;
}
if (update_desc)
{
UINT i;
if (FAILED(hr = wined3d_surface_update_desc(swapchain->front_buffer, swapchain->desc.backbuffer_width,
return hr;
{
if (FAILED(hr = wined3d_surface_update_desc(swapchain->back_buffers[i], swapchain->desc.backbuffer_width,
return hr;
}
if (device->auto_depth_stencil)
{
if (FAILED(hr = wined3d_surface_update_desc(device->auto_depth_stencil, swapchain->desc.backbuffer_width,
return hr;
}
}
{
{
return WINED3DERR_INVALIDCALL;
}
if (!swapchain_desc->windowed)
{
{
if (!focus_window)
{
return hr;
}
/* switch from windowed to fs */
}
else
{
/* Fullscreen -> fullscreen mode change */
TRUE);
}
}
{
/* Fullscreen -> windowed switch */
}
}
else if (!swapchain_desc->windowed)
{
/* If we're in fullscreen, and the mode wasn't changed, we have to get the window back into
* the right position. Some applications(Battlefield 2, Guild Wars) move it and then call
* Reset to clear up their mess. Guild Wars also loses the device during that.
*/
}
if (reset_state)
{
TRACE("Resetting stateblock.\n");
if (device->d3d_initialized)
/* Note: No parent needed for initial internal stateblock */
else
}
else
{
/* Note the min_z / max_z is not reset. */
}
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
* first use
*/
return hr;
#else
ERR("not supported!");
return E_FAIL;
#endif
}
HRESULT CDECL wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs)
{
return WINED3D_OK;
}
{
}
{
struct wined3d_swapchain *swapchain;
TRACE("device %p, swapchain_idx %u, flags %#x, ramp %p.\n",
}
{
struct wined3d_swapchain *swapchain;
TRACE("device %p, swapchain_idx %u, ramp %p.\n",
}
{
}
static void device_resource_remove(struct wined3d_device *device, struct wined3d_resource *resource)
{
}
{
unsigned int i;
switch (type)
{
case WINED3D_RTYPE_SURFACE:
{
if (!device->d3d_initialized) break;
{
{
}
}
{
}
}
break;
case WINED3D_RTYPE_TEXTURE:
for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i)
{
{
ERR("Texture %p is still in use by stateblock %p, stage %u.\n",
}
{
ERR("Texture %p is still in use by stateblock %p, stage %u.\n",
}
}
break;
case WINED3D_RTYPE_BUFFER:
{
for (i = 0; i < MAX_STREAMS; ++i)
{
{
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
}
{
ERR("Buffer %p is still in use by stateblock %p, stream %u.\n",
}
}
{
ERR("Buffer %p is still in use by stateblock %p as index buffer.\n",
}
{
ERR("Buffer %p is still in use by stateblock %p as index buffer.\n",
}
}
break;
default:
break;
}
/* Remove the resource from the resourceStore */
TRACE("Resource released.\n");
}
struct wined3d_surface * CDECL wined3d_device_get_surface_from_dc(const struct wined3d_device *device, HDC dc)
{
struct wined3d_resource *resource;
if (!dc)
return NULL;
{
{
{
return s;
}
}
}
return NULL;
}
{
const struct fragment_pipeline *fragment_pipeline;
const struct wined3d_vertex_pipe_ops *vertex_pipeline;
unsigned int i;
/* Save the creation parameters. */
#ifdef VBOX_WINE_WITH_PROFILE
#endif
{
return hr;
}
{
WARN("Failed to create stateblock.\n");
{
}
return hr;
}
#ifdef VBOX_WINE_WITH_SHADER_CACHE
#endif
return WINED3D_OK;
}
{
struct wined3d_context *context;
UINT i;
for (i = 0; i < device->context_count; ++i)
{
}
}
{
/* The drawable size of a fbo target is the opengl texture size, which is the power of two size. */
}
{
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
* current context's drawable, which is the size of the back buffer of the swapchain
* the active context belongs to. */
}
#ifndef VBOX_WITH_WDDM
{
if (device->filter_messages)
{
TRACE("Filtering message: window %p, message %#x, wparam %#lx, lparam %#lx.\n",
if (unicode)
else
}
if (message == WM_DESTROY)
{
}
else if (message == WM_DISPLAYCHANGE)
{
}
if (unicode)
else
}
#else
{
/* we use only one context, so just acquiring it here should do the job,
* @todo: perhaps we should introduce the mechanism similar to the one used in flush_to_host
* to avoid context acquisition */
return WINED3D_OK;
}
{
struct wined3d_context *context;
int i;
/* no context acquisition is needed */
for (i = 0; i < device->context_count; ++i)
{
}
return WINED3D_OK;
}
{
/* we use only one context, so just acquiring it here should do the job,
* @todo: perhaps we should introduce the mechanism similar to the one used in flush_to_host
* to avoid context acquisition */
return WINED3D_OK;
}
{
if (!id)
{
*pid = 0;
return E_FAIL;
}
return WINED3D_OK;
}
#endif