From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/glsl_shader.c | 1 - dlls/wined3d/utils.c | 120 ++++++++++----------------------- dlls/wined3d/wined3d_private.h | 1 - 3 files changed, 34 insertions(+), 88 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index bf6f49d3f62..24bbe1cc6a8 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -12132,7 +12132,6 @@ static void glsl_fragment_pipe_get_caps(const struct wined3d_adapter *adapter, s const struct wined3d_gl_info *gl_info = &wined3d_adapter_gl_const(adapter)->gl_info;
memset(caps, 0, sizeof(*caps)); - caps->proj_control = true; caps->srgb_write = true; caps->color_key = true; caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 642c5e64eee..91355438378 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5701,7 +5701,7 @@ void get_projection_matrix(const struct wined3d_context *context, const struct w
/* Setup this textures matrix according to the texture flags. */ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, - BOOL transformed, enum wined3d_format_id format_id, BOOL ffp_proj_control, struct wined3d_matrix *out_matrix) + BOOL transformed, enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix) { struct wined3d_matrix mat;
@@ -5719,92 +5719,41 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t
mat = *matrix;
- if (flags & WINED3D_TTFF_PROJECTED) + /* Under Direct3D the R/Z coord can be used for translation, under + * OpenGL we use the Q coord instead. */ + if (!(flags & WINED3D_TTFF_PROJECTED) && !calculated_coords) { - if (!ffp_proj_control) + switch (format_id) { - switch (flags & ~WINED3D_TTFF_PROJECTED) - { - case WINED3D_TTFF_COUNT2: - mat._14 = mat._12; - mat._24 = mat._22; - mat._34 = mat._32; - mat._44 = mat._42; - mat._12 = mat._22 = mat._32 = mat._42 = 0.0f; - break; - case WINED3D_TTFF_COUNT3: - mat._14 = mat._13; - mat._24 = mat._23; - mat._34 = mat._33; - mat._44 = mat._43; - mat._13 = mat._23 = mat._33 = mat._43 = 0.0f; - break; - } - } - } - else - { - /* Under Direct3D the R/Z coord can be used for translation, under - * OpenGL we use the Q coord instead. */ - if (!calculated_coords) - { - switch (format_id) - { - /* Direct3D passes the default 1.0 in the 2nd coord, while GL - * passes it in the 4th. Swap 2nd and 4th coord. No need to - * store the value of mat._41 in mat._21 because the input - * value to the transformation will be 0, so the matrix value - * is irrelevant. */ - case WINED3DFMT_R32_FLOAT: - mat._41 = mat._21; - mat._42 = mat._22; - mat._43 = mat._23; - mat._44 = mat._24; - break; - /* See above, just 3rd and 4th coord. */ - case WINED3DFMT_R32G32_FLOAT: - mat._41 = mat._31; - mat._42 = mat._32; - mat._43 = mat._33; - mat._44 = mat._34; - break; - case WINED3DFMT_R32G32B32_FLOAT: /* Opengl defaults match dx defaults */ - case WINED3DFMT_R32G32B32A32_FLOAT: /* No defaults apply, all app defined */ + /* Direct3D passes the default 1.0 in the 2nd coord, while GL + * passes it in the 4th. Swap 2nd and 4th coord. No need to + * store the value of mat._41 in mat._21 because the input + * value to the transformation will be 0, so the matrix value + * is irrelevant. */ + case WINED3DFMT_R32_FLOAT: + mat._41 = mat._21; + mat._42 = mat._22; + mat._43 = mat._23; + mat._44 = mat._24; + break; + /* See above, just 3rd and 4th coord. */ + case WINED3DFMT_R32G32_FLOAT: + mat._41 = mat._31; + mat._42 = mat._32; + mat._43 = mat._33; + mat._44 = mat._34; + break; + case WINED3DFMT_R32G32B32_FLOAT: /* Opengl defaults match dx defaults */ + case WINED3DFMT_R32G32B32A32_FLOAT: /* No defaults apply, all app defined */
- /* This is to prevent swapping the matrix lines and put the default 4th coord = 1.0 - * into a bad place. The division elimination below will apply to make sure the - * 1.0 doesn't do anything bad. The caller will set this value if the stride is 0 - */ - case WINED3DFMT_UNKNOWN: /* No texture coords, 0/0/0/1 defaults are passed */ - break; - default: - FIXME("Unexpected fixed function texture coord input\n"); - } - } - if (!ffp_proj_control) - { - switch (flags & ~WINED3D_TTFF_PROJECTED) - { - /* case WINED3D_TTFF_COUNT1: Won't ever get here. */ - case WINED3D_TTFF_COUNT2: - mat._13 = mat._23 = mat._33 = mat._43 = 0.0f; - /* OpenGL divides the first 3 vertex coordinates by the 4th by - * default, which is essentially the same as D3DTTFF_PROJECTED. - * Make sure that the 4th coordinate evaluates to 1.0 to - * eliminate that. - * - * If the fixed function pipeline is used, the 4th value - * remains unused, so there is no danger in doing this. With - * vertex shaders we have a problem. Should an application hit - * that problem, the code here would have to check for pixel - * shaders, and the shader has to undo the default GL divide. - * - * A more serious problem occurs if the application passes 4 - * coordinates in, and the 4th is != 1.0 (OpenGL default). - * This would have to be fixed with immediate mode draws. */ - default: - mat._14 = mat._24 = mat._34 = 0.0f; mat._44 = 1.0f; - } + /* This is to prevent swapping the matrix lines and put the default 4th coord = 1.0 + * into a bad place. The division elimination below will apply to make sure the + * 1.0 doesn't do anything bad. The caller will set this value if the stride is 0 + */ + case WINED3DFMT_UNKNOWN: /* No texture coords, 0/0/0/1 defaults are passed */ + break; + default: + FIXME("Unexpected fixed function texture coord input\n"); } }
@@ -5824,8 +5773,7 @@ void get_texture_matrix(const struct wined3d_context *context, const struct wine generated, context->stream_info.position_transformed, context->stream_info.use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx)) ? context->stream_info.elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->id - : WINED3DFMT_UNKNOWN, - context->d3d_info->ffp_fragment_caps.proj_control, mat); + : WINED3DFMT_UNKNOWN, mat); }
void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 96762351f21..1c70b65dd8c 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -197,7 +197,6 @@ struct fragment_caps unsigned int TextureOpCaps; unsigned int max_blend_stages; unsigned int max_textures; - bool proj_control; bool srgb_write; bool color_key; };