Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
December 2019
- 73 participants
- 1394 messages
[PATCH 2/6] strmbase/transform: Hold the streaming lock for the entirety of Receive().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/quartz/acmwrapper.c | 4 ----
dlls/quartz/avidec.c | 22 +++++++++-------------
dlls/strmbase/transform.c | 2 +-
dlls/winegstreamer/gsttffilter.c | 3 ---
4 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c
index 64e0018980..8eea6ab147 100644
--- a/dlls/quartz/acmwrapper.c
+++ b/dlls/quartz/acmwrapper.c
@@ -66,12 +66,10 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
LONGLONG tStart = -1, tStop = -1, tMed;
LONGLONG mtStart = -1, mtStop = -1, mtMed;
- EnterCriticalSection(&This->tf.csReceive);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
if (FAILED(hr))
{
ERR("Cannot get pointer to sample data (%x)\n", hr);
- LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
@@ -107,7 +105,6 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
if (FAILED(hr))
{
ERR("Unable to get delivery buffer (%x)\n", hr);
- LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
IMediaSample_SetPreroll(pOutSample, preroll);
@@ -224,7 +221,6 @@ error:
This->lasttime_real = tStop;
This->lasttime_sent = tMed;
- LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index cbe109df2b..32969a3473 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -111,12 +111,11 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
LONGLONG tStart, tStop;
DWORD flags = 0;
- EnterCriticalSection(&This->tf.csReceive);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
if (FAILED(hr))
{
ERR("Cannot get pointer to sample data (%x)\n", hr);
- goto error;
+ return hr;
}
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
@@ -129,7 +128,7 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->tf.source, &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) {
ERR("Unable to get delivery buffer (%x)\n", hr);
- goto error;
+ return hr;
}
hr = IMediaSample_SetActualDataLength(pOutSample, 0);
@@ -138,13 +137,14 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
hr = IMediaSample_GetPointer(pOutSample, &pbDstStream);
if (FAILED(hr)) {
ERR("Unable to get pointer to buffer (%x)\n", hr);
- goto error;
+ IMediaSample_Release(pOutSample);
+ return hr;
}
cbDstStream = IMediaSample_GetSize(pOutSample);
if (cbDstStream < This->pBihOut->biSizeImage) {
ERR("Sample size is too small %d < %d\n", cbDstStream, This->pBihOut->biSizeImage);
- hr = E_FAIL;
- goto error;
+ IMediaSample_Release(pOutSample);
+ return E_FAIL;
}
if (IMediaSample_IsPreroll(pSample) == S_OK)
@@ -161,8 +161,8 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
/* Drop sample if it's intended to be dropped */
if (flags & ICDECOMPRESS_HURRYUP) {
- hr = S_OK;
- goto error;
+ IMediaSample_Release(pOutSample);
+ return S_OK;
}
IMediaSample_SetActualDataLength(pOutSample, This->pBihOut->biSizeImage);
@@ -187,11 +187,7 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED)
ERR("Error sending sample (%x)\n", hr);
-error:
- if (pOutSample)
- IMediaSample_Release(pOutSample);
-
- LeaveCriticalSection(&This->tf.csReceive);
+ IMediaSample_Release(pOutSample);
return hr;
}
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index 7650232c44..9e2582a0db 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -82,12 +82,12 @@ static HRESULT WINAPI TransformFilter_Input_Receive(struct strmbase_sink *This,
return S_FALSE;
}
- LeaveCriticalSection(&pTransform->csReceive);
if (pTransform->pFuncsTable->pfnReceive)
hr = pTransform->pFuncsTable->pfnReceive(pTransform, pInSample);
else
hr = S_FALSE;
+ LeaveCriticalSection(&pTransform->csReceive);
return hr;
}
diff --git a/dlls/winegstreamer/gsttffilter.c b/dlls/winegstreamer/gsttffilter.c
index baa4c0c2c5..9ff5f8741d 100644
--- a/dlls/winegstreamer/gsttffilter.c
+++ b/dlls/winegstreamer/gsttffilter.c
@@ -227,7 +227,6 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
mark_wine_thread();
- EnterCriticalSection(&This->tf.csReceive);
IMediaSample_GetPointer(sample, &data);
IMediaSample_AddRef(sample);
@@ -235,7 +234,6 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
buf = gst_buffer_new_wrapped_full(0, data, bufsize, 0, bufsize, sample, release_sample_wrapper);
if (!buf) {
IMediaSample_Release(sample);
- LeaveCriticalSection(&This->tf.csReceive);
return S_OK;
}
@@ -259,7 +257,6 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_LIVE);
if (IMediaSample_IsSyncPoint(sample) != S_OK)
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT);
- LeaveCriticalSection(&This->tf.csReceive);
ret = gst_pad_push(This->my_src, buf);
if (ret)
WARN("Sending returned: %i\n", ret);
--
2.24.0
Dec. 1, 2019
[PATCH 1/6] strmbase: Don't hold the filter lock while calling IPin::NewSegment().
by Zebediah Figura
It's not safe to hold the filter lock from a streaming thread, and anyway we aren't protecting anything that needs locking.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/strmbase/transform.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index d39dbbd3ab..7650232c44 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -495,12 +495,10 @@ static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENC
TRACE("iface %p, start %s, stop %s, rate %.16e.\n",
iface, debugstr_time(tStart), debugstr_time(tStop), dRate);
- EnterCriticalSection(&pTransform->filter.csFilter);
if (pTransform->pFuncsTable->pfnNewSegment)
hr = pTransform->pFuncsTable->pfnNewSegment(pTransform, tStart, tStop, dRate);
if (SUCCEEDED(hr))
hr = BaseInputPinImpl_NewSegment(iface, tStart, tStop, dRate);
- LeaveCriticalSection(&pTransform->filter.csFilter);
return hr;
}
--
2.24.0
Dec. 1, 2019
[PATCH v3 2/2] wined3d: Introduce wined3d_stateblock_get_state().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wined3d/stateblock.c | 5 +++
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_private.h | 55 ---------------------------------
include/wine/wined3d.h | 56 ++++++++++++++++++++++++++++++++++
4 files changed, 62 insertions(+), 55 deletions(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 24017490e67..1a0ba0a3d59 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1698,6 +1698,11 @@ HRESULT CDECL wined3d_stateblock_set_light_enable(struct wined3d_stateblock *sta
return S_OK;
}
+const struct wined3d_stateblock_state * CDECL wined3d_stateblock_get_state(const struct wined3d_stateblock *stateblock)
+{
+ return &stateblock->stateblock_state;
+}
+
static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info)
{
union
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index fed5ce1b128..bec84b5979c 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -259,6 +259,7 @@
@ cdecl wined3d_stateblock_capture(ptr ptr)
@ cdecl wined3d_stateblock_create(ptr ptr long ptr)
@ cdecl wined3d_stateblock_decref(ptr)
+@ cdecl wined3d_stateblock_get_state(ptr)
@ cdecl wined3d_stateblock_incref(ptr)
@ cdecl wined3d_stateblock_init_contained_states(ptr)
@ cdecl wined3d_stateblock_reset(ptr)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5f779f041f0..2a7dffb26a9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -272,14 +272,8 @@ 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_SOFTWARE_ACTIVE_LIGHTS 32
-#define WINED3D_MAX_CLIP_DISTANCES 8
#define MAX_CONSTANT_BUFFERS 15
#define MAX_SAMPLER_OBJECTS 16
#define MAX_SHADER_RESOURCE_VIEWS 128
@@ -699,10 +693,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) */
@@ -1504,8 +1494,6 @@ static inline void wined3d_colour_srgb_from_linear(struct wined3d_color *colour_
colour_srgb->a = colour->a;
}
-#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;
@@ -3121,15 +3109,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)
@@ -3216,40 +3195,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;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index eba14e9a022..8b64bf66c23 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -668,6 +668,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) /* Highest value in wined3d_transform_state. */
enum wined3d_basis_type
{
@@ -1588,6 +1589,17 @@ enum wined3d_shader_type
#define WINED3D_REGISTER_WINDOW_NO_ALT_ENTER 0x00000002u
#define WINED3D_REGISTER_WINDOW_NO_PRINT_SCREEN 0x00000004u
+#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_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
{
UINT width;
@@ -2111,6 +2123,49 @@ struct wined3d_output_desc
HMONITOR monitor;
};
+struct wined3d_stream_state
+{
+ struct wined3d_buffer *buffer;
+ UINT offset;
+ UINT stride;
+ UINT frequency;
+ UINT flags;
+};
+
+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_parent_ops
{
void (__stdcall *wined3d_object_destroyed)(void *parent);
@@ -2666,6 +2721,7 @@ void __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, const struct wined3d_stateblock *device_state,
enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock);
ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
+const struct wined3d_stateblock_state * __cdecl wined3d_stateblock_get_state(const struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
void __cdecl wined3d_stateblock_init_contained_states(struct wined3d_stateblock *stateblock);
void __cdecl wined3d_stateblock_reset(struct wined3d_stateblock *stateblock);
--
2.23.0
Dec. 1, 2019
[PATCH v3 1/2] wined3d: Move the wined3d_light_state structure to the wined3d_stateblock structure.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wined3d/stateblock.c | 37 +++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 4 +++-
2 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 1c3704c10a5..24017490e67 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -575,7 +575,7 @@ void wined3d_stateblock_state_cleanup(struct wined3d_stateblock_state *state)
for (i = 0; i < LIGHTMAP_SIZE; ++i)
{
- LIST_FOR_EACH_ENTRY_SAFE(light, cursor, &state->light_state.light_map[i], struct wined3d_light_info, entry)
+ LIST_FOR_EACH_ENTRY_SAFE(light, cursor, &state->light_state->light_map[i], struct wined3d_light_info, entry)
{
list_remove(&light->entry);
heap_free(light);
@@ -1025,7 +1025,7 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
stateblock->stateblock_state.ps = state->ps;
}
- wined3d_state_record_lights(&stateblock->stateblock_state.light_state, &state->light_state);
+ wined3d_state_record_lights(stateblock->stateblock_state.light_state, state->light_state);
TRACE("Capture done.\n");
}
@@ -1073,17 +1073,17 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock,
wined3d_device_set_vs_consts_b(device, idx, 1, &stateblock->stateblock_state.vs_consts_b[idx]);
}
- for (i = 0; i < ARRAY_SIZE(stateblock->stateblock_state.light_state.light_map); ++i)
+ for (i = 0; i < ARRAY_SIZE(stateblock->stateblock_state.light_state->light_map); ++i)
{
const struct wined3d_light_info *light;
struct wined3d_light_info *new_light;
- LIST_FOR_EACH_ENTRY(light, &stateblock->stateblock_state.light_state.light_map[i], struct wined3d_light_info, entry)
+ LIST_FOR_EACH_ENTRY(light, &stateblock->stateblock_state.light_state->light_map[i], struct wined3d_light_info, entry)
{
- if (SUCCEEDED(wined3d_light_state_set_light(&state->light_state, light->OriginalIndex,
+ if (SUCCEEDED(wined3d_light_state_set_light(state->light_state, light->OriginalIndex,
&light->OriginalParms, &new_light)))
{
- wined3d_light_state_enable_light(&state->light_state, &device->adapter->d3d_info, new_light, light->glIndex != -1);
+ wined3d_light_state_enable_light(state->light_state, &device->adapter->d3d_info, new_light, light->glIndex != -1);
}
wined3d_device_set_light(device, light->OriginalIndex, &light->OriginalParms);
wined3d_device_set_light_enable(device, light->OriginalIndex, light->glIndex != -1);
@@ -1678,24 +1678,23 @@ HRESULT CDECL wined3d_stateblock_set_light(struct wined3d_stateblock *stateblock
return WINED3DERR_INVALIDCALL;
}
- return wined3d_light_state_set_light(&stateblock->stateblock_state.light_state, light_idx, light, &object);
+ return wined3d_light_state_set_light(stateblock->stateblock_state.light_state, light_idx, light, &object);
}
HRESULT CDECL wined3d_stateblock_set_light_enable(struct wined3d_stateblock *stateblock, UINT light_idx, BOOL enable)
{
+ struct wined3d_light_state *light_state = stateblock->stateblock_state.light_state;
struct wined3d_light_info *light_info;
HRESULT hr;
TRACE("stateblock %p, light_idx %u, enable %#x.\n", stateblock, light_idx, enable);
- if (!(light_info = wined3d_light_state_get_light(&stateblock->stateblock_state.light_state, light_idx)))
+ if (!(light_info = wined3d_light_state_get_light(light_state, light_idx)))
{
- if (FAILED(hr = wined3d_light_state_set_light(&stateblock->stateblock_state.light_state, light_idx,
- &WINED3D_default_light, &light_info)))
+ if (FAILED(hr = wined3d_light_state_set_light(light_state, light_idx, &WINED3D_default_light, &light_info)))
return hr;
}
- wined3d_light_state_enable_light(&stateblock->stateblock_state.light_state,
- &stateblock->device->adapter->d3d_info, light_info, enable);
+ wined3d_light_state_enable_light(light_state, &stateblock->device->adapter->d3d_info, light_info, enable);
return S_OK;
}
@@ -1981,9 +1980,9 @@ void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(state->light_state.light_map); i++)
+ for (i = 0; i < ARRAY_SIZE(state->light_state->light_map); i++)
{
- list_init(&state->light_state.light_map[i]);
+ list_init(&state->light_state->light_map[i]);
}
if (flags & WINED3D_STATE_INIT_DEFAULT)
@@ -1998,6 +1997,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
stateblock->ref = 1;
stateblock->device = device;
+ stateblock->stateblock_state.light_state = &stateblock->light_state;
wined3d_stateblock_state_init(&stateblock->stateblock_state, device,
type == WINED3D_SBT_PRIMARY ? WINED3D_STATE_INIT_DEFAULT : 0);
@@ -2011,8 +2011,8 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
switch (type)
{
case WINED3D_SBT_ALL:
- stateblock_init_lights(stateblock->stateblock_state.light_state.light_map,
- device_state->stateblock_state.light_state.light_map);
+ stateblock_init_lights(stateblock->stateblock_state.light_state->light_map,
+ device_state->stateblock_state.light_state->light_map);
stateblock_savedstates_set_all(&stateblock->changed,
d3d_info->limits.vs_uniform_count, d3d_info->limits.ps_uniform_count);
break;
@@ -2023,8 +2023,8 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, const stru
break;
case WINED3D_SBT_VERTEX_STATE:
- stateblock_init_lights(stateblock->stateblock_state.light_state.light_map,
- device_state->stateblock_state.light_state.light_map);
+ stateblock_init_lights(stateblock->stateblock_state.light_state->light_map,
+ device_state->stateblock_state.light_state->light_map);
stateblock_savedstates_set_vertex(&stateblock->changed,
d3d_info->limits.vs_uniform_count);
break;
@@ -2078,5 +2078,6 @@ void CDECL wined3d_stateblock_reset(struct wined3d_stateblock *stateblock)
wined3d_stateblock_state_cleanup(&stateblock->stateblock_state);
memset(&stateblock->stateblock_state, 0, sizeof(stateblock->stateblock_state));
+ stateblock->stateblock_state.light_state = &stateblock->light_state;
wined3d_stateblock_state_init(&stateblock->stateblock_state, stateblock->device, WINED3D_STATE_INIT_DEFAULT);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3ae7dab858e..5f779f041f0 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3247,7 +3247,7 @@ struct wined3d_stateblock_state
struct wined3d_viewport viewport;
RECT scissor_rect;
- struct wined3d_light_state light_state;
+ struct wined3d_light_state *light_state;
};
struct wined3d_device
@@ -3946,7 +3946,9 @@ struct wined3d_stateblock
/* Array indicating whether things have been set or changed */
struct wined3d_saved_states changed;
+
struct wined3d_stateblock_state stateblock_state;
+ struct wined3d_light_state light_state;
/* Contained state management */
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1];
--
2.23.0
Dec. 1, 2019