wined3d: Rename "wineD3DDevice" to "device".

This commit is contained in:
Henri Verbeet 2009-12-09 20:32:08 +01:00 committed by Alexandre Julliard
parent bd9828a039
commit b3defd4c80
26 changed files with 290 additions and 274 deletions

View File

@ -537,7 +537,7 @@ static inline void shader_arb_vs_local_constants(IWineD3DDeviceImpl* deviceImpl)
/* GL locking is done by the caller (state handler) */
static void shader_arb_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -567,7 +567,7 @@ static void shader_arb_update_float_vertex_constants(IWineD3DDevice *iface, UINT
/* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
* context. On a context switch the old context will be fully dirtified */
if (!context || ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice != This) return;
if (!context || ((IWineD3DSurfaceImpl *)context->surface)->resource.device != This) return;
memset(context->vshader_const_dirty + start, 1, sizeof(*context->vshader_const_dirty) * count);
This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start + count);
@ -580,7 +580,7 @@ static void shader_arb_update_float_pixel_constants(IWineD3DDevice *iface, UINT
/* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
* context. On a context switch the old context will be fully dirtified */
if (!context || ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice != This) return;
if (!context || ((IWineD3DSurfaceImpl *)context->surface)->resource.device != This) return;
memset(context->pshader_const_dirty + start, 1, sizeof(*context->pshader_const_dirty) * count);
This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, start + count);
@ -4292,7 +4292,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
/* GL locking is done by the caller */
static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS)
{
IWineD3DDeviceImpl *This = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *This = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
struct shader_arb_priv *priv = This->shader_priv;
const struct wined3d_gl_info *gl_info = context->gl_info;
int i;
@ -5263,11 +5263,11 @@ static void arbfp_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info
}
#undef GLINFO_LOCATION
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION stateblock->device->adapter->gl_info
static void state_texfactor_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->device;
float col[4];
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
/* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite
* application provided constants
@ -5287,8 +5287,8 @@ static void state_texfactor_arbfp(DWORD state, IWineD3DStateBlockImpl *statebloc
static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->device;
float col[4];
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
/* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite
* application provided constants
@ -5315,7 +5315,7 @@ static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateb
static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
float mat[2][2];
if (use_ps(stateblock))
@ -5352,7 +5352,7 @@ static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, s
static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
float param[4];
if (use_ps(stateblock))
@ -5873,7 +5873,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
struct shader_arb_priv *priv = device->fragment_priv;
BOOL use_pshader = use_ps(stateblock);
BOOL use_vshader = use_vs(stateblock);

View File

@ -798,10 +798,10 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
}
#undef GLINFO_LOCATION
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION stateblock->device->adapter->gl_info
static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *This = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *This = stateblock->device;
const struct atifs_ffp_desc *desc;
struct ffp_frag_settings settings;
struct atifs_private_data *priv = This->fragment_priv;
@ -889,7 +889,7 @@ static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
static void atifs_apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
BOOL use_vshader = use_vs(stateblock);
context->last_was_pshader = use_ps(stateblock);

View File

@ -81,7 +81,7 @@ static void gltexture_delete(struct gl_texture *tex)
void basetexture_unload(IWineD3DBaseTexture *iface)
{
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context = NULL;
if (This->baseTexture.texture_rgb.name || This->baseTexture.texture_srgb.name)
@ -124,7 +124,7 @@ DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew)
This->baseTexture.texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U;
This->baseTexture.texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U;
if(This->baseTexture.bindCount) {
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(This->baseTexture.sampler));
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(This->baseTexture.sampler));
}
}
@ -152,7 +152,7 @@ DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface)
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType)
{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
UINT textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
@ -477,7 +477,7 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])

View File

@ -29,7 +29,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION This->resource.device->adapter->gl_info
#define VB_MAXDECLCHANGES 100 /* After that number we stop converting */
#define VB_RESETDECLCHANGE 1000 /* Reset the changecount after that number of draws */
@ -68,7 +68,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This)
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
}
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
error = glGetError();
@ -148,7 +148,7 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This,
DWORD attrib_size;
BOOL ret = FALSE;
unsigned int i;
DWORD offset = This->resource.wineD3DDevice->stateBlock->streamOffset[attrib->stream_idx];
DWORD offset = This->resource.device->stateBlock->streamOffset[attrib->stream_idx];
DWORD_PTR data;
/* Check for some valid situations which cause us pain. One is if the buffer is used for
@ -203,7 +203,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
DWORD *stride_this_run, BOOL *float16_used)
{
const struct wined3d_stream_info_element *attrib = &si->elements[attrib_idx];
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
BOOL ret = FALSE;
WINED3DFORMAT format;
@ -311,7 +311,7 @@ static UINT *find_conversion_shift(struct wined3d_buffer *This,
static BOOL buffer_find_decl(struct wined3d_buffer *This)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_stream_info *si = &device->strided_streams;
UINT stride_this_run = 0;
@ -472,7 +472,7 @@ static void buffer_check_buffer_object_size(struct wined3d_buffer *This)
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
}
/* Rescue the data before resizing the buffer object if we do not have our backup copy */
@ -607,7 +607,7 @@ static void STDMETHODCALLTYPE buffer_UnLoad(IWineD3DBuffer *iface)
if (This->buffer_object)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context;
context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
@ -687,7 +687,7 @@ static DWORD STDMETHODCALLTYPE buffer_GetPriority(IWineD3DBuffer *iface)
static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
{
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
UINT start = 0, end = 0, vertices;
struct wined3d_context *context;
BOOL decl_changed = FALSE;
@ -795,7 +795,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
}
if (!This->conversion_map)
@ -957,12 +957,12 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset,
{
if(count == 1)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context;
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
}
context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
@ -1011,12 +1011,12 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) && This->buffer_object)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context;
if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER);
}
context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);

View File

