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 {