From 8fe80e18b2856de90108ae18215502bf8bb73057 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 30 Mar 2011 20:49:26 +0200 Subject: [PATCH] wined3d: Get rid of the IWineD3DBaseShader typedefs. --- dlls/wined3d/arb_program_shader.c | 48 ++++++++++++++-------------- dlls/wined3d/device.c | 48 ++++++++++++++-------------- dlls/wined3d/glsl_shader.c | 52 +++++++++++++++---------------- dlls/wined3d/shader.c | 28 ++++++++--------- dlls/wined3d/state.c | 4 +-- dlls/wined3d/stateblock.c | 4 +-- dlls/wined3d/wined3d_private.h | 16 +++++----- 7 files changed, 96 insertions(+), 104 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index f4db6b64e77..a8c3e2e36af 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -362,7 +362,7 @@ static unsigned int reserved_vs_const(const struct arb_vshader_private *shader_d * or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders) */ /* GL locking is done by the caller */ -static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info, +static unsigned int shader_arb_load_constantsF(struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts) { local_constant* lconst; @@ -636,7 +636,7 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha if (useVertexShader) { - IWineD3DBaseShaderImpl *vshader = (IWineD3DBaseShaderImpl *)stateBlock->state.vertex_shader; + struct wined3d_shader *vshader = stateBlock->state.vertex_shader; const struct arb_vs_compiled_shader *gl_shader = priv->compiled_vprog; /* Load DirectX 9 float constants for vertex shader */ @@ -647,7 +647,7 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha if (usePixelShader) { - IWineD3DBaseShaderImpl *pshader = (IWineD3DBaseShaderImpl *)stateBlock->state.pixel_shader; + struct wined3d_shader *pshader = stateBlock->state.pixel_shader; const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; float rt_height = device->render_targets[0]->resource.height; @@ -682,7 +682,7 @@ static void shader_arb_update_float_pixel_constants(IWineD3DDeviceImpl *device, device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, start + count); } -static DWORD *local_const_mapping(IWineD3DBaseShaderImpl *shader) +static DWORD *local_const_mapping(const struct wined3d_shader *shader) { DWORD *ret; DWORD idx = 0; @@ -706,7 +706,7 @@ static DWORD *local_const_mapping(IWineD3DBaseShaderImpl *shader) } /* Generate the variable & register declarations for the ARB_vertex_program output target */ -static DWORD shader_generate_arb_declarations(IWineD3DBaseShaderImpl *shader, +static DWORD shader_generate_arb_declarations(struct wined3d_shader *shader, const struct wined3d_shader_reg_maps *reg_maps, struct wined3d_shader_buffer *buffer, const struct wined3d_gl_info *gl_info, DWORD *lconst_map, DWORD *num_clipplanes, struct shader_arb_ctx_priv *ctx) @@ -3413,7 +3413,7 @@ static void arbfp_add_sRGB_correction(struct wined3d_shader_buffer *buffer, cons /* [0.0;1.0] clamping. Not needed, this is done implicitly */ } -static const DWORD *find_loop_control_values(IWineD3DBaseShaderImpl *shader, DWORD idx) +static const DWORD *find_loop_control_values(const struct wined3d_shader *shader, DWORD idx) { const local_constant *constant; @@ -3427,7 +3427,7 @@ static const DWORD *find_loop_control_values(IWineD3DBaseShaderImpl *shader, DWO return NULL; } -static void init_ps_input(const IWineD3DBaseShaderImpl *shader, +static void init_ps_input(const struct wined3d_shader *shader, const struct arb_ps_compile_args *args, struct shader_arb_ctx_priv *priv) { static const char * const texcoords[8] = @@ -3502,7 +3502,7 @@ static void init_ps_input(const IWineD3DBaseShaderImpl *shader, } /* GL locking is done by the caller */ -static GLuint shader_arb_generate_pshader(IWineD3DBaseShaderImpl *shader, +static GLuint shader_arb_generate_pshader(struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, const struct arb_ps_compile_args *args, struct arb_ps_compiled_shader *compiled) { @@ -3912,7 +3912,7 @@ static DWORD find_input_signature(struct shader_arb_priv *priv, const struct win return found_sig->idx; } -static void init_output_registers(IWineD3DBaseShaderImpl *shader, DWORD sig_num, +static void init_output_registers(struct wined3d_shader *shader, DWORD sig_num, struct shader_arb_ctx_priv *priv_ctx, struct arb_vs_compiled_shader *compiled) { unsigned int i, j; @@ -4088,7 +4088,7 @@ static void init_output_registers(IWineD3DBaseShaderImpl *shader, DWORD sig_num, } /* GL locking is done by the caller */ -static GLuint shader_arb_generate_vshader(IWineD3DBaseShaderImpl *shader, +static GLuint shader_arb_generate_vshader(struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, const struct arb_vs_compile_args *args, struct arb_vs_compiled_shader *compiled) { @@ -4253,7 +4253,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DBaseShaderImpl *shader, } /* GL locking is done by the caller */ -static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DBaseShaderImpl *shader, +static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *shader, const struct arb_ps_compile_args *args) { IWineD3DDeviceImpl *device = shader->device; @@ -4350,7 +4350,7 @@ static inline BOOL vs_args_equal(const struct arb_vs_compile_args *stored, const return !memcmp(stored->loop_ctrl, new->loop_ctrl, sizeof(stored->loop_ctrl)); } -static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DBaseShaderImpl *shader, +static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *shader, const struct arb_vs_compile_args *args) { IWineD3DDeviceImpl *device = shader->device; @@ -4437,7 +4437,7 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DBaseShaderImpl *s } static void find_arb_ps_compile_args(const struct wined3d_state *state, - IWineD3DBaseShaderImpl *shader, struct arb_ps_compile_args *args) + const struct wined3d_shader *shader, struct arb_ps_compile_args *args) { IWineD3DDeviceImpl *device = shader->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -4492,7 +4492,7 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state, } static void find_arb_vs_compile_args(const struct wined3d_state *state, - IWineD3DBaseShaderImpl *shader, struct arb_vs_compile_args *args) + const struct wined3d_shader *shader, struct arb_vs_compile_args *args) { IWineD3DDeviceImpl *device = shader->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -4504,8 +4504,8 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state, args->clip.boolclip_compare = 0; if (use_ps(state)) { - IWineD3DBaseShaderImpl *ps = state->pixel_shader; - struct arb_pshader_private *shader_priv = ps->backend_data; + const struct wined3d_shader *ps = state->pixel_shader; + const struct arb_pshader_private *shader_priv = ps->backend_data; args->ps_signature = shader_priv->input_signature_idx; args->clip.boolclip.clip_texcoord = shader_priv->clipplane_emulation + 1; @@ -4579,7 +4579,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, /* Deal with pixel shaders first so the vertex shader arg function has the input signature ready */ if (usePS) { - IWineD3DBaseShaderImpl *ps = state->pixel_shader; + struct wined3d_shader *ps = state->pixel_shader; struct arb_ps_compile_args compile_args; struct arb_ps_compiled_shader *compiled; @@ -4637,7 +4637,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, if (useVS) { - IWineD3DBaseShaderImpl *vs = state->vertex_shader; + struct wined3d_shader *vs = state->vertex_shader; struct arb_vs_compile_args compile_args; struct arb_vs_compiled_shader *compiled; @@ -4727,7 +4727,7 @@ static void shader_arb_deselect_depth_blt(void *shader_priv, const struct wined3 } } -static void shader_arb_destroy(IWineD3DBaseShaderImpl *shader) +static void shader_arb_destroy(struct wined3d_shader *shader) { IWineD3DDeviceImpl *device = shader->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -5086,7 +5086,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL }; static BOOL get_bool_const(const struct wined3d_shader_instruction *ins, - IWineD3DBaseShaderImpl *shader, DWORD idx) + const struct wined3d_shader *shader, DWORD idx) { const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; BOOL vshader = shader_is_vshader_version(reg_maps->shader_version.type); @@ -5117,7 +5117,7 @@ static BOOL get_bool_const(const struct wined3d_shader_instruction *ins, } static void get_loop_control_const(const struct wined3d_shader_instruction *ins, - IWineD3DBaseShaderImpl *shader, UINT idx, struct wined3d_shader_loop_control *loop_control) + const struct wined3d_shader *shader, UINT idx, struct wined3d_shader_loop_control *loop_control) { const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; @@ -5673,8 +5673,7 @@ static void set_bumpmat_arbfp(DWORD state_id, struct wined3d_stateblock *statebl if (use_ps(state)) { - IWineD3DBaseShaderImpl *ps = state->pixel_shader; - if (stage && (ps->reg_maps.bumpmat & (1 << stage))) + if (stage && (state->pixel_shader->reg_maps.bumpmat & (1 << stage))) { /* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled * anyway @@ -5712,8 +5711,7 @@ static void tex_bumpenvlum_arbfp(DWORD state_id, if (use_ps(state)) { - IWineD3DBaseShaderImpl *ps = state->pixel_shader; - if (stage && (ps->reg_maps.luminanceparams & (1 << stage))) + if (stage && (state->pixel_shader->reg_maps.luminanceparams & (1 << stage))) { /* The pixel shader has to know the luminance offset. Do a constants update if it * isn't scheduled anyway diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index c34a0ee158f..695dbb283fb 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1513,10 +1513,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3D static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DBaseShader **shader) + struct wined3d_shader **shader) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShaderImpl *object; + struct wined3d_shader *object; HRESULT hr; if (This->vs_selected_mode == SHADER_NONE) @@ -1538,7 +1538,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac } TRACE("Created vertex shader %p.\n", object); - *shader = (IWineD3DBaseShader *)object; + *shader = object; return WINED3D_OK; } @@ -1546,10 +1546,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *iface, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DBaseShader **shader) + struct wined3d_shader **shader) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShaderImpl *object; + struct wined3d_shader *object; HRESULT hr; object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); @@ -1568,7 +1568,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *if } TRACE("Created geometry shader %p.\n", object); - *shader = (IWineD3DBaseShader *)object; + *shader = object; return WINED3D_OK; } @@ -1576,10 +1576,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *if static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DBaseShader **shader) + struct wined3d_shader **shader) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShaderImpl *object; + struct wined3d_shader *object; HRESULT hr; if (This->ps_selected_mode == SHADER_NONE) @@ -1601,7 +1601,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface } TRACE("Created pixel shader %p.\n", object); - *shader = (IWineD3DBaseShader *)object; + *shader = object; return WINED3D_OK; } @@ -3339,12 +3339,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexDeclaration(IWineD3DDevice *if return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3DBaseShader *shader) +static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, struct wined3d_shader *shader) { IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShader *prev = (IWineD3DBaseShader *)device->updateStateBlock->state.vertex_shader; + struct wined3d_shader *prev = device->updateStateBlock->state.vertex_shader; - device->updateStateBlock->state.vertex_shader = (IWineD3DBaseShaderImpl *)shader; + device->updateStateBlock->state.vertex_shader = shader; device->updateStateBlock->changed.vertexShader = TRUE; if (device->isRecordingState) @@ -3374,14 +3374,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, return WINED3D_OK; } -static IWineD3DBaseShader * WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface) +static struct wined3d_shader * WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface) { IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShader *shader; + struct wined3d_shader *shader; TRACE("iface %p.\n", iface); - shader = (IWineD3DBaseShader *)device->stateBlock->state.vertex_shader; + shader = device->stateBlock->state.vertex_shader; if (shader) wined3d_shader_incref(shader); @@ -3691,11 +3691,9 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps, const struct if (ps) { - IWineD3DBaseShaderImpl *pshader = This->stateBlock->state.pixel_shader; - /* Note that we only care if a sampler is sampled or not, not the sampler's specific type. * Otherwise we'd need to call shader_update_samplers() here for 1.x pixelshaders. */ - pshader_sampler_type = pshader->reg_maps.sampler_type; + pshader_sampler_type = This->stateBlock->state.pixel_shader->reg_maps.sampler_type; } for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i) { @@ -3743,12 +3741,12 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) if (vs) device_map_vsamplers(This, ps, gl_info); } -static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DBaseShader *shader) +static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, struct wined3d_shader *shader) { IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShader *prev = (IWineD3DBaseShader *)device->updateStateBlock->state.pixel_shader; + struct wined3d_shader *prev = device->updateStateBlock->state.pixel_shader; - device->updateStateBlock->state.pixel_shader = (IWineD3DBaseShaderImpl *)shader; + device->updateStateBlock->state.pixel_shader = shader; device->updateStateBlock->changed.pixelShader = TRUE; /* Handle recording of state blocks */ @@ -3782,10 +3780,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, I return WINED3D_OK; } -static IWineD3DBaseShader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface) +static struct wined3d_shader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface) { IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseShader *shader; + struct wined3d_shader *shader; TRACE("iface %p.\n", iface); @@ -6252,13 +6250,13 @@ static void delete_opengl_contexts(IWineD3DDeviceImpl *device, IWineD3DSwapChain { const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - IWineD3DBaseShaderImpl *shader; + struct wined3d_shader *shader; context = context_acquire(device, NULL); gl_info = context->gl_info; IWineD3DDevice_EnumResources((IWineD3DDevice *)device, device_unload_resource, NULL); - LIST_FOR_EACH_ENTRY(shader, &device->shaders, IWineD3DBaseShaderImpl, shader_list_entry) + LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) { device->shader_backend->shader_destroy(shader); } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index c10dd17400d..0fb05960f87 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -109,8 +109,8 @@ struct glsl_shader_prog_link { GLint luminanceoffset_location[MAX_TEXTURES]; GLint ycorrection_location; GLenum vertex_color_clamp; - IWineD3DBaseShaderImpl *vshader; - IWineD3DBaseShaderImpl *pshader; + const struct wined3d_shader *vshader; + const struct wined3d_shader *pshader; struct vs_compile_args vs_args; struct ps_compile_args ps_args; UINT constant_version; @@ -118,8 +118,8 @@ struct glsl_shader_prog_link { }; typedef struct { - IWineD3DBaseShaderImpl *vshader; - IWineD3DBaseShaderImpl *pshader; + const struct wined3d_shader *vshader; + const struct wined3d_shader *pshader; struct ps_compile_args ps_args; struct vs_compile_args vs_args; } glsl_program_key_t; @@ -534,7 +534,7 @@ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_i /* Loads floating point constants (aka uniforms) into the currently set GLSL program. */ /* GL locking is done by the caller */ -static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info, +static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const float *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, UINT version) { @@ -565,7 +565,7 @@ static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *shader, const st /* Loads integer constants (aka uniforms) into the currently set GLSL program. */ /* GL locking is done by the caller */ -static void shader_glsl_load_constantsI(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info, +static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const GLint locations[MAX_CONST_I], const int *constants, WORD constants_set) { unsigned int i; @@ -603,7 +603,7 @@ static void shader_glsl_load_constantsI(IWineD3DBaseShaderImpl *shader, const st /* Loads boolean constants (aka uniforms) into the currently set GLSL program. */ /* GL locking is done by the caller */ -static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info, +static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, GLhandleARB programId, const BOOL *constants, WORD constants_set) { GLint tmp_loc; @@ -756,7 +756,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, if (useVertexShader) { - IWineD3DBaseShaderImpl *vshader = (IWineD3DBaseShaderImpl *)stateBlock->state.vertex_shader; + const struct wined3d_shader *vshader = stateBlock->state.vertex_shader; /* Load DirectX 9 float constants/uniforms for vertex shader */ shader_glsl_load_constantsF(vshader, gl_info, stateBlock->state.vs_consts_f, @@ -778,7 +778,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, if (usePixelShader) { - IWineD3DBaseShaderImpl *pshader = stateBlock->state.pixel_shader; + const struct wined3d_shader *pshader = stateBlock->state.pixel_shader; /* Load DirectX 9 float constants/uniforms for pixel shader */ shader_glsl_load_constantsF(pshader, gl_info, stateBlock->state.ps_consts_f, @@ -914,7 +914,7 @@ static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_in /** Generate the variable & register declarations for the GLSL output target */ static void shader_generate_glsl_declarations(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct wined3d_shader_reg_maps *reg_maps, struct shader_glsl_ctx_priv *ctx_priv) { IWineD3DDeviceImpl *device = shader->device; @@ -3647,7 +3647,7 @@ static void shader_glsl_dp2add(const struct wined3d_shader_instruction *ins) } } -static void shader_glsl_input_pack(IWineD3DBaseShaderImpl *shader, struct wined3d_shader_buffer *buffer, +static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, const struct wined3d_shader_signature_element *input_signature, const struct wined3d_shader_reg_maps *reg_maps, enum vertexprocessing_mode vertexprocessing) @@ -3716,7 +3716,7 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh } static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv, - IWineD3DBaseShaderImpl *vshader, IWineD3DBaseShaderImpl *pshader, + const struct wined3d_shader *vshader, const struct wined3d_shader *pshader, struct vs_compile_args *vs_args, struct ps_compile_args *ps_args) { struct wine_rb_entry *entry; @@ -3844,7 +3844,8 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, /* GL locking is done by the caller */ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer, - IWineD3DBaseShaderImpl *vs, IWineD3DBaseShaderImpl *ps, const struct wined3d_gl_info *gl_info) + const struct wined3d_shader *vs, const struct wined3d_shader *ps, + const struct wined3d_gl_info *gl_info) { GLhandleARB ret = 0; DWORD ps_major = ps ? ps->reg_maps.shader_version.major : 0; @@ -3953,8 +3954,8 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer } /* GL locking is done by the caller */ -static void hardcode_local_constants(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info, - GLhandleARB programId, char prefix) +static void hardcode_local_constants(const struct wined3d_shader *shader, + const struct wined3d_gl_info *gl_info, GLhandleARB programId, char prefix) { const local_constant *lconst; GLint tmp_loc; @@ -3973,7 +3974,7 @@ static void hardcode_local_constants(IWineD3DBaseShaderImpl *shader, const struc /* GL locking is done by the caller */ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; @@ -4074,7 +4075,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context /* GL locking is done by the caller */ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct vs_compile_args *args) { const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; @@ -4143,7 +4144,7 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context } static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info) { struct wined3d_state *state = &shader->device->stateBlock->state; @@ -4221,7 +4222,7 @@ static inline BOOL vs_args_equal(const struct vs_compile_args *stored, const str } static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct vs_compile_args *args) { UINT i; @@ -4296,8 +4297,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context, IWineD3DDeviceImpl *device, BOOL use_ps, BOOL use_vs) { const struct wined3d_state *state = &device->stateBlock->state; - IWineD3DBaseShaderImpl *vshader = use_vs ? state->vertex_shader : NULL; - IWineD3DBaseShaderImpl *pshader = use_ps ? state->pixel_shader : NULL; + struct wined3d_shader *vshader = use_vs ? state->vertex_shader : NULL; + struct wined3d_shader *pshader = use_ps ? state->pixel_shader : NULL; const struct wined3d_gl_info *gl_info = context->gl_info; struct shader_glsl_priv *priv = device->shader_priv; struct glsl_shader_prog_link *entry = NULL; @@ -4674,7 +4675,7 @@ static void shader_glsl_deselect_depth_blt(void *shader_priv, const struct wined checkGLcall("glUseProgramObjectARB"); } -static void shader_glsl_destroy(IWineD3DBaseShaderImpl *shader) +static void shader_glsl_destroy(struct wined3d_shader *shader) { const struct list *linked_programs; IWineD3DDeviceImpl *device = shader->device; @@ -4682,9 +4683,6 @@ static void shader_glsl_destroy(IWineD3DBaseShaderImpl *shader) const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - /* Note: Do not use QueryInterface here to find out which shader type this is because this code - * can be called from IWineD3DBaseShader::Release - */ char pshader = shader_is_pshader_version(shader->reg_maps.shader_version.type); if (pshader) @@ -4701,7 +4699,7 @@ static void shader_glsl_destroy(IWineD3DBaseShaderImpl *shader) context = context_acquire(device, NULL); gl_info = context->gl_info; - if (priv->glsl_program && (IWineD3DBaseShaderImpl *)priv->glsl_program->pshader == shader) + if (priv->glsl_program && priv->glsl_program->pshader == shader) { ENTER_GL(); shader_glsl_select(context, FALSE, FALSE); @@ -4722,7 +4720,7 @@ static void shader_glsl_destroy(IWineD3DBaseShaderImpl *shader) context = context_acquire(device, NULL); gl_info = context->gl_info; - if (priv->glsl_program && (IWineD3DBaseShaderImpl *)priv->glsl_program->vshader == shader) + if (priv->glsl_program && priv->glsl_program->vshader == shader) { ENTER_GL(); shader_glsl_select(context, FALSE, FALSE); diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 0fdea9fd5ac..e2c2dce6941 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -298,7 +298,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ... return ret; } -static void shader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, +static void shader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, void *parent, const struct wined3d_parent_ops *parent_ops) { shader->ref = 1; @@ -348,7 +348,7 @@ static inline void set_bitmap_bit(DWORD *bitmap, DWORD bit) bitmap[idx] |= (1 << shift); } -static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct wined3d_shader_reg_maps *reg_maps, +static void shader_record_register_usage(struct wined3d_shader *shader, struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_shader_register *reg, enum wined3d_shader_type shader_type) { switch (reg->type) @@ -448,7 +448,7 @@ static unsigned int get_instr_extra_regcount(enum WINED3D_SHADER_INSTRUCTION_HAN } /* Note that this does not count the loop register as an address register. */ -static HRESULT shader_get_registers_used(IWineD3DBaseShaderImpl *shader, const struct wined3d_shader_frontend *fe, +static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const struct wined3d_shader_frontend *fe, struct wined3d_shader_reg_maps *reg_maps, struct wined3d_shader_signature_element *input_signature, struct wined3d_shader_signature_element *output_signature, const DWORD *byte_code, DWORD constf_size) { @@ -1159,7 +1159,7 @@ void shader_dump_src_param(const struct wined3d_shader_src_param *param, /* Shared code in order to generate the bulk of the shader string. * NOTE: A description of how to parse tokens can be found on MSDN. */ -void shader_generate_main(IWineD3DBaseShaderImpl *shader, struct wined3d_shader_buffer *buffer, +void shader_generate_main(struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) { IWineD3DDeviceImpl *device = shader->device; @@ -1470,7 +1470,7 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe } } -static void shader_cleanup(IWineD3DBaseShaderImpl *shader) +static void shader_cleanup(struct wined3d_shader *shader) { shader->device->shader_backend->shader_destroy(shader); HeapFree(GetProcessHeap(), 0, shader->reg_maps.constf); @@ -1494,7 +1494,7 @@ static void shader_none_update_float_pixel_constants(IWineD3DDeviceImpl *device, static void shader_none_load_constants(const struct wined3d_context *context, char usePS, char useVS) {} static void shader_none_load_np2fixup_constants(void *shader_priv, const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {} -static void shader_none_destroy(IWineD3DBaseShaderImpl *shader) {} +static void shader_none_destroy(struct wined3d_shader *shader) {} static HRESULT shader_none_alloc(IWineD3DDeviceImpl *device) {return WINED3D_OK;} static void shader_none_free(IWineD3DDeviceImpl *device) {} static BOOL shader_none_dirty_const(void) {return FALSE;} @@ -1546,7 +1546,7 @@ const shader_backend_t none_shader_backend = { shader_none_color_fixup_supported, }; -static HRESULT shader_set_function(IWineD3DBaseShaderImpl *shader, const DWORD *byte_code, +static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, DWORD float_const_count) { struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; @@ -1681,7 +1681,7 @@ HRESULT CDECL wined3d_shader_set_local_constants_float(struct wined3d_shader *sh } void find_vs_compile_args(const struct wined3d_state *state, - IWineD3DBaseShaderImpl *shader, struct vs_compile_args *args) + const struct wined3d_shader *shader, struct vs_compile_args *args) { args->fog_src = state->render_states[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE ? VS_FOG_COORD : VS_FOG_Z; @@ -1720,7 +1720,7 @@ BOOL vshader_get_input(struct wined3d_shader *shader, return FALSE; } -static void vertexshader_set_limits(IWineD3DBaseShaderImpl *shader) +static void vertexshader_set_limits(struct wined3d_shader *shader) { DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major, shader->reg_maps.shader_version.minor); @@ -1794,7 +1794,7 @@ static void vertexshader_set_limits(IWineD3DBaseShaderImpl *shader) } } -HRESULT vertexshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, +HRESULT vertexshader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) { @@ -1843,7 +1843,7 @@ HRESULT vertexshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *de return WINED3D_OK; } -HRESULT geometryshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, +HRESULT geometryshader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) { @@ -1864,7 +1864,7 @@ HRESULT geometryshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl * } void find_ps_compile_args(const struct wined3d_state *state, - IWineD3DBaseShaderImpl *shader, struct ps_compile_args *args) + const struct wined3d_shader *shader, struct ps_compile_args *args) { IWineD3DDeviceImpl *device = shader->device; const struct wined3d_texture *texture; @@ -1961,7 +1961,7 @@ void find_ps_compile_args(const struct wined3d_state *state, } } -static void pixelshader_set_limits(IWineD3DBaseShaderImpl *shader) +static void pixelshader_set_limits(struct wined3d_shader *shader) { DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major, shader->reg_maps.shader_version.minor); @@ -2049,7 +2049,7 @@ static void pixelshader_set_limits(IWineD3DBaseShaderImpl *shader) } } -HRESULT pixelshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, +HRESULT pixelshader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) { diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8a6f4517075..182882deee1 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3569,7 +3569,7 @@ static void shaderconstant(DWORD state_id, struct wined3d_stateblock *stateblock static void tex_bumpenvlscale(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); - IWineD3DBaseShaderImpl *ps = stateblock->state.pixel_shader; + const struct wined3d_shader *ps = stateblock->state.pixel_shader; if (ps && stage && (ps->reg_maps.luminanceparams & (1 << stage))) { @@ -3740,7 +3740,7 @@ void apply_pixelshader(DWORD state_id, struct wined3d_stateblock *stateblock, st static void shader_bumpenvmat(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); - IWineD3DBaseShaderImpl *ps = stateblock->state.pixel_shader; + const struct wined3d_shader *ps = stateblock->state.pixel_shader; if (ps && stage && (ps->reg_maps.bumpmat & (1 << stage))) { diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 2e2d1b96b62..2d7adc27a38 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -901,7 +901,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo TRACE("Blocktype: %#x.\n", stateblock->blockType); if (stateblock->changed.vertexShader) - IWineD3DDevice_SetVertexShader(device, (IWineD3DBaseShader *)stateblock->state.vertex_shader); + IWineD3DDevice_SetVertexShader(device, stateblock->state.vertex_shader); /* Vertex Shader Constants. */ for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i) @@ -923,7 +923,7 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo apply_lights(device, &stateblock->state); if (stateblock->changed.pixelShader) - IWineD3DDevice_SetPixelShader(device, (IWineD3DBaseShader *)stateblock->state.pixel_shader); + IWineD3DDevice_SetPixelShader(device, stateblock->state.pixel_shader); /* Pixel Shader Constants. */ for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 59738df6360..8587afc1ace 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -55,8 +55,6 @@ typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl; typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl; typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl; -typedef struct wined3d_shader IWineD3DBaseShaderImpl; -typedef struct wined3d_shader IWineD3DBaseShader; /* Texture format fixups */ @@ -2741,21 +2739,21 @@ struct wined3d_shader } u; }; -HRESULT geometryshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, +HRESULT geometryshader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -HRESULT pixelshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, +HRESULT pixelshader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void pixelshader_update_samplers(struct wined3d_shader_reg_maps *reg_maps, struct wined3d_texture * const *textures) DECLSPEC_HIDDEN; void find_ps_compile_args(const struct wined3d_state *state, - IWineD3DBaseShaderImpl *shader, struct ps_compile_args *args) DECLSPEC_HIDDEN; + const struct wined3d_shader *shader, struct ps_compile_args *args) DECLSPEC_HIDDEN; void find_vs_compile_args(const struct wined3d_state *state, - IWineD3DBaseShaderImpl *shader, struct vs_compile_args *args) DECLSPEC_HIDDEN; -HRESULT vertexshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device, + const struct wined3d_shader *shader, struct vs_compile_args *args) DECLSPEC_HIDDEN; +HRESULT vertexshader_init(struct wined3d_shader *shader, IWineD3DDeviceImpl *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; @@ -2768,7 +2766,7 @@ void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, const struct wined3d_shader_version *shader_version) DECLSPEC_HIDDEN; unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps *reg_maps, unsigned int max) DECLSPEC_HIDDEN; -void shader_generate_main(IWineD3DBaseShaderImpl *shader, struct wined3d_shader_buffer *buffer, +void shader_generate_main(struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, const struct wined3d_shader_reg_maps *reg_maps, const DWORD *pFunction, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, WINED3DDECLUSAGE usage) DECLSPEC_HIDDEN; @@ -2832,7 +2830,7 @@ static inline void shader_get_position_fixup(const struct wined3d_context *conte } } -static inline BOOL shader_constant_is_local(IWineD3DBaseShaderImpl *shader, DWORD reg) +static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader, DWORD reg) { struct local_constant *lconst;