Commit 0e0e3b76 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move "ffp_proj_control" to the fragment caps.

parent 75a38fa2
......@@ -328,6 +328,7 @@ struct shader_arb_priv
const struct wined3d_context *last_context;
const struct fragment_pipeline *fragment_pipe;
BOOL ffp_proj_control;
};
/* Context activation for state handlers is done by the caller. */
......@@ -4270,7 +4271,7 @@ static GLuint shader_arb_generate_vshader(const struct wined3d_shader *shader,
const char *color_init = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_0001);
shader_addline(buffer, "MOV result.color.secondary, %s;\n", color_init);
if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !priv->fragment_pipe->ffp_proj_control)
if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !priv->ffp_proj_control)
{
int i;
const char *one = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_ONE);
......@@ -4889,6 +4890,7 @@ static const struct wine_rb_functions sig_tree_functions =
static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct fragment_pipeline *fragment_pipe)
{
struct shader_arb_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv));
struct fragment_caps fragment_caps;
void *fragment_priv;
if (!(fragment_priv = fragment_pipe->alloc_private(&arb_program_shader_backend, priv)))
......@@ -4917,6 +4919,9 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct frag
ERR("RB tree init failed\n");
goto fail;
}
fragment_pipe->get_caps(&device->adapter->gl_info, &fragment_caps);
priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
device->fragment_priv = fragment_priv;
priv->fragment_pipe = fragment_pipe;
device->shader_priv = priv;
......@@ -5629,7 +5634,7 @@ static BOOL shader_arb_has_ffp_proj_control(void *shader_priv)
{
struct shader_arb_priv *priv = shader_priv;
return priv->fragment_pipe->ffp_proj_control;
return priv->ffp_proj_control;
}
const struct wined3d_shader_backend_ops arb_program_shader_backend =
......@@ -5731,6 +5736,7 @@ static void arbfp_free(struct wined3d_device *device)
static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
{
caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
WINED3DTEXOPCAPS_SELECTARG1 |
......@@ -6673,7 +6679,6 @@ const struct fragment_pipeline arbfp_fragment_pipeline = {
arbfp_free,
shader_arb_color_fixup_supported,
arbfp_fragmentstate_template,
TRUE /* We can disable projected textures */
};
struct arbfp_blit_priv {
......
......@@ -1102,6 +1102,7 @@ static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
{
caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
WINED3DTEXOPCAPS_SELECTARG1 |
......@@ -1217,5 +1218,4 @@ const struct fragment_pipeline atifs_fragment_pipeline = {
atifs_free,
atifs_color_fixup_supported,
atifs_fragmentstate_template,
TRUE /* We can disable projected textures */
};
......@@ -99,6 +99,7 @@ struct shader_glsl_priv {
const struct fragment_pipeline *fragment_pipe;
struct wine_rb_tree ffp_fragment_shaders;
BOOL ffp_proj_control;
};
struct glsl_vs_program
......@@ -6075,6 +6076,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct fra
struct shader_glsl_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_glsl_priv));
SIZE_T stack_size = wined3d_log2i(max(gl_info->limits.glsl_vs_float_constants,
gl_info->limits.glsl_ps_float_constants)) + 1;
struct fragment_caps fragment_caps;
void *fragment_priv;
if (!(fragment_priv = fragment_pipe->alloc_private(&glsl_shader_backend, priv)))
......@@ -6116,6 +6118,8 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct fra
}
priv->next_constant_version = 1;
fragment_pipe->get_caps(gl_info, &fragment_caps);
priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
device->fragment_priv = fragment_priv;
priv->fragment_pipe = fragment_pipe;
......@@ -6359,7 +6363,7 @@ static BOOL shader_glsl_has_ffp_proj_control(void *shader_priv)
{
struct shader_glsl_priv *priv = shader_priv;
return priv->fragment_pipe->ffp_proj_control;
return priv->ffp_proj_control;
}
const struct wined3d_shader_backend_ops glsl_shader_backend =
......@@ -6388,6 +6392,7 @@ static void glsl_fragment_pipe_enable(const struct wined3d_gl_info *gl_info, BOO
static void glsl_fragment_pipe_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
{
caps->wined3d_caps = WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE
| WINED3DTEXOPCAPS_SELECTARG1
......@@ -6681,5 +6686,4 @@ const struct fragment_pipeline glsl_fragment_pipe =
glsl_fragment_pipe_free,
shader_glsl_color_fixup_supported,
glsl_fragment_pipe_state_template,
TRUE,
};
......@@ -670,6 +670,7 @@ static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
{
caps->wined3d_caps = 0;
caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP;
/* The caps below can be supported but aren't handled yet in utils.c
......@@ -898,7 +899,6 @@ const struct fragment_pipeline nvts_fragment_pipeline = {
nvrc_fragment_free,
nvts_color_fixup_supported,
nvrc_fragmentstate_template,
FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
};
const struct fragment_pipeline nvrc_fragment_pipeline = {
......@@ -908,5 +908,4 @@ const struct fragment_pipeline nvrc_fragment_pipeline = {
nvrc_fragment_free,
nvts_color_fixup_supported,
nvrc_fragmentstate_template,
FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
};
......@@ -1479,6 +1479,7 @@ static void shader_cleanup(struct wined3d_shader *shader)
struct shader_none_priv
{
const struct fragment_pipeline *fragment_pipe;
BOOL ffp_proj_control;
};
static void shader_none_handle_instruction(const struct wined3d_shader_instruction *ins) {}
......@@ -1505,6 +1506,7 @@ static void shader_none_select(const struct wined3d_context *context, enum wined
static HRESULT shader_none_alloc(struct wined3d_device *device, const struct fragment_pipeline *fragment_pipe)
{
struct fragment_caps fragment_caps;
struct shader_none_priv *priv;
void *fragment_priv;
......@@ -1521,6 +1523,8 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct fra
return E_FAIL;
}
fragment_pipe->get_caps(&device->adapter->gl_info, &fragment_caps);
priv->ffp_proj_control = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_PROJ_CONTROL;
device->fragment_priv = fragment_priv;
priv->fragment_pipe = fragment_pipe;
device->shader_priv = priv;
......@@ -1571,7 +1575,7 @@ static BOOL shader_none_has_ffp_proj_control(void *shader_priv)
{
struct shader_none_priv *priv = shader_priv;
return priv->fragment_pipe->ffp_proj_control;
return priv->ffp_proj_control;
}
const struct wined3d_shader_backend_ops none_shader_backend =
......
......@@ -5662,6 +5662,7 @@ static void ffp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
{
caps->wined3d_caps = 0;
caps->PrimitiveMiscCaps = 0;
caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD
| WINED3DTEXOPCAPS_ADDSIGNED
......@@ -5732,7 +5733,6 @@ const struct fragment_pipeline ffp_fragment_pipeline = {
ffp_fragment_free,
ffp_color_fixup_supported,
ffp_fragmentstate_template,
FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
};
static void fp_none_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
......@@ -5762,7 +5762,6 @@ const struct fragment_pipeline none_fragment_pipe =
fp_none_free,
fp_none_color_fixup_supported,
NULL,
FALSE,
};
static unsigned int num_handlers(const APPLYSTATEFUNC *funcs)
......
......@@ -1172,8 +1172,11 @@ struct StateEntryTemplate
enum wined3d_gl_extension extension;
};
#define WINED3D_FRAGMENT_CAP_PROJ_CONTROL 0x00000001
struct fragment_caps
{
DWORD wined3d_caps;
DWORD PrimitiveMiscCaps;
DWORD TextureOpCaps;
DWORD MaxTextureBlendStages;
......@@ -1188,7 +1191,6 @@ struct fragment_pipeline
void (*free_private)(struct wined3d_device *device);
BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
const struct StateEntryTemplate *states;
BOOL ffp_proj_control;
};
extern const struct StateEntryTemplate misc_state_template[] DECLSPEC_HIDDEN;
......
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