Commit ea92105d authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Add domain shader type.

parent a69c92d6
......@@ -4833,7 +4833,8 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL);
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
}
/* Context activation is done by the caller. */
......@@ -5122,6 +5123,7 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh
}
caps->hs_version = 0;
caps->ds_version = 0;
caps->gs_version = 0;
if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
......
......@@ -1961,7 +1961,8 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
ret->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL);
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
/* If this happens to be the first context for the device, dummy textures
* are not created yet. In that case, they will be created (and bound) by
......
......@@ -3777,6 +3777,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
adapter->d3d_info.vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING;
adapter->d3d_info.limits.vs_version = shader_caps.vs_version;
adapter->d3d_info.limits.hs_version = shader_caps.hs_version;
adapter->d3d_info.limits.ds_version = shader_caps.ds_version;
adapter->d3d_info.limits.gs_version = shader_caps.gs_version;
adapter->d3d_info.limits.ps_version = shader_caps.ps_version;
adapter->d3d_info.limits.vs_uniform_count = shader_caps.vs_uniform_count;
......
......@@ -271,6 +271,7 @@ static const char *debug_gl_shader_type(GLenum type)
#define WINED3D_TO_STR(u) case u: return #u
WINED3D_TO_STR(GL_VERTEX_SHADER);
WINED3D_TO_STR(GL_TESS_CONTROL_SHADER);
WINED3D_TO_STR(GL_TESS_EVALUATION_SHADER);
WINED3D_TO_STR(GL_GEOMETRY_SHADER);
WINED3D_TO_STR(GL_FRAGMENT_SHADER);
#undef WINED3D_TO_STR
......@@ -289,6 +290,9 @@ static const char *shader_glsl_get_prefix(enum wined3d_shader_type type)
case WINED3D_SHADER_TYPE_HULL:
return "hs";
case WINED3D_SHADER_TYPE_DOMAIN:
return "ds";
case WINED3D_SHADER_TYPE_GEOMETRY:
return "gs";
......@@ -7677,7 +7681,8 @@ static void shader_glsl_invalidate_current_program(struct wined3d_context *conte
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL);
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
}
/* Context activation is done by the caller. */
......@@ -8076,6 +8081,7 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
caps->vs_version = min(wined3d_settings.max_sm_vs, shader_model);
caps->hs_version = min(wined3d_settings.max_sm_hs, shader_model);
caps->ds_version = min(wined3d_settings.max_sm_ds, shader_model);
caps->gs_version = min(wined3d_settings.max_sm_gs, shader_model);
caps->ps_version = min(wined3d_settings.max_sm_ps, shader_model);
......
......@@ -319,6 +319,7 @@ static const struct wined3d_shader_frontend *shader_select_frontend(DWORD versio
case WINED3D_SM4_VS:
case WINED3D_SM4_GS:
case WINED3D_SM5_HS:
case WINED3D_SM5_DS:
return &sm4_shader_frontend;
default:
......@@ -526,6 +527,11 @@ static void shader_set_limits(struct wined3d_shader *shader)
/* min_version, max_version, sampler, constant_int, constant_float, constant_bool, packed_output, packet_input */
{WINED3D_SHADER_VERSION(5, 0), WINED3D_SHADER_VERSION(5, 0), {16, 0, 0, 0, 32, 32}},
},
ds_limits[] =
{
/* min_version, max_version, sampler, constant_int, constant_float, constant_bool, packed_output, packet_input */
{WINED3D_SHADER_VERSION(5, 0), WINED3D_SHADER_VERSION(5, 0), {16, 0, 0, 0, 32, 32}},
},
gs_limits[] =
{
/* min_version, max_version, sampler, constant_int, constant_float, constant_bool, packed_output, packed_input */
......@@ -560,6 +566,9 @@ static void shader_set_limits(struct wined3d_shader *shader)
case WINED3D_SHADER_TYPE_HULL:
limits_array = hs_limits;
break;
case WINED3D_SHADER_TYPE_DOMAIN:
limits_array = ds_limits;
break;
case WINED3D_SHADER_TYPE_GEOMETRY:
limits_array = gs_limits;
break;
......@@ -2038,6 +2047,10 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
type_prefix = "hs";
break;
case WINED3D_SHADER_TYPE_DOMAIN:
type_prefix = "ds";
break;
case WINED3D_SHADER_TYPE_GEOMETRY:
type_prefix = "gs";
break;
......@@ -2337,7 +2350,8 @@ static void shader_none_disable(void *shader_priv, struct wined3d_context *conte
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL);
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
}
static HRESULT shader_none_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
......@@ -2396,6 +2410,7 @@ static void shader_none_get_caps(const struct wined3d_gl_info *gl_info, struct s
/* Set the shader caps to 0 for the none shader backend */
caps->vs_version = 0;
caps->hs_version = 0;
caps->ds_version = 0;
caps->gs_version = 0;
caps->ps_version = 0;
caps->vs_uniform_count = 0;
......@@ -2499,6 +2514,9 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b
case WINED3D_SHADER_TYPE_HULL:
backend_version = d3d_info->limits.hs_version;
break;
case WINED3D_SHADER_TYPE_DOMAIN:
backend_version = d3d_info->limits.ds_version;
break;
case WINED3D_SHADER_TYPE_GEOMETRY:
backend_version = d3d_info->limits.gs_version;
break;
......@@ -2772,7 +2790,7 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
return hr;
}
static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_device *device,
static HRESULT vertex_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
......@@ -2801,7 +2819,20 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d
return WINED3D_OK;
}
static HRESULT hullshader_init(struct wined3d_shader *shader, struct wined3d_device *device,
static HRESULT domain_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
HRESULT hr;
if (FAILED(hr = shader_init(shader, device, desc, 0, WINED3D_SHADER_TYPE_DOMAIN, parent, parent_ops)))
return hr;
shader->load_local_constsF = shader->lconst_inf_or_nan;
return WINED3D_OK;
}
static HRESULT hull_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
HRESULT hr;
......@@ -2814,7 +2845,7 @@ static HRESULT hullshader_init(struct wined3d_shader *shader, struct wined3d_dev
return WINED3D_OK;
}
static HRESULT geometryshader_init(struct wined3d_shader *shader, struct wined3d_device *device,
static HRESULT geometry_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
HRESULT hr;
......@@ -3045,7 +3076,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
args->flatshading = state->render_states[WINED3D_RS_SHADEMODE] == WINED3D_SHADE_FLAT;
}
static HRESULT pixelshader_init(struct wined3d_shader *shader, struct wined3d_device *device,
static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
......@@ -3132,6 +3163,31 @@ void pixelshader_update_resource_types(struct wined3d_shader *shader, WORD tex_t
}
}
HRESULT CDECL wined3d_shader_create_ds(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader)
{
struct wined3d_shader *object;
HRESULT hr;
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = domain_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize domain shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created domain shader %p.\n", object);
*shader = object;
return WINED3D_OK;
}
HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader)
{
......@@ -3145,7 +3201,7 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const stru
if (!object)
return E_OUTOFMEMORY;
if (FAILED(hr = geometryshader_init(object, device, desc, parent, parent_ops)))
if (FAILED(hr = geometry_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize geometry shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
......@@ -3170,7 +3226,7 @@ HRESULT CDECL wined3d_shader_create_hs(struct wined3d_device *device, const stru
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = hullshader_init(object, device, desc, parent, parent_ops)))
if (FAILED(hr = hull_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize hull shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
......@@ -3196,7 +3252,7 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const stru
if (!object)
return E_OUTOFMEMORY;
if (FAILED(hr = pixelshader_init(object, device, desc, parent, parent_ops)))
if (FAILED(hr = pixel_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize pixel shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
......@@ -3222,7 +3278,7 @@ HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const stru
if (!object)
return E_OUTOFMEMORY;
if (FAILED(hr = vertexshader_init(object, device, desc, parent, parent_ops)))
if (FAILED(hr = vertex_shader_init(object, device, desc, parent, parent_ops)))
{
WARN("Failed to initialize vertex shader, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
......
......@@ -917,6 +917,10 @@ static void shader_sm4_read_header(void *data, const DWORD **ptr, struct wined3d
priv->shader_version.type = WINED3D_SHADER_TYPE_HULL;
break;
case WINED3D_SM5_DS:
priv->shader_version.type = WINED3D_SHADER_TYPE_DOMAIN;
break;
default:
FIXME("Unrecognized shader type %#x.\n", version_token >> 16);
}
......
......@@ -3963,6 +3963,7 @@ const char *debug_shader_type(enum wined3d_shader_type type)
WINED3D_TO_STR(WINED3D_SHADER_TYPE_VERTEX);
WINED3D_TO_STR(WINED3D_SHADER_TYPE_GEOMETRY);
WINED3D_TO_STR(WINED3D_SHADER_TYPE_HULL);
WINED3D_TO_STR(WINED3D_SHADER_TYPE_DOMAIN);
#undef WINED3D_TO_STR
default:
FIXME("Unrecognized shader type %#x.\n", type);
......
......@@ -200,6 +200,7 @@
@ cdecl wined3d_sampler_get_parent(ptr)
@ cdecl wined3d_sampler_incref(ptr)
@ cdecl wined3d_shader_create_ds(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_gs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_hs(ptr ptr ptr ptr ptr)
@ cdecl wined3d_shader_create_ps(ptr ptr ptr ptr ptr)
......
......@@ -86,6 +86,7 @@ struct wined3d_settings wined3d_settings =
FALSE, /* Don't range check relative addressing indices in float constants. */
~0U, /* No VS shader model limit by default. */
~0U, /* No HS shader model limit by default. */
~0U, /* No DS shader model limit by default. */
~0U, /* No GS shader model limit by default. */
~0U, /* No PS shader model limit by default. */
FALSE, /* 3D support enabled by default. */
......@@ -318,6 +319,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
TRACE("Limiting VS shader model to %u.\n", wined3d_settings.max_sm_vs);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelHS", &wined3d_settings.max_sm_hs))
TRACE("Limiting HS shader model to %u.\n", wined3d_settings.max_sm_hs);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelDS", &wined3d_settings.max_sm_ds))
TRACE("Limiting DS shader model to %u.\n", wined3d_settings.max_sm_ds);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelGS", &wined3d_settings.max_sm_gs))
TRACE("Limiting GS shader model to %u.\n", wined3d_settings.max_sm_gs);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelPS", &wined3d_settings.max_sm_ps))
......
......@@ -294,6 +294,7 @@ struct wined3d_settings
BOOL check_float_constants;
unsigned int max_sm_vs;
unsigned int max_sm_hs;
unsigned int max_sm_ds;
unsigned int max_sm_gs;
unsigned int max_sm_ps;
BOOL no_3d;
......@@ -486,6 +487,7 @@ enum wined3d_shader_rel_op
#define WINED3D_SM4_VS 0x0001u
#define WINED3D_SM4_GS 0x0002u
#define WINED3D_SM5_HS 0x0003u
#define WINED3D_SM5_DS 0x0004u
/* Shader version tokens, and shader end tokens */
#define WINED3DPS_VERSION(major, minor) ((WINED3D_SM1_PS << 16) | ((major) << 8) | (minor))
......@@ -689,6 +691,7 @@ enum wined3d_shader_type
WINED3D_SHADER_TYPE_VERTEX,
WINED3D_SHADER_TYPE_GEOMETRY,
WINED3D_SHADER_TYPE_HULL,
WINED3D_SHADER_TYPE_DOMAIN,
WINED3D_SHADER_TYPE_COUNT,
};
......@@ -929,6 +932,7 @@ struct shader_caps
{
unsigned int vs_version;
unsigned int hs_version;
unsigned int ds_version;
unsigned int gs_version;
unsigned int ps_version;
......@@ -1925,7 +1929,7 @@ struct wined3d_driver_info
struct wined3d_d3d_limits
{
unsigned int vs_version, hs_version, gs_version, ps_version;
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version;
DWORD vs_uniform_count;
DWORD ps_uniform_count;
UINT varying_count;
......
......@@ -2385,6 +2385,8 @@ ULONG __cdecl wined3d_sampler_decref(struct wined3d_sampler *sampler);
void * __cdecl wined3d_sampler_get_parent(const struct wined3d_sampler *sampler);
ULONG __cdecl wined3d_sampler_incref(struct wined3d_sampler *sampler);
HRESULT __cdecl wined3d_shader_create_ds(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader);
HRESULT __cdecl wined3d_shader_create_gs(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader);
HRESULT __cdecl wined3d_shader_create_hs(struct wined3d_device *device, const struct wined3d_shader_desc *desc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment