Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/glsl_shader.c | 12 ++++++------ dlls/wined3d/stateblock.c | 2 +- dlls/wined3d/utils.c | 2 +- dlls/wined3d/wined3d_private.h | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 2e87e5ff85..1a24a662e8 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -181,7 +181,7 @@ struct glsl_vs_program GLint q_att; GLint cos_htheta; GLint cos_hphi; - } light_location[MAX_ACTIVE_LIGHTS]; + } light_location[WINED3D_MAX_ACTIVE_LIGHTS]; GLint pointsize_location; GLint pointsize_min_location; GLint pointsize_max_location; @@ -1892,7 +1892,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context DWORD directional_count = 0; DWORD parallel_point_count = 0;
- for (i = 0; i < MAX_ACTIVE_LIGHTS; ++i) + for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i) { if (!state->light_state.lights[i]) continue; @@ -1922,7 +1922,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context parallel_point_idx = directional_idx + directional_count;
shader_glsl_ffp_vertex_lightambient_uniform(context, state, prog); - for (i = 0; i < MAX_ACTIVE_LIGHTS; ++i) + for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i) { const struct wined3d_light_info *light_info = state->light_state.lights[i]; unsigned int idx; @@ -9185,7 +9185,7 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr shader_addline(buffer, " float q_att;\n"); shader_addline(buffer, " float cos_htheta;\n"); shader_addline(buffer, " float cos_hphi;\n"); - shader_addline(buffer, "} ffp_light[%u];\n", MAX_ACTIVE_LIGHTS); + shader_addline(buffer, "} ffp_light[%u];\n", WINED3D_MAX_ACTIVE_LIGHTS);
if (settings->point_size) { @@ -10132,7 +10132,7 @@ static void shader_glsl_init_vs_uniform_locations(const struct wined3d_gl_info * vs->material_emissive_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_material.emissive")); vs->material_shininess_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_material.shininess")); vs->light_ambient_location = GL_EXTCALL(glGetUniformLocation(program_id, "ffp_light_ambient")); - for (i = 0; i < MAX_ACTIVE_LIGHTS; ++i) + for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i) { string_buffer_sprintf(name, "ffp_light[%u].diffuse", i); vs->light_location[i].diffuse = GL_EXTCALL(glGetUniformLocation(program_id, name->buffer)); @@ -11661,7 +11661,7 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info, caps->xyzrhw = TRUE; caps->emulated_flatshading = !needs_legacy_glsl_syntax(gl_info); caps->ffp_generic_attributes = TRUE; - caps->max_active_lights = MAX_ACTIVE_LIGHTS; + caps->max_active_lights = WINED3D_MAX_ACTIVE_LIGHTS; caps->max_vertex_blend_matrices = MAX_VERTEX_BLENDS; caps->max_vertex_blend_matrix_index = 0; caps->vertex_processing_caps = WINED3DVTXPCAPS_TEXGEN diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 0194917148..50b7135fb4 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -579,7 +579,7 @@ void state_cleanup(struct wined3d_state *state) if (!(state->flags & WINED3D_STATE_NO_REF)) state_unbind_resources(state);
- for (counter = 0; counter < MAX_ACTIVE_LIGHTS; ++counter) + for (counter = 0; counter < WINED3D_MAX_ACTIVE_LIGHTS; ++counter) { state->light_state.lights[counter] = NULL; } diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index dd452409b8..062f8662aa 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6279,7 +6279,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, if (d3d_info->limits.varying_count >= wined3d_max_compat_varyings(gl_info)) settings->texcoords = (1u << WINED3D_MAX_TEXTURES) - 1;
- for (i = 0; i < MAX_ACTIVE_LIGHTS; ++i) + for (i = 0; i < WINED3D_MAX_ACTIVE_LIGHTS; ++i) { if (!state->light_state.lights[i]) continue; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5606a11c81..2fbcf1a522 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -263,7 +263,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup #define WINED3D_MAX_FRAGMENT_SAMPLERS 16 #define WINED3D_MAX_VERTEX_SAMPLERS 4 #define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS) -#define MAX_ACTIVE_LIGHTS 8 +#define WINED3D_MAX_ACTIVE_LIGHTS 8 #define MAX_CLIP_DISTANCES 8 #define MAX_CONSTANT_BUFFERS 15 #define MAX_SAMPLER_OBJECTS 16 @@ -1615,9 +1615,9 @@ enum wined3d_pipeline #define STATE_LIGHT_TYPE (STATE_VIEWPORT + 1) #define STATE_IS_LIGHT_TYPE(a) ((a) == STATE_LIGHT_TYPE) #define STATE_ACTIVELIGHT(a) (STATE_LIGHT_TYPE + 1 + (a)) -#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS)) +#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(WINED3D_MAX_ACTIVE_LIGHTS))
-#define STATE_SCISSORRECT (STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS - 1) + 1) +#define STATE_SCISSORRECT (STATE_ACTIVELIGHT(WINED3D_MAX_ACTIVE_LIGHTS - 1) + 1) #define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
#define STATE_CLIPPLANE(a) (STATE_SCISSORRECT + 1 + (a)) @@ -2898,7 +2898,7 @@ struct wined3d_light_state { /* Light hashmap. Collisions are handled using linked lists. */ struct list light_map[LIGHTMAP_SIZE]; - const struct wined3d_light_info *lights[MAX_ACTIVE_LIGHTS]; + const struct wined3d_light_info *lights[WINED3D_MAX_ACTIVE_LIGHTS]; };
#define WINED3D_STATE_NO_REF 0x00000001
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/adapter_gl.c | 2 +- dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/shader.c | 2 +- dlls/wined3d/stateblock.c | 2 +- dlls/wined3d/wined3d_private.h | 16 ++++++++-------- 5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index c75b19eae3..acfed24b53 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -2870,7 +2870,7 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info, struct gl_info->limits.arb_ps_temps = 0;
gl_info->gl_ops.gl.p_glGetIntegerv(GL_MAX_CLIP_DISTANCES, &gl_max); - gl_info->limits.user_clip_distances = min(MAX_CLIP_DISTANCES, gl_max); + gl_info->limits.user_clip_distances = min(WINED3D_MAX_CLIP_DISTANCES, gl_max); TRACE("Clip plane support - max planes %d.\n", gl_max);
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 1a24a662e8..660005f57e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -257,7 +257,7 @@ struct glsl_shader_prog_link DWORD constant_update_mask; unsigned int constant_version; DWORD shader_controlled_clip_distances : 1; - DWORD clip_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */ + DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */ DWORD padding : 23; };
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 8faae3a31e..83a793d522 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -966,7 +966,7 @@ static HRESULT shader_calculate_clip_or_cull_distance_mask( /* Clip and cull distances are packed in 4 component registers. 0 and 1 are * the only allowed semantic indices. */ - if (e->semantic_idx >= MAX_CLIP_DISTANCES / 4) + if (e->semantic_idx >= WINED3D_MAX_CLIP_DISTANCES / 4) { *mask = 0; WARN("Invalid clip/cull distance index %u.\n", e->semantic_idx); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 50b7135fb4..b8b02c8a33 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -218,7 +218,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states, stateblock_set_bits(states->renderState, WINEHIGHEST_RENDER_STATE + 1); for (i = 0; i < WINED3D_MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff; for (i = 0; i < WINED3D_MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3ffe; - states->clipplane = (1u << MAX_CLIP_DISTANCES) - 1; + states->clipplane = (1u << WINED3D_MAX_CLIP_DISTANCES) - 1; states->pixelShaderConstantsB = 0xffff; states->pixelShaderConstantsI = 0xffff; states->vertexShaderConstantsB = 0xffff; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 2fbcf1a522..07c6c6ce02 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -264,7 +264,7 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup #define WINED3D_MAX_VERTEX_SAMPLERS 4 #define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS) #define WINED3D_MAX_ACTIVE_LIGHTS 8 -#define MAX_CLIP_DISTANCES 8 +#define WINED3D_MAX_CLIP_DISTANCES 8 #define MAX_CONSTANT_BUFFERS 15 #define MAX_SAMPLER_OBJECTS 16 #define MAX_SHADER_RESOURCE_VIEWS 128 @@ -1009,8 +1009,8 @@ struct wined3d_shader_reg_maps DWORD uav_read_mask : 8; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */ DWORD uav_counter_mask : 8; /* MAX_UNORDERED_ACCESS_VIEWS, 8 */
- DWORD clip_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */ - DWORD cull_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */ + DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */ + DWORD cull_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */ DWORD usesnrm : 1; DWORD vpos : 1; DWORD usesdsx : 1; @@ -1621,9 +1621,9 @@ enum wined3d_pipeline #define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
#define STATE_CLIPPLANE(a) (STATE_SCISSORRECT + 1 + (a)) -#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(MAX_CLIP_DISTANCES - 1)) +#define STATE_IS_CLIPPLANE(a) ((a) >= STATE_CLIPPLANE(0) && (a) <= STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES - 1))
-#define STATE_MATERIAL (STATE_CLIPPLANE(MAX_CLIP_DISTANCES)) +#define STATE_MATERIAL (STATE_CLIPPLANE(WINED3D_MAX_CLIP_DISTANCES)) #define STATE_IS_MATERIAL(a) ((a) == STATE_MATERIAL)
#define STATE_RASTERIZER (STATE_MATERIAL + 1) @@ -1921,7 +1921,7 @@ struct wined3d_context DWORD transform_feedback_active : 1; DWORD transform_feedback_paused : 1; DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */ - DWORD clip_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */ + DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */ DWORD num_untracked_materials : 2; /* Max value 2 */ DWORD padding : 7;
@@ -2941,7 +2941,7 @@ struct wined3d_state DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; - struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES]; + struct wined3d_vec4 clip_planes[WINED3D_MAX_CLIP_DISTANCES]; struct wined3d_material material; struct wined3d_viewport viewports[WINED3D_MAX_VIEWPORTS]; unsigned int viewport_count; @@ -3003,7 +3003,7 @@ struct wined3d_stateblock_state DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; - struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES]; + struct wined3d_vec4 clip_planes[WINED3D_MAX_CLIP_DISTANCES]; struct wined3d_material material; struct wined3d_viewport viewport; RECT scissor_rect;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48095
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 Task: Patch failed to apply
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/device.c | 2 +- dlls/wined3d/stateblock.c | 4 ++-- dlls/wined3d/wined3d_private.h | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f4cfad4be1..f02dcdd39d 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1550,7 +1550,7 @@ void CDECL wined3d_device_multiply_transform(struct wined3d_device *device,
TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix);
- if (state > HIGHEST_TRANSFORMSTATE) + if (state > WINED3D_HIGHEST_TRANSFORM_STATE) { WARN("Unhandled transform state %#x.\n", state); return; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index b8b02c8a33..7495d217c4 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -214,7 +214,7 @@ static void stateblock_savedstates_set_all(struct wined3d_saved_states *states, states->streamSource = 0xffff; states->streamFreq = 0xffff; states->textures = 0xfffff; - stateblock_set_bits(states->transform, HIGHEST_TRANSFORMSTATE + 1); + stateblock_set_bits(states->transform, WINED3D_HIGHEST_TRANSFORM_STATE + 1); stateblock_set_bits(states->renderState, WINEHIGHEST_RENDER_STATE + 1); for (i = 0; i < WINED3D_MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff; for (i = 0; i < WINED3D_MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3ffe; @@ -300,7 +300,7 @@ void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) } }
- for (i = 0; i <= HIGHEST_TRANSFORMSTATE >> 5; ++i) + for (i = 0; i <= WINED3D_HIGHEST_TRANSFORM_STATE >> 5; ++i) { DWORD map = stateblock->changed.transform[i]; for (j = 0; map; map >>= 1, ++j) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 07c6c6ce02..7096925534 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1446,7 +1446,7 @@ static inline void wined3d_color_from_d3dcolor(struct wined3d_color *wined3d_col wined3d_color->a = D3DCOLOR_B_A(d3d_color) / 255.0f; }
-#define HIGHEST_TRANSFORMSTATE WINED3D_TS_WORLD_MATRIX(255) /* Highest value in wined3d_transform_state. */ +#define WINED3D_HIGHEST_TRANSFORM_STATE WINED3D_TS_WORLD_MATRIX(255) /* Highest value in wined3d_transform_state. */
void wined3d_check_gl_call(const struct wined3d_gl_info *gl_info, const char *file, unsigned int line, const char *name) DECLSPEC_HIDDEN; @@ -2940,7 +2940,7 @@ struct wined3d_state DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
- struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; + 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]; @@ -3002,7 +3002,7 @@ struct wined3d_stateblock_state DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
- struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; + 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 viewport; @@ -3567,7 +3567,7 @@ struct wined3d_vertex_declaration
struct wined3d_saved_states { - DWORD transform[(HIGHEST_TRANSFORMSTATE >> 5) + 1]; + DWORD transform[(WINED3D_HIGHEST_TRANSFORM_STATE >> 5) + 1]; WORD streamSource; /* WINED3D_MAX_STREAMS, 16 */ WORD streamFreq; /* WINED3D_MAX_STREAMS, 16 */ DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5) + 1]; @@ -3609,7 +3609,7 @@ struct wined3d_stateblock /* Contained state management */ DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1]; unsigned int num_contained_render_states; - DWORD contained_transform_states[HIGHEST_TRANSFORMSTATE + 1]; + DWORD contained_transform_states[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; unsigned int num_contained_transform_states; DWORD contained_vs_consts_i[WINED3D_MAX_CONSTS_I]; unsigned int num_contained_vs_consts_i;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48096
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 Task: Patch failed to apply
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
And hold it locally in d3d[789].
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d8/d3d8_private.h | 5 +++-- dlls/d3d8/device.c | 13 ++++++++----- dlls/d3d9/d3d9_private.h | 5 +++-- dlls/d3d9/device.c | 20 ++++++++++++-------- dlls/ddraw/ddraw_private.h | 2 ++ dlls/ddraw/device.c | 11 +++++++++-- dlls/wined3d/device.c | 30 ++++++++++++++++-------------- dlls/wined3d/wined3d.spec | 4 ++-- include/wine/wined3d.h | 4 ++-- 9 files changed, 57 insertions(+), 37 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 7c44f07c5e..888a643582 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -126,12 +126,13 @@ struct d3d8_device DWORD sysmem_vb : 16; /* D3D8_MAX_STREAMS */ DWORD sysmem_ib : 1; DWORD in_destruction : 1; - DWORD recording : 1; - DWORD padding : 13; + DWORD padding : 14;
/* The d3d8 API supports only one implicit swapchain (no D3DCREATE_ADAPTERGROUP_DEVICE, * no GetSwapchain, GetBackBuffer doesn't accept a swapchain number). */ struct d3d8_swapchain *implicit_swapchain; + + struct wined3d_stateblock *recording; };
HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter, diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index d367f4200c..abb6ae3e02 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -907,7 +907,8 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, if (SUCCEEDED(hr = wined3d_device_reset(device->wined3d_device, &swapchain_desc, NULL, reset_enum_callback, TRUE))) { - device->recording = FALSE; + wined3d_stateblock_decref(device->recording); + device->recording = NULL; present_parameters->BackBufferCount = swapchain_desc.backbuffer_count; device->implicit_swapchain->swap_interval = wined3dswapinterval_from_d3d(present_parameters->FullScreen_PresentationInterval); @@ -1857,13 +1858,14 @@ static HRESULT WINAPI d3d8_device_GetRenderState(IDirect3DDevice8 *iface, static HRESULT WINAPI d3d8_device_BeginStateBlock(IDirect3DDevice8 *iface) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); + struct wined3d_stateblock *stateblock; HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device))) - device->recording = TRUE; + if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + device->recording = stateblock; wined3d_mutex_unlock();
return hr; @@ -1881,14 +1883,15 @@ static HRESULT WINAPI d3d8_device_EndStateBlock(IDirect3DDevice8 *iface, DWORD * * of memory later and cause locking problems) */ wined3d_mutex_lock(); - hr = wined3d_device_end_stateblock(device->wined3d_device, &stateblock); + hr = wined3d_device_end_stateblock(device->wined3d_device); if (FAILED(hr)) { WARN("Failed to end the state block, %#x.\n", hr); wined3d_mutex_unlock(); return hr; } - device->recording = FALSE; + stateblock = device->recording; + device->recording = NULL;
*token = d3d8_allocate_handle(&device->handle_table, stateblock, D3D8_HANDLE_SB); wined3d_mutex_unlock(); diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 3fe0376e5c..2c959057e7 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -108,8 +108,7 @@ struct d3d9_device DWORD in_destruction : 1; DWORD in_scene : 1; DWORD has_vertex_declaration : 1; - DWORD recording : 1; - DWORD padding : 11; + DWORD padding : 12;
DWORD auto_mipmaps; /* D3D9_MAX_TEXTURE_UNITS */
@@ -117,6 +116,8 @@ struct d3d9_device
UINT implicit_swapchain_count; struct d3d9_swapchain **implicit_swapchains; + + struct wined3d_stateblock *recording; };
HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wined3d *wined3d, diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 6cc3f180b0..1edfa375ca 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -990,7 +990,8 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
if (!extended) { - device->recording = FALSE; + wined3d_stateblock_decref(device->recording); + device->recording = NULL; device->auto_mipmaps = 0; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); @@ -2333,13 +2334,14 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface, static HRESULT WINAPI d3d9_device_BeginStateBlock(IDirect3DDevice9Ex *iface) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_stateblock *stateblock; HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device))) - device->recording = TRUE; + if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + device->recording = stateblock; wined3d_mutex_unlock();
return hr; @@ -2355,14 +2357,16 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire TRACE("iface %p, stateblock %p.\n", iface, stateblock);
wined3d_mutex_lock(); - hr = wined3d_device_end_stateblock(device->wined3d_device, &wined3d_stateblock); - wined3d_mutex_unlock(); + hr = wined3d_device_end_stateblock(device->wined3d_device); if (FAILED(hr)) { - WARN("Failed to end the state block, hr %#x.\n", hr); - return hr; + wined3d_mutex_unlock(); + WARN("Failed to end the stateblock, hr %#x.\n", hr); + return hr; } - device->recording = FALSE; + wined3d_stateblock = device->recording; + device->recording = NULL; + wined3d_mutex_unlock();
if (!(object = heap_alloc_zero(sizeof(*object)))) { diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 77e2866272..cb63e197fc 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -346,6 +346,8 @@ struct d3d_device D3DMATRIXHANDLE world, proj, view;
struct wined3d_vec4 user_clip_planes[D3DMAXUSERCLIPPLANES]; + + struct wined3d_stateblock *recording; };
HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface, diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index d2f11c1dab..c9b7dc93e4 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -5643,14 +5643,18 @@ static HRESULT WINAPI d3d_device7_GetLight_FPUPreserve(IDirect3DDevice7 *iface, static HRESULT d3d_device7_BeginStateBlock(IDirect3DDevice7 *iface) { struct d3d_device *device = impl_from_IDirect3DDevice7(iface); + struct wined3d_stateblock *stateblock; HRESULT hr;
TRACE("iface %p.\n", iface);
wined3d_mutex_lock(); - hr = wined3d_device_begin_stateblock(device->wined3d_device); + hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock); wined3d_mutex_unlock();
+ if (SUCCEEDED(hr)) + device->recording = stateblock; + return hr_ddraw_from_wined3d(hr); }
@@ -5701,7 +5705,7 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl
wined3d_mutex_lock();
- hr = wined3d_device_end_stateblock(device->wined3d_device, &wined3d_sb); + hr = wined3d_device_end_stateblock(device->wined3d_device); if (FAILED(hr)) { WARN("Failed to end stateblock, hr %#x.\n", hr); @@ -5710,6 +5714,9 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl return hr_ddraw_from_wined3d(hr); }
+ wined3d_sb = device->recording; + device->recording = NULL; + h = ddraw_allocate_handle(&device->handle_table, wined3d_sb, DDRAW_HANDLE_STATEBLOCK); if (h == DDRAW_INVALID_HANDLE) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f02dcdd39d..7520d43d90 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3621,49 +3621,51 @@ HRESULT CDECL wined3d_device_get_display_mode(const struct wined3d_device *devic return wined3d_swapchain_get_display_mode(swapchain, mode, rotation); }
-HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device) +HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device, + struct wined3d_stateblock **stateblock) { - struct wined3d_stateblock *stateblock; + struct wined3d_stateblock *object; HRESULT hr;
TRACE("device %p.\n", device);
if (device->recording) + { + *stateblock = NULL; return WINED3DERR_INVALIDCALL; + }
- hr = wined3d_stateblock_create(device, WINED3D_SBT_RECORDED, &stateblock); + hr = wined3d_stateblock_create(device, WINED3D_SBT_RECORDED, &object); if (FAILED(hr)) return hr;
- device->recording = stateblock; - device->update_stateblock_state = &stateblock->stateblock_state; + device->recording = object; + device->update_stateblock_state = &object->stateblock_state; + *stateblock = object;
- TRACE("Recording stateblock %p.\n", stateblock); + TRACE("Recording stateblock %p.\n", *stateblock);
return WINED3D_OK; }
-HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device, - struct wined3d_stateblock **stateblock) +HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device) { - struct wined3d_stateblock *object = device->recording; + struct wined3d_stateblock *stateblock = device->recording;
- TRACE("device %p, stateblock %p.\n", device, stateblock); + TRACE("device %p.\n", device);
if (!device->recording) { WARN("Not recording.\n"); - *stateblock = NULL; return WINED3DERR_INVALIDCALL; }
- stateblock_init_contained_states(object); + stateblock_init_contained_states(stateblock);
- *stateblock = object; device->recording = NULL; device->update_stateblock_state = &device->stateblock_state;
- TRACE("Returning stateblock %p.\n", *stateblock); + TRACE("Ending stateblock %p.\n", stateblock);
return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 75b9fe12c6..ac87f01f50 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -35,7 +35,7 @@
@ cdecl wined3d_device_acquire_focus_window(ptr ptr) @ cdecl wined3d_device_begin_scene(ptr) -@ cdecl wined3d_device_begin_stateblock(ptr) +@ cdecl wined3d_device_begin_stateblock(ptr ptr) @ cdecl wined3d_device_clear(ptr long ptr long ptr float long) @ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long) @ cdecl wined3d_device_clear_unordered_access_view_uint(ptr ptr ptr) @@ -53,7 +53,7 @@ @ cdecl wined3d_device_draw_primitive_instanced(ptr long long long long) @ cdecl wined3d_device_draw_primitive_instanced_indirect(ptr ptr long) @ cdecl wined3d_device_end_scene(ptr) -@ cdecl wined3d_device_end_stateblock(ptr ptr) +@ cdecl wined3d_device_end_stateblock(ptr) @ cdecl wined3d_device_evict_managed_resources(ptr) @ cdecl wined3d_device_get_available_texture_mem(ptr) @ cdecl wined3d_device_get_base_vertex_index(ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 07329024fe..9bd71878f0 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2223,7 +2223,7 @@ ULONG __cdecl wined3d_buffer_incref(struct wined3d_buffer *buffer);
HRESULT __cdecl wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window); HRESULT __cdecl wined3d_device_begin_scene(struct wined3d_device *device); -HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float z, DWORD stencil); HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, @@ -2259,7 +2259,7 @@ void __cdecl wined3d_device_draw_primitive_instanced(struct wined3d_device *devi void __cdecl wined3d_device_draw_primitive_instanced_indirect(struct wined3d_device *device, struct wined3d_buffer *buffer, unsigned int offset); HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); -HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); +HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device); void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); UINT __cdecl wined3d_device_get_available_texture_mem(const struct wined3d_device *device); INT __cdecl wined3d_device_get_base_vertex_index(const struct wined3d_device *device);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48097
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/d3d9_private.h | 1 + dlls/d3d9/device.c | 19 ++++- dlls/wined3d/device.c | 6 ++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 128 -------------------------------- include/wine/wined3d.h | 130 +++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 130 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 2c959057e7..7b1d04afad 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -118,6 +118,7 @@ struct d3d9_device struct d3d9_swapchain **implicit_swapchains;
struct wined3d_stateblock *recording; + struct wined3d_stateblock_state *update_state; };
HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wined3d *wined3d, diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 1edfa375ca..3a270a4eac 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -990,6 +990,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
if (!extended) { + device->update_state = wined3d_device_get_stateblock_state(device->wined3d_device); wined3d_stateblock_decref(device->recording); device->recording = NULL; device->auto_mipmaps = 0; @@ -2341,7 +2342,10 @@ static HRESULT WINAPI d3d9_device_BeginStateBlock(IDirect3DDevice9Ex *iface)
wined3d_mutex_lock(); if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock))) + { device->recording = stateblock; + device->update_state = &stateblock->stateblock_state; + } wined3d_mutex_unlock();
return hr; @@ -2357,6 +2361,7 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire TRACE("iface %p, stateblock %p.\n", iface, stateblock);
wined3d_mutex_lock(); + device->update_state = wined3d_device_get_stateblock_state(device->wined3d_device); hr = wined3d_device_end_stateblock(device->wined3d_device); if (FAILED(hr)) { @@ -3385,8 +3390,16 @@ static HRESULT WINAPI d3d9_device_SetVertexShader(IDirect3DDevice9Ex *iface, IDi TRACE("iface %p, shader %p.\n", iface, shader);
wined3d_mutex_lock(); - wined3d_device_set_vertex_shader(device->wined3d_device, - shader_obj ? shader_obj->wined3d_shader : NULL); + if (shader_obj) + wined3d_shader_incref(shader_obj->wined3d_shader); + if (device->update_state->vs) + wined3d_shader_decref(device->update_state->vs); + device->update_state->vs = shader_obj ? shader_obj->wined3d_shader : NULL; + if (device->recording) + device->recording->changed.vertexShader = TRUE; + else + wined3d_device_set_vertex_shader(device->wined3d_device, + shader_obj ? shader_obj->wined3d_shader : NULL); wined3d_mutex_unlock();
return D3D_OK; @@ -4470,6 +4483,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine return hr; }
+ device->update_state = wined3d_device_get_stateblock_state(device->wined3d_device); + wined3d_get_device_caps(wined3d, adapter, device_type, &caps); device->max_user_clip_planes = caps.MaxUserClipPlanes; if (flags & D3DCREATE_ADAPTERGROUP_DEVICE) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7520d43d90..029a9b4ce2 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5143,6 +5143,12 @@ HRESULT CDECL wined3d_device_set_dialog_box_mode(struct wined3d_device *device, return WINED3D_OK; }
+struct wined3d_stateblock_state * CDECL wined3d_device_get_stateblock_state(struct wined3d_device *device) +{ + TRACE("device %p.\n", device); + + return &device->stateblock_state; +}
void CDECL wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *parameters) diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index ac87f01f50..a976d82e99 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -101,6 +101,7 @@ @ cdecl wined3d_device_get_sampler_state(ptr long long) @ cdecl wined3d_device_get_scissor_rects(ptr ptr ptr) @ cdecl wined3d_device_get_software_vertex_processing(ptr) +@ cdecl wined3d_device_get_stateblock_state(ptr) @ cdecl wined3d_device_get_stream_output(ptr long ptr) @ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr) @ cdecl wined3d_device_get_stream_source_freq(ptr long ptr) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 7096925534..c07e686ff4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -258,13 +258,6 @@ static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup }
/* Device caps */ -#define WINED3D_MAX_STREAMS 16 -#define WINED3D_MAX_TEXTURES 8 -#define WINED3D_MAX_FRAGMENT_SAMPLERS 16 -#define WINED3D_MAX_VERTEX_SAMPLERS 4 -#define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS) -#define WINED3D_MAX_ACTIVE_LIGHTS 8 -#define WINED3D_MAX_CLIP_DISTANCES 8 #define MAX_CONSTANT_BUFFERS 15 #define MAX_SAMPLER_OBJECTS 16 #define MAX_SHADER_RESOURCE_VIEWS 128 @@ -667,10 +660,6 @@ enum wined3d_shader_conditional_op #define MAX_REG_INPUT 32 #define MAX_REG_OUTPUT 32 #define WINED3D_MAX_CBS 15 -#define WINED3D_MAX_CONSTS_B 16 -#define WINED3D_MAX_CONSTS_I 16 -#define WINED3D_MAX_VS_CONSTS_F 256 -#define WINED3D_MAX_PS_CONSTS_F 224
/* FIXME: This needs to go up to 2048 for * Shader model 3 according to msdn (and for software shaders) */ @@ -2882,25 +2871,6 @@ struct wined3d_stream_output UINT offset; };
-struct wined3d_stream_state -{ - struct wined3d_buffer *buffer; - UINT offset; - UINT stride; - UINT frequency; - UINT flags; -}; - -#define LIGHTMAP_SIZE 43 -#define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) - -struct wined3d_light_state -{ - /* Light hashmap. Collisions are handled using linked lists. */ - struct list light_map[LIGHTMAP_SIZE]; - const struct wined3d_light_info *lights[WINED3D_MAX_ACTIVE_LIGHTS]; -}; - #define WINED3D_STATE_NO_REF 0x00000001 #define WINED3D_STATE_INIT_DEFAULT 0x00000002
@@ -2977,40 +2947,6 @@ struct wined3d_dummy_textures * wined3d_device_create() ignores it. */ #define WINED3DCREATE_MULTITHREADED 0x00000004
-struct wined3d_stateblock_state -{ - struct wined3d_vertex_declaration *vertex_declaration; - struct wined3d_stream_state streams[WINED3D_MAX_STREAMS + 1]; - struct wined3d_buffer *index_buffer; - enum wined3d_format_id index_format; - int base_vertex_index; - - struct wined3d_shader *vs; - struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; - struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I]; - BOOL vs_consts_b[WINED3D_MAX_CONSTS_B]; - - struct wined3d_shader *ps; - struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; - struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I]; - BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; - - DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; - struct wined3d_color blend_factor; - - struct wined3d_texture *textures[WINED3D_MAX_COMBINED_SAMPLERS]; - DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; - DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; - - 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 viewport; - RECT scissor_rect; - - struct wined3d_light_state light_state; -}; - struct wined3d_device { LONG ref; @@ -3565,70 +3501,6 @@ struct wined3d_vertex_declaration BOOL have_half_floats; };
-struct wined3d_saved_states -{ - DWORD transform[(WINED3D_HIGHEST_TRANSFORM_STATE >> 5) + 1]; - WORD streamSource; /* WINED3D_MAX_STREAMS, 16 */ - WORD streamFreq; /* WINED3D_MAX_STREAMS, 16 */ - DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5) + 1]; - DWORD textureState[WINED3D_MAX_TEXTURES]; /* WINED3D_HIGHEST_TEXTURE_STATE + 1, 18 */ - WORD samplerState[WINED3D_MAX_COMBINED_SAMPLERS]; /* WINED3D_HIGHEST_SAMPLER_STATE + 1, 14 */ - DWORD clipplane; /* WINED3D_MAX_USER_CLIP_PLANES, 32 */ - WORD pixelShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */ - WORD pixelShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */ - BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; - WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */ - WORD vertexShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */ - BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; - DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */ - DWORD indices : 1; - DWORD material : 1; - DWORD viewport : 1; - DWORD vertexDecl : 1; - DWORD pixelShader : 1; - DWORD vertexShader : 1; - DWORD scissorRect : 1; - DWORD blend_state : 1; - DWORD padding : 4; -}; - -struct StageState { - DWORD stage; - DWORD state; -}; - -struct wined3d_stateblock -{ - LONG ref; /* Note: Ref counting not required */ - struct wined3d_device *device; - - /* Array indicating whether things have been set or changed */ - struct wined3d_saved_states changed; - struct wined3d_stateblock_state stateblock_state; - - /* Contained state management */ - DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1]; - unsigned int num_contained_render_states; - DWORD contained_transform_states[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; - unsigned int num_contained_transform_states; - DWORD contained_vs_consts_i[WINED3D_MAX_CONSTS_I]; - unsigned int num_contained_vs_consts_i; - DWORD contained_vs_consts_b[WINED3D_MAX_CONSTS_B]; - unsigned int num_contained_vs_consts_b; - DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; - unsigned int num_contained_vs_consts_f; - DWORD contained_ps_consts_i[WINED3D_MAX_CONSTS_I]; - unsigned int num_contained_ps_consts_i; - DWORD contained_ps_consts_b[WINED3D_MAX_CONSTS_B]; - unsigned int num_contained_ps_consts_b; - DWORD contained_ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; - unsigned int num_contained_ps_consts_f; - struct StageState contained_tss_states[WINED3D_MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1)]; - unsigned int num_contained_tss_states; - struct StageState contained_sampler_states[WINED3D_MAX_COMBINED_SAMPLERS * WINED3D_HIGHEST_SAMPLER_STATE]; - unsigned int num_contained_sampler_states; -}; - void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN;
void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 9bd71878f0..1481ee9613 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -672,6 +672,7 @@ enum wined3d_transform_state };
#define WINED3D_TS_WORLD_MATRIX(index) (enum wined3d_transform_state)(index + 256) +#define WINED3D_HIGHEST_TRANSFORM_STATE WINED3D_TS_WORLD_MATRIX(255)
enum wined3d_basis_type { @@ -1583,6 +1584,17 @@ enum wined3d_shader_type #define WINED3D_VIEW_TEXTURE_ARRAY 0x00000010
#define WINED3D_MAX_VIEWPORTS 16 +#define WINED3D_MAX_STREAMS 16 +#define WINED3D_MAX_TEXTURES 8 +#define WINED3D_MAX_FRAGMENT_SAMPLERS 16 +#define WINED3D_MAX_VERTEX_SAMPLERS 4 +#define WINED3D_MAX_COMBINED_SAMPLERS (WINED3D_MAX_FRAGMENT_SAMPLERS + WINED3D_MAX_VERTEX_SAMPLERS) +#define WINED3D_MAX_ACTIVE_LIGHTS 8 +#define WINED3D_MAX_CLIP_DISTANCES 8 +#define WINED3D_MAX_CONSTS_B 16 +#define WINED3D_MAX_CONSTS_I 16 +#define WINED3D_MAX_VS_CONSTS_F 256 +#define WINED3D_MAX_PS_CONSTS_F 224
struct wined3d_display_mode { @@ -2105,6 +2117,123 @@ struct wined3d_output_desc HMONITOR monitor; };
+struct wined3d_stream_state +{ + struct wined3d_buffer *buffer; + UINT offset; + UINT stride; + UINT frequency; + UINT flags; +}; + +#define LIGHTMAP_SIZE 43 +#define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) + +struct wined3d_light_state +{ + /* Light hashmap. Collisions are handled using linked lists. */ + struct list light_map[LIGHTMAP_SIZE]; + const struct wined3d_light_info *lights[WINED3D_MAX_ACTIVE_LIGHTS]; +}; + +struct wined3d_stateblock_state +{ + struct wined3d_vertex_declaration *vertex_declaration; + struct wined3d_stream_state streams[WINED3D_MAX_STREAMS + 1]; + struct wined3d_buffer *index_buffer; + enum wined3d_format_id index_format; + int base_vertex_index; + + struct wined3d_shader *vs; + struct wined3d_vec4 vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; + struct wined3d_ivec4 vs_consts_i[WINED3D_MAX_CONSTS_I]; + BOOL vs_consts_b[WINED3D_MAX_CONSTS_B]; + + struct wined3d_shader *ps; + struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; + struct wined3d_ivec4 ps_consts_i[WINED3D_MAX_CONSTS_I]; + BOOL ps_consts_b[WINED3D_MAX_CONSTS_B]; + + DWORD rs[WINEHIGHEST_RENDER_STATE + 1]; + struct wined3d_color blend_factor; + + struct wined3d_texture *textures[WINED3D_MAX_COMBINED_SAMPLERS]; + DWORD sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; + DWORD texture_states[WINED3D_MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; + + 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 viewport; + RECT scissor_rect; + + struct wined3d_light_state light_state; +}; + +struct wined3d_saved_states +{ + DWORD transform[(WINED3D_HIGHEST_TRANSFORM_STATE >> 5) + 1]; + WORD streamSource; /* WINED3D_MAX_STREAMS, 16 */ + WORD streamFreq; /* WINED3D_MAX_STREAMS, 16 */ + DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5) + 1]; + DWORD textureState[WINED3D_MAX_TEXTURES]; /* WINED3D_HIGHEST_TEXTURE_STATE + 1, 18 */ + WORD samplerState[WINED3D_MAX_COMBINED_SAMPLERS]; /* WINED3D_HIGHEST_SAMPLER_STATE + 1, 14 */ + DWORD clipplane; /* WINED3D_MAX_USER_CLIP_PLANES, 32 */ + WORD pixelShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */ + WORD pixelShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */ + BOOL ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; + WORD vertexShaderConstantsB; /* WINED3D_MAX_CONSTS_B, 16 */ + WORD vertexShaderConstantsI; /* WINED3D_MAX_CONSTS_I, 16 */ + BOOL vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; + DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */ + DWORD indices : 1; + DWORD material : 1; + DWORD viewport : 1; + DWORD vertexDecl : 1; + DWORD pixelShader : 1; + DWORD vertexShader : 1; + DWORD scissorRect : 1; + DWORD blend_state : 1; + DWORD padding : 4; +}; + +struct StageState { + DWORD stage; + DWORD state; +}; + +struct wined3d_stateblock +{ + LONG ref; /* Note: Ref counting not required */ + struct wined3d_device *device; + + /* Array indicating whether things have been set or changed */ + struct wined3d_saved_states changed; + struct wined3d_stateblock_state stateblock_state; + + /* Contained state management */ + DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1]; + unsigned int num_contained_render_states; + DWORD contained_transform_states[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; + unsigned int num_contained_transform_states; + DWORD contained_vs_consts_i[WINED3D_MAX_CONSTS_I]; + unsigned int num_contained_vs_consts_i; + DWORD contained_vs_consts_b[WINED3D_MAX_CONSTS_B]; + unsigned int num_contained_vs_consts_b; + DWORD contained_vs_consts_f[WINED3D_MAX_VS_CONSTS_F]; + unsigned int num_contained_vs_consts_f; + DWORD contained_ps_consts_i[WINED3D_MAX_CONSTS_I]; + unsigned int num_contained_ps_consts_i; + DWORD contained_ps_consts_b[WINED3D_MAX_CONSTS_B]; + unsigned int num_contained_ps_consts_b; + DWORD contained_ps_consts_f[WINED3D_MAX_PS_CONSTS_F]; + unsigned int num_contained_ps_consts_f; + struct StageState contained_tss_states[WINED3D_MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1)]; + unsigned int num_contained_tss_states; + struct StageState contained_sampler_states[WINED3D_MAX_COMBINED_SAMPLERS * WINED3D_HIGHEST_SAMPLER_STATE]; + unsigned int num_contained_sampler_states; +}; + struct wined3d_parent_ops { void (__stdcall *wined3d_object_destroyed)(void *parent); @@ -2330,6 +2459,7 @@ DWORD __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *devi void __cdecl wined3d_device_get_scissor_rects(const struct wined3d_device *device, unsigned int *rect_count, RECT *rect); BOOL __cdecl wined3d_device_get_software_vertex_processing(const struct wined3d_device *device); +struct wined3d_stateblock_state * __cdecl wined3d_device_get_stateblock_state(struct wined3d_device *device); struct wined3d_buffer * __cdecl wined3d_device_get_stream_output(struct wined3d_device *device, UINT idx, UINT *offset); HRESULT __cdecl wined3d_device_get_stream_source(const struct wined3d_device *device,
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48098
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 error: patch failed: dlls/wined3d/wined3d_private.h:258 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 error: patch failed: dlls/wined3d/wined3d_private.h:258 Task: Patch failed to apply
On Fri, Feb 22, 2019 at 2:02 AM Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d9/d3d9_private.h | 1 + dlls/d3d9/device.c | 19 ++++- dlls/wined3d/device.c | 6 ++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 128 -------------------------------- include/wine/wined3d.h | 130 +++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 130 deletions(-)
I don't like the idea of exposing the internal structure of stateblocks in public wined3d API, and open-coding state updates in all client libraries. I think it would be preferred to keep helpers for state updates in wined3d. The main idea was to move stateblocks out of wined3d core, but it should be still possible to keep stateblock helpers for client libraries.
On 02/22/2019 02:07 AM, Józef Kucia wrote:
On Fri, Feb 22, 2019 at 2:02 AM Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d9/d3d9_private.h | 1 + dlls/d3d9/device.c | 19 ++++- dlls/wined3d/device.c | 6 ++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 128 -------------------------------- include/wine/wined3d.h | 130 +++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 130 deletions(-)
I don't like the idea of exposing the internal structure of stateblocks in public wined3d API, and open-coding state updates in all client libraries. I think it would be preferred to keep helpers for state updates in wined3d. The main idea was to move stateblocks out of wined3d core, but it should be still possible to keep stateblock helpers for client libraries.
Thanks. So to clarify, we want to add a series of methods like this?
void wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
On Fri, Feb 22, 2019 at 7:00 PM Zebediah Figura z.figura12@gmail.com wrote:
On 02/22/2019 02:07 AM, Józef Kucia wrote:
On Fri, Feb 22, 2019 at 2:02 AM Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d9/d3d9_private.h | 1 + dlls/d3d9/device.c | 19 ++++- dlls/wined3d/device.c | 6 ++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 128 -------------------------------- include/wine/wined3d.h | 130 +++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 130 deletions(-)
I don't like the idea of exposing the internal structure of stateblocks in public wined3d API, and open-coding state updates in all client libraries. I think it would be preferred to keep helpers for state updates in wined3d. The main idea was to move stateblocks out of wined3d core, but it should be still possible to keep stateblock helpers for client libraries.
Thanks. So to clarify, we want to add a series of methods like this?
void wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
Methods like this might be fine, initially. In the long term, we need something more. We need methods for translating legacy states (e.g. some render states) into state objects (blend state objects, rasterizer state objects, ...).
On 02/22/2019 03:55 PM, Józef Kucia wrote:
On Fri, Feb 22, 2019 at 7:00 PM Zebediah Figura z.figura12@gmail.com wrote:
On 02/22/2019 02:07 AM, Józef Kucia wrote:
On Fri, Feb 22, 2019 at 2:02 AM Zebediah Figura z.figura12@gmail.com wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/d3d9/d3d9_private.h | 1 + dlls/d3d9/device.c | 19 ++++- dlls/wined3d/device.c | 6 ++ dlls/wined3d/wined3d.spec | 1 + dlls/wined3d/wined3d_private.h | 128 -------------------------------- include/wine/wined3d.h | 130 +++++++++++++++++++++++++++++++++ 6 files changed, 155 insertions(+), 130 deletions(-)
I don't like the idea of exposing the internal structure of stateblocks in public wined3d API, and open-coding state updates in all client libraries. I think it would be preferred to keep helpers for state updates in wined3d. The main idea was to move stateblocks out of wined3d core, but it should be still possible to keep stateblock helpers for client libraries.
Thanks. So to clarify, we want to add a series of methods like this?
void wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock *stateblock, struct wined3d_shader *shader);
Methods like this might be fine, initially. In the long term, we need something more. We need methods for translating legacy states (e.g. some render states) into state objects (blend state objects, rasterizer state objects, ...).
Right. As long as we're here, can we clarify what we want the end goal for this architecture to look like? I think I've been misunderstanding somewhat. E.g. what should the body of d3d9_device_SetRenderState() resemble? I was originally picturing something like this:
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevice9Ex *iface, D3DRENDERSTATETYPE state, DWORD value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_rasterizer_state *rasterizer_state; struct wined3d_color factor;
TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
if (state > WINED3D_HIGHEST_RENDER_STATE) { ERR("Invalid render state %#x.\n", state); return D3DERR_INVALIDCALL; }
wined3d_mutex_lock();
device->update_state->rs[state] = value;
if (device->recording) { device->recording->changed.renderState[state >> 5] |= 1u << (state & 0x1f); wined3d_mutex_unlock(); return D3D_OK; }
switch (state) { case D3DRS_FILLMODE: case D3DRS_CULLMODE: case D3DRS_DEPTHBIAS: case D3DRS_SLOPESCALEDEPTHBIAS: case D3DRS_SCISSORTESTENABLE: case D3DRS_MULTISAMPLEANTIALIAS: case D3DRS_ANTIALIASEDLINEENABLE: if (FAILED(hr = d3d9_rasterizer_state_from_render_state(device->state.rs, &rasterizer_state))) { wined3d_mutex_unlock(); return hr; } wined3d_rasterizer_state_decref(device->rasterizer_state); device->rasterizer_state = rasterizer_state; wined3d_device_set_rasterizer_state(device->wined3d_device, rasterizer_state); break; case D3DRS_SRCBLEND: case D3DRS_DESTBLEND: case D3DRS_BLENDOP: case D3DRS_SRCBLENDALPHA: case D3DRS_DESTBLENDALPHA: case D3DRS_BLENDOPALPHA: case D3DRS_COLORWRITEENABLE: case D3DRS_COLORWRITEENABLE1: case D3DRS_COLORWRITEENABLE2: case D3DRS_COLORWRITEENABLE3: /* sim. */ case D3DRS_BLENDFACTOR: wined3d_color_from_d3dcolor(&factor, value); wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor); default: wined3d_device_set_render_State(device->wined3d_device, state, value); }
wined3d_mutex_unlock(); return D3D_OK; }
but this seems to not quite be what you want; can you please help clarify?
On Fri, Feb 22, 2019 at 11:49 PM Zebediah Figura z.figura12@gmail.com wrote:
Right. As long as we're here, can we clarify what we want the end goal for this architecture to look like? I think I've been misunderstanding somewhat. E.g. what should the body of d3d9_device_SetRenderState() resemble? I was originally picturing something like this:
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_SetRenderState(IDirect3DDevice9Ex *iface, D3DRENDERSTATETYPE state, DWORD value) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_rasterizer_state *rasterizer_state; struct wined3d_color factor;
TRACE("iface %p, state %#x, value %#x.\n", iface, state, value); if (state > WINED3D_HIGHEST_RENDER_STATE) { ERR("Invalid render state %#x.\n", state); return D3DERR_INVALIDCALL; } wined3d_mutex_lock(); device->update_state->rs[state] = value; if (device->recording) { device->recording->changed.renderState[state >> 5] |= 1u <<
(state & 0x1f); wined3d_mutex_unlock(); return D3D_OK; }
switch (state) { case D3DRS_FILLMODE: case D3DRS_CULLMODE: case D3DRS_DEPTHBIAS: case D3DRS_SLOPESCALEDEPTHBIAS: case D3DRS_SCISSORTESTENABLE: case D3DRS_MULTISAMPLEANTIALIAS: case D3DRS_ANTIALIASEDLINEENABLE: if (FAILED(hr =
d3d9_rasterizer_state_from_render_state(device->state.rs, &rasterizer_state))) { wined3d_mutex_unlock(); return hr; } wined3d_rasterizer_state_decref(device->rasterizer_state); device->rasterizer_state = rasterizer_state; wined3d_device_set_rasterizer_state(device->wined3d_device, rasterizer_state); break; case D3DRS_SRCBLEND: case D3DRS_DESTBLEND: case D3DRS_BLENDOP: case D3DRS_SRCBLENDALPHA: case D3DRS_DESTBLENDALPHA: case D3DRS_BLENDOPALPHA: case D3DRS_COLORWRITEENABLE: case D3DRS_COLORWRITEENABLE1: case D3DRS_COLORWRITEENABLE2: case D3DRS_COLORWRITEENABLE3: /* sim. */ case D3DRS_BLENDFACTOR: wined3d_color_from_d3dcolor(&factor, value); wined3d_device_set_blend_state(device->wined3d_device, NULL, &factor); default: wined3d_device_set_render_State(device->wined3d_device, state, value); }
wined3d_mutex_unlock(); return D3D_OK;
}
but this seems to not quite be what you want; can you please help clarify?
I'm not sure about the exact design, but I think it would be preferred to introduce an abstraction in wined3d for the state translation to new d3d11-like state objects. Mainly because, there are no reasons to duplicate code in client libraries, and the state translation won't be entirely trivial, e.g. we need some caching mechanism for the state objects. I expect that d3d9_device_SetRenderState() should just call some wined3d helpers methods. In theory, the state translation code could even reside in a separate library outside wined3d, but we don't have strong reasons to introduce a new library.
Also, I don't think that we want to create rasterizer and blend state objects in d3d9_device_SetRenderState(). We should create and set state objects just before draw calls.
You may want to ask Henri for his opinion. Hopefully, it aligns with my description.
On Mon, 25 Feb 2019 at 12:51, Józef Kucia joseph.kucia@gmail.com wrote:
I'm not sure about the exact design, but I think it would be preferred to introduce an abstraction in wined3d for the state translation to new d3d11-like state objects. Mainly because, there are no reasons to duplicate code in client libraries, and the state translation won't be entirely trivial, e.g. we need some caching mechanism for the state objects. I expect that d3d9_device_SetRenderState() should just call some wined3d helpers methods. In theory, the state translation code could even reside in a separate library outside wined3d, but we don't have strong reasons to introduce a new library.
Also, I don't think that we want to create rasterizer and blend state objects in d3d9_device_SetRenderState(). We should create and set state objects just before draw calls.
You may want to ask Henri for his opinion. Hopefully, it aligns with my description.
Yeah. I'd put this in roughly the same category as the wined3d_private_store helpers. I think it's fine for the wined3d_stateblock_state structure to be in the public header, but probably not the details of wined3d_stateblock itself. State object extraction should happen on draws.
On 02/25/2019 02:16 PM, Henri Verbeet wrote:
On Mon, 25 Feb 2019 at 12:51, Józef Kucia joseph.kucia@gmail.com wrote:
I'm not sure about the exact design, but I think it would be preferred to introduce an abstraction in wined3d for the state translation to new d3d11-like state objects. Mainly because, there are no reasons to duplicate code in client libraries, and the state translation won't be entirely trivial, e.g. we need some caching mechanism for the state objects. I expect that d3d9_device_SetRenderState() should just call some wined3d helpers methods. In theory, the state translation code could even reside in a separate library outside wined3d, but we don't have strong reasons to introduce a new library.
Also, I don't think that we want to create rasterizer and blend state objects in d3d9_device_SetRenderState(). We should create and set state objects just before draw calls.
You may want to ask Henri for his opinion. Hopefully, it aligns with my description.
Yeah. I'd put this in roughly the same category as the wined3d_private_store helpers. I think it's fine for the wined3d_stateblock_state structure to be in the public header, but probably not the details of wined3d_stateblock itself. State object extraction should happen on draws.
Right, okay, thanks. So then would the translation happen on the wined3d side? I.e. would we have d3d[789] call wined3d_device_set_render_state() as now, and that would forgo invalidating state for things like depth bias until a draw call occurs? Or would the client d3d libraries be responsible for calling wined3d_device_set_render_state() only for states that actually correspond to wined3d render states?
On Tue, 26 Feb 2019 at 00:35, Zebediah Figura z.figura12@gmail.com wrote:
Right, okay, thanks. So then would the translation happen on the wined3d side? I.e. would we have d3d[789] call wined3d_device_set_render_state() as now, and that would forgo invalidating state for things like depth bias until a draw call occurs? Or would the client d3d libraries be responsible for calling wined3d_device_set_render_state() only for states that actually correspond to wined3d render states?
Eventually, we'd like to just get rid of wined3d_device_set_render_state(). Until that happens, we'd probably have to do some filtering in the client libraries. I don't think the exact approach for that is critical at this stage though.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 3a270a4eac..bc45a17cfc 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3447,8 +3447,16 @@ static HRESULT WINAPI d3d9_device_SetVertexShaderConstantF(IDirect3DDevice9Ex *i }
wined3d_mutex_lock(); - hr = wined3d_device_set_vs_consts_f(device->wined3d_device, - reg_idx, count, (const struct wined3d_vec4 *)data); + memcpy(&device->update_state->vs_consts_f[reg_idx], data, count * sizeof(struct wined3d_vec4)); + if (device->recording) + { + memset(&device->recording->changed.vs_consts_f[reg_idx], 1, + count * sizeof(*device->recording->changed.vs_consts_f)); + hr = D3D_OK; + } + else + hr = wined3d_device_set_vs_consts_f(device->wined3d_device, + reg_idx, count, (const struct wined3d_vec4 *)data); wined3d_mutex_unlock();
return hr;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48099
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 error: patch failed: dlls/wined3d/wined3d_private.h:258 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 error: patch failed: dlls/wined3d/stateblock.c:218 error: patch failed: dlls/wined3d/wined3d_private.h:264 error: patch failed: dlls/wined3d/stateblock.c:214 error: patch failed: dlls/wined3d/wined3d_private.h:2940 error: patch failed: dlls/wined3d/wined3d_private.h:258 Task: Patch failed to apply
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48094
Your paranoid android.
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/wined3d/utils.c:6279 error: patch failed: dlls/wined3d/wined3d_private.h:263 Task: Patch failed to apply