Commit dab01d43 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of IWineD3DVertexShaderImpl.

parent 3d4fe0b7
...@@ -3898,8 +3898,8 @@ static DWORD find_input_signature(struct shader_arb_priv *priv, const struct win ...@@ -3898,8 +3898,8 @@ static DWORD find_input_signature(struct shader_arb_priv *priv, const struct win
return found_sig->idx; return found_sig->idx;
} }
static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_num, struct shader_arb_ctx_priv *priv_ctx, static void init_output_registers(IWineD3DBaseShaderImpl *shader, DWORD sig_num,
struct arb_vs_compiled_shader *compiled) struct shader_arb_ctx_priv *priv_ctx, struct arb_vs_compiled_shader *compiled)
{ {
unsigned int i, j; unsigned int i, j;
static const char * const texcoords[8] = static const char * const texcoords[8] =
...@@ -4075,16 +4075,16 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu ...@@ -4075,16 +4075,16 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu
} }
/* GL locking is done by the caller */ /* GL locking is done by the caller */
static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, static GLuint shader_arb_generate_vshader(IWineD3DBaseShaderImpl *shader,
const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, 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) const struct arb_vs_compile_args *args, struct arb_vs_compiled_shader *compiled)
{ {
const struct arb_vshader_private *shader_data = This->baseShader.backend_data; const struct arb_vshader_private *shader_data = shader->baseShader.backend_data;
const struct wined3d_shader_reg_maps *reg_maps = &This->baseShader.reg_maps; const struct wined3d_shader_reg_maps *reg_maps = &shader->baseShader.reg_maps;
CONST DWORD *function = This->baseShader.function; const DWORD *function = shader->baseShader.function;
const local_constant *lconst; const local_constant *lconst;
GLuint ret; GLuint ret;
DWORD next_local, *lconst_map = local_const_mapping((IWineD3DBaseShaderImpl *) This); DWORD next_local, *lconst_map = local_const_mapping(shader);
struct shader_arb_ctx_priv priv_ctx; struct shader_arb_ctx_priv priv_ctx;
unsigned int i; unsigned int i;
GLint errPos; GLint errPos;
...@@ -4092,7 +4092,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, ...@@ -4092,7 +4092,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
memset(&priv_ctx, 0, sizeof(priv_ctx)); memset(&priv_ctx, 0, sizeof(priv_ctx));
priv_ctx.cur_vs_args = args; priv_ctx.cur_vs_args = args;
list_init(&priv_ctx.control_frames); list_init(&priv_ctx.control_frames);
init_output_registers(This, args->ps_signature, &priv_ctx, compiled); init_output_registers(shader, args->ps_signature, &priv_ctx, compiled);
/* Create the hw ARB shader */ /* Create the hw ARB shader */
shader_addline(buffer, "!!ARBvp1.0\n"); shader_addline(buffer, "!!ARBvp1.0\n");
...@@ -4129,15 +4129,15 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, ...@@ -4129,15 +4129,15 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
shader_addline(buffer, "TEMP TA;\n"); shader_addline(buffer, "TEMP TA;\n");
/* Base Declarations */ /* Base Declarations */
next_local = shader_generate_arb_declarations((IWineD3DBaseShaderImpl *)This, next_local = shader_generate_arb_declarations(shader, reg_maps, buffer,
reg_maps, buffer, gl_info, lconst_map, &priv_ctx.vs_clipplanes, &priv_ctx); gl_info, lconst_map, &priv_ctx.vs_clipplanes, &priv_ctx);
for(i = 0; i < MAX_CONST_I; i++) for(i = 0; i < MAX_CONST_I; i++)
{ {
compiled->int_consts[i] = WINED3D_CONST_NUM_UNUSED; compiled->int_consts[i] = WINED3D_CONST_NUM_UNUSED;
if(reg_maps->integer_constants & (1 << i) && priv_ctx.target_version >= NV2) if(reg_maps->integer_constants & (1 << i) && priv_ctx.target_version >= NV2)
{ {
const DWORD *control_values = find_loop_control_values((IWineD3DBaseShaderImpl *) This, i); const DWORD *control_values = find_loop_control_values(shader, i);
if(control_values) if(control_values)
{ {
...@@ -4170,7 +4170,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, ...@@ -4170,7 +4170,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
*/ */
if (!gl_info->supported[NV_VERTEX_PROGRAM]) if (!gl_info->supported[NV_VERTEX_PROGRAM])
{ {
IWineD3DDeviceImpl *device = This->baseShader.device; IWineD3DDeviceImpl *device = shader->baseShader.device;
const char *color_init = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_0001); const char *color_init = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_0001);
shader_addline(buffer, "MOV result.color.secondary, %s;\n", color_init); shader_addline(buffer, "MOV result.color.secondary, %s;\n", color_init);
...@@ -4189,7 +4189,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, ...@@ -4189,7 +4189,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
/* The shader starts with the main function */ /* The shader starts with the main function */
priv_ctx.in_main_func = TRUE; priv_ctx.in_main_func = TRUE;
/* Base Shader Body */ /* Base Shader Body */
shader_generate_main((IWineD3DBaseShaderImpl *)This, buffer, reg_maps, function, &priv_ctx); shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx);
if (!priv_ctx.footer_written) vshader_add_footer(&priv_ctx, if (!priv_ctx.footer_written) vshader_add_footer(&priv_ctx,
shader_data, args, reg_maps, gl_info, buffer); shader_data, args, reg_maps, gl_info, buffer);
...@@ -4225,8 +4225,10 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, ...@@ -4225,8 +4225,10 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
if (!native) WARN("Program exceeds native resource limits.\n"); if (!native) WARN("Program exceeds native resource limits.\n");
/* Load immediate constants */ /* Load immediate constants */
if(lconst_map) { if (lconst_map)
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { {
LIST_FOR_EACH_ENTRY(lconst, &shader->baseShader.constantsF, local_constant, entry)
{
const float *value = (const float *)lconst->value; const float *value = (const float *)lconst->value;
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst_map[lconst->idx], value)); GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst_map[lconst->idx], value));
} }
...@@ -4332,7 +4334,8 @@ static inline BOOL vs_args_equal(const struct arb_vs_compile_args *stored, const ...@@ -4332,7 +4334,8 @@ 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)); return !memcmp(stored->loop_ctrl, new->loop_ctrl, sizeof(stored->loop_ctrl));
} }
static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl *shader, const struct arb_vs_compile_args *args) static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DBaseShaderImpl *shader,
const struct arb_vs_compile_args *args)
{ {
IWineD3DDeviceImpl *device = shader->baseShader.device; IWineD3DDeviceImpl *device = shader->baseShader.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
...@@ -4473,7 +4476,7 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state, ...@@ -4473,7 +4476,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, static void find_arb_vs_compile_args(const struct wined3d_state *state,
IWineD3DVertexShaderImpl *shader, struct arb_vs_compile_args *args) IWineD3DBaseShaderImpl *shader, struct arb_vs_compile_args *args)
{ {
IWineD3DDeviceImpl *device = shader->baseShader.device; IWineD3DDeviceImpl *device = shader->baseShader.device;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
...@@ -4618,7 +4621,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, ...@@ -4618,7 +4621,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS,
if (useVS) if (useVS)
{ {
IWineD3DVertexShaderImpl *vs = state->vertex_shader; IWineD3DBaseShaderImpl *vs = state->vertex_shader;
struct arb_vs_compile_args compile_args; struct arb_vs_compile_args compile_args;
struct arb_vs_compiled_shader *compiled; struct arb_vs_compiled_shader *compiled;
......
...@@ -1516,7 +1516,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac ...@@ -1516,7 +1516,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
IWineD3DBaseShader **shader) IWineD3DBaseShader **shader)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexShaderImpl *object; IWineD3DBaseShaderImpl *object;
HRESULT hr; HRESULT hr;
if (This->vs_selected_mode == SHADER_NONE) if (This->vs_selected_mode == SHADER_NONE)
...@@ -3344,7 +3344,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, ...@@ -3344,7 +3344,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface,
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface;
IWineD3DBaseShader *prev = (IWineD3DBaseShader *)device->updateStateBlock->state.vertex_shader; IWineD3DBaseShader *prev = (IWineD3DBaseShader *)device->updateStateBlock->state.vertex_shader;
device->updateStateBlock->state.vertex_shader = (IWineD3DVertexShaderImpl *)shader; device->updateStateBlock->state.vertex_shader = (IWineD3DBaseShaderImpl *)shader;
device->updateStateBlock->changed.vertexShader = TRUE; device->updateStateBlock->changed.vertexShader = TRUE;
if (device->isRecordingState) if (device->isRecordingState)
......
...@@ -109,7 +109,7 @@ struct glsl_shader_prog_link { ...@@ -109,7 +109,7 @@ struct glsl_shader_prog_link {
GLint luminanceoffset_location[MAX_TEXTURES]; GLint luminanceoffset_location[MAX_TEXTURES];
GLint ycorrection_location; GLint ycorrection_location;
GLenum vertex_color_clamp; GLenum vertex_color_clamp;
IWineD3DVertexShaderImpl *vshader; IWineD3DBaseShaderImpl *vshader;
IWineD3DPixelShaderImpl *pshader; IWineD3DPixelShaderImpl *pshader;
struct vs_compile_args vs_args; struct vs_compile_args vs_args;
struct ps_compile_args ps_args; struct ps_compile_args ps_args;
...@@ -118,7 +118,7 @@ struct glsl_shader_prog_link { ...@@ -118,7 +118,7 @@ struct glsl_shader_prog_link {
}; };
typedef struct { typedef struct {
IWineD3DVertexShaderImpl *vshader; IWineD3DBaseShaderImpl *vshader;
IWineD3DPixelShaderImpl *pshader; IWineD3DPixelShaderImpl *pshader;
struct ps_compile_args ps_args; struct ps_compile_args ps_args;
struct vs_compile_args vs_args; struct vs_compile_args vs_args;
...@@ -3710,7 +3710,7 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh ...@@ -3710,7 +3710,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, static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv,
IWineD3DVertexShaderImpl *vshader, IWineD3DPixelShaderImpl *pshader, IWineD3DBaseShaderImpl *vshader, IWineD3DPixelShaderImpl *pshader,
struct vs_compile_args *vs_args, struct ps_compile_args *ps_args) struct vs_compile_args *vs_args, struct ps_compile_args *ps_args)
{ {
struct wine_rb_entry *entry; struct wine_rb_entry *entry;
...@@ -3838,7 +3838,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, ...@@ -3838,7 +3838,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
/* GL locking is done by the caller */ /* GL locking is done by the caller */
static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer, static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer,
IWineD3DVertexShaderImpl *vs, IWineD3DPixelShaderImpl *ps, const struct wined3d_gl_info *gl_info) IWineD3DBaseShaderImpl *vs, IWineD3DPixelShaderImpl *ps, const struct wined3d_gl_info *gl_info)
{ {
GLhandleARB ret = 0; GLhandleARB ret = 0;
DWORD ps_major = ps ? ps->baseShader.reg_maps.shader_version.major : 0; DWORD ps_major = ps ? ps->baseShader.reg_maps.shader_version.major : 0;
...@@ -4070,12 +4070,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context ...@@ -4070,12 +4070,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
/* GL locking is done by the caller */ /* GL locking is done by the caller */
static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context, static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context,
struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *This, struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader,
const struct vs_compile_args *args) const struct vs_compile_args *args)
{ {
const struct wined3d_shader_reg_maps *reg_maps = &This->baseShader.reg_maps; const struct wined3d_shader_reg_maps *reg_maps = &shader->baseShader.reg_maps;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
CONST DWORD *function = This->baseShader.function; const DWORD *function = shader->baseShader.function;
struct shader_glsl_ctx_priv priv_ctx; struct shader_glsl_ctx_priv priv_ctx;
/* Create the hw GLSL shader program and assign it as the shader->prgId */ /* Create the hw GLSL shader program and assign it as the shader->prgId */
...@@ -4090,10 +4090,10 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context ...@@ -4090,10 +4090,10 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context
priv_ctx.cur_vs_args = args; priv_ctx.cur_vs_args = args;
/* Base Declarations */ /* Base Declarations */
shader_generate_glsl_declarations(context, buffer, (IWineD3DBaseShaderImpl *)This, reg_maps, &priv_ctx); shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx);
/* Base Shader Body */ /* Base Shader Body */
shader_generate_main((IWineD3DBaseShaderImpl *)This, buffer, reg_maps, function, &priv_ctx); shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx);
/* Unpack outputs */ /* Unpack outputs */
shader_addline(buffer, "order_ps_input(OUT);\n"); shader_addline(buffer, "order_ps_input(OUT);\n");
...@@ -4217,7 +4217,7 @@ static inline BOOL vs_args_equal(const struct vs_compile_args *stored, const str ...@@ -4217,7 +4217,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, static GLhandleARB find_glsl_vshader(const struct wined3d_context *context,
struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *shader, struct wined3d_shader_buffer *buffer, IWineD3DBaseShaderImpl *shader,
const struct vs_compile_args *args) const struct vs_compile_args *args)
{ {
UINT i; UINT i;
...@@ -4292,7 +4292,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context, ...@@ -4292,7 +4292,7 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
IWineD3DDeviceImpl *device, BOOL use_ps, BOOL use_vs) IWineD3DDeviceImpl *device, BOOL use_ps, BOOL use_vs)
{ {
const struct wined3d_state *state = &device->stateBlock->state; const struct wined3d_state *state = &device->stateBlock->state;
IWineD3DVertexShaderImpl *vshader = use_vs ? state->vertex_shader : NULL; IWineD3DBaseShaderImpl *vshader = use_vs ? state->vertex_shader : NULL;
IWineD3DPixelShaderImpl *pshader = use_ps ? state->pixel_shader : NULL; IWineD3DPixelShaderImpl *pshader = use_ps ? state->pixel_shader : NULL;
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_glsl_priv *priv = device->shader_priv; struct shader_glsl_priv *priv = device->shader_priv;
......
...@@ -1665,7 +1665,7 @@ static HRESULT STDMETHODCALLTYPE vertexshader_QueryInterface(IWineD3DBaseShader ...@@ -1665,7 +1665,7 @@ static HRESULT STDMETHODCALLTYPE vertexshader_QueryInterface(IWineD3DBaseShader
static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DBaseShader *iface) static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DBaseShader *iface)
{ {
IWineD3DVertexShaderImpl *shader = (IWineD3DVertexShaderImpl *)iface; IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)iface;
ULONG refcount = InterlockedIncrement(&shader->baseShader.ref); ULONG refcount = InterlockedIncrement(&shader->baseShader.ref);
TRACE("%p increasing refcount to %u.\n", shader, refcount); TRACE("%p increasing refcount to %u.\n", shader, refcount);
...@@ -1676,14 +1676,14 @@ static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DBaseShader *iface) ...@@ -1676,14 +1676,14 @@ static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DBaseShader *iface)
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DBaseShader *iface) static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DBaseShader *iface)
{ {
IWineD3DVertexShaderImpl *shader = (IWineD3DVertexShaderImpl *)iface; IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)iface;
ULONG refcount = InterlockedDecrement(&shader->baseShader.ref); ULONG refcount = InterlockedDecrement(&shader->baseShader.ref);
TRACE("%p decreasing refcount to %u.\n", shader, refcount); TRACE("%p decreasing refcount to %u.\n", shader, refcount);
if (!refcount) if (!refcount)
{ {
shader_cleanup((IWineD3DBaseShaderImpl *)shader); shader_cleanup(shader);
shader->baseShader.parent_ops->wined3d_object_destroyed(shader->baseShader.parent); shader->baseShader.parent_ops->wined3d_object_destroyed(shader->baseShader.parent);
HeapFree(GetProcessHeap(), 0, shader); HeapFree(GetProcessHeap(), 0, shader);
} }
...@@ -1728,7 +1728,7 @@ static const IWineD3DBaseShaderVtbl IWineD3DVertexShader_Vtbl = ...@@ -1728,7 +1728,7 @@ static const IWineD3DBaseShaderVtbl IWineD3DVertexShader_Vtbl =
}; };
void find_vs_compile_args(const struct wined3d_state *state, void find_vs_compile_args(const struct wined3d_state *state,
IWineD3DVertexShaderImpl *shader, struct vs_compile_args *args) IWineD3DBaseShaderImpl *shader, struct vs_compile_args *args)
{ {
args->fog_src = state->render_states[WINED3DRS_FOGTABLEMODE] args->fog_src = state->render_states[WINED3DRS_FOGTABLEMODE]
== WINED3DFOG_NONE ? VS_FOG_COORD : VS_FOG_Z; == WINED3DFOG_NONE ? VS_FOG_COORD : VS_FOG_Z;
...@@ -1747,7 +1747,7 @@ static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_id ...@@ -1747,7 +1747,7 @@ static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_id
return FALSE; return FALSE;
} }
BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, BOOL vshader_get_input(struct IWineD3DBaseShaderImpl *shader,
BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum)
{ {
WORD map = shader->baseShader.reg_maps.input_registers; WORD map = shader->baseShader.reg_maps.input_registers;
...@@ -1757,8 +1757,8 @@ BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, ...@@ -1757,8 +1757,8 @@ BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader,
{ {
if (!(map & 1)) continue; if (!(map & 1)) continue;
if (match_usage(shader->attributes[i].usage, if (match_usage(shader->u.vs.attributes[i].usage,
shader->attributes[i].usage_idx, usage_req, usage_idx_req)) shader->u.vs.attributes[i].usage_idx, usage_req, usage_idx_req))
{ {
*regnum = i; *regnum = i;
return TRUE; return TRUE;
...@@ -1767,7 +1767,7 @@ BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, ...@@ -1767,7 +1767,7 @@ BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader,
return FALSE; return FALSE;
} }
static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader) static void vertexshader_set_limits(IWineD3DBaseShaderImpl *shader)
{ {
DWORD shader_version = WINED3D_SHADER_VERSION(shader->baseShader.reg_maps.shader_version.major, DWORD shader_version = WINED3D_SHADER_VERSION(shader->baseShader.reg_maps.shader_version.major,
shader->baseShader.reg_maps.shader_version.minor); shader->baseShader.reg_maps.shader_version.minor);
...@@ -1841,7 +1841,7 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader) ...@@ -1841,7 +1841,7 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader)
} }
} }
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT vertexshader_init(IWineD3DBaseShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
void *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
...@@ -1855,12 +1855,11 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl * ...@@ -1855,12 +1855,11 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *
shader->lpVtbl = &IWineD3DVertexShader_Vtbl; shader->lpVtbl = &IWineD3DVertexShader_Vtbl;
shader_init(&shader->baseShader, device, parent, parent_ops); shader_init(&shader->baseShader, device, parent, parent_ops);
hr = shader_set_function((IWineD3DBaseShaderImpl *)shader, byte_code, hr = shader_set_function(shader, byte_code, output_signature, device->d3d_vshader_constantF);
output_signature, device->d3d_vshader_constantF);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to set function, hr %#x.\n", hr); WARN("Failed to set function, hr %#x.\n", hr);
shader_cleanup((IWineD3DBaseShaderImpl *)shader); shader_cleanup(shader);
return hr; return hr;
} }
...@@ -1869,9 +1868,9 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl * ...@@ -1869,9 +1868,9 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *
{ {
if (!(map & 1) || !shader->baseShader.input_signature[i].semantic_name) continue; if (!(map & 1) || !shader->baseShader.input_signature[i].semantic_name) continue;
shader->attributes[i].usage = shader->u.vs.attributes[i].usage =
shader_usage_from_semantic_name(shader->baseShader.input_signature[i].semantic_name); shader_usage_from_semantic_name(shader->baseShader.input_signature[i].semantic_name);
shader->attributes[i].usage_idx = shader->baseShader.input_signature[i].semantic_idx; shader->u.vs.attributes[i].usage_idx = shader->baseShader.input_signature[i].semantic_idx;
} }
if (output_signature) if (output_signature)
......
...@@ -2336,7 +2336,7 @@ struct wined3d_state ...@@ -2336,7 +2336,7 @@ struct wined3d_state
INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */ INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */
GLenum gl_primitive_type; GLenum gl_primitive_type;
struct IWineD3DVertexShaderImpl *vertex_shader; struct IWineD3DBaseShaderImpl *vertex_shader;
BOOL vs_consts_b[MAX_CONST_B]; BOOL vs_consts_b[MAX_CONST_B];
INT vs_consts_i[MAX_CONST_I * 4]; INT vs_consts_i[MAX_CONST_I * 4];
float *vs_consts_f; float *vs_consts_f;
...@@ -2682,7 +2682,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *fmt, ...) P ...@@ -2682,7 +2682,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *fmt, ...) P
int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *fmt, va_list args) DECLSPEC_HIDDEN; int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *fmt, va_list args) DECLSPEC_HIDDEN;
/* Vertex shader utility functions */ /* Vertex shader utility functions */
extern BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, extern BOOL vshader_get_input(struct IWineD3DBaseShaderImpl *shader,
BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) DECLSPEC_HIDDEN; BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
...@@ -2720,14 +2720,30 @@ typedef struct IWineD3DBaseShaderClass ...@@ -2720,14 +2720,30 @@ typedef struct IWineD3DBaseShaderClass
} IWineD3DBaseShaderClass; } IWineD3DBaseShaderClass;
struct wined3d_vertex_shader
{
struct wined3d_shader_attribute attributes[MAX_ATTRIBS];
};
typedef struct IWineD3DBaseShaderImpl { typedef struct IWineD3DBaseShaderImpl {
/* IUnknown */ /* IUnknown */
const IWineD3DBaseShaderVtbl *lpVtbl; const IWineD3DBaseShaderVtbl *lpVtbl;
/* IWineD3DBaseShader */ /* IWineD3DBaseShader */
IWineD3DBaseShaderClass baseShader; IWineD3DBaseShaderClass baseShader;
union
{
struct wined3d_vertex_shader vs;
} u;
} IWineD3DBaseShaderImpl; } IWineD3DBaseShaderImpl;
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 DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
void shader_buffer_clear(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; void shader_buffer_clear(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN;
BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN;
void shader_buffer_free(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; void shader_buffer_free(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN;
...@@ -2812,24 +2828,6 @@ static inline BOOL shader_constant_is_local(IWineD3DBaseShaderImpl* This, DWORD ...@@ -2812,24 +2828,6 @@ static inline BOOL shader_constant_is_local(IWineD3DBaseShaderImpl* This, DWORD
} }
/*****************************************************************************
* IDirect3DVertexShader implementation structures
*/
typedef struct IWineD3DVertexShaderImpl
{
const IWineD3DBaseShaderVtbl *lpVtbl;
IWineD3DBaseShaderClass baseShader;
/* Vertex shader attributes. */
struct wined3d_shader_attribute attributes[MAX_ATTRIBS];
} IWineD3DVertexShaderImpl;
void find_vs_compile_args(const struct wined3d_state *state,
IWineD3DVertexShaderImpl *shader, struct vs_compile_args *args) DECLSPEC_HIDDEN;
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *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;
struct wined3d_geometryshader struct wined3d_geometryshader
{ {
const struct IWineD3DBaseShaderVtbl *vtbl; const struct IWineD3DBaseShaderVtbl *vtbl;
......
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