[Mesa-dev] [PATCH 09/14] mesa: In emit_texenv() type mismatch was forced with typecast
Chris Forbes
chrisf at ijw.co.nz
Wed Mar 26 13:28:05 PDT 2014
On Thu, Mar 27, 2014 at 2:20 AM, Juha-Pekka Heikkila
<juhapekka.heikkila at gmail.com> wrote:
> Type mismatch caused random memory to be copied when casted
> memory area was smaller than expected type.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
> src/mesa/main/ff_fragment_shader.cpp | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
> index cad67aa..1138fd9 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -888,14 +888,17 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
> shift = new(p->mem_ctx) ir_constant((float)(1 << rgb_shift));
> }
> else {
> - float const_data[4] = {
> - float(1 << rgb_shift),
> - float(1 << rgb_shift),
> - float(1 << rgb_shift),
> - float(1 << alpha_shift)
> - };
> - shift = new(p->mem_ctx) ir_constant(glsl_type::vec4_type,
> - (ir_constant_data *)const_data);
> + ir_constant_data const_data = {
> + .f = {
C99ism here is going to upset MSVC.
> + float(1 << rgb_shift),
> + float(1 << rgb_shift),
> + float(1 << rgb_shift),
> + float(1 << alpha_shift)
> + }
> + };
> +
> + shift = new(p->mem_ctx) ir_constant(glsl_type::vec4_type,
> + &const_data);
> }
>
> return saturate(mul(deref, shift));
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list