wined3d: Add compute shader type.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-06-21 13:09:56 +02:00 committed by Alexandre Julliard
parent 03ed7f483d
commit b30f59c567
8 changed files with 40 additions and 6 deletions

View File

@ -4842,7 +4842,8 @@ static void shader_arb_disable(void *shader_priv, struct wined3d_context *contex
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
| (1u << WINED3D_SHADER_TYPE_DOMAIN)
| (1u << WINED3D_SHADER_TYPE_COMPUTE);
}
/* Context activation is done by the caller. */
@ -5117,6 +5118,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;
caps->cs_version = 0;
if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
{

View File

@ -1987,7 +1987,8 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
| (1u << WINED3D_SHADER_TYPE_DOMAIN)
| (1u << WINED3D_SHADER_TYPE_COMPUTE);
/* 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

View File

@ -3839,6 +3839,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter, DWORD
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.cs_version = shader_caps.cs_version;
adapter->d3d_info.limits.vs_uniform_count = shader_caps.vs_uniform_count;
adapter->d3d_info.limits.ps_uniform_count = shader_caps.ps_uniform_count;
adapter->d3d_info.limits.varying_count = shader_caps.varying_count;

View File

@ -279,6 +279,7 @@ static const char *debug_gl_shader_type(GLenum type)
WINED3D_TO_STR(GL_TESS_EVALUATION_SHADER);
WINED3D_TO_STR(GL_GEOMETRY_SHADER);
WINED3D_TO_STR(GL_FRAGMENT_SHADER);
WINED3D_TO_STR(GL_COMPUTE_SHADER);
#undef WINED3D_TO_STR
default:
return wine_dbg_sprintf("UNKNOWN(%#x)", type);
@ -304,6 +305,9 @@ static const char *shader_glsl_get_prefix(enum wined3d_shader_type type)
case WINED3D_SHADER_TYPE_PIXEL:
return "ps";
case WINED3D_SHADER_TYPE_COMPUTE:
return "cs";
default:
FIXME("Unhandled shader type %#x.\n", type);
return "unknown";
@ -8092,7 +8096,8 @@ static void shader_glsl_invalidate_current_program(struct wined3d_context *conte
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
| (1u << WINED3D_SHADER_TYPE_DOMAIN)
| (1u << WINED3D_SHADER_TYPE_COMPUTE);
}
/* Context activation is done by the caller. */
@ -8492,6 +8497,7 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s
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);
caps->cs_version = min(wined3d_settings.max_sm_cs, shader_model);
caps->vs_uniform_count = min(WINED3D_MAX_VS_CONSTS_F, gl_info->limits.glsl_vs_float_constants);
caps->ps_uniform_count = min(WINED3D_MAX_PS_CONSTS_F, gl_info->limits.glsl_ps_float_constants);

View File

