mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
mesa: In emit_texenv() type mismatch was forced with typecast
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@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
6cd30f5d73
commit
fe5224b16a
1 changed files with 9 additions and 8 deletions
|
|
@ -877,14 +877,15 @@ 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;
|
||||
|
||||
const_data.f[0] = float(1 << rgb_shift);
|
||||
const_data.f[1] = float(1 << rgb_shift);
|
||||
const_data.f[2] = float(1 << rgb_shift);
|
||||
const_data.f[3] = float(1 << alpha_shift);
|
||||
|
||||
shift = new(p->mem_ctx) ir_constant(glsl_type::vec4_type,
|
||||
&const_data);
|
||||
}
|
||||
|
||||
return saturate(mul(deref, shift));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue