[PATCH 2/6] wined3d: Clean up buffer_internal_preload().

Henri Verbeet hverbeet at gmail.com
Wed Oct 19 06:31:49 CDT 2016


On 16 October 2016 at 21:46, Józef Kucia <jkucia at codeweavers.com> wrote:
> -static inline void fixup_transformed_pos(float *p)
> +static inline unsigned int fixup_transformed_pos(float *p)
>  {
>      /* rhw conversion like in position_float4(). */
>      if (p[3] != 1.0f && p[3] != 0.0f)
> @@ -452,6 +454,8 @@ static inline void fixup_transformed_pos(float *p)
>          p[2] *= w;
>          p[3] = w;
>      }
> +
> +    return 4 * sizeof(*p);
>  }
Since you're cleaning things up, note that this should probably use
struct wined3d_vec4.

> -        for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertices); ++i)
> +        for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertex_count); ++i)
>          {
> -            for (j = 0; j < buffer->stride; ++j)
> +            for (j = 0; j < buffer->stride;)
>              {
>                  switch (buffer->conversion_map[j])
>                  {
In general this conversion code shouldn't be used a lot, but I could
imagine it being better to loop over the vertices in the fixup
functions instead of in the outer loop.



More information about the wine-devel mailing list