[PATCH 4/6] wined3d: Rename WineD3DContext to struct wined3d_context.
Henri Verbeet
hverbeet at codeweavers.com
Mon Aug 3 01:06:51 CDT 2009
---
dlls/wined3d/arb_program_shader.c | 29 ++--
dlls/wined3d/ati_fragment_shader.c | 15 +-
dlls/wined3d/context.c | 85 +++++----
dlls/wined3d/device.c | 16 +-
dlls/wined3d/drawprim.c | 4 +-
dlls/wined3d/gl_compat.c | 18 +-
dlls/wined3d/nvidia_texture_shader.c | 15 +-
dlls/wined3d/query.c | 4 +-
dlls/wined3d/state.c | 307 ++++++++++++++++++++++------------
dlls/wined3d/surface.c | 4 +-
dlls/wined3d/swapchain.c | 9 +-
dlls/wined3d/utils.c | 6 +-
dlls/wined3d/wined3d_private.h | 187 +++++++++++----------
13 files changed, 414 insertions(+), 285 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 682624b..c6f4447 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -534,7 +534,7 @@ static void shader_arb_load_constants(
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
- const struct WineD3DContext *context = context_get_current();
+ const struct wined3d_context *context = context_get_current();
const struct wined3d_gl_info *gl_info = context->gl_info;
if (useVertexShader) {
@@ -560,7 +560,7 @@ static void shader_arb_load_constants(
static void shader_arb_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- struct WineD3DContext *context = context_get_current();
+ struct wined3d_context *context = context_get_current();
/* 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 */
@@ -573,7 +573,7 @@ static void shader_arb_update_float_vertex_constants(IWineD3DDevice *iface, UINT
static void shader_arb_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- struct WineD3DContext *context = context_get_current();
+ struct wined3d_context *context = context_get_current();
/* 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 */
@@ -4215,7 +4215,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct shader_arb_priv *priv = This->shader_priv;
- struct WineD3DContext *context = context_get_current();
+ struct wined3d_context *context = context_get_current();
const struct wined3d_gl_info *gl_info = context->gl_info;
int i;
@@ -5161,7 +5161,8 @@ static void arbfp_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info
#undef GLINFO_LOCATION
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
-static void state_texfactor_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_texfactor_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
@@ -5182,7 +5183,8 @@ static void state_texfactor_arbfp(DWORD state, IWineD3DStateBlockImpl *statebloc
}
-static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
@@ -5209,7 +5211,8 @@ static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateb
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col)");
}
-static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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;
float mat[2][2];
@@ -5244,7 +5247,8 @@ static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, W
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_BUMPMAT(stage), &mat[0][0])");
}
-static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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;
float param[4];
@@ -5751,7 +5755,8 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
return ret;
}
-static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
struct shader_arb_priv *priv = device->fragment_priv;
BOOL use_pshader = use_ps(stateblock);
@@ -5848,7 +5853,8 @@ static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock,
* is that changing the fog start and fog end(which links to FOGENABLE in vertex) results in the
* fragment_prog_arbfp function being called because FOGENABLE is dirty, which calls this function here
*/
-static void state_arbfp_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_arbfp_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
enum fogsource new_source;
TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
@@ -5878,7 +5884,8 @@ static void state_arbfp_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(!isStateDirty(context, STATE_PIXELSHADER)) {
fragment_prog_arbfp(state, stateblock, context);
}
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 29a7850..7d93e00 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -796,7 +796,8 @@ 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
-static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *This = stateblock->wineD3DDevice;
const struct atifs_ffp_desc *desc;
struct ffp_frag_settings settings;
@@ -842,7 +843,8 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, Wi
GL_EXTCALL(glBindFragmentShaderATI(desc->shader));
}
-static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
@@ -850,7 +852,8 @@ static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *statebloc
checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_TFACTOR, col)");
}
-static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
float mat[2][2];
@@ -873,13 +876,15 @@ static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_BUMPMAT(stage), mat)");
}
-static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(!isStateDirty(context, STATE_PIXELSHADER)) {
set_tex_op_atifs(state, stateblock, context);
}
}
-static void atifs_apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void atifs_apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL use_vshader = use_vs(stateblock);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 0d04728..d0b23b7 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -35,7 +35,7 @@ static DWORD wined3d_context_tls_idx;
/* FBO helper functions */
/* GL locking is done by the caller */
-void context_bind_fbo(struct WineD3DContext *context, GLenum target, GLuint *fbo)
+void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
GLuint f;
@@ -101,7 +101,7 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info)
}
/* GL locking is done by the caller */
-static void context_destroy_fbo(struct WineD3DContext *context, GLuint *fbo)
+static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -178,7 +178,7 @@ static void context_apply_attachment_filter_states(IWineD3DSurface *surface, BOO
}
/* GL locking is done by the caller */
-void context_attach_depth_stencil_fbo(struct WineD3DContext *context,
+void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer)
{
IWineD3DSurfaceImpl *depth_stencil_impl = (IWineD3DSurfaceImpl *)depth_stencil;
@@ -250,7 +250,7 @@ void context_attach_depth_stencil_fbo(struct WineD3DContext *context,
}
/* GL locking is done by the caller */
-void context_attach_surface_fbo(const struct WineD3DContext *context,
+void context_attach_surface_fbo(const struct wined3d_context *context,
GLenum fbo_target, DWORD idx, IWineD3DSurface *surface)
{
const IWineD3DSurfaceImpl *surface_impl = (IWineD3DSurfaceImpl *)surface;
@@ -272,7 +272,7 @@ void context_attach_surface_fbo(const struct WineD3DContext *context,
}
/* GL locking is done by the caller */
-static void context_check_fbo_status(struct WineD3DContext *context)
+static void context_check_fbo_status(struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
GLenum status;
@@ -307,7 +307,7 @@ static void context_check_fbo_status(struct WineD3DContext *context)
}
}
-static struct fbo_entry *context_create_fbo_entry(struct WineD3DContext *context)
+static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -324,7 +324,7 @@ static struct fbo_entry *context_create_fbo_entry(struct WineD3DContext *context
}
/* GL locking is done by the caller */
-static void context_reuse_fbo_entry(struct WineD3DContext *context, struct fbo_entry *entry)
+static void context_reuse_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -338,7 +338,7 @@ static void context_reuse_fbo_entry(struct WineD3DContext *context, struct fbo_e
}
/* GL locking is done by the caller */
-static void context_destroy_fbo_entry(struct WineD3DContext *context, struct fbo_entry *entry)
+static void context_destroy_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry)
{
if (entry->id)
{
@@ -353,7 +353,7 @@ static void context_destroy_fbo_entry(struct WineD3DContext *context, struct fbo
/* GL locking is done by the caller */
-static struct fbo_entry *context_find_fbo_entry(struct WineD3DContext *context)
+static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -388,7 +388,7 @@ static struct fbo_entry *context_find_fbo_entry(struct WineD3DContext *context)
}
/* GL locking is done by the caller */
-static void context_apply_fbo_entry(struct WineD3DContext *context, struct fbo_entry *entry)
+static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_entry *entry)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -436,7 +436,7 @@ static void context_apply_fbo_entry(struct WineD3DContext *context, struct fbo_e
}
/* GL locking is done by the caller */
-static void context_apply_fbo_state(struct WineD3DContext *context)
+static void context_apply_fbo_state(struct wined3d_context *context)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->surface)->resource.wineD3DDevice;
@@ -453,7 +453,7 @@ static void context_apply_fbo_state(struct WineD3DContext *context)
}
/* Context activation is done by the caller. */
-void context_alloc_occlusion_query(struct WineD3DContext *context, struct wined3d_occlusion_query *query)
+void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -485,7 +485,7 @@ void context_alloc_occlusion_query(struct WineD3DContext *context, struct wined3
void context_free_occlusion_query(struct wined3d_occlusion_query *query)
{
- struct WineD3DContext *context = query->context;
+ struct wined3d_context *context = query->context;
list_remove(&query->entry);
query->context = NULL;
@@ -510,7 +510,7 @@ void context_free_occlusion_query(struct wined3d_occlusion_query *query)
}
/* Context activation is done by the caller. */
-void context_alloc_event_query(struct WineD3DContext *context, struct wined3d_event_query *query)
+void context_alloc_event_query(struct wined3d_context *context, struct wined3d_event_query *query)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -551,7 +551,7 @@ void context_alloc_event_query(struct WineD3DContext *context, struct wined3d_ev
void context_free_event_query(struct wined3d_event_query *query)
{
- struct WineD3DContext *context = query->context;
+ struct wined3d_context *context = query->context;
list_remove(&query->entry);
query->context = NULL;
@@ -590,7 +590,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
for (i = 0; i < This->numContexts; ++i)
{
- WineD3DContext *context = This->contexts[i];
+ struct wined3d_context *context = This->contexts[i];
const struct wined3d_gl_info *gl_info = context->gl_info;
struct fbo_entry *entry, *entry2;
@@ -627,7 +627,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
}
}
-static void context_destroy_gl_resources(struct WineD3DContext *context)
+static void context_destroy_gl_resources(struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_occlusion_query *occlusion_query;
@@ -720,14 +720,14 @@ void context_set_tls_idx(DWORD idx)
wined3d_context_tls_idx = idx;
}
-struct WineD3DContext *context_get_current(void)
+struct wined3d_context *context_get_current(void)
{
return TlsGetValue(wined3d_context_tls_idx);
}
-BOOL context_set_current(struct WineD3DContext *ctx)
+BOOL context_set_current(struct wined3d_context *ctx)
{
- struct WineD3DContext *old = context_get_current();
+ struct wined3d_context *old = context_get_current();
if (old == ctx)
{
@@ -785,7 +785,8 @@ BOOL context_set_current(struct WineD3DContext *ctx)
* StateTable: Pointer to the state table in use(for state grouping)
*
*****************************************************************************/
-static void Context_MarkStateDirty(WineD3DContext *context, DWORD state, const struct StateEntry *StateTable) {
+static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state, const struct StateEntry *StateTable)
+{
DWORD rep = StateTable[state].representative;
DWORD idx;
BYTE shift;
@@ -814,8 +815,10 @@ static void Context_MarkStateDirty(WineD3DContext *context, DWORD state, const s
* pbuffer: optional pbuffer used with this context
*
*****************************************************************************/
-static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, HWND win_handle, HDC hdc, HGLRC glCtx, HPBUFFERARB pbuffer) {
- WineD3DContext **oldArray = This->contexts;
+static struct wined3d_context *AddContextToArray(IWineD3DDeviceImpl *This,
+ HWND win_handle, HDC hdc, HGLRC glCtx, HPBUFFERARB pbuffer)
+{
+ struct wined3d_context **oldArray = This->contexts;
DWORD state;
This->contexts = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->contexts) * (This->numContexts + 1));
@@ -828,7 +831,7 @@ static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, HWND win_hand
memcpy(This->contexts, oldArray, sizeof(*This->contexts) * This->numContexts);
}
- This->contexts[This->numContexts] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineD3DContext));
+ This->contexts[This->numContexts] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**This->contexts));
if(This->contexts[This->numContexts] == NULL) {
ERR("Unable to allocate a new context\n");
HeapFree(GetProcessHeap(), 0, This->contexts);
@@ -1044,10 +1047,12 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
* pPresentParameters: contains the pixelformats to use for onscreen rendering
*
*****************************************************************************/
-WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win_handle, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms) {
+struct wined3d_context *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target,
+ HWND win_handle, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms)
+{
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
+ struct wined3d_context *ret = NULL;
HPBUFFERARB pbuffer = NULL;
- WineD3DContext *ret = NULL;
unsigned int s;
HGLRC ctx;
HDC hdc;
@@ -1382,8 +1387,9 @@ out:
* context: Context to remove
*
*****************************************************************************/
-static void RemoveContextFromArray(IWineD3DDeviceImpl *This, WineD3DContext *context) {
- WineD3DContext **new_array;
+static void RemoveContextFromArray(IWineD3DDeviceImpl *This, struct wined3d_context *context)
+{
+ struct wined3d_context **new_array;
BOOL found = FALSE;
UINT i;
@@ -1438,7 +1444,7 @@ static void RemoveContextFromArray(IWineD3DDeviceImpl *This, WineD3DContext *con
* context: Context to destroy
*
*****************************************************************************/
-void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context)
+void DestroyContext(IWineD3DDeviceImpl *This, struct wined3d_context *context)
{
BOOL destroy;
@@ -1497,7 +1503,8 @@ static inline void set_blit_dimension(UINT width, UINT height) {
*
*****************************************************************************/
/* Context activation is done by the caller. */
-static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *context, UINT width, UINT height) {
+static inline void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *context, UINT width, UINT height)
+{
int i, sampler;
const struct StateEntry *StateTable = This->StateTable;
const struct wined3d_gl_info *gl_info = context->gl_info;
@@ -1686,7 +1693,8 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
* If none can be found the swapchain is requested to create a new context
*
*****************************************************************************/
-static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchain, DWORD tid) {
+static struct wined3d_context *findThreadContextForSwapChain(IWineD3DSwapChain *swapchain, DWORD tid)
+{
unsigned int i;
for(i = 0; i < ((IWineD3DSwapChainImpl *) swapchain)->num_contexts; i++) {
@@ -1712,13 +1720,14 @@ static WineD3DContext *findThreadContextForSwapChain(IWineD3DSwapChain *swapchai
* Returns: The needed context
*
*****************************************************************************/
-static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, DWORD tid) {
+static inline struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, DWORD tid)
+{
IWineD3DSwapChain *swapchain = NULL;
BOOL readTexture = wined3d_settings.offscreen_rendering_mode != ORM_FBO && This->render_offscreen;
- struct WineD3DContext *current_context = context_get_current();
+ struct wined3d_context *current_context = context_get_current();
BOOL oldRenderOffscreen = This->render_offscreen;
const struct StateEntry *StateTable = This->StateTable;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
if (current_context && current_context->destroyed) current_context = NULL;
@@ -1914,7 +1923,7 @@ retry:
}
/* Context activation is done by the caller. */
-static void context_apply_draw_buffer(struct WineD3DContext *context, BOOL blit)
+static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
IWineD3DSurface *rt = context->current_rt;
@@ -1974,15 +1983,15 @@ static void context_apply_draw_buffer(struct WineD3DContext *context, BOOL blit)
* usage: Prepares the context for blitting, drawing or other actions
*
*****************************************************************************/
-struct WineD3DContext *ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, enum ContextUsage usage)
+struct wined3d_context *ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, enum ContextUsage usage)
{
- struct WineD3DContext *current_context = context_get_current();
+ struct wined3d_context *current_context = context_get_current();
DWORD tid = GetCurrentThreadId();
DWORD i, dirtyState, idx;
BYTE shift;
- WineD3DContext *context;
const struct StateEntry *StateTable = This->StateTable;
const struct wined3d_gl_info *gl_info;
+ struct wined3d_context *context;
TRACE("(%p): Selecting context for render target %p, thread %d\n", This, target, tid);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e62934c..9035a19 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4888,7 +4888,7 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa
UINT drawable_width, drawable_height;
IWineD3DSurfaceImpl *depth_stencil = (IWineD3DSurfaceImpl *) This->stencilBufferTarget;
IWineD3DSwapChainImpl *swapchain = NULL;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
/* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the
* drawable. After the clear we'll mark the drawable up to date, so we have to make sure that this is true
@@ -6011,7 +6011,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
const WINED3DRECT *rect, const float color[4])
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
IWineD3DSwapChain *swapchain;
swapchain = get_swapchain(surface);
@@ -6390,7 +6390,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
GLbitfield mask = GL_COLOR_BUFFER_BIT; /* TODO: Support blitting depth/stencil surfaces */
IWineD3DSwapChain *src_swapchain, *dst_swapchain;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
GLenum gl_filter;
POINT offset = {0, 0};
@@ -6593,7 +6593,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
|| ((IWineD3DSurfaceImpl *)This->stencilBufferTarget)->Flags & SFLAG_DISCARD) {
surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_DISCARDED);
} else {
- struct WineD3DContext *context = ActivateContext(This, This->render_targets[0], CTXUSAGE_RESOURCELOAD);
+ struct wined3d_context *context = ActivateContext(This, This->render_targets[0], CTXUSAGE_RESOURCELOAD);
surface_load_ds_location(This->stencilBufferTarget, context, SFLAG_DS_OFFSCREEN);
surface_modify_ds_location(This->stencilBufferTarget, SFLAG_DS_OFFSCREEN);
}
@@ -7679,10 +7679,10 @@ const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S] = {
void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) {
DWORD rep = This->StateTable[state].representative;
+ struct wined3d_context *context;
DWORD idx;
BYTE shift;
UINT i;
- WineD3DContext *context;
if(!rep) return;
for(i = 0; i < This->numContexts; i++) {
@@ -7696,7 +7696,7 @@ void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) {
}
}
-void get_drawable_size_pbuffer(struct WineD3DContext *context, UINT *width, UINT *height)
+void get_drawable_size_pbuffer(struct wined3d_context *context, UINT *width, UINT *height)
{
IWineD3DDeviceImpl *device = ((IWineD3DSurfaceImpl *)context->current_rt)->resource.wineD3DDevice;
/* The drawable size of a pbuffer render target is the current pbuffer size. */
@@ -7704,7 +7704,7 @@ void get_drawable_size_pbuffer(struct WineD3DContext *context, UINT *width, UINT
*height = device->pbufferHeight;
}
-void get_drawable_size_fbo(struct WineD3DContext *context, UINT *width, UINT *height)
+void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *height)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)context->current_rt;
/* The drawable size of a fbo target is the opengl texture size, which is the power of two size. */
@@ -7712,7 +7712,7 @@ void get_drawable_size_fbo(struct WineD3DContext *context, UINT *width, UINT *he
*height = surface->pow2Height;
}
-void get_drawable_size_backbuffer(struct WineD3DContext *context, UINT *width, UINT *height)
+void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)context->surface;
/* The drawable size of a backbuffer / aux buffer offscreen target is the size of the
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 57f4227..d6d1469 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -73,7 +73,7 @@ static void drawStridedFast(IWineD3DDevice *iface, GLenum primitive_type,
static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_stream_info *si, UINT NumVertexes,
GLenum glPrimType, const void *idxData, UINT idxSize, UINT minIndex, UINT startIdx)
{
- struct WineD3DContext *context = context_get_current();
+ struct wined3d_context *context = context_get_current();
unsigned int textureNo = 0;
const WORD *pIdxBufS = NULL;
const DWORD *pIdxBufL = NULL;
@@ -559,7 +559,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertice
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *target;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
unsigned int i;
if (!index_count) return;
diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c
index 30d3408..9166041 100644
--- a/dlls/wined3d/gl_compat.c
+++ b/dlls/wined3d/gl_compat.c
@@ -147,7 +147,7 @@ static void WINE_GLAPI wine_glGetDoublev(GLenum pname, GLdouble* params) {
static void (WINE_GLAPI *old_fogcoord_glEnable) (GLenum cap) = NULL;
static void WINE_GLAPI wine_glEnable(GLenum cap) {
if(cap == GL_FOG) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
ctx->fog_enabled = 1;
if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
}
@@ -157,7 +157,7 @@ static void WINE_GLAPI wine_glEnable(GLenum cap) {
static void (WINE_GLAPI *old_fogcoord_glDisable) (GLenum cap) = NULL;
static void WINE_GLAPI wine_glDisable(GLenum cap) {
if(cap == GL_FOG) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
ctx->fog_enabled = 0;
if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
}
@@ -166,7 +166,7 @@ static void WINE_GLAPI wine_glDisable(GLenum cap) {
static void (WINE_GLAPI *old_fogcoord_glFogi) (GLenum pname, GLint param) = NULL;
static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
ctx->gl_fog_source = param;
@@ -188,7 +188,7 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
static void (WINE_GLAPI *old_fogcoord_glFogiv) (GLenum pname, const GLint *param) = NULL;
static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
ctx->gl_fog_source = *param;
if(*param == GL_FRAGMENT_DEPTH_EXT) {
@@ -209,7 +209,7 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
static void (WINE_GLAPI *old_fogcoord_glFogf) (GLenum pname, GLfloat param) = NULL;
static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
ctx->gl_fog_source = (GLint) param;
if(param == GL_FRAGMENT_DEPTH_EXT) {
@@ -230,7 +230,7 @@ static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
static void (WINE_GLAPI *old_fogcoord_glFogfv) (GLenum pname, const GLfloat *param) = NULL;
static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
ctx->gl_fog_source = (GLint) *param;
if(*param == GL_FRAGMENT_DEPTH_EXT) {
@@ -269,7 +269,7 @@ static void (WINE_GLAPI *old_fogcoord_glFogCoordfvEXT) (const GLfloat *f) = NULL
static void (WINE_GLAPI *old_fogcoord_glFogCoorddvEXT) (const GLdouble *f) = NULL;
static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) {
GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]};
GLfloat i;
@@ -299,7 +299,7 @@ static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
}
static void WINE_GLAPI wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
ctx->color[0] = r;
ctx->color[1] = g;
ctx->color[2] = b;
@@ -327,7 +327,7 @@ static void WINE_GLAPI wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte
* precision function
*/
static void WINE_GLAPI wine_glFogCoordfEXT(GLfloat f) {
- struct WineD3DContext *ctx = context_get_current();
+ struct wined3d_context *ctx = context_get_current();
ctx->fog_coord_value = f;
}
static void WINE_GLAPI wine_glFogCoorddEXT(GLdouble f) {
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index 1448cfc..a0a576b 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -32,7 +32,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* GL locking for state handlers is done by the caller. */
-static void nvts_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void nvts_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
BOOL bumpmap = FALSE;
if(stage > 0 && (stateblock->textureState[stage - 1][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAPLUMINANCE ||
@@ -452,7 +453,8 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEX
}
-static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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);
@@ -544,7 +546,8 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3
}
}
-static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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];
@@ -559,7 +562,8 @@ static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
nvts_activate_dimensions(sampler, stateblock, context);
}
-static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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];
float mat[2][2];
@@ -586,7 +590,8 @@ static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 0f395bc..6627b09 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -457,7 +457,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD
if (dwIssueFlags & WINED3DISSUE_END)
{
struct wined3d_event_query *query = This->extendedData;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
if (query->context)
{
@@ -514,7 +514,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
if (GL_SUPPORT(ARB_OCCLUSION_QUERY))
{
struct wined3d_occlusion_query *query = This->extendedData;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
/* This is allowed according to msdn and our tests. Reset the query and restart */
if (dwIssueFlags & WINED3DISSUE_BEGIN)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 44c0c06..c8f3d4d 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -38,9 +38,10 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
/* GL locking for state handlers is done by the caller. */
-static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
+static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
-static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* Used for states which are not mapped to a gl state as-is, but used somehow different,
* e.g as a parameter for drawing, or which are unimplemented in windows d3d
*/
@@ -53,7 +54,8 @@ static void state_nogl(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
}
}
-static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* Print a WARN, this allows the stateblock code to loop over all states to generate a display
* list without causing confusing terminal output. Deliberately no special debug name here
* because its undefined.
@@ -61,7 +63,8 @@ static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
WARN("undefined state %d\n", state);
}
-static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
WINED3DFILLMODE Value = stateblock->renderState[WINED3DRS_FILLMODE];
switch(Value) {
@@ -82,7 +85,8 @@ static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* Lighting is not enabled if transformed vertices are drawn
* but lighting does not affect the stream sources, so it is not grouped for performance reasons.
* This state reads the decoded vertex declaration, so if it is dirty don't do anything. The
@@ -104,7 +108,8 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* No z test without depth stencil buffers */
if(stateblock->wineD3DDevice->stencilBufferTarget == NULL) {
TRACE("No Z buffer - disabling depth test\n");
@@ -132,7 +137,8 @@ static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD
}
}
-static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* glFrontFace() is set in context.c at context init and on an offscreen / onscreen rendering
* switch
*/
@@ -158,7 +164,8 @@ static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
switch ((WINED3DSHADEMODE) stateblock->renderState[WINED3DRS_SHADEMODE]) {
case WINED3DSHADE_FLAT:
glShadeModel(GL_FLAT);
@@ -176,7 +183,8 @@ static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if (stateblock->renderState[WINED3DRS_DITHERENABLE]) {
glEnable(GL_DITHER);
checkGLcall("glEnable GL_DITHER");
@@ -186,7 +194,8 @@ static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock,
}
}
-static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. If yes,
* this has to be merged with ZENABLE and ZFUNC
*/
@@ -199,7 +208,8 @@ static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
int glParm = CompareFunc(stateblock->renderState[WINED3DRS_ZFUNC]);
if(glParm) {
@@ -222,7 +232,8 @@ static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
}
}
-static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
@@ -231,7 +242,8 @@ static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD
checkGLcall("glLightModel for MODEL_AMBIENT");
}
-static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
int srcBlend = GL_ZERO;
int dstBlend = GL_ZERO;
IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0];
@@ -443,11 +455,13 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
}
}
-static void state_blendfactor_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_blendfactor_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n");
}
-static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
TRACE("Setting BlendFactor to %d\n", stateblock->renderState[WINED3DRS_BLENDFACTOR]);
@@ -456,7 +470,8 @@ static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, W
checkGLcall("glBlendColor");
}
-static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
int glParm = 0;
float ref;
BOOL enable_ckey = FALSE;
@@ -521,7 +536,8 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
}
}
-static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD enable = 0xFFFFFFFF;
DWORD disable = 0x00000000;
@@ -589,11 +605,13 @@ static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-static void state_blendop_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_blendop_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
}
-static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
int blendEquation = GL_FUNC_ADD;
int blendEquationAlpha = GL_FUNC_ADD;
@@ -634,8 +652,8 @@ static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD
}
}
-static void
-state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* Originally this used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR)
* and (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR) to swap between enabled/disabled
* specular color. This is wrong:
@@ -734,7 +752,8 @@ state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCon
checkGLcall("glMaterialfv(GL_EMISSION)");
}
-static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
unsigned int i;
/* Note the texture color applies to all textures whereas
@@ -768,8 +787,8 @@ renderstate_stencil_twosided(IWineD3DStateBlockImpl *stateblock, GLint face, GLi
checkGLcall("glStencilOp(...)");
}
-static void
-state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD onesided_enable = FALSE;
DWORD twosided_enable = FALSE;
GLint func = GL_ALWAYS;
@@ -858,7 +877,8 @@ state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *c
}
}
-static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD mask;
if(stateblock->wineD3DDevice->stencilBufferTarget) {
@@ -876,7 +896,8 @@ static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock
glStencilMask(mask);
}
-static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD mask;
if(stateblock->wineD3DDevice->stencilBufferTarget) {
@@ -889,7 +910,8 @@ static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock,
checkGLcall("glStencilMask");
}
-static void state_fog_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_fog_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
@@ -926,7 +948,8 @@ static void state_fog_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock
}
}
-void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float fogstart, fogend;
union {
DWORD d;
@@ -974,7 +997,8 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
TRACE("Fog End == %f\n", fogend);
}
-void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
enum fogsource new_source;
TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context);
@@ -1115,13 +1139,15 @@ void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
}
}
-static void state_rangefog_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_rangefog_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_RANGEFOGENABLE]) {
WARN("Range fog enabled, but not supported by this opengl implementation\n");
}
}
-static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_RANGEFOGENABLE]) {
glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV);
checkGLcall("glFogi(GL_FOG_DISTANCE_MODE_NV, GL_EYE_RADIAL_NV)");
@@ -1131,14 +1157,16 @@ static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_FOGCOLOR], col);
glFogfv(GL_FOG_COLOR, &col[0]);
checkGLcall("glFog GL_FOG_COLOR");
}
-void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1148,7 +1176,8 @@ void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo
checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)");
}
-static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
GLenum Parm = 0;
const struct wined3d_stream_info_element *diffuse = &device->strided_streams.elements[WINED3D_FFP_DIFFUSE];
@@ -1260,7 +1289,8 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
context->tracking_parm = Parm;
}
-static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
WINED3DLINEPATTERN lp;
@@ -1280,7 +1310,8 @@ static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1308,7 +1339,8 @@ static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
}
-static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(isStateDirty(context, STATE_VDECL)) {
return;
}
@@ -1328,7 +1360,8 @@ static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1347,7 +1380,8 @@ static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, Wi
}
-static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1367,7 +1401,8 @@ static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock,
checkGLcall("glPointParameterfEXT(...)");
}
-static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1387,7 +1422,8 @@ static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock,
checkGLcall("glPointParameterfARB(...)");
}
-static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* TODO: Group this with the viewport */
/*
* POINTSCALEENABLE controls how point size value is treated. If set to
@@ -1457,7 +1493,8 @@ static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3
checkGLcall("glPointSize(...);");
}
-static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD Value = stateblock->renderState[WINED3DRS_COLORWRITEENABLE];
TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
@@ -1482,7 +1519,8 @@ static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, Wi
}
}
-static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_LOCALVIEWER]) {
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1)");
@@ -1492,7 +1530,8 @@ static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_LASTPIXEL]) {
TRACE("Last Pixel Drawing Enabled\n");
} else {
@@ -1506,7 +1545,8 @@ static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
BOOL warned = FALSE;
/* TODO: NV_POINT_SPRITE */
if (!warned && stateblock->renderState[WINED3DRS_POINTSPRITEENABLE]) {
@@ -1516,7 +1556,8 @@ static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock,
}
}
-static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if (stateblock->renderState[WINED3DRS_POINTSPRITEENABLE]) {
BOOL warned = FALSE;
if(GL_LIMITS(point_sprite_units) < GL_LIMITS(textures) && !warned) {
@@ -1534,7 +1575,8 @@ static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/**
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/texture/
http://www.gamedev.net/reference/programming/features/rendererdll3/page2.asp
@@ -1564,13 +1606,15 @@ static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
}
}
-static void state_msaa_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_msaa_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
WARN("Multisample antialiasing not supported by gl\n");
}
}
-static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_MULTISAMPLEANTIALIAS]) {
glEnable(GL_MULTISAMPLE_ARB);
checkGLcall("glEnable(GL_MULTISAMPLE_ARB)");
@@ -1580,7 +1624,8 @@ static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
}
}
-static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_SCISSORTESTENABLE]) {
glEnable(GL_SCISSOR_TEST);
checkGLcall("glEnable(GL_SCISSOR_TEST)");
@@ -1590,7 +1635,8 @@ static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD
}
}
-static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1609,7 +1655,8 @@ static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if (stateblock->renderState[WINED3DRS_TEXTUREPERSPECTIVE]) {
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
checkGLcall("glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)");
@@ -1619,31 +1666,36 @@ static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void state_stippledalpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_stippledalpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if (stateblock->renderState[WINED3DRS_STIPPLEDALPHA])
FIXME(" Stippled Alpha not supported yet.\n");
}
-static void state_antialias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_antialias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if (stateblock->renderState[WINED3DRS_ANTIALIAS])
FIXME(" Antialias not supported yet.\n");
}
-static void state_multisampmask(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_multisampmask(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if (stateblock->renderState[WINED3DRS_MULTISAMPLEMASK] != 0xFFFFFFFF)
FIXME("(WINED3DRS_MULTISAMPLEMASK,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_MULTISAMPLEMASK]);
}
-static void state_patchedgestyle(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_patchedgestyle(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if (stateblock->renderState[WINED3DRS_PATCHEDGESTYLE] != WINED3DPATCHEDGE_DISCRETE)
FIXME("(WINED3DRS_PATCHEDGESTYLE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_PATCHEDGESTYLE]);
}
-static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
union {
DWORD d;
float f;
@@ -1663,109 +1715,127 @@ static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock,
}
}
-static void state_positiondegree(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_positiondegree(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if (stateblock->renderState[WINED3DRS_POSITIONDEGREE] != WINED3DDEGREE_CUBIC)
FIXME("(WINED3DRS_POSITIONDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_POSITIONDEGREE]);
}
-static void state_normaldegree(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_normaldegree(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if (stateblock->renderState[WINED3DRS_NORMALDEGREE] != WINED3DDEGREE_LINEAR)
FIXME("(WINED3DRS_NORMALDEGREE,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_NORMALDEGREE]);
}
-static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
TRACE("Stub\n");
if(stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION])
FIXME("(WINED3DRS_ENABLEADAPTIVETESSELLATION,%d) not yet implemented\n", stateblock->renderState[WINED3DRS_ENABLEADAPTIVETESSELLATION]);
}
-static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_WRAPU]) {
FIXME("Render state WINED3DRS_WRAPU not implemented yet\n");
}
}
-static void state_wrapv(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_wrapv(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_WRAPV]) {
FIXME("Render state WINED3DRS_WRAPV not implemented yet\n");
}
}
-static void state_monoenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_monoenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_MONOENABLE]) {
FIXME("Render state WINED3DRS_MONOENABLE not implemented yet\n");
}
}
-static void state_rop2(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_rop2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_ROP2]) {
FIXME("Render state WINED3DRS_ROP2 not implemented yet\n");
}
}
-static void state_planemask(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_planemask(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_PLANEMASK]) {
FIXME("Render state WINED3DRS_PLANEMASK not implemented yet\n");
}
}
-static void state_subpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_subpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_SUBPIXEL]) {
FIXME("Render state WINED3DRS_SUBPIXEL not implemented yet\n");
}
}
-static void state_subpixelx(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_subpixelx(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_SUBPIXELX]) {
FIXME("Render state WINED3DRS_SUBPIXELX not implemented yet\n");
}
}
-static void state_stippleenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_stippleenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_STIPPLEENABLE]) {
FIXME("Render state WINED3DRS_STIPPLEENABLE not implemented yet\n");
}
}
-static void state_bordercolor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_bordercolor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_BORDERCOLOR]) {
FIXME("Render state WINED3DRS_BORDERCOLOR not implemented yet\n");
}
}
-static void state_mipmaplodbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_mipmaplodbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_MIPMAPLODBIAS]) {
FIXME("Render state WINED3DRS_MIPMAPLODBIAS not implemented yet\n");
}
}
-static void state_anisotropy(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_anisotropy(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_ANISOTROPY]) {
FIXME("Render state WINED3DRS_ANISOTROPY not implemented yet\n");
}
}
-static void state_flushbatch(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_flushbatch(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_FLUSHBATCH]) {
FIXME("Render state WINED3DRS_FLUSHBATCH not implemented yet\n");
}
}
-static void state_translucentsi(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_translucentsi(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_TRANSLUCENTSORTINDEPENDENT]) {
FIXME("Render state WINED3DRS_TRANSLUCENTSORTINDEPENDENT not implemented yet\n");
}
}
-static void state_extents(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_extents(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_EXTENTS]) {
FIXME("Render state WINED3DRS_EXTENTS not implemented yet\n");
}
}
-static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->renderState[WINED3DRS_COLORKEYBLENDENABLE]) {
FIXME("Render state WINED3DRS_COLORKEYBLENDENABLE not implemented yet\n");
}
@@ -2844,7 +2914,8 @@ static void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTE
}
-static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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);
@@ -2902,7 +2973,8 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
stateblock->textureState[stage][WINED3DTSS_COLORARG0]);
}
-void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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);
@@ -3001,7 +3073,8 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext
}
}
-static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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];
BOOL generated;
@@ -3102,7 +3175,8 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, const struct wined
checkGLcall("loadTexCoords");
}
-static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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];
static const GLfloat s_plane[] = { 1.0f, 0.0f, 0.0f, 0.0f };
@@ -3275,7 +3349,8 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
/* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
@@ -3289,7 +3364,8 @@ static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
device->shader_backend->shader_load_constants((IWineD3DDevice *)device, use_ps(stateblock), use_vs(stateblock));
}
-static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
if(stateblock->pixelShader && stage != 0 &&
@@ -3304,7 +3380,8 @@ static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
const DWORD sampler = state - STATE_SAMPLER(0);
IWineD3DBaseTexture *texture = stateblock->textures[sampler];
@@ -3330,7 +3407,8 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
union {
@@ -3402,7 +3480,8 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
}
}
-void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL use_pshader = use_ps(stateblock);
BOOL use_vshader = use_vs(stateblock);
@@ -3447,7 +3526,8 @@ void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
}
}
-static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
if(stateblock->pixelShader && stage != 0 &&
((IWineD3DPixelShaderImpl *) stateblock->pixelShader)->baseShader.reg_maps.bumpmat[stage]) {
@@ -3461,7 +3541,8 @@ static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
/* This function is called by transform_view below if the view matrix was changed too
*
* Deliberately no check if the vertex declaration is dirty because the vdecl state
@@ -3489,7 +3570,8 @@ static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, Win
}
}
-static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
UINT index = state - STATE_CLIPPLANE(0);
if(isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW)) || index >= GL_LIMITS(clipplanes)) {
@@ -3525,7 +3607,8 @@ static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo
glPopMatrix();
}
-static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
UINT matrix = state - STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0));
GLenum glMat;
TRACE("Setting world matrix %d\n", matrix);
@@ -3564,7 +3647,8 @@ static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
static BOOL once = FALSE;
switch(stateblock->renderState[WINED3DRS_VERTEXBLEND]) {
@@ -3583,7 +3667,8 @@ static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock,
}
}
-static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
WINED3DVERTEXBLENDFLAGS val = stateblock->renderState[WINED3DRS_VERTEXBLEND];
switch(val) {
@@ -3625,7 +3710,8 @@ static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
unsigned int k;
/* If we are changing the View matrix, reset the light and clipping planes to the new view
@@ -3682,7 +3768,8 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
}
}
-static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
glMatrixMode(GL_PROJECTION);
checkGLcall("glMatrixMode(GL_PROJECTION)");
glLoadIdentity();
@@ -3825,7 +3912,7 @@ static inline void unloadVertexData(IWineD3DStateBlockImpl *stateblock) {
unloadTexCoords(stateblock);
}
-static inline void unload_numbered_array(IWineD3DStateBlockImpl *stateblock, WineD3DContext *context, int i)
+static inline void unload_numbered_array(IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context, int i)
{
GL_EXTCALL(glDisableVertexAttribArrayARB(i));
checkGLcall("glDisableVertexAttribArrayARB(reg)");
@@ -3836,7 +3923,7 @@ static inline void unload_numbered_array(IWineD3DStateBlockImpl *stateblock, Win
/* This should match any arrays loaded in loadNumberedArrays
* TODO: Only load / unload arrays if we have to.
*/
-static inline void unloadNumberedArrays(IWineD3DStateBlockImpl *stateblock, WineD3DContext *context)
+static inline void unloadNumberedArrays(IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
/* disable any attribs (this is the same for both GLSL and ARB modes) */
GLint maxAttribs = 16;
@@ -3853,7 +3940,7 @@ static inline void unloadNumberedArrays(IWineD3DStateBlockImpl *stateblock, Wine
}
static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock,
- const struct wined3d_stream_info *stream_info, WineD3DContext *context)
+ const struct wined3d_stream_info *stream_info, struct wined3d_context *context)
{
GLuint curVBO = GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT) ? ~0U : 0;
int i;
@@ -4284,7 +4371,8 @@ static inline void drawPrimitiveTraceDataLocations(const struct wined3d_stream_i
return;
}
-static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
BOOL fixup = FALSE;
struct wined3d_stream_info *dataLocations = &device->strided_streams;
@@ -4363,7 +4451,8 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo
}
}
-static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
BOOL updateFog = FALSE;
BOOL useVertexShaderFunction = use_vs(stateblock);
BOOL usePixelShaderFunction = use_ps(stateblock);
@@ -4518,7 +4607,8 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
}
-static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
UINT width, height;
IWineD3DSurfaceImpl *target;
@@ -4542,7 +4632,8 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, W
checkGLcall("glViewport");
}
-static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
stateblock->wineD3DDevice->posFixup[2] = 1.0f / stateblock->viewport.Width;
stateblock->wineD3DDevice->posFixup[3] = -stateblock->wineD3DDevice->posFixup[1] / stateblock->viewport.Height;
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
@@ -4553,7 +4644,8 @@ static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
}
}
-static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
UINT Index = state - STATE_ACTIVELIGHT(0);
const PLIGHTINFOEL *lightInfo = stateblock->activeLights[Index];
@@ -4668,7 +4760,8 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContex
return;
}
-static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
RECT *pRect = &stateblock->scissorRect;
UINT height;
UINT width;
@@ -4689,7 +4782,8 @@ static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
checkGLcall("glScissor");
}
-static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->streamIsUP || stateblock->pIndexData == NULL ) {
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
} else {
@@ -4698,7 +4792,8 @@ static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
}
}
-static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->wineD3DDevice->render_offscreen) {
glFrontFace(GL_CCW);
checkGLcall("glFrontFace(GL_CCW)");
@@ -5468,12 +5563,14 @@ static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
return i;
}
-static void multistate_apply_2(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+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);
}
-static void multistate_apply_3(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *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);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 843247d..e74c90e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3140,7 +3140,7 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
float left, right, top, bottom; /* Texture coordinates */
UINT fbwidth = Src->currentDesc.Width;
UINT fbheight = Src->currentDesc.Height;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
GLenum drawBuffer = GL_BACK;
GLenum texture_target;
BOOL noBackBufferBackup;
@@ -4374,7 +4374,7 @@ void surface_modify_ds_location(IWineD3DSurface *iface, DWORD location) {
}
/* Context activation is done by the caller. */
-void surface_load_ds_location(IWineD3DSurface *iface, struct WineD3DContext *context, DWORD location)
+void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *context, DWORD location)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index c0e0457..c61c952 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -372,10 +372,11 @@ const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
IWineD3DBaseSwapChainImpl_GetGammaRamp
};
-WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *iface) {
- WineD3DContext *ctx;
+struct wined3d_context *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *iface)
+{
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;
- WineD3DContext **newArray;
+ struct wined3d_context **newArray;
+ struct wined3d_context *ctx;
TRACE("Creating a new context for swapchain %p, thread %d\n", This, GetCurrentThreadId());
@@ -402,7 +403,7 @@ WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *
return ctx;
}
-void get_drawable_size_swapchain(struct WineD3DContext *context, UINT *width, UINT *height)
+void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, UINT *height)
{
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)context->current_rt;
/* The drawable size of an onscreen drawable is the surface size.
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index d2631ea..71587c1 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2394,7 +2394,8 @@ void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *des
*/
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
/* GL locking is done by the caller (state handler) */
-void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
if(stateblock->textures[stage]) {
switch (IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[stage])) {
case GL_TEXTURE_2D:
@@ -2468,7 +2469,8 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
}
/* GL locking is done by the caller (state handler) */
-void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
+{
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 00f311d..1a3314a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1070,8 +1070,6 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT];
(((((d3dvtVertexType) >> (16 + (2 * (tex_num)))) + 1) & 0x03) + 1)
/* Routines and structures related to state management */
-typedef struct WineD3DContext WineD3DContext;
-typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *ctx);
#define STATE_RENDER(a) (a)
#define STATE_IS_RENDER(a) ((a) >= STATE_RENDER(1) && (a) <= STATE_RENDER(WINEHIGHEST_RENDER_STATE))
@@ -1123,63 +1121,6 @@ typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock,
#define STATE_HIGHEST (STATE_FRONTFACE)
-struct StateEntry
-{
- DWORD representative;
- APPLYSTATEFUNC apply;
-};
-
-struct StateEntryTemplate
-{
- DWORD state;
- struct StateEntry content;
- GL_SupportedExt extension;
-};
-
-struct fragment_caps {
- DWORD PrimitiveMiscCaps;
-
- DWORD TextureOpCaps;
- DWORD MaxTextureBlendStages;
- DWORD MaxSimultaneousTextures;
-};
-
-struct fragment_pipeline {
- void (*enable_extension)(IWineD3DDevice *iface, BOOL enable);
- void (*get_caps)(WINED3DDEVTYPE devtype, const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
- HRESULT (*alloc_private)(IWineD3DDevice *iface);
- void (*free_private)(IWineD3DDevice *iface);
- BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
- const struct StateEntryTemplate *states;
- BOOL ffp_proj_control;
-};
-
-extern const struct StateEntryTemplate misc_state_template[];
-extern const struct StateEntryTemplate ffp_vertexstate_template[];
-extern const struct fragment_pipeline ffp_fragment_pipeline;
-extern const struct fragment_pipeline atifs_fragment_pipeline;
-extern const struct fragment_pipeline arbfp_fragment_pipeline;
-extern const struct fragment_pipeline nvts_fragment_pipeline;
-extern const struct fragment_pipeline nvrc_fragment_pipeline;
-
-/* "Base" state table */
-HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
- const struct wined3d_gl_info *gl_info, const struct StateEntryTemplate *vertex,
- const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc);
-
-/* Shaders for color conversions in blits */
-struct blit_shader {
- HRESULT (*alloc_private)(IWineD3DDevice *iface);
- void (*free_private)(IWineD3DDevice *iface);
- HRESULT (*set_shader)(IWineD3DDevice *iface, const struct GlPixelFormatDesc *format_desc,
- GLenum textype, UINT width, UINT height);
- void (*unset_shader)(IWineD3DDevice *iface);
- BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
-};
-
-extern const struct blit_shader ffp_blit;
-extern const struct blit_shader arbfp_blit;
-
enum fogsource {
FOGSOURCE_FFP,
FOGSOURCE_VS,
@@ -1192,18 +1133,17 @@ struct wined3d_occlusion_query
{
struct list entry;
GLuint id;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
};
struct wined3d_event_query
{
struct list entry;
GLuint id;
- struct WineD3DContext *context;
+ struct wined3d_context *context;
};
-/* The new context manager that should deal with onscreen and offscreen rendering */
-struct WineD3DContext
+struct wined3d_context
{
const struct wined3d_gl_info *gl_info;
/* State dirtification
@@ -1280,6 +1220,67 @@ struct WineD3DContext
GLuint dummy_arbfp_prog;
};
+typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *ctx);
+
+struct StateEntry
+{
+ DWORD representative;
+ APPLYSTATEFUNC apply;
+};
+
+struct StateEntryTemplate
+{
+ DWORD state;
+ struct StateEntry content;
+ GL_SupportedExt extension;
+};
+
+struct fragment_caps
+{
+ DWORD PrimitiveMiscCaps;
+ DWORD TextureOpCaps;
+ DWORD MaxTextureBlendStages;
+ DWORD MaxSimultaneousTextures;
+};
+
+struct fragment_pipeline
+{
+ void (*enable_extension)(IWineD3DDevice *iface, BOOL enable);
+ void (*get_caps)(WINED3DDEVTYPE devtype, const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
+ HRESULT (*alloc_private)(IWineD3DDevice *iface);
+ void (*free_private)(IWineD3DDevice *iface);
+ BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
+ const struct StateEntryTemplate *states;
+ BOOL ffp_proj_control;
+};
+
+extern const struct StateEntryTemplate misc_state_template[];
+extern const struct StateEntryTemplate ffp_vertexstate_template[];
+extern const struct fragment_pipeline ffp_fragment_pipeline;
+extern const struct fragment_pipeline atifs_fragment_pipeline;
+extern const struct fragment_pipeline arbfp_fragment_pipeline;
+extern const struct fragment_pipeline nvts_fragment_pipeline;
+extern const struct fragment_pipeline nvrc_fragment_pipeline;
+
+/* "Base" state table */
+HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
+ const struct wined3d_gl_info *gl_info, const struct StateEntryTemplate *vertex,
+ const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc);
+
+/* Shaders for color conversions in blits */
+struct blit_shader
+{
+ HRESULT (*alloc_private)(IWineD3DDevice *iface);
+ void (*free_private)(IWineD3DDevice *iface);
+ HRESULT (*set_shader)(IWineD3DDevice *iface, const struct GlPixelFormatDesc *format_desc,
+ GLenum textype, UINT width, UINT height);
+ void (*unset_shader)(IWineD3DDevice *iface);
+ BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
+};
+
+extern const struct blit_shader ffp_blit;
+extern const struct blit_shader arbfp_blit;
+
typedef enum ContextUsage {
CTXUSAGE_RESOURCELOAD = 1, /* Only loads textures: No State is applied */
CTXUSAGE_DRAWPRIM = 2, /* OpenGL states are set up for blitting DirectDraw surfaces */
@@ -1287,22 +1288,23 @@ typedef enum ContextUsage {
CTXUSAGE_CLEAR = 4, /* Drawable and states are set up for clearing */
} ContextUsage;
-struct WineD3DContext *ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, enum ContextUsage usage);
-WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms);
-void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
-void context_alloc_event_query(struct WineD3DContext *context, struct wined3d_event_query *query);
-void context_alloc_occlusion_query(struct WineD3DContext *context, struct wined3d_occlusion_query *query);
+struct wined3d_context *ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, enum ContextUsage usage);
+struct wined3d_context *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win,
+ BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms);
+void DestroyContext(IWineD3DDeviceImpl *This, struct wined3d_context *context);
+void context_alloc_event_query(struct wined3d_context *context, struct wined3d_event_query *query);
+void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query);
void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type);
-void context_bind_fbo(struct WineD3DContext *context, GLenum target, GLuint *fbo);
-void context_attach_depth_stencil_fbo(struct WineD3DContext *context,
+void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo);
+void context_attach_depth_stencil_fbo(struct wined3d_context *context,
GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer);
-void context_attach_surface_fbo(const struct WineD3DContext *context,
+void context_attach_surface_fbo(const struct wined3d_context *context,
GLenum fbo_target, DWORD idx, IWineD3DSurface *surface);
void context_free_event_query(struct wined3d_event_query *query);
void context_free_occlusion_query(struct wined3d_occlusion_query *query);
-struct WineD3DContext *context_get_current(void);
+struct wined3d_context *context_get_current(void);
DWORD context_get_tls_idx(void);
-BOOL context_set_current(struct WineD3DContext *ctx);
+BOOL context_set_current(struct wined3d_context *ctx);
void context_set_tls_idx(DWORD idx);
void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain);
@@ -1615,9 +1617,9 @@ struct IWineD3DDeviceImpl
const WineDirect3DVertexStridedData *up_strided;
/* Context management */
- WineD3DContext **contexts; /* Dynamic array containing pointers to context structures */
+ struct wined3d_context **contexts;
UINT numContexts;
- WineD3DContext *pbufferContext; /* The context that has a pbuffer as drawable */
+ struct wined3d_context *pbufferContext; /* The context that has a pbuffer as drawable */
DWORD pbufferWidth, pbufferHeight; /* Size of the buffer drawable */
/* High level patch management */
@@ -1640,7 +1642,8 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfa
float Z, DWORD Stencil);
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This);
void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state);
-static inline BOOL isStateDirty(WineD3DContext *context, DWORD state) {
+static inline BOOL isStateDirty(struct wined3d_context *context, DWORD state)
+{
DWORD idx = state >> 5;
BYTE shift = state & 0x1f;
return context->isStateDirty[idx] & (1 << shift);
@@ -1956,7 +1959,7 @@ struct IWineD3DSurfaceImpl
UINT pow2Height;
/* A method to retrieve the drawable size. Not in the Vtable to make it changeable */
- void (*get_drawable_size)(struct WineD3DContext *context, UINT *width, UINT *height);
+ void (*get_drawable_size)(struct wined3d_context *context, UINT *width, UINT *height);
/* Oversized texture */
RECT glRect;
@@ -2050,10 +2053,10 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DL
void WINAPI IWineD3DBaseSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb);
const void *WINAPI IWineD3DBaseSurfaceImpl_GetData(IWineD3DSurface *iface);
-void get_drawable_size_swapchain(struct WineD3DContext *context, UINT *width, UINT *height);
-void get_drawable_size_backbuffer(struct WineD3DContext *context, UINT *width, UINT *height);
-void get_drawable_size_pbuffer(struct WineD3DContext *context, UINT *width, UINT *height);
-void get_drawable_size_fbo(struct WineD3DContext *context, UINT *width, UINT *height);
+void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, UINT *height);
+void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height);
+void get_drawable_size_pbuffer(struct wined3d_context *context, UINT *width, UINT *height);
+void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *height);
void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back);
@@ -2463,7 +2466,7 @@ typedef struct IWineD3DSwapChainImpl
long prev_time, frames; /* Performance tracking */
unsigned int vSyncCounter;
- WineD3DContext **context; /* Later a array for multithreading */
+ struct wined3d_context **context;
unsigned int num_contexts;
HWND win_handle;
@@ -2486,7 +2489,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain
HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, DWORD Flags, CONST WINED3DGAMMARAMP *pRamp);
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, WINED3DGAMMARAMP *pRamp);
-WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *iface);
+struct wined3d_context *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *iface);
/*****************************************************************************
* Utility function prototypes
@@ -2521,18 +2524,18 @@ GLenum CompareFunc(DWORD func);
BOOL is_invalid_op(IWineD3DDeviceImpl *This, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst);
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, DWORD coordtype, BOOL ffp_can_disable_proj);
-void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
-void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
+void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
+void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context);
void surface_add_dirty_rect(IWineD3DSurface *iface, const RECT *dirty_rect);
GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain);
-void surface_load_ds_location(IWineD3DSurface *iface, struct WineD3DContext *context, DWORD location);
+void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *context, DWORD location);
void surface_modify_ds_location(IWineD3DSurface *iface, DWORD location);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height);
void surface_set_texture_name(IWineD3DSurface *iface, GLuint name, BOOL srgb_name);
--
1.6.0.6
More information about the wine-patches
mailing list