Module: wine Branch: master Commit: db63c8be29fdadf95e4ce2788f5b39e58b0cfe86 URL: https://gitlab.winehq.org/wine/wine/-/commit/db63c8be29fdadf95e4ce2788f5b39e...
Author: Elizabeth Figura zfigura@codeweavers.com Date: Fri May 3 16:42:42 2024 -0500
wined3d: Just check the vertex declaration for point size usage.
Do not check the stream info. In practice, this amounts to a difference if the usage is included in the vertex declaration but the corresponding stream is not bound. The just-added tests show that in this case it is correct to use per-vertex point size with a default size of one, rather than treating this case as equivalent to if the usage was not specified in the vertex declaration.
---
dlls/d3d9/tests/visual.c | 19 ++++++++----------- dlls/wined3d/glsl_shader.c | 3 ++- dlls/wined3d/utils.c | 5 +++-- dlls/wined3d/vertexdeclaration.c | 4 +++- dlls/wined3d/wined3d_private.h | 3 ++- 5 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index d1020339db0..4b8a7a994b3 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -12332,17 +12332,14 @@ static void test_pointsize(void) ok(color != 0xff00ffff, "Got unexpected color 0x%08x at (64, 64).\n", color); }
- todo_wine_if (j == 10 || (j == 11 && i == 10)) - { - color = get_readback_color(&rb, 63, 64); - ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (63, 64).\n", color); - color = get_readback_color(&rb, 65, 64); - ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (65, 64).\n", color); - color = get_readback_color(&rb, 64, 63); - ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (64, 63).\n", color); - color = get_readback_color(&rb, 64, 65); - ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (64, 65).\n", color); - } + color = get_readback_color(&rb, 63, 64); + ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (63, 64).\n", color); + color = get_readback_color(&rb, 65, 64); + ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (65, 64).\n", color); + color = get_readback_color(&rb, 64, 63); + ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (64, 63).\n", color); + color = get_readback_color(&rb, 64, 65); + ok(color == 0xff00ffff, "Got unexpected color 0x%08x at (64, 65).\n", color); } else { diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 463dbf47fd6..ae618266d79 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11756,15 +11756,16 @@ static void glsl_vertex_pipe_shader(struct wined3d_context *context, static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { + const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration; struct wined3d_context_gl *context_gl = wined3d_context_gl(context); const struct wined3d_gl_info *gl_info = context_gl->gl_info; BOOL specular = !!(context->stream_info.use_map & (1u << WINED3D_FFP_SPECULAR)); - BOOL point_size = !!(context->stream_info.use_map & (1u << WINED3D_FFP_PSIZE)); BOOL diffuse = !!(context->stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE)); BOOL normal = !!(context->stream_info.use_map & (1u << WINED3D_FFP_NORMAL)); const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info); BOOL transformed = context->stream_info.position_transformed; BOOL wasrhw = context->last_was_rhw; + bool point_size = vdecl->point_size; unsigned int i;
context->last_was_rhw = transformed; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index a1c5a00d51f..98b58cbeb06 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6566,6 +6566,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings) { enum wined3d_material_color_source diffuse_source, emissive_source, ambient_source, specular_source; + const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration; const struct wined3d_stream_info *si = &context->stream_info; const struct wined3d_d3d_info *d3d_info = context->d3d_info; unsigned int coord_idx, i; @@ -6576,7 +6577,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, { settings->transformed = 1; settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST; - settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE); + settings->per_vertex_point_size = vdecl->point_size; 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) @@ -6625,7 +6626,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER]; settings->specular_enable = !!state->render_states[WINED3D_RS_SPECULARENABLE]; settings->point_size = state->primitive_type == WINED3D_PT_POINTLIST; - settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE); + settings->per_vertex_point_size = vdecl->point_size;
wined3d_get_material_colour_source(&diffuse_source, &emissive_source, &ambient_source, &specular_source, state, si); diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index c48c621bd11..d86b6afc41c 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -219,7 +219,9 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara alignment = 4;
if (e->usage == WINED3D_DECL_USAGE_POSITIONT) - declaration->position_transformed = TRUE; + declaration->position_transformed = true; + else if (e->usage == WINED3D_DECL_USAGE_PSIZE) + declaration->point_size = true;
/* Find the streams used in the declaration. The vertex buffers have * to be loaded when drawing, but filter tessellation pseudo streams. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 85badd3b2c3..ff192c1b3f4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3491,7 +3491,8 @@ struct wined3d_vertex_declaration struct wined3d_vertex_declaration_element *elements; unsigned int element_count;
- BOOL position_transformed; + bool position_transformed; + bool point_size; };
bool wined3d_light_state_enable_light(struct wined3d_light_state *state, const struct wined3d_d3d_info *d3d_info,