mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
wined3d: Calculate the texture matrix solely from the vertex declaration.
This commit is contained in:
parent
b02b73673b
commit
70258a160f
Notes:
Alexandre Julliard
2024-11-13 22:30:11 +01:00
Approved-by: Jan Sikorski (@jsikorski) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6756
3 changed files with 18 additions and 17 deletions
|
@ -3697,14 +3697,9 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
|||
if (changed->texture_matrices)
|
||||
{
|
||||
struct wined3d_ffp_vs_constants constants;
|
||||
struct wined3d_stream_info si;
|
||||
|
||||
/* FIXME: This is a bit fragile. Ideally we should be calculating
|
||||
* stream info from the stateblock state. */
|
||||
wined3d_stream_info_from_declaration(&si, context->state, &device->adapter->d3d_info);
|
||||
|
||||
for (i = 0; i < WINED3D_MAX_FFP_TEXTURES; ++i)
|
||||
get_texture_matrix(&si, state, i, &constants.texture_matrices[i]);
|
||||
get_texture_matrix(state, i, &constants.texture_matrices[i]);
|
||||
wined3d_device_context_push_constants(context,
|
||||
WINED3D_PUSH_CONSTANTS_VS_FFP, WINED3D_SHADER_CONST_FFP_TEXMATRIX,
|
||||
offsetof(struct wined3d_ffp_vs_constants, texture_matrices),
|
||||
|
|
|
@ -5649,23 +5649,29 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t
|
|||
*out_matrix = mat;
|
||||
}
|
||||
|
||||
void get_texture_matrix(const struct wined3d_stream_info *si,
|
||||
const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat)
|
||||
static enum wined3d_format_id get_texcoord_format(const struct wined3d_vertex_declaration *decl, unsigned int index)
|
||||
{
|
||||
for (unsigned int i = 0; i < decl->element_count; ++i)
|
||||
{
|
||||
if (decl->elements[i].usage == WINED3D_DECL_USAGE_TEXCOORD
|
||||
&& decl->elements[i].usage_idx == index)
|
||||
return decl->elements[i].format->id;
|
||||
}
|
||||
|
||||
return WINED3DFMT_UNKNOWN;
|
||||
}
|
||||
|
||||
void get_texture_matrix(const struct wined3d_stateblock_state *state,
|
||||
const unsigned int tex, struct wined3d_matrix *mat)
|
||||
{
|
||||
BOOL generated = (state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000)
|
||||
!= WINED3DTSS_TCI_PASSTHRU;
|
||||
unsigned int coord_idx = min(state->texture_states[tex][WINED3D_TSS_TEXCOORD_INDEX] & 0x0000ffff,
|
||||
WINED3D_MAX_FFP_TEXTURES - 1);
|
||||
enum wined3d_format_id attribute_format;
|
||||
|
||||
if (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx)))
|
||||
attribute_format = si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->id;
|
||||
else
|
||||
attribute_format = WINED3DFMT_UNKNOWN;
|
||||
|
||||
compute_texture_matrix(&state->transforms[WINED3D_TS_TEXTURE0 + tex],
|
||||
state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
|
||||
generated, attribute_format, mat);
|
||||
generated, get_texcoord_format(state->vertex_declaration, coord_idx), mat);
|
||||
}
|
||||
|
||||
void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
|
||||
|
|
|
@ -4376,8 +4376,8 @@ static inline BOOL shader_sampler_is_shadow(const struct wined3d_shader *shader,
|
|||
|
||||
void get_identity_matrix(struct wined3d_matrix *mat);
|
||||
void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned int index, struct wined3d_matrix *mat);
|
||||
void get_texture_matrix(const struct wined3d_stream_info *si,
|
||||
const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat);
|
||||
void get_texture_matrix(const struct wined3d_stateblock_state *state,
|
||||
const unsigned int tex, struct wined3d_matrix *mat);
|
||||
void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,
|
||||
float *out_min, float *out_max);
|
||||
void get_fog_start_end(const struct wined3d_context *context, const struct wined3d_state *state,
|
||||
|
|
Loading…
Reference in a new issue