@ -582,6 +582,11 @@ static void shader_set_limits(struct wined3d_shader *shader)
{WINED3D_SHADER_VERSION(3, 0), WINED3D_SHADER_VERSION(3, 0), {16, 16, 224, 16, 0, 12}},
{WINED3D_SHADER_VERSION(4, 0), WINED3D_SHADER_VERSION(5, 0), {16, 0, 0, 0, 0, 32}},
{0}
},
cs_limits[] =
{
/* min_version, max_version, sampler, constant_int, constant_float, constant_bool, packed_output, packed_input */
{WINED3D_SHADER_VERSION(5, 0), WINED3D_SHADER_VERSION(5, 0), {16, 0, 0, 0, 0, 0}},
};
const struct limits_entry *limits_array;
DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major,
@ -608,6 +613,9 @@ static void shader_set_limits(struct wined3d_shader *shader)
case WINED3D_SHADER_TYPE_PIXEL:
limits_array = ps_limits;
break;
case WINED3D_SHADER_TYPE_COMPUTE:
limits_array = cs_limits;
break;
}
while (limits_array[i].min_version && limits_array[i].min_version <= shader_version)
@ -2111,6 +2119,10 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
type_prefix = "ps";
break;
case WINED3D_SHADER_TYPE_COMPUTE:
type_prefix = "cs";
break;
default:
FIXME("Unhandled shader type %#x.\n", shader_version.type);
type_prefix = "unknown";
@ -2413,7 +2425,8 @@ static void shader_none_disable(void *shader_priv, struct wined3d_context *conte
| (1u << WINED3D_SHADER_TYPE_VERTEX)
| (1u << WINED3D_SHADER_TYPE_GEOMETRY)
| (1u << WINED3D_SHADER_TYPE_HULL)
| (1u << WINED3D_SHADER_TYPE_DOMAIN);
| (1u << WINED3D_SHADER_TYPE_DOMAIN)
| (1u << WINED3D_SHADER_TYPE_COMPUTE);
}
static HRESULT shader_none_alloc(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
@ -2475,6 +2488,7 @@ static void shader_none_get_caps(const struct wined3d_gl_info *gl_info, struct s
caps->ds_version = 0;
caps->gs_version = 0;
caps->ps_version = 0;
caps->cs_version = 0;
caps->vs_uniform_count = 0;
caps->ps_uniform_count = 0;
caps->ps_1x_max_value = 0.0f;
@ -2584,8 +2598,11 @@ static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *b
case WINED3D_SHADER_TYPE_PIXEL:
backend_version = d3d_info->limits.ps_version;
break;
case WINED3D_SHADER_TYPE_COMPUTE:
backend_version = d3d_info->limits.cs_version;
break;
default:
FIXME("No backend version-checking for this shader type\n");
FIXME("No backend version-checking for this shader type.\n");
backend_version = 0;
}
if (reg_maps->shader_version.major > backend_version)

View File

@ -4186,6 +4186,7 @@ const char *debug_shader_type(enum wined3d_shader_type type)
WINED3D_TO_STR(WINED3D_SHADER_TYPE_GEOMETRY);
WINED3D_TO_STR(WINED3D_SHADER_TYPE_HULL);
WINED3D_TO_STR(WINED3D_SHADER_TYPE_DOMAIN);
WINED3D_TO_STR(WINED3D_SHADER_TYPE_COMPUTE);
#undef WINED3D_TO_STR
default:
FIXME("Unrecognized shader type %#x.\n", type);

View File

@ -89,6 +89,7 @@ struct wined3d_settings wined3d_settings =
~0U, /* No DS shader model limit by default. */
~0U, /* No GS shader model limit by default. */
~0U, /* No PS shader model limit by default. */
~0u, /* No CS shader model limit by default. */
FALSE, /* 3D support enabled by default. */
};
@ -325,6 +326,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
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))
TRACE("Limiting PS shader model to %u.\n", wined3d_settings.max_sm_ps);
if (!get_config_key_dword(hkey, appkey, "MaxShaderModelCS", &wined3d_settings.max_sm_cs))
TRACE("Limiting CS shader model to %u.\n", wined3d_settings.max_sm_cs);
if (!get_config_key(hkey, appkey, "DirectDrawRenderer", buffer, size)
&& !strcmp(buffer, "gdi"))
{

View File

@ -308,6 +308,7 @@ struct wined3d_settings
unsigned int max_sm_ds;
unsigned int max_sm_gs;
unsigned int max_sm_ps;
unsigned int max_sm_cs;
BOOL no_3d;
};
@ -738,6 +739,7 @@ enum wined3d_shader_type
WINED3D_SHADER_TYPE_GEOMETRY,
WINED3D_SHADER_TYPE_HULL,
WINED3D_SHADER_TYPE_DOMAIN,
WINED3D_SHADER_TYPE_COMPUTE,
WINED3D_SHADER_TYPE_COUNT,
};
@ -981,6 +983,7 @@ struct shader_caps
unsigned int ds_version;
unsigned int gs_version;
unsigned int ps_version;
unsigned int cs_version;
DWORD vs_uniform_count;
DWORD ps_uniform_count;
@ -2004,7 +2007,7 @@ struct wined3d_driver_info
struct wined3d_d3d_limits
{
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version;
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version, cs_version;
DWORD vs_uniform_count;
DWORD ps_uniform_count;
UINT varying_count;