[PATCH 3/5] wined3d: Remove some now redundant error handling from wined3d_device_set_*() functions.
Zebediah Figura
z.figura12 at gmail.com
Tue Mar 3 17:50:04 CST 2020
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/wined3d/device.c | 97 +------------------------------------------
1 file changed, 2 insertions(+), 95 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 441601efcb..4c9f858c95 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1321,23 +1321,6 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic
TRACE("device %p, stream_idx %u, divider %#x.\n", device, stream_idx, divider);
- /* Verify input. At least in d3d9 this is invalid. */
- if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (divider & WINED3DSTREAMSOURCE_INDEXEDDATA))
- {
- WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
- if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !stream_idx)
- {
- WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
- if (!divider)
- {
- WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
stream = &device->state.streams[stream_idx];
old_flags = stream->flags;
old_freq = stream->frequency;
@@ -1395,42 +1378,12 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device,
UINT light_idx, const struct wined3d_light *light)
{
struct wined3d_light_info *object = NULL;
- HRESULT hr;
float rho;
TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light);
- /* Check the parameter range. Need for speed most wanted sets junk lights
- * which confuse the GL driver. */
- if (!light)
- return WINED3DERR_INVALIDCALL;
-
- switch (light->type)
- {
- case WINED3D_LIGHT_POINT:
- case WINED3D_LIGHT_SPOT:
- case WINED3D_LIGHT_GLSPOT:
- /* Incorrect attenuation values can cause the gl driver to crash.
- * Happens with Need for speed most wanted. */
- if (light->attenuation0 < 0.0f || light->attenuation1 < 0.0f || light->attenuation2 < 0.0f)
- {
- WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
- break;
-
- case WINED3D_LIGHT_DIRECTIONAL:
- case WINED3D_LIGHT_PARALLELPOINT:
- /* Ignores attenuation */
- break;
-
- default:
- WARN("Light type out of range, returning WINED3DERR_INVALIDCALL\n");
- return WINED3DERR_INVALIDCALL;
- }
-
- if (FAILED(hr = wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
- return hr;
+ if (FAILED(wined3d_light_state_set_light(&device->state.light_state, light_idx, light, &object)))
+ return;
/* Initialize the object. */
TRACE("Light %u setting to type %#x, diffuse %s, specular %s, ambient %s, "
@@ -1802,12 +1755,6 @@ void CDECL wined3d_device_set_sampler_state(struct wined3d_device *device,
if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
- if (sampler_idx >= ARRAY_SIZE(device->state.sampler_states))
- {
- WARN("Invalid sampler %u.\n", sampler_idx);
- return; /* Windows accepts overflowing this array ... we do not. */
- }
-
if (value == device->state.sampler_states[sampler_idx][state])
{
TRACE("Application is setting the old value over, nothing to do.\n");
@@ -2068,12 +2015,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
TRACE("device %p, start_idx %u, count %u, constants %p.\n",
device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_B)
- return WINED3DERR_INVALIDCALL;
-
- if (count > WINED3D_MAX_CONSTS_B - start_idx)
- count = WINED3D_MAX_CONSTS_B - start_idx;
-
memcpy(&device->state.vs_consts_b[start_idx], constants, count * sizeof(*constants));
if (TRACE_ON(d3d))
{
@@ -2094,12 +2035,6 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
TRACE("device %p, start_idx %u, count %u, constants %p.\n",
device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_I)
- return WINED3DERR_INVALIDCALL;
-
- if (count > WINED3D_MAX_CONSTS_I - start_idx)
- count = WINED3D_MAX_CONSTS_I - start_idx;
-
memcpy(&device->state.vs_consts_i[start_idx], constants, count * sizeof(*constants));
if (TRACE_ON(d3d))
{
@@ -2115,16 +2050,11 @@ HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device,
HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device,
unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
{
- const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
unsigned int i;
TRACE("device %p, start_idx %u, count %u, constants %p.\n",
device, start_idx, count, constants);
- if (!constants || start_idx >= d3d_info->limits.vs_uniform_count
- || count > d3d_info->limits.vs_uniform_count - start_idx)
- return WINED3DERR_INVALIDCALL;
-
memcpy(&device->state.vs_consts_f[start_idx], constants, count * sizeof(*constants));
if (TRACE_ON(d3d))
{
@@ -2199,12 +2129,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device,
TRACE("device %p, start_idx %u, count %u, constants %p.\n",
device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_B)
- return WINED3DERR_INVALIDCALL;
-
- if (count > WINED3D_MAX_CONSTS_B - start_idx)
- count = WINED3D_MAX_CONSTS_B - start_idx;
-
memcpy(&device->state.ps_consts_b[start_idx], constants, count * sizeof(*constants));
if (TRACE_ON(d3d))
{
@@ -2225,12 +2149,6 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
TRACE("device %p, start_idx %u, count %u, constants %p.\n",
device, start_idx, count, constants);
- if (!constants || start_idx >= WINED3D_MAX_CONSTS_I)
- return WINED3DERR_INVALIDCALL;
-
- if (count > WINED3D_MAX_CONSTS_I - start_idx)
- count = WINED3D_MAX_CONSTS_I - start_idx;
-
memcpy(&device->state.ps_consts_i[start_idx], constants, count * sizeof(*constants));
if (TRACE_ON(d3d))
{
@@ -2246,16 +2164,11 @@ HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device,
HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
unsigned int start_idx, unsigned int count, const struct wined3d_vec4 *constants)
{
- const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
unsigned int i;
TRACE("device %p, start_idx %u, count %u, constants %p.\n",
device, start_idx, count, constants);
- if (!constants || start_idx >= d3d_info->limits.ps_uniform_count
- || count > d3d_info->limits.ps_uniform_count - start_idx)
- return WINED3DERR_INVALIDCALL;
-
memcpy(&device->state.ps_consts_f[start_idx], constants, count * sizeof(*constants));
if (TRACE_ON(d3d))
{
@@ -3520,12 +3433,6 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
TRACE("device %p, stage %u, state %s, value %#x.\n",
device, stage, debug_d3dtexturestate(state), value);
- if (state > WINED3D_HIGHEST_TEXTURE_STATE)
- {
- WARN("Invalid state %#x passed.\n", state);
- return;
- }
-
if (stage >= d3d_info->limits.ffp_blend_stages)
{
WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n",
--
2.25.1
More information about the wine-devel
mailing list