From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/stateblock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 0d5d62359f7..67c696fa4f5 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2266,7 +2266,8 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru stateblock->changed.store_stream_offset = 1; list_init(&stateblock->changed.changed_lights);
- wined3d_stateblock_invalidate_push_constants(stateblock); + if (type == WINED3D_SBT_PRIMARY) + wined3d_stateblock_invalidate_push_constants(stateblock);
if (type == WINED3D_SBT_RECORDED || type == WINED3D_SBT_PRIMARY) return WINED3D_OK;
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/cs.c | 29 ----------------------------- dlls/wined3d/ffp_gl.c | 1 - dlls/wined3d/glsl_shader.c | 23 ++++++++++------------- dlls/wined3d/shader_spirv.c | 1 - dlls/wined3d/stateblock.c | 15 +++++---------- dlls/wined3d/utils.c | 2 -- dlls/wined3d/wined3d_private.h | 9 ++------- 7 files changed, 17 insertions(+), 63 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index f7f8021e8ba..d35c33f678c 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -121,7 +121,6 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_TRANSFORM, WINED3D_CS_OP_SET_CLIP_PLANE, WINED3D_CS_OP_SET_COLOR_KEY, - WINED3D_CS_OP_SET_MATERIAL, WINED3D_CS_OP_SET_LIGHT, WINED3D_CS_OP_SET_LIGHT_ENABLE, WINED3D_CS_OP_SET_FEATURE_LEVEL, @@ -383,12 +382,6 @@ struct wined3d_cs_set_clip_plane struct wined3d_vec4 plane; };
-struct wined3d_cs_set_material -{ - enum wined3d_cs_op opcode; - struct wined3d_material material; -}; - struct wined3d_cs_set_light { enum wined3d_cs_op opcode; @@ -604,7 +597,6 @@ static const char *debug_cs_op(enum wined3d_cs_op op) WINED3D_TO_STR(WINED3D_CS_OP_SET_TRANSFORM); WINED3D_TO_STR(WINED3D_CS_OP_SET_CLIP_PLANE); WINED3D_TO_STR(WINED3D_CS_OP_SET_COLOR_KEY); - WINED3D_TO_STR(WINED3D_CS_OP_SET_MATERIAL); WINED3D_TO_STR(WINED3D_CS_OP_SET_LIGHT); WINED3D_TO_STR(WINED3D_CS_OP_SET_LIGHT_ENABLE); WINED3D_TO_STR(WINED3D_CS_OP_SET_FEATURE_LEVEL); @@ -2015,26 +2007,6 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); }
-static void wined3d_cs_exec_set_material(struct wined3d_cs *cs, const void *data) -{ - const struct wined3d_cs_set_material *op = data; - - cs->state.material = op->material; - device_invalidate_state(cs->c.device, STATE_MATERIAL); -} - -void wined3d_device_context_emit_set_material(struct wined3d_device_context *context, - const struct wined3d_material *material) -{ - struct wined3d_cs_set_material *op; - - op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); - op->opcode = WINED3D_CS_OP_SET_MATERIAL; - op->material = *material; - - wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); -} - static void wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_light *op = data; @@ -2957,7 +2929,6 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform, /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane, /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, - /* WINED3D_CS_OP_SET_MATERIAL */ wined3d_cs_exec_set_material, /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, /* WINED3D_CS_OP_SET_FEATURE_LEVEL */ wined3d_cs_exec_set_feature_level, diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index f1f995f6e4c..a518521b101 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -1684,7 +1684,6 @@ static void validate_state_table(struct wined3d_state_entry *state_table) }; static const unsigned int simple_states[] = { - STATE_MATERIAL, STATE_VDECL, STATE_STREAMSRC, STATE_INDEXBUFFER, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 3fe7640106f..b4973c71343 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1509,16 +1509,20 @@ static void shader_glsl_ffp_vertex_texmatrix_uniform(const struct wined3d_contex checkGLcall("glUniformMatrix4fv"); }
-static void shader_glsl_ffp_vertex_material_uniform(const struct wined3d_context_gl *context_gl, +static void shader_glsl_ffp_vertex_material_uniform(struct wined3d_context_gl *context_gl, const struct wined3d_state *state, struct glsl_shader_prog_link *prog) { const struct wined3d_gl_info *gl_info = context_gl->gl_info; + const struct wined3d_ffp_vs_constants *constants;
- GL_EXTCALL(glUniform4fv(prog->vs.material_specular_location, 1, &state->material.specular.r)); - GL_EXTCALL(glUniform1f(prog->vs.material_shininess_location, state->material.power)); - GL_EXTCALL(glUniform4fv(prog->vs.material_ambient_location, 1, &state->material.ambient.r)); - GL_EXTCALL(glUniform4fv(prog->vs.material_diffuse_location, 1, &state->material.diffuse.r)); - GL_EXTCALL(glUniform4fv(prog->vs.material_emissive_location, 1, &state->material.emissive.r)); + constants = wined3d_buffer_load_sysmem( + context_gl->c.device->push_constants[WINED3D_PUSH_CONSTANTS_VS_FFP], &context_gl->c); + + GL_EXTCALL(glUniform4fv(prog->vs.material_specular_location, 1, &constants->material.specular.r)); + GL_EXTCALL(glUniform1f(prog->vs.material_shininess_location, constants->material.power)); + GL_EXTCALL(glUniform4fv(prog->vs.material_ambient_location, 1, &constants->material.ambient.r)); + GL_EXTCALL(glUniform4fv(prog->vs.material_diffuse_location, 1, &constants->material.diffuse.r)); + GL_EXTCALL(glUniform4fv(prog->vs.material_emissive_location, 1, &constants->material.emissive.r)); checkGLcall("setting FFP material uniforms"); }
@@ -11847,12 +11851,6 @@ static void glsl_vertex_pipe_viewport(struct wined3d_context *context, context->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP; }
-static void glsl_vertex_pipe_material(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MATERIAL; -} - static void glsl_vertex_pipe_pointsize(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -11902,7 +11900,6 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_SHADER(WINED3D_SHADER_TYPE_HULL), {STATE_SHADER(WINED3D_SHADER_TYPE_HULL), glsl_vertex_pipe_hs }, WINED3D_GL_EXT_NONE }, {STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), {STATE_SHADER(WINED3D_SHADER_TYPE_GEOMETRY), glsl_vertex_pipe_geometry_shader}, WINED3D_GL_EXT_NONE }, {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), {STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL), glsl_vertex_pipe_pixel_shader}, WINED3D_GL_EXT_NONE }, - {STATE_MATERIAL, {STATE_MATERIAL, glsl_vertex_pipe_material}, WINED3D_GL_EXT_NONE }, /* Clip planes */ {STATE_CLIPPLANE(0), {STATE_CLIPPLANE(0), glsl_vertex_pipe_clip_plane}, WINED3D_GLSL_130 }, {STATE_CLIPPLANE(0), {STATE_CLIPPLANE(0), clipplane }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index a4b311ae8d2..a5461d3d998 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -1176,7 +1176,6 @@ static const struct wined3d_state_entry_template spirv_vertex_pipe_vk_vp_states[ {STATE_RENDER(WINED3D_RS_POINTSCALE_B), {STATE_RENDER(WINED3D_RS_POINTSCALE_B), state_nop}}, {STATE_RENDER(WINED3D_RS_POINTSCALE_C), {STATE_RENDER(WINED3D_RS_POINTSCALE_C), state_nop}}, {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), state_nop}}, - {STATE_MATERIAL, {STATE_MATERIAL, state_nop}}, {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), state_nop}}, {STATE_LIGHT_TYPE, {STATE_LIGHT_TYPE, state_nop}}, {0}, /* Terminate */ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 67c696fa4f5..0618f982315 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2250,6 +2250,7 @@ static void wined3d_stateblock_invalidate_push_constants(struct wined3d_stateblo stateblock->changed.ffp_ps_constants = 1; stateblock->changed.lights = 1; stateblock->changed.texture_matrices = 1; + stateblock->changed.material = 1; }
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state, @@ -2610,14 +2611,6 @@ static void wined3d_device_set_texture(struct wined3d_device *device, return; }
-static void wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material) -{ - TRACE("device %p, material %p.\n", device, material); - - device->cs->c.state->material = *material; - wined3d_device_context_emit_set_material(&device->cs->c, material); -} - static void wined3d_device_set_transform(struct wined3d_device *device, enum wined3d_transform_state state, const struct wined3d_matrix *matrix) { @@ -3355,8 +3348,6 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, wined3d_device_set_base_vertex_index(device, state->base_vertex_index); if (changed->vertexDecl) wined3d_device_context_set_vertex_declaration(context, state->vertex_declaration); - if (changed->material) - wined3d_device_set_material(device, &state->material); if (changed->viewport) wined3d_device_context_set_viewports(context, 1, &state->viewport); if (changed->scissorRect) @@ -3426,6 +3417,10 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, } }
+ if (changed->material) + wined3d_device_context_push_constants(context, WINED3D_PUSH_CONSTANTS_VS_FFP, WINED3D_SHADER_CONST_FFP_MATERIAL, + offsetof(struct wined3d_ffp_vs_constants, material), sizeof(state->material), &state->material); + if (changed->lights) { unsigned int point_idx, spot_idx, directional_idx, parallel_point_idx; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index cd3458770aa..495831c40e5 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5369,8 +5369,6 @@ const char *debug_d3dstate(uint32_t state) return "STATE_SCISSORRECT"; if (STATE_IS_CLIPPLANE(state)) return wine_dbg_sprintf("STATE_CLIPPLANE(%#x)", state - STATE_CLIPPLANE(0)); - if (STATE_IS_MATERIAL(state)) - return "STATE_MATERIAL"; if (STATE_IS_RASTERIZER(state)) return "STATE_RASTERIZER"; if (STATE_IS_DEPTH_BOUNDS(state)) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a2db15d6c9e..7d36979b8da 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1757,10 +1757,7 @@ void dispatch_compute(struct wined3d_device *device, const struct wined3d_state #define STATE_CLIPPLANE(a) (STATE_SCISSORRECT + 1 + (a)) #define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES - 1))
-#define STATE_MATERIAL (STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES)) -#define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL) - -#define STATE_RASTERIZER (STATE_MATERIAL + 1) +#define STATE_RASTERIZER (STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES)) #define STATE_IS_RASTERIZER(a) ((a) == STATE_RASTERIZER)
#define STATE_DEPTH_BOUNDS (STATE_RASTERIZER + 1) @@ -2772,6 +2769,7 @@ BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size); struct wined3d_ffp_vs_constants { struct wined3d_matrix texture_matrices[WINED3D_MAX_FFP_TEXTURES]; + struct wined3d_material material; struct wined3d_ffp_light_constants { struct wined3d_color ambient; @@ -2889,7 +2887,6 @@ struct wined3d_state
struct wined3d_matrix transforms[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; struct wined3d_vec4 clip_planes[WINED3D_MAX_CLIP_DISTANCES]; - struct wined3d_material material; struct wined3d_viewport viewports[WINED3D_MAX_VIEWPORTS]; unsigned int viewport_count; RECT scissor_rects[WINED3D_MAX_VIEWPORTS]; @@ -3702,8 +3699,6 @@ void wined3d_device_context_emit_set_light(struct wined3d_device_context *contex const struct wined3d_light_info *light); void wined3d_device_context_emit_set_light_enable(struct wined3d_device_context *context, unsigned int idx, BOOL enable); -void wined3d_device_context_emit_set_material(struct wined3d_device_context *context, - const struct wined3d_material *material); void wined3d_device_context_emit_set_predication(struct wined3d_device_context *context, struct wined3d_query *predicate, BOOL value); void wined3d_device_context_emit_set_rasterizer_state(struct wined3d_device_context *context,
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/ffp_gl.c | 2 +- dlls/wined3d/glsl_shader.c | 85 ++++++++++++++++++++++++++++++++++ dlls/wined3d/utils.c | 85 ---------------------------------- dlls/wined3d/wined3d_private.h | 4 +- 4 files changed, 87 insertions(+), 89 deletions(-)
diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index a518521b101..447de1b68b0 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -1139,7 +1139,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info; - /* See get_projection_matrix() in utils.c for a discussion about those values. */ + /* See get_projection_matrix() in glsl_shader.c for a discussion about those values. */ float pixel_center_offset = context->d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER ? 0.5f : 0.0f; GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS]; diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index b4973c71343..e055e88103e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1477,6 +1477,91 @@ static void reset_program_constant_version(struct wine_rb_entry *entry, void *co WINE_RB_ENTRY_VALUE(entry, struct glsl_shader_prog_link, program_lookup_entry)->constant_version = 0; }
+static void get_projection_matrix(const struct wined3d_context *context, + const struct wined3d_state *state, struct wined3d_matrix *mat) +{ + const struct wined3d_d3d_info *d3d_info = context->d3d_info; + bool clip_control, flip; + float center_offset; + + /* There are a couple of additional things we have to take into account + * here besides the projection transformation itself: + * - We need to flip along the y-axis in case of offscreen rendering. + * - OpenGL Z range is {-Wc,...,Wc} while D3D Z range is {0,...,Wc}. + * - <= D3D9 coordinates refer to pixel centers while GL coordinates + * refer to pixel corners. D3D10 fixed this particular oddity. + * - D3D has a top-left filling convention while GL does not specify + * a particular behavior, other than that that the GL implementation + * needs to be consistent. + * + * In order to handle the pixel center, we translate by 0.5 / VPw and + * 0.5 / VPh. We test the filling convention during adapter init and + * add a small offset to correct it if necessary. See + * wined3d_caps_gl_ctx_test_filling_convention() for more details on how + * we test GL and considerations regarding the added offset value. + * + * If we have GL_ARB_clip_control we take care of all this through + * viewport properties and don't have to translate geometry. */ + + /* Projection matrices are <= d3d9, which all have integer pixel centers. */ + if (!(d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER)) + ERR("Did not expect to enter this codepath without WINED3D_PIXEL_CENTER_INTEGER.\n"); + + clip_control = d3d_info->clip_control; + flip = !clip_control; + if (!clip_control) + center_offset = 1.0f + d3d_info->filling_convention_offset; + else + center_offset = 0.0f; + + if (context->stream_info.position_transformed) + { + /* Transform D3D RHW coordinates to OpenGL clip coordinates. */ + float x = state->viewports[0].x; + float y = state->viewports[0].y; + float w = state->viewports[0].width; + float h = state->viewports[0].height; + float x_scale = 2.0f / w; + float x_offset = (center_offset - (2.0f * x) - w) / w; + float y_scale = flip ? 2.0f / h : 2.0f / -h; + float y_offset = flip + ? (center_offset - (2.0f * y) - h) / h + : (center_offset - (2.0f * y) - h) / -h; + bool zenable = state->fb.depth_stencil ? + (state->depth_stencil_state ? state->depth_stencil_state->desc.depth : true) : false; + float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f; + float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f; + const struct wined3d_matrix projection = + { + x_scale, 0.0f, 0.0f, 0.0f, + 0.0f, y_scale, 0.0f, 0.0f, + 0.0f, 0.0f, z_scale, 0.0f, + x_offset, y_offset, z_offset, 1.0f, + }; + + *mat = projection; + } + else + { + float y_scale = flip ? -1.0f : 1.0f; + float x_offset = center_offset / state->viewports[0].width; + float y_offset = flip + ? center_offset / state->viewports[0].height + : -center_offset / state->viewports[0].height; + float z_scale = clip_control ? 1.0f : 2.0f; + float z_offset = clip_control ? 0.0f : -1.0f; + const struct wined3d_matrix projection = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, y_scale, 0.0f, 0.0f, + 0.0f, 0.0f, z_scale, 0.0f, + x_offset, y_offset, z_offset, 1.0f, + }; + + multiply_matrix(mat, &projection, &state->transforms[WINED3D_TS_PROJECTION]); + } +} + static void shader_glsl_ffp_vertex_normalmatrix_uniform(const struct wined3d_context_gl *context_gl, const struct wined3d_state *state, struct glsl_shader_prog_link *prog) { diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 495831c40e5..fb663abcb8f 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5598,91 +5598,6 @@ void get_modelview_matrix(const struct wined3d_context *context, const struct wi multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(index)]); }
-void get_projection_matrix(const struct wined3d_context *context, const struct wined3d_state *state, - struct wined3d_matrix *mat) -{ - const struct wined3d_d3d_info *d3d_info = context->d3d_info; - BOOL clip_control, flip; - float center_offset; - - /* There are a couple of additional things we have to take into account - * here besides the projection transformation itself: - * - We need to flip along the y-axis in case of offscreen rendering. - * - OpenGL Z range is {-Wc,...,Wc} while D3D Z range is {0,...,Wc}. - * - <= D3D9 coordinates refer to pixel centers while GL coordinates - * refer to pixel corners. D3D10 fixed this particular oddity. - * - D3D has a top-left filling convention while GL does not specify - * a particular behavior, other than that that the GL implementation - * needs to be consistent. - * - * In order to handle the pixel center, we translate by 0.5 / VPw and - * 0.5 / VPh. We test the filling convention during adapter init and - * add a small offset to correct it if necessary. See - * wined3d_caps_gl_ctx_test_filling_convention() for more details on how - * we test GL and considerations regarding the added offset value. - * - * If we have GL_ARB_clip_control we take care of all this through - * viewport properties and don't have to translate geometry. */ - - /* Projection matrices are <= d3d9, which all have integer pixel centers. */ - if (!(d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER)) - ERR("Did not expect to enter this codepath without WINED3D_PIXEL_CENTER_INTEGER.\n"); - - clip_control = d3d_info->clip_control; - flip = !clip_control; - if (!clip_control) - center_offset = 1.0f + d3d_info->filling_convention_offset; - else - center_offset = 0.0f; - - if (context->stream_info.position_transformed) - { - /* Transform D3D RHW coordinates to OpenGL clip coordinates. */ - float x = state->viewports[0].x; - float y = state->viewports[0].y; - float w = state->viewports[0].width; - float h = state->viewports[0].height; - float x_scale = 2.0f / w; - float x_offset = (center_offset - (2.0f * x) - w) / w; - float y_scale = flip ? 2.0f / h : 2.0f / -h; - float y_offset = flip - ? (center_offset - (2.0f * y) - h) / h - : (center_offset - (2.0f * y) - h) / -h; - bool zenable = state->fb.depth_stencil ? - (state->depth_stencil_state ? state->depth_stencil_state->desc.depth : true) : false; - float z_scale = zenable ? clip_control ? 1.0f : 2.0f : 0.0f; - float z_offset = zenable ? clip_control ? 0.0f : -1.0f : 0.0f; - const struct wined3d_matrix projection = - { - x_scale, 0.0f, 0.0f, 0.0f, - 0.0f, y_scale, 0.0f, 0.0f, - 0.0f, 0.0f, z_scale, 0.0f, - x_offset, y_offset, z_offset, 1.0f, - }; - - *mat = projection; - } - else - { - float y_scale = flip ? -1.0f : 1.0f; - float x_offset = center_offset / state->viewports[0].width; - float y_offset = flip - ? center_offset / state->viewports[0].height - : -center_offset / state->viewports[0].height; - float z_scale = clip_control ? 1.0f : 2.0f; - float z_offset = clip_control ? 0.0f : -1.0f; - const struct wined3d_matrix projection = - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, y_scale, 0.0f, 0.0f, - 0.0f, 0.0f, z_scale, 0.0f, - x_offset, y_offset, z_offset, 1.0f, - }; - - multiply_matrix(mat, &projection, &state->transforms[WINED3D_TS_PROJECTION]); - } -} - /* Setup this textures matrix according to the texture flags. */ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 7d36979b8da..693aa9efeee 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4321,7 +4321,7 @@ static inline void shader_get_position_fixup(const struct wined3d_context *conte float center_offset, x = 0.0f, y = 0.0f; unsigned int i;
- /* See get_projection_matrix() in utils.c for a discussion of the position fixup. + /* See get_projection_matrix() in glsl_shader.c for a discussion of the position fixup. * This function here also applies to d3d10+ which does not need adjustment for * integer pixel centers, but it may need the filling convention offset. */ if (context->d3d_info->wined3d_creation_flags & WINED3D_PIXEL_CENTER_INTEGER) @@ -4376,8 +4376,6 @@ static inline BOOL shader_sampler_is_shadow(const struct wined3d_shader *shader, void get_identity_matrix(struct wined3d_matrix *mat); void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat); -void get_projection_matrix(const struct wined3d_context *context, const struct wined3d_state *state, - struct wined3d_matrix *mat); void get_texture_matrix(const struct wined3d_stream_info *si, const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat); void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
From: Elizabeth Figura zfigura@codeweavers.com
We cannot get rid of the WINED3D_TS_PROJECTION state handler yet, because table fog still depends on it. --- dlls/wined3d/ffp_gl.c | 4 ++-- dlls/wined3d/glsl_shader.c | 14 +++++++------- dlls/wined3d/stateblock.c | 12 ++++++++++++ dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index 447de1b68b0..3bcd67f9c02 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -759,8 +759,8 @@ static void depth(struct wined3d_context *context, const struct wined3d_state *s } }
- if (context->stream_info.position_transformed && !isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION))) - context_apply_state(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION)); + if (context->stream_info.position_transformed) + context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PROJ; }
static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e055e88103e..977e5f1ae07 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1478,7 +1478,7 @@ static void reset_program_constant_version(struct wine_rb_entry *entry, void *co }
static void get_projection_matrix(const struct wined3d_context *context, - const struct wined3d_state *state, struct wined3d_matrix *mat) + const struct wined3d_ffp_vs_constants *constants, const struct wined3d_state *state, struct wined3d_matrix *mat) { const struct wined3d_d3d_info *d3d_info = context->d3d_info; bool clip_control, flip; @@ -1558,7 +1558,7 @@ static void get_projection_matrix(const struct wined3d_context *context, x_offset, y_offset, z_offset, 1.0f, };
- multiply_matrix(mat, &projection, &state->transforms[WINED3D_TS_PROJECTION]); + multiply_matrix(mat, &projection, &constants->projection_matrix); } }
@@ -1814,9 +1814,12 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv,
if (update_mask & WINED3D_SHADER_CONST_FFP_PROJ) { + const struct wined3d_ffp_vs_constants *constants; struct wined3d_matrix projection;
- get_projection_matrix(context, state, &projection); + constants = wined3d_buffer_load_sysmem(context->device->push_constants[WINED3D_PUSH_CONSTANTS_VS_FFP], context); + + get_projection_matrix(context, constants, state, &projection); GL_EXTCALL(glUniformMatrix4fv(prog->vs.projection_matrix_location, 1, FALSE, &projection._11)); checkGLcall("glUniformMatrix4fv"); } @@ -11922,18 +11925,15 @@ static void glsl_vertex_pipe_projection(struct wined3d_context *context, if (state->render_states[WINED3D_RS_FOGENABLE] && state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; - context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_PROJ; }
static void glsl_vertex_pipe_viewport(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION))) - glsl_vertex_pipe_projection(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION)); if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)) && state->render_states[WINED3D_RS_POINTSCALEENABLE]) context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE; - context->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP; + context->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP | WINED3D_SHADER_CONST_FFP_PROJ; }
static void glsl_vertex_pipe_pointsize(struct wined3d_context *context, diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 0618f982315..8e638033eb0 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2251,6 +2251,8 @@ static void wined3d_stateblock_invalidate_push_constants(struct wined3d_stateblo stateblock->changed.lights = 1; stateblock->changed.texture_matrices = 1; stateblock->changed.material = 1; + stateblock->changed.transforms = 1; + wined3d_bitmap_set(stateblock->changed.transform, WINED3D_TS_PROJECTION); }
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state, @@ -3334,6 +3336,16 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, changed->clipplane = wined3d_mask_from_size(WINED3D_MAX_CLIP_DISTANCES); }
+ if (idx == WINED3D_TS_PROJECTION) + { + wined3d_device_context_push_constants(context, + WINED3D_PUSH_CONSTANTS_VS_FFP, WINED3D_SHADER_CONST_FFP_PROJ, + offsetof(struct wined3d_ffp_vs_constants, projection_matrix), + sizeof(state->transforms[idx]), &state->transforms[idx]); + /* wined3d_ffp_vs_settings.ortho_fog still needs the + * device state to be set. */ + } + if (!(idx >= WINED3D_TS_TEXTURE0 && idx <= WINED3D_TS_TEXTURE7)) wined3d_device_set_transform(device, idx, &state->transforms[idx]); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 693aa9efeee..30f836f901f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2768,6 +2768,7 @@ BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size);
struct wined3d_ffp_vs_constants { + struct wined3d_matrix projection_matrix; struct wined3d_matrix texture_matrices[WINED3D_MAX_FFP_TEXTURES]; struct wined3d_material material; struct wined3d_ffp_light_constants
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/glsl_shader.c | 18 +++++++++++++----- dlls/wined3d/utils.c | 8 ++------ dlls/wined3d/wined3d_private.h | 3 +-- 3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 977e5f1ae07..7d14ba7580d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1572,7 +1572,7 @@ static void shader_glsl_ffp_vertex_normalmatrix_uniform(const struct wined3d_con if (prog->vs.normal_matrix_location == -1) return;
- get_modelview_matrix(&context_gl->c, state, 0, &mv); + get_modelview_matrix(state, 0, &mv); compute_normal_matrix(mat, context_gl->c.d3d_info->wined3d_creation_flags & WINED3D_LEGACY_FFP_LIGHTING, &mv);
GL_EXTCALL(glUniformMatrix3fv(prog->vs.normal_matrix_location, 1, FALSE, mat)); @@ -1790,7 +1790,7 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv, { struct wined3d_matrix mat;
- get_modelview_matrix(context, state, 0, &mat); + get_modelview_matrix(state, 0, &mat); GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[0], 1, FALSE, &mat._11)); checkGLcall("glUniformMatrix4fv");
@@ -1806,7 +1806,7 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv, if (prog->vs.modelview_matrix_location[i] == -1) break;
- get_modelview_matrix(context, state, i, &mat); + get_modelview_matrix(state, i, &mat); GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11)); checkGLcall("glUniformMatrix4fv"); } @@ -9258,12 +9258,20 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr { if (!settings->vertexblends) { - shader_addline(buffer, "normal = ffp_normal_matrix * ffp_attrib_normal;\n"); + if (settings->transformed) + shader_addline(buffer, "normal = ffp_attrib_normal;\n"); + else + shader_addline(buffer, "normal = ffp_normal_matrix * ffp_attrib_normal;\n"); } else { for (i = 0; i < settings->vertexblends + 1; ++i) - shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] * (mat3(ffp_modelview_matrix[%u]) * ffp_attrib_normal);\n", i, i); + { + if (settings->transformed) + shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] * ffp_attrib_normal;\n", i); + else + shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] * (mat3(ffp_modelview_matrix[%u]) * ffp_attrib_normal);\n", i, i); + } }
if (settings->normalize) diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index fb663abcb8f..c7f2f6dcd90 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5589,13 +5589,9 @@ void get_identity_matrix(struct wined3d_matrix *mat) *mat = identity; }
-void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state, - unsigned int index, struct wined3d_matrix *mat) +void get_modelview_matrix(const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat) { - if (context->stream_info.position_transformed) - get_identity_matrix(mat); - else - multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(index)]); + multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(index)]); }
/* Setup this textures matrix according to the texture flags. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 30f836f901f..7979c144a6a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4375,8 +4375,7 @@ static inline BOOL shader_sampler_is_shadow(const struct wined3d_shader *shader, }
void get_identity_matrix(struct wined3d_matrix *mat); -void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state, - unsigned int index, struct wined3d_matrix *mat); +void get_modelview_matrix(const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat); void get_texture_matrix(const struct wined3d_stream_info *si, const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat); void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/glsl_shader.c | 48 ++++++++++------------------------ dlls/wined3d/stateblock.c | 34 +++++++++++++++++++++--- dlls/wined3d/utils.c | 2 +- dlls/wined3d/wined3d_private.h | 3 ++- 4 files changed, 47 insertions(+), 40 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7d14ba7580d..78926739310 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1563,17 +1563,16 @@ static void get_projection_matrix(const struct wined3d_context *context, }
static void shader_glsl_ffp_vertex_normalmatrix_uniform(const struct wined3d_context_gl *context_gl, - const struct wined3d_state *state, struct glsl_shader_prog_link *prog) + const struct wined3d_ffp_vs_constants *constants, struct glsl_shader_prog_link *prog) { const struct wined3d_gl_info *gl_info = context_gl->gl_info; - struct wined3d_matrix mv; float mat[3 * 3];
if (prog->vs.normal_matrix_location == -1) return;
- get_modelview_matrix(state, 0, &mv); - compute_normal_matrix(mat, context_gl->c.d3d_info->wined3d_creation_flags & WINED3D_LEGACY_FFP_LIGHTING, &mv); + compute_normal_matrix(mat, context_gl->c.d3d_info->wined3d_creation_flags & WINED3D_LEGACY_FFP_LIGHTING, + &constants->modelview_matrices[0]);
GL_EXTCALL(glUniformMatrix3fv(prog->vs.normal_matrix_location, 1, FALSE, mat)); checkGLcall("glUniformMatrix3fv"); @@ -1788,26 +1787,30 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv,
if (update_mask & WINED3D_SHADER_CONST_FFP_MODELVIEW) { - struct wined3d_matrix mat; + const struct wined3d_ffp_vs_constants *constants;
- get_modelview_matrix(state, 0, &mat); - GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[0], 1, FALSE, &mat._11)); + constants = wined3d_buffer_load_sysmem(context->device->push_constants[WINED3D_PUSH_CONSTANTS_VS_FFP], context); + + GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[0], 1, + FALSE, &constants->modelview_matrices[0]._11)); checkGLcall("glUniformMatrix4fv");
- shader_glsl_ffp_vertex_normalmatrix_uniform(context_gl, state, prog); + shader_glsl_ffp_vertex_normalmatrix_uniform(context_gl, constants, prog); }
if (update_mask & WINED3D_SHADER_CONST_FFP_VERTEXBLEND) { - struct wined3d_matrix mat; + const struct wined3d_ffp_vs_constants *constants; + + constants = wined3d_buffer_load_sysmem(context->device->push_constants[WINED3D_PUSH_CONSTANTS_VS_FFP], context);
for (i = 1; i < MAX_VERTEX_BLENDS; ++i) { if (prog->vs.modelview_matrix_location[i] == -1) break;
- get_modelview_matrix(state, i, &mat); - GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11)); + GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], + 1, FALSE, &constants->modelview_matrices[i]._11)); checkGLcall("glUniformMatrix4fv"); } } @@ -11908,24 +11911,6 @@ static void glsl_vertex_pipe_pixel_shader(struct wined3d_context *context, context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; }
-static void glsl_vertex_pipe_world(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW; -} - -static void glsl_vertex_pipe_vertexblend(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_VERTEXBLEND; -} - -static void glsl_vertex_pipe_view(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) -{ - context->constant_update_mask |= WINED3D_SHADER_CONST_FFP_MODELVIEW - | WINED3D_SHADER_CONST_FFP_VERTEXBLEND; -} - static void glsl_vertex_pipe_projection(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -12015,12 +12000,7 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = /* Viewport */ {STATE_VIEWPORT, {STATE_VIEWPORT, glsl_vertex_pipe_viewport}, WINED3D_GL_EXT_NONE }, /* Transform states */ - {STATE_TRANSFORM(WINED3D_TS_VIEW), {STATE_TRANSFORM(WINED3D_TS_VIEW), glsl_vertex_pipe_view }, WINED3D_GL_EXT_NONE }, {STATE_TRANSFORM(WINED3D_TS_PROJECTION), {STATE_TRANSFORM(WINED3D_TS_PROJECTION), glsl_vertex_pipe_projection}, WINED3D_GL_EXT_NONE }, - {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)), glsl_vertex_pipe_world }, WINED3D_GL_EXT_NONE }, - {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(1)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(1)), glsl_vertex_pipe_vertexblend }, WINED3D_GL_EXT_NONE }, - {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(2)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(2)), glsl_vertex_pipe_vertexblend }, WINED3D_GL_EXT_NONE }, - {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(3)), {STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(3)), glsl_vertex_pipe_vertexblend }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXCOORD_INDEX), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXCOORD_INDEX), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXCOORD_INDEX), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), NULL }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 8e638033eb0..d32e95e98fa 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -62,6 +62,7 @@ struct wined3d_saved_states * translation from stateblock formats to wined3d_state formats. */ uint32_t ffp_ps_constants : 1; uint32_t texture_matrices : 1; + uint32_t modelview_matrices : 1; };
struct stage_state @@ -1580,6 +1581,10 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb stateblock->changed.ffp_ps_constants = 1; break;
+ case WINED3D_RS_VERTEXBLEND: + stateblock->changed.modelview_matrices = 1; + break; + default: break; } @@ -1673,6 +1678,8 @@ void CDECL wined3d_stateblock_set_transform(struct wined3d_stateblock *statebloc
if (d3dts >= WINED3D_TS_TEXTURE0 && d3dts <= WINED3D_TS_TEXTURE7) stateblock->changed.texture_matrices = 1; + else if (d3dts == WINED3D_TS_VIEW || d3dts >= WINED3D_TS_WORLD) + stateblock->changed.modelview_matrices = 1; }
void CDECL wined3d_stateblock_multiply_transform(struct wined3d_stateblock *stateblock, @@ -2252,7 +2259,8 @@ static void wined3d_stateblock_invalidate_push_constants(struct wined3d_stateblo stateblock->changed.texture_matrices = 1; stateblock->changed.material = 1; stateblock->changed.transforms = 1; - wined3d_bitmap_set(stateblock->changed.transform, WINED3D_TS_PROJECTION); + memset(stateblock->changed.transform, 0xff, sizeof(stateblock->changed.transform)); + stateblock->changed.modelview_matrices = 1; }
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state, @@ -3344,10 +3352,8 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, sizeof(state->transforms[idx]), &state->transforms[idx]); /* wined3d_ffp_vs_settings.ortho_fog still needs the * device state to be set. */ - } - - if (!(idx >= WINED3D_TS_TEXTURE0 && idx <= WINED3D_TS_TEXTURE7)) wined3d_device_set_transform(device, idx, &state->transforms[idx]); + } } }
@@ -3522,6 +3528,26 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, offsetof(struct wined3d_ffp_vs_constants, light), sizeof(constants), &constants); }
+ if (changed->modelview_matrices) + { + struct wined3d_matrix matrices[MAX_VERTEX_BLENDS]; + + get_modelview_matrix(state, 0, &matrices[0]); + wined3d_device_context_push_constants(context, + WINED3D_PUSH_CONSTANTS_VS_FFP, WINED3D_SHADER_CONST_FFP_MODELVIEW, + offsetof(struct wined3d_ffp_vs_constants, modelview_matrices[0]), sizeof(matrices[0]), &matrices[0]); + + if (state->rs[WINED3D_RS_VERTEXBLEND]) + { + for (i = 1; i < MAX_VERTEX_BLENDS; ++i) + get_modelview_matrix(state, i, &matrices[i]); + wined3d_device_context_push_constants(context, + WINED3D_PUSH_CONSTANTS_VS_FFP, WINED3D_SHADER_CONST_FFP_VERTEXBLEND, + offsetof(struct wined3d_ffp_vs_constants, modelview_matrices[1]), + sizeof(matrices) - sizeof(matrices[0]), &matrices[1]); + } + } + if (changed->texture_matrices) { struct wined3d_ffp_vs_constants constants; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index c7f2f6dcd90..20e7fd05e2c 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5589,7 +5589,7 @@ void get_identity_matrix(struct wined3d_matrix *mat) *mat = identity; }
-void get_modelview_matrix(const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat) +void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned int index, struct wined3d_matrix *mat) { multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(index)]); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 7979c144a6a..191894bf95a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2768,6 +2768,7 @@ BOOL wined3d_get_app_name(char *app_name, unsigned int app_name_size);
struct wined3d_ffp_vs_constants { + struct wined3d_matrix modelview_matrices[MAX_VERTEX_BLENDS]; struct wined3d_matrix projection_matrix; struct wined3d_matrix texture_matrices[WINED3D_MAX_FFP_TEXTURES]; struct wined3d_material material; @@ -4375,7 +4376,7 @@ static inline BOOL shader_sampler_is_shadow(const struct wined3d_shader *shader, }
void get_identity_matrix(struct wined3d_matrix *mat); -void get_modelview_matrix(const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat); +void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned int index, struct wined3d_matrix *mat); void get_texture_matrix(const struct wined3d_stream_info *si, const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat); void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147266
Your paranoid android.
=== debian11b (64 bit WoW report) ===
Report validation errors: mshtml:script crashed (c0000005)
This merge request was approved by Jan Sikorski.