Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d11/shader.c | 27 ---------------------------
dlls/d3d8/shader.c | 2 --
dlls/d3d9/shader.c | 2 --
dlls/wined3d/shader.c | 37 ++++++++++++++++++++++++++++++-------
include/wine/wined3d.h | 1 -
5 files changed, 30 insertions(+), 39 deletions(-)
diff --git a/dlls/d3d11/shader.c b/dlls/d3d11/shader.c
index 759c5702746d..a1da9effc2b8 100644
--- a/dlls/d3d11/shader.c
+++ b/dlls/d3d11/shader.c
@@ -517,27 +517,6 @@ static const struct wined3d_parent_ops d3d_vertex_shader_wined3d_parent_ops =
d3d_vertex_shader_wined3d_object_destroyed,
};
-static unsigned int d3d_sm_from_feature_level(D3D_FEATURE_LEVEL feature_level)
-{
- switch (feature_level)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return 5;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return 4;
- case D3D_FEATURE_LEVEL_9_3:
- return 3;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 2;
- default:
- ERR("Unexpected feature_level %#x.\n", feature_level);
- }
- return 0;
-}
-
static HRESULT d3d_vertex_shader_init(struct d3d_vertex_shader *shader, struct d3d_device *device,
const void *byte_code, SIZE_T byte_code_length)
{
@@ -557,7 +536,6 @@ static HRESULT d3d_vertex_shader_init(struct d3d_vertex_shader *shader, struct d
wined3d_mutex_unlock();
return hr;
}
- desc.max_version = d3d_sm_from_feature_level(device->feature_level);
hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader,
&d3d_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader);
@@ -769,7 +747,6 @@ static HRESULT d3d11_hull_shader_init(struct d3d11_hull_shader *shader, struct d
wined3d_mutex_unlock();
return hr;
}
- desc.max_version = d3d_sm_from_feature_level(device->feature_level);
hr = wined3d_shader_create_hs(device->wined3d_device, &desc, shader,
&d3d11_hull_shader_wined3d_parent_ops, &shader->wined3d_shader);
@@ -971,7 +948,6 @@ static HRESULT d3d11_domain_shader_init(struct d3d11_domain_shader *shader, stru
wined3d_mutex_unlock();
return hr;
}
- desc.max_version = d3d_sm_from_feature_level(device->feature_level);
hr = wined3d_shader_create_ds(device->wined3d_device, &desc, shader,
&d3d11_domain_shader_wined3d_parent_ops, &shader->wined3d_shader);
@@ -1477,7 +1453,6 @@ static HRESULT d3d_geometry_shader_init(struct d3d_geometry_shader *shader,
WARN("Failed to extract shader, hr %#x.\n", hr);
return hr;
}
- desc.max_version = d3d_sm_from_feature_level(device->feature_level);
memset(&so_desc, 0, sizeof(so_desc));
if (so_entries)
@@ -1827,7 +1802,6 @@ static HRESULT d3d_pixel_shader_init(struct d3d_pixel_shader *shader, struct d3d
wined3d_mutex_unlock();
return hr;
}
- desc.max_version = d3d_sm_from_feature_level(device->feature_level);
hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
&d3d_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader);
@@ -2037,7 +2011,6 @@ static HRESULT d3d11_compute_shader_init(struct d3d11_compute_shader *shader, st
wined3d_mutex_unlock();
return hr;
}
- desc.max_version = d3d_sm_from_feature_level(device->feature_level);
hr = wined3d_shader_create_cs(device->wined3d_device, &desc, shader,
&d3d11_compute_shader_wined3d_parent_ops, &shader->wined3d_shader);
diff --git a/dlls/d3d8/shader.c b/dlls/d3d8/shader.c
index 8192b238ebd7..8a6881200e8b 100644
--- a/dlls/d3d8/shader.c
+++ b/dlls/d3d8/shader.c
@@ -121,7 +121,6 @@ HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_d
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
- desc.max_version = 1;
wined3d_mutex_lock();
hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader,
@@ -173,7 +172,6 @@ HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_dev
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
- desc.max_version = 1;
wined3d_mutex_lock();
hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
diff --git a/dlls/d3d9/shader.c b/dlls/d3d9/shader.c
index 9cb398388b91..5fc356c8e8af 100644
--- a/dlls/d3d9/shader.c
+++ b/dlls/d3d9/shader.c
@@ -148,7 +148,6 @@ HRESULT vertexshader_init(struct d3d9_vertexshader *shader, struct d3d9_device *
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
- desc.max_version = 3;
wined3d_mutex_lock();
hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader,
@@ -302,7 +301,6 @@ HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *de
desc.input_signature.element_count = 0;
desc.output_signature.element_count = 0;
desc.patch_constant_signature.element_count = 0;
- desc.max_version = 3;
wined3d_mutex_lock();
hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 20d4f0773dd7..62ec97154141 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3321,8 +3321,8 @@ const struct wined3d_shader_backend_ops none_shader_backend =
shader_none_has_ffp_proj_control,
};
-static HRESULT shader_set_function(struct wined3d_shader *shader, DWORD float_const_count,
- enum wined3d_shader_type type, unsigned int max_version)
+static HRESULT shader_set_function(struct wined3d_shader *shader,
+ unsigned int float_const_count, enum wined3d_shader_type type, unsigned int max_version)
{
const struct wined3d_d3d_info *d3d_info = &shader->device->adapter->d3d_info;
struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
@@ -3351,12 +3351,12 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, DWORD float_co
if (reg_maps->shader_version.type != type)
{
- WARN("Wrong shader type %d.\n", reg_maps->shader_version.type);
+ WARN("Wrong shader type %#x.\n", reg_maps->shader_version.type);
return WINED3DERR_INVALIDCALL;
}
if (reg_maps->shader_version.major > max_version)
{
- WARN("Shader version %d not supported by this D3D API version.\n", reg_maps->shader_version.major);
+ WARN("Shader version %u not supported by this device.\n", reg_maps->shader_version.major);
return WINED3DERR_INVALIDCALL;
}
switch (type)
@@ -3636,17 +3636,40 @@ static HRESULT shader_signature_copy(struct wined3d_shader_signature *dst,
return WINED3D_OK;
}
+static unsigned int shader_max_version_from_feature_level(enum wined3d_feature_level level)
+{
+ switch (level)
+ {
+ case WINED3D_FEATURE_LEVEL_11_1:
+ case WINED3D_FEATURE_LEVEL_11:
+ return 5;
+ case WINED3D_FEATURE_LEVEL_10_1:
+ case WINED3D_FEATURE_LEVEL_10:
+ return 4;
+ case WINED3D_FEATURE_LEVEL_9_SM3:
+ return 3;
+ case WINED3D_FEATURE_LEVEL_9_SM2:
+ case WINED3D_FEATURE_LEVEL_9_1:
+ return 2;
+ default:
+ return 1;
+ }
+}
+
static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, DWORD float_const_count, enum wined3d_shader_type type,
void *parent, const struct wined3d_parent_ops *parent_ops)
{
+ unsigned int max_version;
size_t byte_code_size;
SIZE_T total;
HRESULT hr;
char *ptr;
- TRACE("byte_code %p, byte_code_size %#lx, format %#x, max_version %#x.\n",
- desc->byte_code, (long)desc->byte_code_size, desc->format, desc->max_version);
+ TRACE("byte_code %p, byte_code_size %#lx, format %#x.\n",
+ desc->byte_code, (long)desc->byte_code_size, desc->format);
+
+ max_version = shader_max_version_from_feature_level(device->feature_level);
if (!(shader->frontend = shader_select_frontend(desc->format)))
{
@@ -3732,7 +3755,7 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
memcpy(shader->function, desc->byte_code, byte_code_size);
shader->functionLength = byte_code_size;
- if (FAILED(hr = shader_set_function(shader, float_const_count, type, desc->max_version)))
+ if (FAILED(hr = shader_set_function(shader, float_const_count, type, max_version)))
{
WARN("Failed to set function, hr %#x.\n", hr);
shader_cleanup(shader);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index ef89caf0633f..dc613fff2b2b 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2063,7 +2063,6 @@ struct wined3d_shader_desc
struct wined3d_shader_signature input_signature;
struct wined3d_shader_signature output_signature;
struct wined3d_shader_signature patch_constant_signature;
- unsigned int max_version;
};
struct wined3d_stream_output_element
--
2.16.4