Commit 96d225d4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the IWineD3DStateBlockImpl typedef.

parent b98cd5d9
......@@ -621,7 +621,7 @@ static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *g
static void shader_arb_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader)
{
IWineD3DDeviceImpl *device = context->swapchain->device;
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
struct wined3d_stateblock *stateBlock = device->stateBlock;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_arb_priv *priv = device->shader_priv;
......@@ -5579,7 +5579,8 @@ static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8);
}
static void state_texfactor_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void state_texfactor_arbfp(DWORD state_id,
struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_state *state = &stateblock->state;
......@@ -5604,7 +5605,7 @@ static void state_texfactor_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateb
}
static void state_arb_specularenable(DWORD state_id,
IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_state *state = &stateblock->state;
......@@ -5635,7 +5636,7 @@ static void state_arb_specularenable(DWORD state_id,
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col)");
}
static void set_bumpmat_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void set_bumpmat_arbfp(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
const struct wined3d_gl_info *gl_info = context->gl_info;
......@@ -5673,7 +5674,8 @@ static void set_bumpmat_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_BUMPMAT(stage), &mat[0][0])");
}
static void tex_bumpenvlum_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void tex_bumpenvlum_arbfp(DWORD state_id,
struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
const struct wined3d_gl_info *gl_info = context->gl_info;
......@@ -5925,7 +5927,7 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta
}
}
static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWineD3DStateBlockImpl *stateblock)
static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, struct wined3d_stateblock *stateblock)
{
const struct wined3d_gl_info *gl_info = &stateblock->device->adapter->gl_info;
unsigned int stage;
......@@ -6202,7 +6204,7 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
return ret;
}
static void fragment_prog_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void fragment_prog_arbfp(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_state *state = &stateblock->state;
......@@ -6300,7 +6302,7 @@ static void fragment_prog_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblo
* 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_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void state_arbfp_fog(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_state *state = &stateblock->state;
enum fogsource new_source;
......@@ -6335,11 +6337,10 @@ static void state_arbfp_fog(DWORD state_id, IWineD3DStateBlockImpl *stateblock,
}
}
static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void textransform(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
if(!isStateDirty(context, STATE_PIXELSHADER)) {
if (!isStateDirty(context, STATE_PIXELSHADER))
fragment_prog_arbfp(state, stateblock, context);
}
}
static const struct StateEntryTemplate arbfp_fragmentstate_template[] = {
......
......@@ -796,7 +796,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
return ret;
}
static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void set_tex_op_atifs(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
IWineD3DDeviceImpl *This = stateblock->device;
......@@ -845,7 +845,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st
GL_EXTCALL(glBindFragmentShaderATI(desc->shader));
}
static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void state_texfactor_atifs(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
float col[4];
......@@ -855,7 +855,7 @@ static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *statebloc
checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_TFACTOR, col)");
}
static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void set_bumpmat(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
const struct wined3d_gl_info *gl_info = context->gl_info;
......@@ -880,14 +880,14 @@ static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_BUMPMAT(stage), mat)");
}
static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void textransform(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
if(!isStateDirty(context, STATE_PIXELSHADER)) {
if (!isStateDirty(context, STATE_PIXELSHADER))
set_tex_op_atifs(state, stateblock, context);
}
}
static void atifs_apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void atifs_apply_pixelshader(DWORD state_id,
struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_state *state = &stateblock->state;
IWineD3DDeviceImpl *device = stateblock->device;
......@@ -913,7 +913,7 @@ static void atifs_apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stat
}
}
static void atifs_srgbwriteenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void atifs_srgbwriteenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
if (stateblock->state.render_states[WINED3DRS_SRGBWRITEENABLE])
WARN("sRGB writes are not supported by this fragment pipe.\n");
......
......@@ -560,7 +560,7 @@ void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *c
void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect)
{
IWineD3DStateBlockImpl *stateblock = device->stateBlock;
struct wined3d_stateblock *stateblock = device->stateBlock;
WINED3DVIEWPORT *vp = &stateblock->state.viewport;
SetRect(rect, vp->X, vp->Y, vp->X + vp->Width, vp->Y + vp->Height);
......@@ -1010,7 +1010,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface,
WINED3DSTATEBLOCKTYPE type, struct wined3d_stateblock **stateblock)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DStateBlockImpl *object;
struct wined3d_stateblock *object;
HRESULT hr;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
......@@ -4651,7 +4651,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_BeginStateBlock(IWineD3DDevice *iface)
if (FAILED(hr)) return hr;
wined3d_stateblock_decref(This->updateStateBlock);
This->updateStateBlock = (IWineD3DStateBlockImpl *)stateblock;
This->updateStateBlock = stateblock;
This->isRecordingState = TRUE;
TRACE("(%p) recording stateblock %p\n", This, stateblock);
......@@ -4663,7 +4663,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface,
struct wined3d_stateblock **stateblock)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DStateBlockImpl *object = This->updateStateBlock;
struct wined3d_stateblock *object = This->updateStateBlock;
TRACE("iface %p, stateblock %p.\n", iface, stateblock);
......
......@@ -731,7 +731,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
{
const struct wined3d_gl_info *gl_info = context->gl_info;
IWineD3DDeviceImpl *device = context->swapchain->device;
IWineD3DStateBlockImpl* stateBlock = device->stateBlock;
struct wined3d_stateblock *stateBlock = device->stateBlock;
struct shader_glsl_priv *priv = device->shader_priv;
float position_fixup[4];
......
......@@ -456,7 +456,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
}
static void nvrc_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void nvrc_colorop(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage);
......@@ -566,7 +566,7 @@ static void nvrc_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, str
}
}
static void nvts_texdim(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void nvts_texdim(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD sampler = state_id - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->device->texUnitMap[sampler];
......@@ -583,7 +583,7 @@ static void nvts_texdim(DWORD state_id, IWineD3DStateBlockImpl *stateblock, stru
nvts_activate_dimensions(state, sampler, context);
}
static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void nvts_bumpenvmat(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->device->texUnitMap[stage + 1];
......@@ -612,7 +612,7 @@ static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, str
}
}
static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
static void nvrc_texfactor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
float col[4];
......
......@@ -191,7 +191,7 @@ static const DWORD vertex_states_sampler[] =
/* Allocates the correct amount of space for pixel and vertex shader constants,
* along with their set/changed flags on the given stateblock object
*/
static HRESULT stateblock_allocate_shader_constants(IWineD3DStateBlockImpl *object)
static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *object)
{
IWineD3DDeviceImpl *device = object->device;
......@@ -327,7 +327,7 @@ static void stateblock_savedstates_set_vertex(SAVEDSTATES *states, const DWORD n
memset(states->vertexShaderConstantsF, TRUE, sizeof(BOOL) * num_constants);
}
void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock)
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock)
{
IWineD3DDeviceImpl *device = stateblock->device;
unsigned int i, j;
......@@ -439,7 +439,7 @@ void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock)
}
}
static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct list *light_map)
static void stateblock_init_lights(struct wined3d_stateblock *stateblock, struct list *light_map)
{
unsigned int i;
......@@ -1066,7 +1066,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
return WINED3D_OK;
}
void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock)
void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
{
IWineD3DDeviceImpl *device = stateblock->device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
......@@ -1317,7 +1317,7 @@ void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock)
TRACE("Done.\n");
}
HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *device, WINED3DSTATEBLOCKTYPE type)
HRESULT stateblock_init(struct wined3d_stateblock *stateblock, IWineD3DDeviceImpl *device, WINED3DSTATEBLOCKTYPE type)
{
unsigned int i;
HRESULT hr;
......
......@@ -100,10 +100,10 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface,
iface, back_buffer_idx, type, back_buffer);
/* Return invalid if there is no backbuffer array, otherwise it will
* crash when ddraw is used (there swapchain->back_buffers is always NULL).
* We need this because this function is called from
* IWineD3DStateBlockImpl_InitStartupStateBlock() to get the default
* scissorrect dimensions. */
* crash when ddraw is used (there swapchain->back_buffers is always
* NULL). We need this because this function is called from
* stateblock_init_default_state() to get the default scissorrect
* dimensions. */
if (!swapchain->back_buffers || back_buffer_idx >= swapchain->presentParms.BackBufferCount)
{
WARN("Invalid back buffer index.\n");
......
......@@ -2720,7 +2720,8 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) {
return size;
}
void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype) {
void gen_ffp_frag_op(struct wined3d_stateblock *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype)
{
#define ARG1 0x01
#define ARG2 0x02
#define ARG0 0x04
......@@ -3095,7 +3096,7 @@ void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture, const struct
}
/* GL locking is done by the caller (state handler) */
void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
void sampler_texdim(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context)
{
DWORD sampler = state - STATE_SAMPLER(0);
DWORD mapped_stage = stateblock->device->texUnitMap[sampler];
......
......@@ -52,7 +52,6 @@
#define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010
#define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
typedef struct wined3d_stateblock IWineD3DStateBlockImpl;
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DPaletteImpl IWineD3DPaletteImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
......@@ -1124,7 +1123,7 @@ struct wined3d_context
GLuint dummy_arbfp_prog;
};
typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *ctx);
typedef void (*APPLYSTATEFUNC)(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *ctx);
struct StateEntry
{
......@@ -1606,7 +1605,7 @@ struct ffp_frag_desc
extern const struct wine_rb_functions wined3d_ffp_frag_program_rb_functions DECLSPEC_HIDDEN;
extern const struct wined3d_parent_ops wined3d_null_parent_ops DECLSPEC_HIDDEN;
void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_settings *settings,
void gen_ffp_frag_op(struct wined3d_stateblock *stateblock, struct ffp_frag_settings *settings,
BOOL ignore_textype) DECLSPEC_HIDDEN;
const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders,
const struct ffp_frag_settings *settings) DECLSPEC_HIDDEN;
......@@ -1699,8 +1698,8 @@ struct IWineD3DDeviceImpl
unsigned char surface_alignment; /* Line Alignment of surfaces */
/* State block related */
IWineD3DStateBlockImpl *stateBlock;
IWineD3DStateBlockImpl *updateStateBlock;
struct wined3d_stateblock *stateBlock;
struct wined3d_stateblock *updateStateBlock;
/* Internal use fields */
WINED3DDEVICE_CREATION_PARAMETERS createParms;
......@@ -2343,10 +2342,6 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWine
const WINED3DVERTEXELEMENT *elements, UINT element_count,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/*****************************************************************************
* IWineD3DStateBlock implementation structure
*/
/* Internal state Block for Begin/End/Capture/Create/Apply info */
/* Note: Very long winded but gl Lists are not flexible enough */
/* to resolve everything we need, so doing it manually for now */
......@@ -2434,10 +2429,7 @@ struct wined3d_state
struct wined3d_stateblock
{
/* IUnknown fields */
LONG ref; /* Note: Ref counting not required */
/* IWineD3DStateBlock information */
IWineD3DDeviceImpl *device;
WINED3DSTATEBLOCKTYPE blockType;
......@@ -2468,12 +2460,12 @@ struct wined3d_stateblock
unsigned int num_contained_sampler_states;
};
HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock,
HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
IWineD3DDeviceImpl *device, WINED3DSTATEBLOCKTYPE type) DECLSPEC_HIDDEN;
void stateblock_init_contained_states(IWineD3DStateBlockImpl *object) DECLSPEC_HIDDEN;
void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) DECLSPEC_HIDDEN;
void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void stateblock_init_default_state(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
static inline void stateblock_apply_state(DWORD state, IWineD3DStateBlockImpl *stateblock,
static inline void stateblock_apply_state(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context)
{
const struct StateEntry *statetable = stateblock->device->StateTable;
......@@ -2689,19 +2681,19 @@ void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords,
BOOL transformed, enum wined3d_format_id coordtype, BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN;
void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock,
void sampler_texdim(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock,
void tex_alphaop(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock,
void apply_pixelshader(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock,
void state_fogcolor(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock,
void state_fogdensity(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock,
void state_fogstartend(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
void state_fog_fragpart(DWORD state, struct wined3d_stateblock *stateblock,
struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL getColorBits(const struct wined3d_format *format,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment