[PATCH 3/6] wined3d: Get rid of the "recording" field from struct wined3d_device.

Zebediah Figura z.figura12 at gmail.com
Tue Nov 26 22:58:25 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/device.c          | 173 +--------------------------------
 dlls/wined3d/wined3d_private.h |   1 -
 2 files changed, 1 insertion(+), 173 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f2d060184ba..562caf8900a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -533,10 +533,6 @@ void wined3d_device_cleanup(struct wined3d_device *device)
 
     wined3d_cs_destroy(device->cs);
 
-    if (device->recording && wined3d_stateblock_decref(device->recording))
-        ERR("Something's still holding the recording stateblock.\n");
-    device->recording = NULL;
-
     for (i = 0; i < ARRAY_SIZE(device->multistate_funcs); ++i)
     {
         heap_free(device->multistate_funcs[i]);
@@ -1283,12 +1279,6 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
     device->update_stateblock_state->streams[stream_idx].stride = stride;
     device->update_stateblock_state->streams[stream_idx].offset = offset;
 
-    if (device->recording)
-    {
-        device->recording->changed.streamSource |= 1u << stream_idx;
-        return WINED3D_OK;
-    }
-
     if (prev_buffer == buffer
             && stream->stride == stride
             && stream->offset == offset)
@@ -1365,11 +1355,6 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic
 
     device->update_stateblock_state->streams[stream_idx].flags = flags;
     device->update_stateblock_state->streams[stream_idx].frequency = freq;
-    if (device->recording)
-    {
-        device->recording->changed.streamFreq |= 1u << stream_idx;
-        return WINED3D_OK;
-    }
 
     stream->flags = flags;
     stream->frequency = freq;
@@ -1406,12 +1391,6 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device,
 
     /* Handle recording of state blocks. */
     device->update_stateblock_state->transforms[d3dts] = *matrix;
-    if (device->recording)
-    {
-        TRACE("Recording... not performing anything.\n");
-        device->recording->changed.transform[d3dts >> 5] |= 1u << (d3dts & 0x1f);
-        return;
-    }
 
     /* If the new matrix is the same as the current one,
      * we cut off any further processing. this seems to be a reasonable
@@ -1504,8 +1483,6 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
 
     if (FAILED(hr = wined3d_light_state_set_light(&device->update_stateblock_state->light_state, light_idx, light, &object)))
         return hr;
-    if (device->recording)
-        return WINED3D_OK;
 
     if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
         return hr;
@@ -1634,9 +1611,6 @@ HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UIN
     wined3d_light_state_enable_light(&device->update_stateblock_state->light_state,
             &device->adapter->d3d_info, light_info, enable);
 
-    if (device->recording)
-        return WINED3D_OK;
-
     /* Special case - enabling an undefined light creates one with a strict set of parameters. */
     if (!(light_info = wined3d_light_state_get_light(&device->state.light_state, light_idx)))
     {
@@ -1685,12 +1659,6 @@ HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device,
 
     device->update_stateblock_state->clip_planes[plane_idx] = *plane;
 
-    if (device->recording)
-    {
-        device->recording->changed.clipplane |= 1u << plane_idx;
-        return WINED3D_OK;
-    }
-
     if (!memcmp(&device->state.clip_planes[plane_idx], plane, sizeof(*plane)))
     {
         TRACE("Application is setting old values over, nothing to do.\n");
@@ -1747,11 +1715,6 @@ void CDECL wined3d_device_set_material(struct wined3d_device *device, const stru
     TRACE("device %p, material %p.\n", device, material);
 
     device->update_stateblock_state->material = *material;
-    if (device->recording)
-    {
-        device->recording->changed.material = TRUE;
-        return;
-    }
 
     device->state.material = *material;
     wined3d_cs_emit_set_material(device->cs, material);
@@ -1791,12 +1754,6 @@ void CDECL wined3d_device_set_index_buffer(struct wined3d_device *device,
     device->update_stateblock_state->index_buffer = buffer;
     device->update_stateblock_state->index_format = format_id;
 
-    if (device->recording)
-    {
-        device->recording->changed.indices = TRUE;
-        return;
-    }
-
     if (prev_buffer == buffer && prev_format == format_id && prev_offset == offset)
         return;
 
@@ -1826,8 +1783,7 @@ void CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, I
     TRACE("device %p, base_index %d.\n", device, base_index);
 
     device->update_stateblock_state->base_vertex_index = base_index;
-    if (!device->recording)
-        device->state.base_vertex_index = base_index;
+    device->state.base_vertex_index = base_index;
 }
 
 INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *device)
@@ -1853,14 +1809,6 @@ void CDECL wined3d_device_set_viewports(struct wined3d_device *device, unsigned
     if (viewport_count)
         device->update_stateblock_state->viewport = viewports[0];
 
-    /* Handle recording of state blocks */
-    if (device->recording)
-    {
-        TRACE("Recording... not performing anything\n");
-        device->recording->changed.viewport = TRUE;
-        return;
-    }
-
     if (viewport_count)
         memcpy(device->state.viewports, viewports, viewport_count * sizeof(*viewports));
     else
@@ -1912,11 +1860,6 @@ void CDECL wined3d_device_set_blend_state(struct wined3d_device *device,
     TRACE("device %p, blend_state %p, blend_factor %s.\n", device, blend_state, debug_color(blend_factor));
 
     device->update_stateblock_state->blend_factor = *blend_factor;
-    if (device->recording)
-    {
-        device->recording->changed.blend_state = TRUE;
-        return;
-    }
 
     prev = state->blend_state;
     if (prev == blend_state && !memcmp(blend_factor, &state->blend_factor, sizeof(*blend_factor)))
@@ -1981,14 +1924,6 @@ void CDECL wined3d_device_set_render_state(struct wined3d_device *device,
 
     device->update_stateblock_state->rs[state] = value;
 
-    /* Handle recording of state blocks. */
-    if (device->recording)
-    {
-        TRACE("Recording... not performing anything.\n");
-        device->recording->changed.renderState[state >> 5] |= 1u << (state & 0x1f);
-        return;
-    }
-
     if (value == device->state.render_states[state])
         TRACE("Application is setting the old value over, nothing to do.\n");
     else
@@ -2028,14 +1963,6 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
 
     device->update_stateblock_state->sampler_states[sampler_idx][state] = value;
 
-    /* Handle recording of state blocks. */
-    if (device->recording)
-    {
-        TRACE("Recording... not performing anything.\n");
-        device->recording->changed.samplerState[sampler_idx] |= 1u << state;
-        return;
-    }
-
     if (value == device->state.sampler_states[sampler_idx][state])
     {
         TRACE("Application is setting the old value over, nothing to do.\n");
@@ -2079,12 +2006,6 @@ void CDECL wined3d_device_set_scissor_rects(struct wined3d_device *device, unsig
     if (rect_count)
         device->update_stateblock_state->scissor_rect = rects[0];
 
-    if (device->recording)
-    {
-        device->recording->changed.scissorRect = TRUE;
-        return;
-    }
-
     if (device->state.scissor_rect_count == rect_count
             && !memcmp(device->state.scissor_rects, rects, rect_count * sizeof(*rects)))
     {
@@ -2127,12 +2048,6 @@ void CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device,
         wined3d_vertex_declaration_decref(device->update_stateblock_state->vertex_declaration);
     device->update_stateblock_state->vertex_declaration = declaration;
 
-    if (device->recording)
-    {
-        device->recording->changed.vertexDecl = TRUE;
-        return;
-    }
-
     if (declaration == prev)
         return;
 
@@ -2163,12 +2078,6 @@ void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struc
         wined3d_shader_decref(device->update_stateblock_state->vs);
     device->update_stateblock_state->vs = shader;
 
-    if (device->recording)
-    {
-        device->recording->changed.vertexShader = TRUE;
-        return;
-    }
-
     if (shader == prev)
         return;
 
@@ -2354,12 +2263,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
         count = WINED3D_MAX_CONSTS_B - start_idx;
 
     memcpy(&device->update_stateblock_state->vs_consts_b[start_idx], constants, count * sizeof(*constants));
-    if (device->recording)
-    {
-        for (i = start_idx; i < count + start_idx; ++i)
-            device->recording->changed.vertexShaderConstantsB |= (1u << i);
-        return WINED3D_OK;
-    }
 
     memcpy(&device->state.vs_consts_b[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
@@ -2404,12 +2307,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
         count = WINED3D_MAX_CONSTS_I - start_idx;
 
     memcpy(&device->update_stateblock_state->vs_consts_i[start_idx], constants, count * sizeof(*constants));
-    if (device->recording)
-    {
-        for (i = start_idx; i < count + start_idx; ++i)
-            device->recording->changed.vertexShaderConstantsI |= (1u << i);
-        return WINED3D_OK;
-    }
 
     memcpy(&device->state.vs_consts_i[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
@@ -2452,12 +2349,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
         return WINED3DERR_INVALIDCALL;
 
     memcpy(&device->update_stateblock_state->vs_consts_f[start_idx], constants, count * sizeof(*constants));
-    if (device->recording)
-    {
-        memset(&device->recording->changed.vs_consts_f[start_idx], 1,
-                count * sizeof(*device->recording->changed.vs_consts_f));
-        return WINED3D_OK;
-    }
 
     memcpy(&device->state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
@@ -2499,11 +2390,6 @@ void CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct
     if (device->update_stateblock_state->ps)
         wined3d_shader_decref(device->update_stateblock_state->ps);
     device->update_stateblock_state->ps = shader;
-    if (device->recording)
-    {
-        device->recording->changed.pixelShader = TRUE;
-        return;
-    }
 
     if (shader == prev)
         return;
@@ -2568,12 +2454,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
         count = WINED3D_MAX_CONSTS_B - start_idx;
 
     memcpy(&device->update_stateblock_state->ps_consts_b[start_idx], constants, count * sizeof(*constants));
-    if (device->recording)
-    {
-        for (i = start_idx; i < count + start_idx; ++i)
-            device->recording->changed.pixelShaderConstantsB |= (1u << i);
-        return WINED3D_OK;
-    }
 
     memcpy(&device->state.ps_consts_b[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
@@ -2618,12 +2498,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
         count = WINED3D_MAX_CONSTS_I - start_idx;
 
     memcpy(&device->update_stateblock_state->ps_consts_i[start_idx], constants, count * sizeof(*constants));
-    if (device->recording)
-    {
-        for (i = start_idx; i < count + start_idx; ++i)
-            device->recording->changed.pixelShaderConstantsI |= (1u << i);
-        return WINED3D_OK;
-    }
 
     memcpy(&device->state.ps_consts_i[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
@@ -2667,12 +2541,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
         return WINED3DERR_INVALIDCALL;
 
     memcpy(&device->update_stateblock_state->ps_consts_f[start_idx], constants, count * sizeof(*constants));
-    if (device->recording)
-    {
-        memset(&device->recording->changed.ps_consts_f[start_idx], 1,
-                count * sizeof(*device->recording->changed.ps_consts_f));
-        return WINED3D_OK;
-    }
 
     memcpy(&device->state.ps_consts_f[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
@@ -3970,13 +3838,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
 
     device->update_stateblock_state->texture_states[stage][state] = value;
 
-    if (device->recording)
-    {
-        TRACE("Recording... not performing anything.\n");
-        device->recording->changed.textureState[stage] |= 1u << state;
-        return;
-    }
-
     if (value == device->state.texture_states[stage][state])
     {
         TRACE("Application is setting the old value over, nothing to do.\n");
@@ -4026,12 +3887,6 @@ void CDECL wined3d_device_set_texture(struct wined3d_device *device,
         wined3d_texture_decref(device->update_stateblock_state->textures[stage]);
     device->update_stateblock_state->textures[stage] = texture;
 
-    if (device->recording)
-    {
-        device->recording->changed.textures |= 1u << stage;
-        return;
-    }
-
     prev = device->state.textures[stage];
     TRACE("Previous texture %p.\n", prev);
 
@@ -5538,11 +5393,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
     if (reset_state)
     {
         TRACE("Resetting stateblock.\n");
-        if (device->recording)
-        {
-            wined3d_stateblock_decref(device->recording);
-            device->recording = NULL;
-        }
         wined3d_cs_emit_reset_state(device->cs);
         state_cleanup(&device->state);
 
@@ -5693,13 +5543,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
                     ERR("Texture resource %p is still in use, stage %u.\n", resource, i);
                     device->state.textures[i] = NULL;
                 }
-
-                if (device->recording && &device->update_stateblock_state->textures[i]->resource == resource)
-                {
-                    ERR("Texture resource %p is still in use by recording stateblock %p, stage %u.\n",
-                            resource, device->recording, i);
-                    device->update_stateblock_state->textures[i] = NULL;
-                }
             }
             break;
 
@@ -5711,13 +5554,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
                     ERR("Buffer resource %p is still in use, stream %u.\n", resource, i);
                     device->state.streams[i].buffer = NULL;
                 }
-
-                if (device->recording && &device->update_stateblock_state->streams[i].buffer->resource == resource)
-                {
-                    ERR("Buffer resource %p is still in use by stateblock %p, stream %u.\n",
-                            resource, device->recording, i);
-                    device->update_stateblock_state->streams[i].buffer = NULL;
-                }
             }
 
             if (&device->state.index_buffer->resource == resource)
@@ -5725,13 +5561,6 @@ void device_resource_released(struct wined3d_device *device, struct wined3d_reso
                 ERR("Buffer resource %p is still in use as index buffer.\n", resource);
                 device->state.index_buffer =  NULL;
             }
-
-            if (device->recording && &device->update_stateblock_state->index_buffer->resource == resource)
-            {
-                ERR("Buffer resource %p is still in use by stateblock %p as index buffer.\n",
-                        resource, device->recording);
-                device->update_stateblock_state->index_buffer =  NULL;
-            }
             break;
 
         default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8ebf377b114..0fedd706ce7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3282,7 +3282,6 @@ struct wined3d_device
     enum wined3d_feature_level feature_level;
 
     struct wined3d_state state;
-    struct wined3d_stateblock *recording;
     struct wined3d_stateblock_state stateblock_state;
     struct wined3d_stateblock_state *update_stateblock_state;
 
-- 
2.23.0




More information about the wine-devel mailing list