@ -117,7 +117,7 @@ static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo)
static void context_apply_attachment_filter_states(IWineD3DSurface *surface, BOOL force_preload)
{
const IWineD3DSurfaceImpl *surface_impl = (IWineD3DSurfaceImpl *)surface;
IWineD3DDeviceImpl *device = surface_impl->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = surface_impl->resource.device;
IWineD3DBaseTextureImpl *texture_impl;
BOOL update_minfilter = FALSE;
BOOL update_magfilter = FALSE;
@ -317,7 +317,7 @@ static void context_check_fbo_status(struct wined3d_context *context)
static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct fbo_entry *entry;
@ -334,7 +334,7 @@ static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *contex
/* GL locking is done by the caller */
static void context_reuse_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
context_bind_fbo(context, GL_FRAMEBUFFER, &entry->id);
@ -363,7 +363,7 @@ static void context_destroy_fbo_entry(struct wined3d_context *context, struct fb
/* GL locking is done by the caller */
static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct fbo_entry *entry;
@ -399,7 +399,7 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context)
/* GL locking is done by the caller */
static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
unsigned int i;
@ -1869,7 +1869,7 @@ static inline struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWin
{
if (current_context
&& current_context->current_rt
&& ((IWineD3DSurfaceImpl *)current_context->surface)->resource.wineD3DDevice == This)
&& ((IWineD3DSurfaceImpl *)current_context->surface)->resource.device == This)
{
target = current_context->current_rt;
}
@ -1952,7 +1952,7 @@ retry:
{
/* Stay with the currently active context. */
if (current_context
&& ((IWineD3DSurfaceImpl *)current_context->surface)->resource.wineD3DDevice == This)
&& ((IWineD3DSurfaceImpl *)current_context->surface)->resource.device == This)
{
context = current_context;
}
@ -2057,7 +2057,7 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit
IWineD3DSwapChain *swapchain;
IWineD3DDeviceImpl *device;
device = ((IWineD3DSurfaceImpl *)rt)->resource.wineD3DDevice;
device = ((IWineD3DSurfaceImpl *)rt)->resource.device;
if (SUCCEEDED(IWineD3DSurface_GetContainer(rt, &IID_IWineD3DSwapChain, (void **)&swapchain)))
{
IWineD3DSwapChain_Release((IUnknown *)swapchain);

View File

@ -31,7 +31,7 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
{
/* Override the IWineD3DResource Preload method. */
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context = NULL;
unsigned int i, j;
BOOL srgb_mode;

View File

@ -881,7 +881,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
object->lpVtbl = vtable;
object->type = Type;
object->state = QUERY_CREATED;
object->wineD3DDevice = This;
object->device = This;
object->parent = parent;
object->ref = 1;
@ -1080,7 +1080,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
HeapFree(GetProcessHeap(), 0, object);
return WINED3DERR_INVALIDCALL;
}
object->wineD3DDevice = This;
object->device = This;
object->parent = parent;
object->ref = 1;
@ -1631,7 +1631,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DW
object->ref = 1;
object->Flags = Flags;
object->parent = Parent;
object->wineD3DDevice = This;
object->device = This;
object->palNumEntries = IWineD3DPaletteImpl_Size(Flags);
object->hpal = CreatePalette((const LOGPALETTE*)&(object->palVersion));
@ -6530,7 +6530,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EvictManagedResources(IWineD3DDevice*
static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT_PARAMETERS* pPresentationParameters)
{
IWineD3DDeviceImpl *device = surface->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = surface->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
/* Reallocate proper memory for the front and back buffer and adjust their sizes */
@ -7380,7 +7380,7 @@ void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) {
void get_drawable_size_pbuffer(struct wined3d_context *context, UINT *width, UINT *height)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->current_rt)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->current_rt)->resource.device;
/* The drawable size of a pbuffer render target is the current pbuffer size. */
*width = device->pbufferWidth;
*height = device->pbufferHeight;

View File

@ -630,7 +630,7 @@ static void shader_glsl_load_np2fixup_constants(
static void shader_glsl_load_constants(const struct wined3d_context *context,
char usePixelShader, char useVertexShader)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
struct shader_glsl_priv *priv = device->shader_priv;
@ -4315,7 +4315,7 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info,
/* GL locking is done by the caller */
static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_glsl_priv *priv = device->shader_priv;
GLhandleARB program_id = 0;

View File

@ -28,7 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION stateblock->device->adapter->gl_info
/* GL locking for state handlers is done by the caller. */
@ -458,8 +458,8 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEX
static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage);
BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
DWORD mapped_stage = stateblock->device->texUnitMap[stage];
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Setting color op for stage %d\n", stage);
@ -533,7 +533,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
}
/* Set the texture combiners */
set_tex_op_nvrc((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
set_tex_op_nvrc((IWineD3DDevice *)stateblock->device, FALSE, stage,
stateblock->textureState[stage][WINED3DTSS_COLOROP],
stateblock->textureState[stage][WINED3DTSS_COLORARG1],
stateblock->textureState[stage][WINED3DTSS_COLORARG2],
@ -562,7 +562,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
DWORD mapped_stage = stateblock->device->texUnitMap[sampler];
/* No need to enable / disable anything here for unused samplers. The tex_colorop
* handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
@ -578,7 +578,7 @@ static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage + 1];
DWORD mapped_stage = stateblock->device->texUnitMap[stage + 1];
float mat[2][2];
/* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to

View File

@ -151,7 +151,8 @@ static HRESULT WINAPI IWineD3DPaletteImpl_SetEntries(IWineD3DPalette *iface,
/* If the palette is attached to the render target, update all render targets */
LIST_FOR_EACH_ENTRY(res, &This->wineD3DDevice->resources, IWineD3DResourceImpl, resource.resource_list_entry) {
LIST_FOR_EACH_ENTRY(res, &This->device->resources, IWineD3DResourceImpl, resource.resource_list_entry)
{
if(IWineD3DResource_GetType((IWineD3DResource *) res) == WINED3DRTYPE_SURFACE) {
IWineD3DSurfaceImpl *impl = (IWineD3DSurfaceImpl *) res;
if(impl->palette == This)

View File

@ -31,7 +31,7 @@
*/
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION This->device->adapter->gl_info
/* *******************************************
IWineD3DQuery IUnknown parts follow
@ -263,7 +263,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
struct wined3d_occlusion_query *query = This->extendedData;
IWineD3DDeviceImpl *device = This->wineD3DDevice;
IWineD3DDeviceImpl *device = This->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context;
DWORD* data = pData;
@ -304,7 +304,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface,
return S_OK;
}
context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
@ -362,7 +362,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void
return S_OK;
}
context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
@ -472,17 +472,17 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD
if (query->context->tid != GetCurrentThreadId())
{
context_free_event_query(query);
context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD);
context_alloc_event_query(context, query);
}
else
{
context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
}
}
else
{
context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD);
context_alloc_event_query(context, query);
}
@ -520,7 +520,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
IWineD3DDeviceImpl *device = This->wineD3DDevice;
IWineD3DDeviceImpl *device = This->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if (gl_info->supported[ARB_OCCLUSION_QUERY])
@ -538,12 +538,12 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
FIXME("Wrong thread, can't restart query.\n");
context_free_occlusion_query(query);
context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD);
context_alloc_occlusion_query(context, query);
}
else
{
context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
@ -554,7 +554,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
else
{
if (query->context) context_free_occlusion_query(query);
context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD);
context_alloc_occlusion_query(context, query);
}
@ -578,7 +578,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
}
else
{
context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));

View File

@ -33,7 +33,7 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
{
struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource;
resource->wineD3DDevice = device;
resource->device = device;
resource->parent = parent;
resource->resourceType = resource_type;
resource->ref = 1;
@ -87,7 +87,7 @@ void resource_cleanup(IWineD3DResource *iface)
TRACE("(%p) Cleaning up resource\n", This);
if (This->resource.pool == WINED3DPOOL_DEFAULT) {
TRACE("Decrementing device memory pool by %u\n", This->resource.size);
WineD3DAdapterChangeGLRam(This->resource.wineD3DDevice, -This->resource.size);
WineD3DAdapterChangeGLRam(This->resource.device, -This->resource.size);
}
LIST_FOR_EACH_SAFE(e1, e2, &This->resource.privateData) {
@ -102,7 +102,7 @@ void resource_cleanup(IWineD3DResource *iface)
This->resource.allocatedMemory = 0;
This->resource.heapMemory = 0;
if (This->resource.wineD3DDevice) device_resource_released(This->resource.wineD3DDevice, iface);
if (This->resource.device) device_resource_released(This->resource.device, iface);
}
static PrivateData* resource_find_private_data(IWineD3DResourceImpl *This, REFGUID tag)
@ -179,7 +179,7 @@ HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID refguid, void
if (data->flags & WINED3DSPD_IUNKNOWN) {
*(LPUNKNOWN *)pData = data->ptr.object;
if (((IWineD3DImpl *)This->resource.wineD3DDevice->wined3d)->dxVersion != 7)
if (((IWineD3DImpl *)This->resource.device->wined3d)->dxVersion != 7)
{
/* D3D8 and D3D9 addref the private data, DDraw does not. This can't be handled in
* ddraw because it doesn't know if the pointer returned is an IUnknown * or just a

View File

@ -95,7 +95,7 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
}
if (stateblock->renderState[WINED3DRS_LIGHTING]
&& !stateblock->wineD3DDevice->strided_streams.position_transformed)
&& !stateblock->device->strided_streams.position_transformed)
{
glEnable(GL_LIGHTING);
checkGLcall("glEnable GL_LIGHTING");
@ -108,7 +108,8 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
/* No z test without depth stencil buffers */
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
if (!stateblock->device->stencilBufferTarget)
{
TRACE("No Z buffer - disabling depth test\n");
glDisable(GL_DEPTH_TEST); /* This also disables z writing in gl */
checkGLcall("glDisable GL_DEPTH_TEST");
@ -241,9 +242,9 @@ static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, struc
static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *)stateblock->device->render_targets[0];
int srcBlend = GL_ZERO;
int dstBlend = GL_ZERO;
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
/* GL_LINE_SMOOTH needs GL_BLEND to work, according to the red book, and special blending params */
if (stateblock->renderState[WINED3DRS_ALPHABLENDENABLE] ||
@ -448,8 +449,9 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
/* colorkey fixup for stage 0 alphaop depends on WINED3DRS_ALPHABLENDENABLE state,
so it may need updating */
if (stateblock->renderState[WINED3DRS_COLORKEYENABLE]) {
const struct StateEntry *StateTable = stateblock->wineD3DDevice->StateTable;
if (stateblock->renderState[WINED3DRS_COLORKEYENABLE])
{
const struct StateEntry *StateTable = stateblock->device->StateTable;
StateTable[STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP)].apply(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context);
}
}
@ -503,8 +505,9 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
}
}
if(enable_ckey || context->last_was_ckey) {
const struct StateEntry *StateTable = stateblock->wineD3DDevice->StateTable;
if (enable_ckey || context->last_was_ckey)
{
const struct StateEntry *StateTable = stateblock->device->StateTable;
StateTable[STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP)].apply(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context);
}
context->last_was_ckey = enable_ckey;
@ -540,7 +543,7 @@ static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
DWORD enable = 0xFFFFFFFF;
DWORD disable = 0x00000000;
if (!stateblock->wineD3DDevice->vs_clipping && use_vs(stateblock))
if (!stateblock->device->vs_clipping && use_vs(stateblock))
{
/* The spec says that opengl clipping planes are disabled when using shaders. Direct3D planes aren't,
* so that is an issue. The MacOS ATI driver keeps clipping planes activated with shaders in some
@ -748,14 +751,18 @@ static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock
}
}
TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Diffuse.r, stateblock->material.Diffuse.g,
stateblock->material.Diffuse.b, stateblock->material.Diffuse.a);
TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Ambient.r, stateblock->material.Ambient.g,
stateblock->material.Ambient.b, stateblock->material.Ambient.a);
TRACE("(%p) : Specular (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Specular.r, stateblock->material.Specular.g,
stateblock->material.Specular.b, stateblock->material.Specular.a);
TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", stateblock->wineD3DDevice, stateblock->material.Emissive.r, stateblock->material.Emissive.g,
stateblock->material.Emissive.b, stateblock->material.Emissive.a);
TRACE("(%p) : Diffuse {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
stateblock->material.Diffuse.r, stateblock->material.Diffuse.g,
stateblock->material.Diffuse.b, stateblock->material.Diffuse.a);
TRACE("(%p) : Ambient {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
stateblock->material.Ambient.r, stateblock->material.Ambient.g,
stateblock->material.Ambient.b, stateblock->material.Ambient.a);
TRACE("(%p) : Specular {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
stateblock->material.Specular.r, stateblock->material.Specular.g,
stateblock->material.Specular.b, stateblock->material.Specular.a);
TRACE("(%p) : Emissive {%.8e, %.8e, %.8e, %.8e}\n", stateblock->device,
stateblock->material.Emissive.r, stateblock->material.Emissive.g,
stateblock->material.Emissive.b, stateblock->material.Emissive.a);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*) &stateblock->material.Ambient);
checkGLcall("glMaterialfv(GL_AMBIENT)");
@ -817,8 +824,9 @@ static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struc
GLint depthFail_ccw = GL_KEEP;
GLint stencilPass_ccw = GL_KEEP;
/* No stencil test without a stencil buffer */
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
/* No stencil test without a stencil buffer. */
if (!stateblock->device->stencilBufferTarget)
{
glDisable(GL_STENCIL_TEST);
checkGLcall("glDisable GL_STENCIL_TEST");
return;
@ -900,13 +908,7 @@ static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struc
static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD mask;
if(stateblock->wineD3DDevice->stencilBufferTarget) {
mask = stateblock->renderState[WINED3DRS_STENCILWRITEMASK];
} else {
mask = 0;
}
DWORD mask = stateblock->device->stencilBufferTarget ? stateblock->renderState[WINED3DRS_STENCILWRITEMASK] : 0;
GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK));
checkGLcall("glActiveStencilFaceEXT(GL_BACK)");
@ -919,13 +921,7 @@ static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock
static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD mask;
if(stateblock->wineD3DDevice->stencilBufferTarget) {
mask = stateblock->renderState[WINED3DRS_STENCILWRITEMASK];
} else {
mask = 0;
}
DWORD mask = stateblock->device->stencilBufferTarget ? stateblock->renderState[WINED3DRS_STENCILWRITEMASK] : 0;
glStencilMask(mask);
checkGLcall("glStencilMask");
@ -1199,7 +1195,7 @@ void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
GLenum Parm = 0;
/* Depends on the decoded vertex declaration to read the existence of diffuse data.
@ -1368,7 +1364,7 @@ static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, str
* by zero and is not properly defined in opengl, so avoid it
*/
if (stateblock->renderState[WINED3DRS_NORMALIZENORMALS]
&& (stateblock->wineD3DDevice->strided_streams.use_map & (1 << WINED3D_FFP_NORMAL)))
&& (stateblock->device->strided_streams.use_map & (1 << WINED3D_FFP_NORMAL)))
{
glEnable(GL_NORMALIZE);
checkGLcall("glEnable(GL_NORMALIZE);");
@ -2974,8 +2970,8 @@ static void set_tex_op(const struct wined3d_context *context, IWineD3DDevice *if
static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage);
BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
DWORD mapped_stage = stateblock->device->texUnitMap[stage];
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Setting color op for stage %d\n", stage);
@ -3027,7 +3023,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
if (tex_used) texture_activate_dimensions(stage, stateblock, context);
}
set_tex_op(context, (IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
set_tex_op(context, (IWineD3DDevice *)stateblock->device, FALSE, stage,
stateblock->textureState[stage][WINED3DTSS_COLOROP],
stateblock->textureState[stage][WINED3DTSS_COLORARG1],
stateblock->textureState[stage][WINED3DTSS_COLORARG2],
@ -3037,8 +3033,8 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage);
BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
DWORD mapped_stage = stateblock->device->texUnitMap[stage];
DWORD op, arg1, arg2, arg0;
TRACE("Setting alpha op for stage %d\n", stage);
@ -3126,20 +3122,19 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d
TRACE("Setting alpha op for stage %d\n", stage);
if (context->gl_info->supported[NV_REGISTER_COMBINERS])
{
set_tex_op_nvrc((IWineD3DDevice *)stateblock->wineD3DDevice, TRUE, stage,
op, arg1, arg2, arg0,
mapped_stage,
stateblock->textureState[stage][WINED3DTSS_RESULTARG]);
} else {
set_tex_op(context, (IWineD3DDevice *)stateblock->wineD3DDevice, TRUE, stage,
op, arg1, arg2, arg0);
set_tex_op_nvrc((IWineD3DDevice *)stateblock->device, TRUE, stage, op, arg1, arg2, arg0,
mapped_stage, stateblock->textureState[stage][WINED3DTSS_RESULTARG]);
}
else
{
set_tex_op(context, (IWineD3DDevice *)stateblock->device, TRUE, stage, op, arg1, arg2, arg0);
}
}
static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD texUnit = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[texUnit];
DWORD mapped_stage = stateblock->device->texUnitMap[texUnit];
BOOL generated;
int coordIdx;
@ -3160,10 +3155,10 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, s
set_texture_matrix(&stateblock->transforms[WINED3DTS_TEXTURE0 + texUnit].u.m[0][0],
stateblock->textureState[texUnit][WINED3DTSS_TEXTURETRANSFORMFLAGS], generated, context->last_was_rhw,
stateblock->wineD3DDevice->strided_streams.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))
? stateblock->wineD3DDevice->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format_desc->format
stateblock->device->strided_streams.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))
? stateblock->device->strided_streams.elements[WINED3D_FFP_TEXCOORD0 + coordIdx].format_desc->format
: WINED3DFMT_UNKNOWN,
stateblock->wineD3DDevice->frag_pipe->ffp_proj_control);
stateblock->device->frag_pipe->ffp_proj_control);
/* The sampler applying function calls us if this changes */
if ((context->lastWasPow2Texture & (1 << texUnit)) && stateblock->textures[texUnit])
@ -3202,7 +3197,7 @@ static void loadTexCoords(const struct wined3d_context *context, IWineD3DStateBl
{
int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
mapped_stage = stateblock->wineD3DDevice->texUnitMap[textureNo];
mapped_stage = stateblock->device->texUnitMap[textureNo];
if (mapped_stage == WINED3D_UNMAPPED_STAGE) continue;
if (coordIdx < MAX_TEXTURES && (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))))
@ -3245,7 +3240,7 @@ static void loadTexCoords(const struct wined3d_context *context, IWineD3DStateBl
static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
DWORD mapped_stage = stateblock->device->texUnitMap[stage];
static const GLfloat s_plane[] = { 1.0f, 0.0f, 0.0f, 0.0f };
static const GLfloat t_plane[] = { 0.0f, 1.0f, 0.0f, 0.0f };
static const GLfloat r_plane[] = { 0.0f, 0.0f, 1.0f, 0.0f };
@ -3413,13 +3408,13 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
GLuint curVBO = context->gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
unloadTexCoords(context);
loadTexCoords(context, stateblock, &stateblock->wineD3DDevice->strided_streams, &curVBO);
loadTexCoords(context, stateblock, &stateblock->device->strided_streams, &curVBO);
}
}
static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
/* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
* has an update pending
@ -3471,7 +3466,8 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, s
{
if (texIsPow2) context->lastWasPow2Texture |= 1 << sampler;
else context->lastWasPow2Texture &= ~(1 << sampler);
transform_texture(STATE_TEXTURESTAGE(stateblock->wineD3DDevice->texUnitMap[sampler], WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
transform_texture(STATE_TEXTURESTAGE(stateblock->device->texUnitMap[sampler],
WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
}
}
}
@ -3479,7 +3475,7 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, s
static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
DWORD mapped_stage = stateblock->device->texUnitMap[sampler];
const struct wined3d_gl_info *gl_info = context->gl_info;
union {
float f;
@ -3532,8 +3528,9 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
}
/* Trigger shader constant reloading (for NP2 texcoord fixup) */
if (!tex_impl->baseTexture.pow2Matrix_identity) {
IWineD3DDeviceImpl* d3ddevice = stateblock->wineD3DDevice;
if (!tex_impl->baseTexture.pow2Matrix_identity)
{
IWineD3DDeviceImpl *d3ddevice = stateblock->device;
d3ddevice->shader_backend->shader_load_np2fixup_constants(
(IWineD3DDevice*)d3ddevice, use_ps(stateblock), use_vs(stateblock));
}
@ -3549,14 +3546,14 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context);
}
} /* Otherwise tex_colorop disables the stage */
glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler]);
checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->wineD3DDevice->dummyTextureName[sampler])");
glBindTexture(GL_TEXTURE_2D, stateblock->device->dummyTextureName[sampler]);
checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->device->dummyTextureName[sampler])");
}
}
void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
BOOL use_pshader = use_ps(stateblock);
BOOL use_vshader = use_vs(stateblock);
int i;
@ -3633,10 +3630,13 @@ static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, str
checkGLcall("glLoadIdentity()");
} else {
/* In the general case, the view matrix is the identity matrix */
if (stateblock->wineD3DDevice->view_ident) {
if (stateblock->device->view_ident)
{
glLoadMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
checkGLcall("glLoadMatrixf");
} else {
}
else
{
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
glMultMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(0)].u.m[0][0]);
@ -3711,10 +3711,13 @@ static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, s
/* World matrix 0 is multiplied with the view matrix because d3d uses 3 matrices while gl uses only 2. To avoid
* weighting the view matrix incorrectly it has to be multiplied into every gl modelview matrix
*/
if(stateblock->wineD3DDevice->view_ident) {
if (stateblock->device->view_ident)
{
glLoadMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(matrix)].u.m[0][0]);
checkGLcall("glLoadMatrixf");
} else {
}
else
{
glLoadMatrixf(&stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
checkGLcall("glLoadMatrixf");
glMultMatrixf(&stateblock->transforms[WINED3DTS_WORLDMATRIX(matrix)].u.m[0][0]);
@ -3758,7 +3761,8 @@ static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, s
*/
GL_EXTCALL(glVertexBlendARB(stateblock->renderState[WINED3DRS_VERTEXBLEND] + 1));
if(!stateblock->wineD3DDevice->vertexBlendUsed) {
if (!stateblock->device->vertexBlendUsed)
{
unsigned int i;
for (i = 1; i < context->gl_info->limits.blends; ++i)
{
@ -3767,7 +3771,7 @@ static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, s
transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i)), stateblock, context);
}
}
stateblock->wineD3DDevice->vertexBlendUsed = TRUE;
stateblock->device->vertexBlendUsed = TRUE;
}
break;
@ -3804,7 +3808,8 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
checkGLcall("glLoadMatrixf(...)");
/* Reset lights. TODO: Call light apply func */
for(k = 0; k < stateblock->wineD3DDevice->maxConcurrentLights; k++) {
for (k = 0; k < stateblock->device->maxConcurrentLights; ++k)
{
light = stateblock->activeLights[k];
if(!light) continue;
glLightfv(GL_LIGHT0 + light->glIndex, GL_POSITION, light->lightPosn);
@ -3836,7 +3841,7 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
}
/* Avoid looping over a number of matrices if the app never used the functionality */
if (stateblock->wineD3DDevice->vertexBlendUsed)
if (stateblock->device->vertexBlendUsed)
{
for (k = 1; k < context->gl_info->limits.blends; ++k)
{
@ -3864,7 +3869,8 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
minZ = stateblock->viewport.MinZ;
maxZ = stateblock->viewport.MaxZ;
if(!stateblock->wineD3DDevice->untransformed) {
if (!stateblock->device->untransformed)
{
/* Transformed vertices are supposed to bypass the whole transform pipeline including
* frustum clipping. This can't be done in opengl, so this code adjusts the Z range to
* suppress depth clipping. This can be done because it is an orthogonal projection and
@ -4042,7 +4048,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
DWORD_PTR shift_index;
/* Default to no instancing */
stateblock->wineD3DDevice->instancedDraw = FALSE;
stateblock->device->instancedDraw = FALSE;
for (i = 0; i < MAX_ATTRIBS; i++) {
if (!(stream_info->use_map & (1 << i)))
@ -4055,7 +4061,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
if (stateblock->streamFlags[stream_info->elements[i].stream_idx] & WINED3DSTREAMSOURCE_INSTANCEDATA)
{
if (context->numbered_array_mask & (1 << i)) unload_numbered_array(stateblock, context, i);
stateblock->wineD3DDevice->instancedDraw = TRUE;
stateblock->device->instancedDraw = TRUE;
continue;
}
@ -4217,7 +4223,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
TRACE("Using fast vertex array code\n");
/* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */
stateblock->wineD3DDevice->instancedDraw = FALSE;
stateblock->device->instancedDraw = FALSE;
/* Blend Data ---------------------------------------------- */
if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))
@ -4473,7 +4479,7 @@ static inline void drawPrimitiveTraceDataLocations(const struct wined3d_stream_i
static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
BOOL fixup = FALSE;
struct wined3d_stream_info *dataLocations = &device->strided_streams;
BOOL useVertexShaderFunction;
@ -4563,9 +4569,8 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s
BOOL updateFog = FALSE;
BOOL useVertexShaderFunction = use_vs(stateblock);
BOOL usePixelShaderFunction = use_ps(stateblock);
IWineD3DDeviceImpl *device = stateblock->device;
BOOL transformed;
/* Some stuff is in the device until we have per context tracking */
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL wasrhw = context->last_was_rhw;
unsigned int i;
@ -4721,8 +4726,8 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s
static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *)stateblock->device->render_targets[0];
UINT width, height;
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
WINED3DVIEWPORT vp = stateblock->viewport;
if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width;
@ -4750,8 +4755,8 @@ static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
{
GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height;
stateblock->wineD3DDevice->posFixup[2] = (63.0f / 64.0f) / stateblock->viewport.Width;
stateblock->wineD3DDevice->posFixup[3] = stateblock->wineD3DDevice->posFixup[1] * yoffset;
stateblock->device->posFixup[2] = (63.0f / 64.0f) / stateblock->viewport.Width;
stateblock->device->posFixup[3] = stateblock->device->posFixup[1] * yoffset;
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
@ -4879,16 +4884,16 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3
static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *)stateblock->device->render_targets[0];
RECT *pRect = &stateblock->scissorRect;
UINT height;
UINT width;
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
target->get_drawable_size(context, &width, &height);
/* Warning: glScissor uses window coordinates, not viewport coordinates, so our viewport correction does not apply
* Warning2: Even in windowed mode the coords are relative to the window, not the screen
*/
TRACE("(%p) Setting new Scissor Rect to %d:%d-%d:%d\n", stateblock->wineD3DDevice, pRect->left, pRect->bottom - height,
TRACE("(%p) Setting new Scissor Rect to %d:%d-%d:%d\n", stateblock->device, pRect->left, pRect->bottom - height,
pRect->right - pRect->left, pRect->bottom - pRect->top);
if (context->render_offscreen)
@ -5687,15 +5692,15 @@ static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
static void multistate_apply_2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
stateblock->wineD3DDevice->multistate_funcs[state][0](state, stateblock, context);
stateblock->wineD3DDevice->multistate_funcs[state][1](state, stateblock, context);
stateblock->device->multistate_funcs[state][0](state, stateblock, context);
stateblock->device->multistate_funcs[state][1](state, stateblock, context);
}
static void multistate_apply_3(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
stateblock->wineD3DDevice->multistate_funcs[state][0](state, stateblock, context);
stateblock->wineD3DDevice->multistate_funcs[state][1](state, stateblock, context);
stateblock->wineD3DDevice->multistate_funcs[state][2](state, stateblock, context);
stateblock->device->multistate_funcs[state][0](state, stateblock, context);
stateblock->device->multistate_funcs[state][1](state, stateblock, context);
stateblock->device->multistate_funcs[state][2](state, stateblock, context);
}
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,

View File

@ -193,7 +193,7 @@ static const DWORD vertex_states_sampler[] =
*/
static HRESULT stateblock_allocate_shader_constants(IWineD3DStateBlockImpl *object)
{
IWineD3DDeviceImpl *device = object->wineD3DDevice;
IWineD3DDeviceImpl *device = object->device;
/* Allocate space for floating point constants */
object->pixelShaderConstantF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
@ -329,7 +329,7 @@ static void stateblock_savedstates_set_vertex(SAVEDSTATES *states, const DWORD n
void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock)
{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
unsigned int i, j;
for (i = 0; i <= WINEHIGHEST_RENDER_STATE >> 5; ++i)
@ -583,7 +583,7 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock
static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
{
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
IWineD3DStateBlockImpl *targetStateBlock = This->wineD3DDevice->stateBlock;
IWineD3DStateBlockImpl *targetStateBlock = This->device->stateBlock;
unsigned int i;
DWORD map;
@ -720,7 +720,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
if (This->changed.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl
&& (This->blockType != WINED3DSBT_RECORDED
|| ((IWineD3DImpl *)This->wineD3DDevice->wined3d)->dxVersion != 9))
|| ((IWineD3DImpl *)This->device->wined3d)->dxVersion != 9))
{
TRACE("Updating vertex declaration from %p to %p.\n", This->vertexDecl, targetStateBlock->vertexDecl);
@ -878,7 +878,7 @@ static void apply_lights(IWineD3DDevice *pDevice, const IWineD3DStateBlockImpl *
static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
{
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
IWineD3DDevice *pDevice = (IWineD3DDevice *)This->wineD3DDevice;
IWineD3DDevice *pDevice = (IWineD3DDevice *)This->device;
unsigned int i;
DWORD map;
@ -961,8 +961,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if (This->changed.primitive_type)
{
This->wineD3DDevice->updateStateBlock->changed.primitive_type = TRUE;
This->wineD3DDevice->updateStateBlock->gl_primitive_type = This->gl_primitive_type;
This->device->updateStateBlock->changed.primitive_type = TRUE;
This->device->updateStateBlock->gl_primitive_type = This->gl_primitive_type;
}
if (This->changed.indices)
@ -1028,12 +1028,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
IWineD3DDevice_SetClipPlane(pDevice, i, clip);
}
This->wineD3DDevice->stateBlock->lowest_disabled_stage = MAX_TEXTURES - 1;
This->device->stateBlock->lowest_disabled_stage = MAX_TEXTURES - 1;
for (i = 0; i < MAX_TEXTURES - 1; ++i)
{
if (This->wineD3DDevice->stateBlock->textureState[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE)
if (This->device->stateBlock->textureState[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE)
{
This->wineD3DDevice->stateBlock->lowest_disabled_stage = i;
This->device->stateBlock->lowest_disabled_stage = i;
break;
}
}
@ -1044,9 +1044,9 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock* iface) {
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
IWineD3DDevice *device = (IWineD3DDevice *)This->wineD3DDevice;
IWineD3DDevice *device = (IWineD3DDevice *)This->device;
IWineD3DDeviceImpl *ThisDevice = (IWineD3DDeviceImpl *)device;
const struct wined3d_gl_info *gl_info = &This->wineD3DDevice->adapter->gl_info;
const struct wined3d_gl_info *gl_info = &ThisDevice->adapter->gl_info;
union {
WINED3DLINEPATTERN lp;
DWORD d;
@ -1063,7 +1063,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
/* Note this may have a large overhead but it should only be executed
once, in order to initialize the complete state of the device and
all opengl equivalents */
TRACE("(%p) -----------------------> Setting up device defaults... %p\n", This, This->wineD3DDevice);
TRACE("(%p) -----------------------> Setting up device defaults... %p\n", This, ThisDevice);
/* TODO: make a special stateblock type for the primary stateblock (it never gets applied so it doesn't need a real type) */
This->blockType = WINED3DSBT_INIT;
@ -1323,7 +1323,7 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
stateblock->lpVtbl = &IWineD3DStateBlock_Vtbl;
stateblock->ref = 1;
stateblock->wineD3DDevice = device;
stateblock->device = device;
stateblock->blockType = type;
for (i = 0; i < LIGHTMAP_SIZE; i++)

View File

@ -38,7 +38,7 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d);
static void surface_cleanup(IWineD3DSurfaceImpl *This)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context = NULL;
renderbuffer_entry_t *entry, *entry2;
@ -322,11 +322,11 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) {
ENTER_GL();
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
LEAVE_GL();
active_sampler = This->resource.wineD3DDevice->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
active_sampler = This->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
if (active_sampler != WINED3D_UNMAPPED_STAGE)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(active_sampler));
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler));
}
IWineD3DSurface_BindTexture((IWineD3DSurface *)This, srgb);
}
@ -345,7 +345,7 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device)
#undef GLINFO_LOCATION
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION This->resource.device->adapter->gl_info
/* This call just downloads data, the caller is responsible for binding the
* correct texture. */
@ -393,14 +393,14 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
int dst_pitch = 0;
/* In case of P8 the index is stored in the alpha component if the primary render target uses P8 */
if (format_desc->format == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.wineD3DDevice))
if (format_desc->format == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device))
{
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
}
if (This->Flags & SFLAG_NONPOW2) {
unsigned char alignment = This->resource.wineD3DDevice->surface_alignment;
unsigned char alignment = This->resource.device->surface_alignment;
src_pitch = format_desc->byte_count * This->pow2Width;
dst_pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This);
src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1);
@ -553,7 +553,7 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsi
* the correct texture. */
/* Context activation is done by the caller. */
static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal, GLsizei width, GLsizei height, GLenum format, GLenum type) {
const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
const struct GlPixelFormatDesc *format_desc = This->resource.format_desc;
BOOL enable_client_storage = FALSE;
const BYTE *mem = NULL;
@ -615,7 +615,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal,
/* GL locking is done by the caller */
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
renderbuffer_entry_t *entry;
GLuint renderbuffer = 0;
unsigned int src_width, src_height;
@ -757,8 +757,8 @@ void surface_internal_preload(IWineD3DSurface *iface, enum WINED3DSRGB srgb)
{
/* TODO: check for locks */
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.device;
IWineD3DBaseTexture *baseTexture = NULL;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p)Checking to see if the container is a base texture\n", This);
if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == WINED3D_OK) {
@ -851,7 +851,7 @@ BOOL surface_init_sysmem(IWineD3DSurface *iface)
static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
IWineD3DBaseTexture *texture = NULL;
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info;
renderbuffer_entry_t *entry, *entry2;
struct wined3d_context *context;
@ -926,8 +926,9 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
****************************************************** */
/* Read the framebuffer back into the surface */
static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, void *dest, UINT pitch) {
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, void *dest, UINT pitch)
{
IWineD3DDeviceImpl *myDevice = This->resource.device;
struct wined3d_context *context;
BYTE *mem;
GLint fmt;
@ -1170,7 +1171,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
/* Read the framebuffer contents into a texture */
static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
IWineD3DSwapChainImpl *swapchain;
struct wined3d_context *context;
int bpp;
@ -1247,7 +1248,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
/* Performance optimization: Count how often a surface is locked, if it is locked regularly do not throw away the system memory copy.
@ -1321,7 +1322,7 @@ static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This)
static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
const RECT *pass_rect = pRect;
TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
@ -1424,7 +1425,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
GLint prev_rasterpos[4];
GLint skipBytes = 0;
UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This); /* target is argb, 4 byte */
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
IWineD3DSwapChainImpl *swapchain;
struct wined3d_context *context;
@ -1528,7 +1529,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
BOOL fullsurface;
if (!(This->Flags & SFLAG_LOCKED)) {
@ -1703,7 +1704,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
} else {
IWineD3DSurfaceImpl *dds_primary;
IWineD3DSwapChainImpl *swapchain;
swapchain = (IWineD3DSwapChainImpl *)This->resource.wineD3DDevice->swapchains[0];
swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[0];
dds_primary = (IWineD3DSurfaceImpl *)swapchain->frontBuffer;
if (dds_primary && dds_primary->palette)
pal = dds_primary->palette->palents;
@ -1761,7 +1762,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC
HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode) {
BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT);
const struct GlPixelFormatDesc *glDesc = This->resource.format_desc;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
/* Default values: From the surface */
@ -1988,7 +1989,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL colorkey)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
IWineD3DPaletteImpl *pal = This->palette;
BOOL index_in_alpha = FALSE;
unsigned int i;
@ -2069,7 +2070,7 @@ static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4]
static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UINT width,
UINT height, UINT outpitch, CONVERT_TYPES convert, IWineD3DSurfaceImpl *This)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const BYTE *source;
BYTE *dest;
@ -2508,7 +2509,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES convert) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
BYTE table[256][4];
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
d3dfmt_p8_init_palette(This, table, (convert == CONVERT_PALETTED_CK));
@ -2573,8 +2574,9 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
}
}
BOOL palette9_changed(IWineD3DSurfaceImpl *This) {
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
BOOL palette9_changed(IWineD3DSurfaceImpl *This)
{
IWineD3DDeviceImpl *device = This->resource.device;
if (This->palette || (This->resource.format_desc->format != WINED3DFMT_P8_UINT
&& This->resource.format_desc->format != WINED3DFMT_P8_UINT_A8_UNORM))
@ -2673,8 +2675,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb) {
/* TODO: check for locks */
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.device;
IWineD3DBaseTexture *baseTexture = NULL;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
TRACE("(%p)Checking to see if the container is a base texture\n", This);
if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == WINED3D_OK) {
@ -2784,7 +2786,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, c
glGetIntegerv(GL_READ_BUFFER, &prevRead);
checkGLcall("glGetIntegerv");
glReadBuffer(swapChain ? GL_BACK : This->resource.wineD3DDevice->offscreenBuffer);
glReadBuffer(swapChain ? GL_BACK : This->resource.device->offscreenBuffer);
checkGLcall("glReadBuffer");
glCopyTexImage2D(GL_TEXTURE_2D,
0,
@ -3092,7 +3094,7 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
IWineD3DSwapChainImpl *swapchain, const WINED3DRECT *srect, const WINED3DRECT *drect,
BOOL upsidedown, WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
float xrel, yrel;
UINT row;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
@ -3187,8 +3189,8 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
IWineD3DSwapChainImpl *swapchain, const WINED3DRECT *srect, const WINED3DRECT *drect,
BOOL upsidedown, WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DDeviceImpl *myDevice = This->resource.device;
GLuint src, backup = 0;
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
float left, right, top, bottom; /* Texture coordinates */
UINT fbwidth = Src->currentDesc.Width;
@ -3440,8 +3442,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
IWineD3DSurface *SrcSurface, const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx,
WINED3DTEXTUREFILTERTYPE Filter)
{
IWineD3DDeviceImpl *myDevice = This->resource.device;
WINED3DRECT rect;
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DSwapChainImpl *srcSwapchain = NULL, *dstSwapchain = NULL;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
@ -3990,7 +3992,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *DestRect,
IWineD3DSurface *SrcSurface, const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx)
{
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
float depth;
if (Flags & WINEDDBLT_DEPTHFILL) {
@ -4031,7 +4033,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT
const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx);
TRACE("(%p): Usage is %s\n", This, debug_d3dusage(This->resource.usage));
@ -4072,7 +4075,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DSurfaceImpl *srcImpl = (IWineD3DSurfaceImpl *) Source;
IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *myDevice = This->resource.device;
TRACE("(%p)->(%d, %d, %p, %p, %08x\n", iface, dstx, dsty, Source, rsrc, trans);
if ( (This->Flags & SFLAG_LOCKED) || (srcImpl->Flags & SFLAG_LOCKED))
@ -4154,7 +4158,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)
if((This->resource.usage & WINED3DUSAGE_RENDERTARGET) && (convert == NO_CONVERSION))
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context;
/* Make sure the texture is up to date. This call doesn't do anything if the texture is already up to date. */
@ -4198,7 +4202,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)
static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
/** Check against the maximum texture sizes supported by the video card **/
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
unsigned int pow2Width, pow2Height;
This->texture_name = 0;
@ -4388,7 +4392,7 @@ static void surface_get_depth_blt_info(GLenum target, GLsizei w, GLsizei h, stru
/* GL locking is done by the caller */
static void surface_depth_blt(IWineD3DSurfaceImpl *This, GLuint texture, GLsizei w, GLsizei h, GLenum target)
{
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct depth_blt_info info;
GLint old_binding = 0;
@ -4447,7 +4451,7 @@ void surface_modify_ds_location(IWineD3DSurface *iface, DWORD location) {
void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *context, DWORD location)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("(%p) New location %#x\n", This, location);
@ -4633,12 +4637,12 @@ static inline void cube_coords_float(const RECT *r, UINT w, UINT h, struct float
static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT *rect_in)
{
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context;
struct coords coords[4];
RECT rect;
IWineD3DSwapChain *swapchain;
IWineD3DBaseTexture *texture;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
GLenum bind_target;
struct float_rect f;
@ -4827,7 +4831,7 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
*****************************************************************************/
static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, DWORD flag, const RECT *rect) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
GLenum format, internal, type;
CONVERT_TYPES convert;

View File

@ -162,11 +162,8 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetContainer(IWineD3DSurface* iface, REFI
}
/* Standalone surfaces return the device as container. */
if (This->container) {
container = This->container;
} else {
container = (IWineD3DBase *)This->resource.wineD3DDevice;
}
if (This->container) container = This->container;
else container = (IWineD3DBase *)This->resource.device;
TRACE("Relaying to QueryInterface\n");
return IUnknown_QueryInterface(container, riid, ppContainer);
@ -342,7 +339,7 @@ DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
}
else
{
unsigned char alignment = This->resource.wineD3DDevice->surface_alignment;
unsigned char alignment = This->resource.device->surface_alignment;
ret = This->resource.format_desc->byte_count * This->currentDesc.Width; /* Bytes / row */
ret = (ret + alignment - 1) & ~(alignment - 1);
}
@ -507,7 +504,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWin
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(format,
&This->resource.wineD3DDevice->adapter->gl_info);
&This->resource.device->adapter->gl_info);
if (This->resource.format_desc->format != WINED3DFMT_UNKNOWN)
{
@ -517,7 +514,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3D
TRACE("(%p) : Setting texture format to (%d,%s)\n", This, format, debug_d3dformat(format));
This->resource.size = surface_calculate_size(format_desc, This->resource.wineD3DDevice->surface_alignment,
This->resource.size = surface_calculate_size(format_desc, This->resource.device->surface_alignment,
This->pow2Width, This->pow2Height);
This->Flags |= (WINED3DFMT_D16_LOCKABLE == format) ? SFLAG_LOCKABLE : 0;
@ -793,7 +790,7 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
return NULL;
}
IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.wineD3DDevice, source->currentDesc.Width,
IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width,
source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */, &ret,
0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */,
0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),

View File

@ -429,7 +429,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
} else {
IWineD3DSurfaceImpl *dds_primary;
IWineD3DSwapChainImpl *swapchain;
swapchain = (IWineD3DSwapChainImpl *)This->resource.wineD3DDevice->swapchains[0];
swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[0];
dds_primary = (IWineD3DSurfaceImpl *)swapchain->frontBuffer;
if (dds_primary && dds_primary->palette)
pal = dds_primary->palette->palents;

View File

@ -33,7 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(fps);
#define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION This->device->adapter->gl_info
/*IWineD3DSwapChain parts follow: */
static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
@ -76,7 +76,7 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
for (i = 0; i < This->num_contexts; ++i)
{
context_destroy(This->wineD3DDevice, This->context[i]);
context_destroy(This->device, This->context[i]);
}
/* Restore the screen resolution if we rendered in fullscreen
* This will restore the screen resolution to what it was before creating the swapchain. In case of d3d8 and d3d9
@ -88,7 +88,7 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
mode.Height = This->orig_height;
mode.RefreshRate = 0;
mode.Format = This->orig_fmt;
IWineD3DDevice_SetDisplayMode((IWineD3DDevice *) This->wineD3DDevice, 0, &mode);
IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)This->device, 0, &mode);
}
HeapFree(GetProcessHeap(), 0, This->context);
@ -99,7 +99,7 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface)
static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *context)
{
RECT window;
IWineD3DDeviceImpl *device = This->wineD3DDevice;
IWineD3DDeviceImpl *device = This->device;
IWineD3DSurfaceImpl *backbuffer = ((IWineD3DSurfaceImpl *) This->backBuffer[0]);
UINT w = backbuffer->currentDesc.Width;
UINT h = backbuffer->currentDesc.Height;
@ -121,7 +121,7 @@ static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_co
glDrawBuffer(GL_BACK);
glDisable(GL_SCISSOR_TEST);
IWineD3DDeviceImpl_MarkStateDirty(This->wineD3DDevice, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
IWineD3DDeviceImpl_MarkStateDirty(This->device, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
/* Note that the texture is upside down */
gl_info->fbo_ops.glBlitFramebuffer(0, 0, w, h,
@ -138,7 +138,7 @@ static inline void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_co
float tex_right = w;
float tex_bottom = h;
context2 = context_acquire(This->wineD3DDevice, This->backBuffer[0], CTXUSAGE_BLIT);
context2 = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_BLIT);
if(backbuffer->Flags & SFLAG_NORMCOORD)
{
@ -211,15 +211,19 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
unsigned int sync;
int retval;
context = context_acquire(This->wineD3DDevice, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);
/* Render the cursor onto the back buffer, using our nifty directdraw blitting code :-) */
if(This->wineD3DDevice->bCursorVisible && This->wineD3DDevice->cursorTexture) {
if (This->device->bCursorVisible && This->device->cursorTexture)
{
IWineD3DSurfaceImpl cursor;
RECT destRect = {This->wineD3DDevice->xScreenSpace - This->wineD3DDevice->xHotSpot,
This->wineD3DDevice->yScreenSpace - This->wineD3DDevice->yHotSpot,
This->wineD3DDevice->xScreenSpace + This->wineD3DDevice->cursorWidth - This->wineD3DDevice->xHotSpot,
This->wineD3DDevice->yScreenSpace + This->wineD3DDevice->cursorHeight - This->wineD3DDevice->yHotSpot};
RECT destRect =
{
This->device->xScreenSpace - This->device->xHotSpot,
This->device->yScreenSpace - This->device->yHotSpot,
This->device->xScreenSpace + This->device->cursorWidth - This->device->xHotSpot,
This->device->yScreenSpace + This->device->cursorHeight - This->device->yHotSpot,
};
TRACE("Rendering the cursor. Creating fake surface at %p\n", &cursor);
/* Build a fake surface to call the Blitting code. It is not possible to use the interface passed by
* the application because we are only supposed to copy the information out. Using a fake surface
@ -228,16 +232,15 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
memset(&cursor, 0, sizeof(cursor));
cursor.lpVtbl = &IWineD3DSurface_Vtbl;
cursor.resource.ref = 1;
cursor.resource.wineD3DDevice = This->wineD3DDevice;
cursor.resource.device = This->device;
cursor.resource.pool = WINED3DPOOL_SCRATCH;
cursor.resource.format_desc =
getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, &This->wineD3DDevice->adapter->gl_info);
cursor.resource.format_desc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, context->gl_info);
cursor.resource.resourceType = WINED3DRTYPE_SURFACE;
cursor.texture_name = This->wineD3DDevice->cursorTexture;
cursor.texture_name = This->device->cursorTexture;
cursor.texture_target = GL_TEXTURE_2D;
cursor.texture_level = 0;
cursor.currentDesc.Width = This->wineD3DDevice->cursorWidth;
cursor.currentDesc.Height = This->wineD3DDevice->cursorHeight;
cursor.currentDesc.Width = This->device->cursorWidth;
cursor.currentDesc.Height = This->device->cursorHeight;
cursor.glRect.left = 0;
cursor.glRect.top = 0;
cursor.glRect.right = cursor.currentDesc.Width;
@ -256,9 +259,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
IWineD3DSurface_Blt(This->backBuffer[0], &destRect, (IWineD3DSurface *)&cursor,
NULL, WINEDDBLT_KEYSRC, NULL, WINED3DTEXF_POINT);
}
if(This->wineD3DDevice->logo_surface) {
/* Blit the logo into the upper left corner of the drawable */
IWineD3DSurface_BltFast(This->backBuffer[0], 0, 0, This->wineD3DDevice->logo_surface, NULL, WINEDDBLTFAST_SRCCOLORKEY);
if (This->device->logo_surface)
{
/* Blit the logo into the upper left corner of the drawable. */
IWineD3DSurface_BltFast(This->backBuffer[0], 0, 0, This->device->logo_surface, NULL, WINEDDBLTFAST_SRCCOLORKEY);
}
if (pSourceRect || pDestRect) FIXME("Unhandled present rects %s/%s\n", wine_dbgstr_rect(pSourceRect), wine_dbgstr_rect(pDestRect));
@ -389,7 +394,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
if (FALSE && This->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) {
TRACE("Clearing the color buffer with cyan color\n");
IWineD3DDevice_Clear((IWineD3DDevice*)This->wineD3DDevice, 0, NULL,
IWineD3DDevice_Clear((IWineD3DDevice *)This->device, 0, NULL,
WINED3DCLEAR_TARGET, 0xff00ffff, 1.0f, 0);
}
@ -429,10 +434,12 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
}
}
if (This->wineD3DDevice->stencilBufferTarget) {
if (This->device->stencilBufferTarget)
{
if (This->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL
|| ((IWineD3DSurfaceImpl *)This->wineD3DDevice->stencilBufferTarget)->Flags & SFLAG_DISCARD) {
surface_modify_ds_location(This->wineD3DDevice->stencilBufferTarget, SFLAG_DS_DISCARDED);
|| ((IWineD3DSurfaceImpl *)This->device->stencilBufferTarget)->Flags & SFLAG_DISCARD)
{
surface_modify_ds_location(This->device->stencilBufferTarget, SFLAG_DS_DISCARDED);
}
}
@ -493,16 +500,19 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_SetDestWindowOverride(IWineD3DSwapCh
if(window == This->win_handle) return WINED3D_OK;
TRACE("Performing dest override of swapchain %p from window %p to %p\n", This, This->win_handle, window);
if(This->context[0] == This->wineD3DDevice->contexts[0]) {
if (This->context[0] == This->device->contexts[0])
{
/* The primary context 'owns' all the opengl resources. Destroying and recreating that context requires downloading
* all opengl resources, deleting the gl resources, destroying all other contexts, then recreating all other contexts
* and reload the resources
*/
delete_opengl_contexts((IWineD3DDevice *) This->wineD3DDevice, iface);
This->win_handle = window;
create_primary_opengl_context((IWineD3DDevice *) This->wineD3DDevice, iface);
} else {
This->win_handle = window;
delete_opengl_contexts((IWineD3DDevice *)This->device, iface);
This->win_handle = window;
create_primary_opengl_context((IWineD3DDevice *)This->device, iface);
}
else
{
This->win_handle = window;
/* The old back buffer has to be copied over to the new back buffer. A lockrect - switchcontext - unlockrect
* would suffice in theory, but it is rather nasty and may cause troubles with future changes of the locking code
@ -513,8 +523,8 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_SetDestWindowOverride(IWineD3DSwapCh
memcpy(mem, r.pBits, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
context_destroy(This->wineD3DDevice, This->context[0]);
This->context[0] = context_create(This->wineD3DDevice, (IWineD3DSurfaceImpl *)This->frontBuffer,
context_destroy(This->device, This->context[0]);
This->context[0] = context_create(This->device, (IWineD3DSurfaceImpl *)This->frontBuffer,
This->win_handle, FALSE /* pbuffer */, &This->presentParms);
context_release(This->context[0]);
@ -555,7 +565,7 @@ struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *i
TRACE("Creating a new context for swapchain %p, thread %d\n", This, GetCurrentThreadId());
ctx = context_create(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer,
ctx = context_create(This->device, (IWineD3DSurfaceImpl *)This->frontBuffer,
This->context[0]->win_handle, FALSE /* pbuffer */, &This->presentParms);
if (!ctx)
{
@ -567,7 +577,7 @@ struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *i
newArray = HeapAlloc(GetProcessHeap(), 0, sizeof(*newArray) * This->num_contexts + 1);
if(!newArray) {
ERR("Out of memory when trying to allocate a new context array\n");
context_destroy(This->wineD3DDevice, ctx);
context_destroy(This->device, ctx);
return NULL;
}
memcpy(newArray, This->context, sizeof(*newArray) * This->num_contexts);

View File

@ -139,7 +139,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface
HRESULT hr;
TRACE("(%p)->(%p): Calling GetAdapterDisplayMode\n", This, pMode);
hr = IWineD3D_GetAdapterDisplayMode(This->wineD3DDevice->wined3d, This->wineD3DDevice->adapter->ordinal, pMode);
hr = IWineD3D_GetAdapterDisplayMode(This->device->wined3d, This->device->adapter->ordinal, pMode);
TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate,
pMode->Format, debug_d3dformat(pMode->Format));
@ -149,7 +149,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice**ppDevice) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
*ppDevice = (IWineD3DDevice *) This->wineD3DDevice;
*ppDevice = (IWineD3DDevice *)This->device;
/* Note Calling this method will increase the internal reference count
on the IDirect3DDevice9 interface. */

View File

@ -67,7 +67,7 @@ static void WINAPI IWineGDISwapChainImpl_Destroy(IWineD3DSwapChain *iface)
mode.Height = This->orig_height;
mode.RefreshRate = 0;
mode.Format = This->orig_fmt;
IWineD3DDevice_SetDisplayMode((IWineD3DDevice *) This->wineD3DDevice, 0, &mode);
IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)This->device, 0, &mode);
}
HeapFree(GetProcessHeap(), 0, This->context);

View File

@ -31,7 +31,7 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
{
/* Override the IWineD3DResource PreLoad method. */
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
struct wined3d_context *context = NULL;
unsigned int i;
BOOL srgb_mode;

View File

@ -2227,7 +2227,7 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) {
*********************************************************************/
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4])
{
const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
int x1 = Rect->left, x2 = Rect->right;
int y1 = Rect->top, y2 = Rect->bottom;
GLint maxSize = gl_info->limits.texture_size;
@ -2386,7 +2386,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
unsigned int i;
DWORD ttff;
DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2;
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
IWineD3DDeviceImpl *device = stateblock->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
for (i = 0; i < gl_info->limits.texture_stages; ++i)
@ -2703,7 +2703,7 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
DWORD mapped_stage = stateblock->device->texUnitMap[sampler];
/* No need to enable / disable anything here for unused samplers. The tex_colorop
* handler takes care. Also no action is needed with pixel shaders, or if tex_colorop

View File

@ -206,7 +206,7 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWine
declaration->ref = 1;
declaration->parent = parent;
declaration->parent_ops = parent_ops;
declaration->wineD3DDevice = device;
declaration->device = device;
declaration->elements = HeapAlloc(GetProcessHeap(), 0, sizeof(*declaration->elements) * element_count);
if (!declaration->elements)
{

View File

@ -25,12 +25,12 @@
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
#define GLINFO_LOCATION This->resource.device->adapter->gl_info
/* Context activation is done by the caller. */
static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
IWineD3DVolumeTexture *texture;
DWORD active_sampler;
@ -51,14 +51,14 @@ static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
ENTER_GL();
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
LEAVE_GL();
active_sampler = This->resource.wineD3DDevice->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
active_sampler = This->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
} else {
active_sampler = 0;
}
if (active_sampler != WINED3D_UNMAPPED_STAGE)
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(active_sampler));
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler));
}
if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DVolumeTexture, (void **)&texture))) {

View File

@ -30,7 +30,7 @@ static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINE
{
/* Override the IWineD3DResource Preload method. */
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
IWineD3DDeviceImpl *device = This->resource.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context = NULL;
BOOL srgb_mode = This->baseTexture.is_srgb;

View File

@ -1631,7 +1631,7 @@ typedef struct IWineD3DResourceClass
/* WineD3DResource Information */
IUnknown *parent;
WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *wineD3DDevice;
IWineD3DDeviceImpl *device;
WINED3DPOOL pool;
UINT size;
DWORD usage;
@ -2133,7 +2133,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
IUnknown *parent;
const struct wined3d_parent_ops *parent_ops;
IWineD3DDeviceImpl *wineD3DDevice;
IWineD3DDeviceImpl *device;
struct wined3d_vertex_declaration_element *elements;
UINT element_count;
@ -2193,7 +2193,7 @@ struct IWineD3DStateBlockImpl
LONG ref; /* Note: Ref counting not required */
/* IWineD3DStateBlock information */
IWineD3DDeviceImpl *wineD3DDevice;
IWineD3DDeviceImpl *device;
WINED3DSTATEBLOCKTYPE blockType;
/* Array indicating whether things have been set or changed */
@ -2313,7 +2313,7 @@ typedef struct IWineD3DQueryImpl
LONG ref; /* Note: Ref counting not required */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
IWineD3DDeviceImpl *device;
/* IWineD3DQuery fields */
enum query_state state;
@ -2401,7 +2401,7 @@ typedef struct IWineD3DSwapChainImpl
LONG ref; /* Note: Ref counting not required */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
IWineD3DDeviceImpl *device;
/* IWineD3DSwapChain fields */
IWineD3DSurface **backBuffer;
@ -2790,7 +2790,7 @@ struct IWineD3DPaletteImpl {
LONG ref;
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
IWineD3DDeviceImpl *device;
/* IWineD3DPalette */
HPALETTE hpal;
@ -2866,13 +2866,12 @@ static inline BOOL use_vs(IWineD3DStateBlockImpl *stateblock)
* style strided data. */
return (stateblock->vertexShader
&& !((IWineD3DVertexDeclarationImpl *)stateblock->vertexDecl)->position_transformed
&& stateblock->wineD3DDevice->vs_selected_mode != SHADER_NONE);
&& stateblock->device->vs_selected_mode != SHADER_NONE);
}
static inline BOOL use_ps(IWineD3DStateBlockImpl *stateblock)
{
return (stateblock->pixelShader
&& stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE);
return (stateblock->pixelShader && stateblock->device->ps_selected_mode != SHADER_NONE);
}
void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface,