From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/cs.c | 2 +- dlls/wined3d/ffp_gl.c | 3 +-- dlls/wined3d/glsl_shader.c | 7 ------- dlls/wined3d/shader.c | 2 +- dlls/wined3d/stateblock.c | 3 +++ dlls/wined3d/utils.c | 4 ++-- dlls/wined3d/wined3d_private.h | 1 + 7 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index ee0f926e870..24852762a6a 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -1950,7 +1950,7 @@ static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *dat /* Fog behaviour depends on the projection matrix. */ if (op->state == WINED3D_TS_PROJECTION && cs->state.render_states[WINED3D_RS_FOGENABLE] - && cs->state.render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) + && cs->state.extra_vs_args.pixel_fog) device_invalidate_state(cs->c.device, STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX)); }
diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index 01146ef51fb..f6c1b96baf4 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -1530,8 +1530,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) { 1, 8}, { 11, 25}, { 27, 27}, - { 30, 34}, - { 36, 40}, + { 30, 40}, { 42, 47}, { 49, 136}, {138, 139}, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 24a3b91bb45..247f08f887c 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11809,12 +11809,6 @@ static void glsl_vertex_pipe_vp_free(struct wined3d_device *device, struct wined static void glsl_vertex_pipe_nop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) {}
-static void glsl_vertex_pipe_shader(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; -} - static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -11925,7 +11919,6 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_RENDER(WINED3D_RS_DIFFUSEMATERIALSOURCE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_EMISSIVEMATERIALSOURCE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_FOGENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), state_nop }, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), {STATE_RENDER(WINED3D_RS_FOGTABLEMODE), glsl_vertex_pipe_shader}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_FOGVERTEXMODE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_LIGHTING), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_LOCALVIEWER), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index f2e40d1b055..1236a7f6229 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2695,7 +2695,7 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3 const struct wined3d_d3d_info *d3d_info = context->d3d_info; WORD swizzle_map = context->stream_info.swizzle_map;
- if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) + if (state->extra_vs_args.pixel_fog) { if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 87ea93f4850..bf5c3a887e3 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1731,6 +1731,7 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb case WINED3D_RS_FOGTABLEMODE: stateblock->changed.ffp_vs_settings = 1; stateblock->changed.fog_constants = 1; + stateblock->changed.extra_vs_args = 1; stateblock->changed.extra_ps_args = 1; break;
@@ -3231,6 +3232,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_SRGBWRITEENABLE: case WINED3D_RS_CLIPPING: case WINED3D_RS_CLIPPLANEENABLE: + case WINED3D_RS_FOGTABLEMODE: break;
case WINED3D_RS_ANTIALIAS: @@ -3980,6 +3982,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_extra_vs_args args;
args.clip_planes = state->rs[WINED3D_RS_CLIPPING] ? state->rs[WINED3D_RS_CLIPPLANEENABLE] : 0; + args.pixel_fog = (state->rs[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE); wined3d_device_context_emit_set_extra_vs_args(context, &args); }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 67a99939e1c..e8a0a3c58ec 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6503,7 +6503,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct settings->diffuse = vdecl->diffuse; if (!state->render_states[WINED3D_RS_FOGENABLE]) settings->fog_mode = WINED3D_FFP_VS_FOG_OFF; - else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) + else if (state->extra_vs_args.pixel_fog) settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH; else settings->fog_mode = WINED3D_FFP_VS_FOG_FOGCOORD; @@ -6595,7 +6595,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
if (!state->render_states[WINED3D_RS_FOGENABLE]) settings->fog_mode = WINED3D_FFP_VS_FOG_OFF; - else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) + else if (state->extra_vs_args.pixel_fog) { settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 71e3ac7a24d..bc2076cc46b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2877,6 +2877,7 @@ enum wined3d_push_constants struct wined3d_extra_vs_args { uint8_t clip_planes; + bool pixel_fog; };
struct wined3d_extra_ps_args
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/ffp_gl.c | 2 +- dlls/wined3d/glsl_shader.c | 14 +------------- dlls/wined3d/shader.c | 2 +- dlls/wined3d/stateblock.c | 8 +++++++- dlls/wined3d/utils.c | 4 ++-- dlls/wined3d/wined3d_private.h | 1 + 6 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index f6c1b96baf4..d617f8d5194 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -1527,7 +1527,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table) } rs_holes[] = { - { 1, 8}, + { 1, 9}, { 11, 25}, { 27, 27}, { 30, 40}, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 247f08f887c..0651efaac95 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -10575,8 +10575,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, { reorder_shader_id = shader_glsl_generate_vs3_rasterizer_input_setup(priv, vshader, pshader, state->primitive_type == WINED3D_PT_POINTLIST && vshader->reg_maps.point_size, - d3d_info->emulated_flatshading - && state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT, gl_info); + d3d_info->emulated_flatshading && state->extra_vs_args.flat_shading, gl_info); TRACE("Attaching GLSL shader object %u to program %u.\n", reorder_shader_id, program_id); GL_EXTCALL(glAttachShader(program_id, reorder_shader_id)); checkGLcall("glAttachShader"); @@ -11806,9 +11805,6 @@ static void glsl_vertex_pipe_vp_free(struct wined3d_device *device, struct wined wine_rb_destroy(&priv->ffp_vertex_shaders, shader_glsl_free_ffp_vertex_shader, &ctx); }
-static void glsl_vertex_pipe_nop(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) {} - static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { @@ -11899,12 +11895,6 @@ static void glsl_vertex_pipe_pointsize(struct wined3d_context *context, context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE; }
-static void glsl_vertex_pipe_shademode(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; -} - static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = { {STATE_VDECL, {STATE_VDECL, glsl_vertex_pipe_vdecl }, WINED3D_GL_EXT_NONE }, @@ -11930,8 +11920,6 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_RENDER(WINED3D_RS_POINTSIZE), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), glsl_vertex_pipe_pointsize}, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_shademode}, WINED3D_GLSL_130 }, - {STATE_RENDER(WINED3D_RS_SHADEMODE), {STATE_RENDER(WINED3D_RS_SHADEMODE), glsl_vertex_pipe_nop }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXCOORD_INDEX), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXCOORD_INDEX), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXCOORD_INDEX), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 1236a7f6229..c6e219c94eb 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2740,7 +2740,7 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3 args->next_shader_input_count = 0; args->swizzle_map = swizzle_map; if (d3d_info->emulated_flatshading) - args->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; + args->flatshading = state->extra_vs_args.flat_shading; else args->flatshading = 0;
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index bf5c3a887e3..3560bbcaf2c 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1718,11 +1718,15 @@ void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateb case WINED3D_RS_ALPHAFUNC: case WINED3D_RS_ALPHATESTENABLE: case WINED3D_RS_POINTSPRITEENABLE: - case WINED3D_RS_SHADEMODE: case WINED3D_RS_SRGBWRITEENABLE: stateblock->changed.extra_ps_args = 1; break;
+ case WINED3D_RS_SHADEMODE: + stateblock->changed.extra_vs_args = 1; + stateblock->changed.extra_ps_args = 1; + break; + case WINED3D_RS_FOGENABLE: stateblock->changed.ffp_vs_settings = 1; stateblock->changed.extra_ps_args = 1; @@ -3233,6 +3237,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_CLIPPING: case WINED3D_RS_CLIPPLANEENABLE: case WINED3D_RS_FOGTABLEMODE: + case WINED3D_RS_SHADEMODE: break;
case WINED3D_RS_ANTIALIAS: @@ -3983,6 +3988,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
args.clip_planes = state->rs[WINED3D_RS_CLIPPING] ? state->rs[WINED3D_RS_CLIPPLANEENABLE] : 0; args.pixel_fog = (state->rs[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE); + args.flat_shading = state->rs[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; wined3d_device_context_emit_set_extra_vs_args(context, &args); }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index e8a0a3c58ec..d6adfaf59a6 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6519,7 +6519,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct settings->texcoords = wined3d_mask_from_size(WINED3D_MAX_FFP_TEXTURES);
if (d3d_info->emulated_flatshading) - settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; + settings->flatshading = state->extra_vs_args.flat_shading; else settings->flatshading = FALSE;
@@ -6613,7 +6613,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH;
if (d3d_info->emulated_flatshading) - settings->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; + settings->flatshading = state->extra_vs_args.flat_shading; else settings->flatshading = FALSE;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index bc2076cc46b..d70da4260e2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2878,6 +2878,7 @@ struct wined3d_extra_vs_args { uint8_t clip_planes; bool pixel_fog; + bool flat_shading; };
struct wined3d_extra_ps_args
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/cs.c | 35 -------------------------- dlls/wined3d/stateblock.c | 46 ---------------------------------- dlls/wined3d/wined3d_private.h | 3 --- 3 files changed, 84 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 24852762a6a..83c74c56ed0 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -118,7 +118,6 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_DEPTH_BOUNDS, WINED3D_CS_OP_SET_RENDER_STATE, WINED3D_CS_OP_SET_TEXTURE_STATE, - WINED3D_CS_OP_SET_TRANSFORM, WINED3D_CS_OP_SET_COLOR_KEY, WINED3D_CS_OP_SET_LIGHT, WINED3D_CS_OP_SET_LIGHT_ENABLE, @@ -380,13 +379,6 @@ struct wined3d_cs_set_texture_state DWORD value; };
-struct wined3d_cs_set_transform -{ - enum wined3d_cs_op opcode; - enum wined3d_transform_state state; - struct wined3d_matrix matrix; -}; - struct wined3d_cs_set_light { enum wined3d_cs_op opcode; @@ -619,7 +611,6 @@ static const char *debug_cs_op(enum wined3d_cs_op op) WINED3D_TO_STR(WINED3D_CS_OP_SET_DEPTH_BOUNDS); WINED3D_TO_STR(WINED3D_CS_OP_SET_RENDER_STATE); WINED3D_TO_STR(WINED3D_CS_OP_SET_TEXTURE_STATE); - WINED3D_TO_STR(WINED3D_CS_OP_SET_TRANSFORM); WINED3D_TO_STR(WINED3D_CS_OP_SET_COLOR_KEY); WINED3D_TO_STR(WINED3D_CS_OP_SET_LIGHT); WINED3D_TO_STR(WINED3D_CS_OP_SET_LIGHT_ENABLE); @@ -1942,31 +1933,6 @@ void wined3d_device_context_emit_set_texture_state(struct wined3d_device_context wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); }
-static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) -{ - const struct wined3d_cs_set_transform *op = data; - - cs->state.transforms[op->state] = op->matrix; - /* Fog behaviour depends on the projection matrix. */ - if (op->state == WINED3D_TS_PROJECTION - && cs->state.render_states[WINED3D_RS_FOGENABLE] - && cs->state.extra_vs_args.pixel_fog) - device_invalidate_state(cs->c.device, STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX)); -} - -void wined3d_device_context_emit_set_transform(struct wined3d_device_context *context, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix) -{ - struct wined3d_cs_set_transform *op; - - op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); - op->opcode = WINED3D_CS_OP_SET_TRANSFORM; - op->state = state; - op->matrix = *matrix; - - wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); -} - static void wined3d_cs_exec_set_color_key(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_color_key *op = data; @@ -3060,7 +3026,6 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_DEPTH_BOUNDS */ wined3d_cs_exec_set_depth_bounds, /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state, /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state, - /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform, /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, /* WINED3D_CS_OP_SET_LIGHT */ wined3d_cs_exec_set_light, /* WINED3D_CS_OP_SET_LIGHT_ENABLE */ wined3d_cs_exec_set_light_enable, diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 97e865a4926..f4122a968be 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2327,21 +2327,12 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d state->primitive_type = WINED3D_PT_UNDEFINED; state->patch_vertex_count = 0;
- /* Set some of the defaults for lights, transforms etc */ - state->transforms[WINED3D_TS_PROJECTION] = identity; - state->transforms[WINED3D_TS_VIEW] = identity; - for (i = 0; i < 256; ++i) - { - state->transforms[WINED3D_TS_WORLD_MATRIX(i)] = identity; - } - init_default_render_states(state->render_states, d3d_info);
/* Texture Stage States - Put directly into state block, we will call function below */ for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i) { TRACE("Setting up default texture states for texture Stage %u.\n", i); - state->transforms[WINED3D_TS_TEXTURE0 + i] = identity; init_default_texture_state(i, state->texture_states[i]); }
@@ -2837,31 +2828,6 @@ static void wined3d_device_set_texture(struct wined3d_device *device, return; }
-static void wined3d_device_set_transform(struct wined3d_device *device, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix) -{ - TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); - TRACE("%.8e %.8e %.8e %.8e\n", matrix->_11, matrix->_12, matrix->_13, matrix->_14); - TRACE("%.8e %.8e %.8e %.8e\n", matrix->_21, matrix->_22, matrix->_23, matrix->_24); - TRACE("%.8e %.8e %.8e %.8e\n", matrix->_31, matrix->_32, matrix->_33, matrix->_34); - TRACE("%.8e %.8e %.8e %.8e\n", matrix->_41, matrix->_42, matrix->_43, matrix->_44); - - /* If the new matrix is the same as the current one, - * we cut off any further processing. this seems to be a reasonable - * optimization because as was noticed, some apps (warcraft3 for example) - * tend towards setting the same matrix repeatedly for some reason. - * - * From here on we assume that the new matrix is different, wherever it matters. */ - if (!memcmp(&device->cs->c.state->transforms[state], matrix, sizeof(*matrix))) - { - TRACE("The application is setting the same matrix over again.\n"); - return; - } - - device->cs->c.state->transforms[state] = *matrix; - wined3d_device_context_emit_set_transform(&device->cs->c, state, matrix); -} - static enum wined3d_texture_address get_texture_address_mode(const struct wined3d_texture *texture, enum wined3d_texture_address t) { @@ -3688,13 +3654,6 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, 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(matrix), &matrix); } - - if (wined3d_bitmap_is_set(changed->transform, WINED3D_TS_PROJECTION)) - { - /* wined3d_ffp_vs_settings.ortho_fog still needs the - * device state to be set. */ - wined3d_device_set_transform(device, WINED3D_TS_PROJECTION, &state->transforms[WINED3D_TS_PROJECTION]); - } } else if (changed->transforms) { @@ -3705,15 +3664,10 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, }
if (wined3d_bitmap_is_set(changed->transform, WINED3D_TS_PROJECTION) || changed->position_transformed) - { 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[WINED3D_TS_PROJECTION]), &state->transforms[WINED3D_TS_PROJECTION]); - /* wined3d_ffp_vs_settings.ortho_fog and vs_compile_args.ortho_fog - * still need the device state to be set. */ - wined3d_device_set_transform(device, WINED3D_TS_PROJECTION, &state->transforms[WINED3D_TS_PROJECTION]); - }
/* Clip planes are affected by the view matrix. */ changed->clipplane = wined3d_mask_from_size(WINED3D_MAX_CLIP_DISTANCES); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f0dd1884838..5e74a216c5c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2980,7 +2980,6 @@ struct wined3d_state
uint32_t texture_states[WINED3D_MAX_FFP_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
- struct wined3d_matrix transforms[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; struct wined3d_viewport viewports[WINED3D_MAX_VIEWPORTS]; unsigned int viewport_count; RECT scissor_rects[WINED3D_MAX_VIEWPORTS]; @@ -3821,8 +3820,6 @@ void wined3d_device_context_emit_set_texture(struct wined3d_device_context *cont struct wined3d_shader_resource_view *view); void wined3d_device_context_emit_set_texture_state(struct wined3d_device_context *context, unsigned int stage, enum wined3d_texture_stage_state state, unsigned int value); -void wined3d_device_context_emit_set_transform(struct wined3d_device_context *context, - enum wined3d_transform_state state, const struct wined3d_matrix *matrix); void wined3d_device_context_emit_set_unordered_access_views(struct wined3d_device_context *context, enum wined3d_pipeline pipeline, unsigned int start_idx, unsigned int count, struct wined3d_unordered_access_view *const *views, const unsigned int *initial_count);
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/shader.c | 5 +---- dlls/wined3d/stateblock.c | 5 +++++ dlls/wined3d/utils.c | 7 +------ dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index c6e219c94eb..4e1c443ff35 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2697,10 +2697,7 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3
if (state->extra_vs_args.pixel_fog) { - if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f - && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f - && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f - && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f) + if (state->extra_vs_args.ortho_fog) { /* Fog source is vertex output Z. * diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 3560bbcaf2c..97e865a4926 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1900,6 +1900,9 @@ void CDECL wined3d_stateblock_set_transform(struct wined3d_stateblock *statebloc stateblock->changed.texture_matrices = 1; else if (d3dts == WINED3D_TS_VIEW || d3dts >= WINED3D_TS_WORLD) stateblock->changed.modelview_matrices = 1; + else if (d3dts == WINED3D_TS_PROJECTION + && stateblock->stateblock_state.rs[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) + stateblock->changed.extra_vs_args = 1; /* For ortho_fog. */ }
void CDECL wined3d_stateblock_multiply_transform(struct wined3d_stateblock *stateblock, @@ -3984,11 +3987,13 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
if (changed->extra_vs_args) { + const struct wined3d_matrix *proj = &state->transforms[WINED3D_TS_PROJECTION]; struct wined3d_extra_vs_args args;
args.clip_planes = state->rs[WINED3D_RS_CLIPPING] ? state->rs[WINED3D_RS_CLIPPLANEENABLE] : 0; args.pixel_fog = (state->rs[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE); args.flat_shading = state->rs[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT; + args.ortho_fog = (proj->_14 == 0.0f && proj->_24 == 0.0f && proj->_34 == 0.0f && proj->_44 == 1.0f); wined3d_device_context_emit_set_extra_vs_args(context, &args); }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index d6adfaf59a6..92ee2eb7109 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6598,12 +6598,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct else if (state->extra_vs_args.pixel_fog) { settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH; - - if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f - && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f - && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f - && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f) - settings->ortho_fog = 1; + settings->ortho_fog = state->extra_vs_args.ortho_fog; } else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE) settings->fog_mode = WINED3D_FFP_VS_FOG_FOGCOORD; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d70da4260e2..f0dd1884838 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2879,6 +2879,7 @@ struct wined3d_extra_vs_args uint8_t clip_planes; bool pixel_fog; bool flat_shading; + bool ortho_fog; };
struct wined3d_extra_ps_args
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/ffp_gl.c | 6 ++---- dlls/wined3d/glsl_shader.c | 18 +++--------------- dlls/wined3d/shader_spirv.c | 3 --- dlls/wined3d/stateblock.c | 19 +++++++++++++++++++ dlls/wined3d/utils.c | 19 ------------------- dlls/wined3d/wined3d_private.h | 7 +++++-- 6 files changed, 29 insertions(+), 43 deletions(-)
diff --git a/dlls/wined3d/ffp_gl.c b/dlls/wined3d/ffp_gl.c index d617f8d5194..04c6310013c 100644 --- a/dlls/wined3d/ffp_gl.c +++ b/dlls/wined3d/ffp_gl.c @@ -1536,10 +1536,8 @@ static void validate_state_table(struct wined3d_state_entry *state_table) {138, 139}, {144, 144}, {149, 150}, - {152, 153}, - {156, 160}, - {162, 165}, - {167, 209}, + {152, 160}, + {162, 209}, { 0, 0}, }; static const unsigned int simple_states[] = diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 0651efaac95..93abadc6f6b 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1660,19 +1660,16 @@ static void shader_glsl_pointsize_uniform(struct wined3d_context_gl *context_gl, { const struct wined3d_gl_info *gl_info = context_gl->gl_info; const struct wined3d_ffp_vs_constants *constants; - float min, max;
constants = wined3d_buffer_load_sysmem( context_gl->c.device->push_constants[WINED3D_PUSH_CONSTANTS_VS_FFP], &context_gl->c);
- get_pointsize_minmax(&context_gl->c, state, &min, &max); - - GL_EXTCALL(glUniform1f(prog->vs.pointsize_min_location, min)); + GL_EXTCALL(glUniform1f(prog->vs.pointsize_min_location, constants->point_clamp.min)); checkGLcall("glUniform1f"); - GL_EXTCALL(glUniform1f(prog->vs.pointsize_max_location, max)); + GL_EXTCALL(glUniform1f(prog->vs.pointsize_max_location, constants->point_clamp.max)); checkGLcall("glUniform1f");
- GL_EXTCALL(glUniform1f(prog->vs.pointsize_location, int_to_float(state->render_states[WINED3D_RS_POINTSIZE]))); + GL_EXTCALL(glUniform1f(prog->vs.pointsize_location, constants->point.size)); checkGLcall("glUniform1f"); GL_EXTCALL(glUniform1f(prog->vs.pointsize_c_att_location, constants->point.scale_const)); checkGLcall("glUniform1f"); @@ -11889,12 +11886,6 @@ static void glsl_vertex_pipe_viewport(struct wined3d_context *context, context->constant_update_mask |= WINED3D_SHADER_CONST_POS_FIXUP | WINED3D_SHADER_CONST_FFP_PROJ; }
-static void glsl_vertex_pipe_pointsize(struct wined3d_context *context, - const struct wined3d_state *state, DWORD state_id) -{ - context->constant_update_mask |= WINED3D_SHADER_CONST_VS_POINTSIZE; -} - static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = { {STATE_VDECL, {STATE_VDECL, glsl_vertex_pipe_vdecl }, WINED3D_GL_EXT_NONE }, @@ -11917,9 +11908,6 @@ static const struct wined3d_state_entry_template glsl_vertex_pipe_vp_states[] = {STATE_RENDER(WINED3D_RS_SPECULARENABLE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_SPECULARMATERIALSOURCE), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3D_RS_VERTEXBLEND), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_POINTSIZE), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), glsl_vertex_pipe_pointsize}, WINED3D_GL_EXT_NONE }, - {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXCOORD_INDEX), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXCOORD_INDEX), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(2, WINED3D_TSS_TEXCOORD_INDEX), {STATE_RENDER(WINED3D_RS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index 5c84e2b1bfd..f67e5e79338 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -1217,9 +1217,6 @@ static void spirv_vertex_pipe_vk_vp_free(struct wined3d_device *device, struct w
static const struct wined3d_state_entry_template spirv_vertex_pipe_vk_vp_states[] = { - {STATE_RENDER(WINED3D_RS_POINTSIZE), {STATE_RENDER(WINED3D_RS_POINTSIZE), state_nop}}, - {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), {STATE_RENDER(WINED3D_RS_POINTSIZE_MIN), state_nop}}, - {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), {STATE_RENDER(WINED3D_RS_POINTSIZE_MAX), state_nop}}, {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), {STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX), state_nop}}, {0}, /* Terminate */ }; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index f4122a968be..95a4a4c05ec 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -70,6 +70,7 @@ struct wined3d_saved_states uint32_t position_transformed : 1; uint32_t bumpenv_constants : 1; uint32_t fog_constants : 1; + uint32_t point_size_constants : 1; uint32_t extra_vs_args : 1; uint32_t extra_ps_args : 1; }; @@ -331,6 +332,7 @@ void CDECL wined3d_stateblock_primary_dirtify_all_states(struct wined3d_device * states->position_transformed = 1; states->bumpenv_constants = 1; states->fog_constants = 1; + states->point_size_constants = 1; states->extra_vs_args = 1; states->extra_ps_args = 1;
@@ -2486,6 +2488,8 @@ static void wined3d_stateblock_invalidate_initial_states(struct wined3d_stateblo stateblock->changed.ffp_ps_settings = 1; stateblock->changed.bumpenv_constants = 1; stateblock->changed.fog_constants = 1; + wined3d_bitmap_set_bits(stateblock->changed.renderState, WINED3D_RS_POINTSIZE_MAX, 1); + wined3d_bitmap_set_bits(stateblock->changed.renderState, WINED3D_RS_POINTSIZE_MIN, 1); }
static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const struct wined3d_stateblock *device_state, @@ -3207,6 +3211,8 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, case WINED3D_RS_CLIPPLANEENABLE: case WINED3D_RS_FOGTABLEMODE: case WINED3D_RS_SHADEMODE: + case WINED3D_RS_POINTSIZE_MAX: + case WINED3D_RS_POINTSIZE_MIN: break;
case WINED3D_RS_ANTIALIAS: @@ -3904,6 +3910,19 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, offsetof(struct wined3d_ffp_vs_constants, point), sizeof(constants), &constants); }
+ if (wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_POINTSIZE_MIN) + || wined3d_bitmap_is_set(changed->renderState, WINED3D_RS_POINTSIZE_MAX)) + { + struct wined3d_ffp_point_clamp_constants constants; + + constants.min = int_to_float(state->rs[WINED3D_RS_POINTSIZE_MIN]); + constants.max = int_to_float(state->rs[WINED3D_RS_POINTSIZE_MAX]); + if (constants.min > constants.max) + constants.min = constants.max; + wined3d_device_context_push_constants(context, WINED3D_PUSH_CONSTANTS_VS_FFP, WINED3D_SHADER_CONST_VS_POINTSIZE, + offsetof(struct wined3d_ffp_vs_constants, point_clamp), sizeof(constants), &constants); + } + if (changed->bumpenv_constants) { struct wined3d_ffp_bumpenv_constants constants; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 92ee2eb7109..cf30ae288d2 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5765,25 +5765,6 @@ void get_texture_matrix(const struct wined3d_stateblock_state *state, generated, get_texcoord_format(state->vertex_declaration, coord_idx), mat); }
-void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state, - float *out_min, float *out_max) -{ - union - { - DWORD d; - float f; - } min, max; - - min.d = state->render_states[WINED3D_RS_POINTSIZE_MIN]; - max.d = state->render_states[WINED3D_RS_POINTSIZE_MAX]; - - if (min.f > max.f) - min.f = max.f; - - *out_min = min.f; - *out_max = max.f; -} - static BOOL wined3d_get_primary_display(WCHAR *display) { DISPLAY_DEVICEW display_device; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5e74a216c5c..2fcb1cd9241 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2819,6 +2819,11 @@ struct wined3d_ffp_vs_constants
/* States not used by the HLSL pipeline. */ struct wined3d_vec4 clip_planes[WINED3D_MAX_CLIP_DISTANCES]; + struct wined3d_ffp_point_clamp_constants + { + float min, max; + } point_clamp; + float padding2[2]; /* Align to 16-bytes. */ };
struct wined3d_ffp_ps_constants @@ -4490,8 +4495,6 @@ void get_identity_matrix(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_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, - float *out_min, float *out_max);
struct wined3d_palette {
This merge request was approved by Jan Sikorski.