mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
isl/state: Refactor the setup of clear colors
This commit switches clear colors to use #if's instead of a C if. This lets us properly handle SNB where the clear color field doesn't exist. Reviewed-by: Chad Versace <chad.versace@intel.com> Cc: "12.0" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
parent
62a5e6e031
commit
87f0ffa646
1 changed files with 22 additions and 18 deletions
|
|
@ -373,31 +373,35 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (GEN_GEN <= 8) {
|
#if GEN_GEN >= 9
|
||||||
/* Prior to Sky Lake, we only have one bit for the clear color which
|
s.RedClearColor = info->clear_color.u32[0];
|
||||||
* gives us 0 or 1 in whatever the surface's format happens to be.
|
s.GreenClearColor = info->clear_color.u32[1];
|
||||||
*/
|
s.BlueClearColor = info->clear_color.u32[2];
|
||||||
if (isl_format_has_int_channel(info->view->format)) {
|
s.AlphaClearColor = info->clear_color.u32[3];
|
||||||
for (unsigned i = 0; i < 4; i++) {
|
#elif GEN_GEN >= 7
|
||||||
assert(info->clear_color.u32[i] == 0 ||
|
/* Prior to Sky Lake, we only have one bit for the clear color which
|
||||||
info->clear_color.u32[i] == 1);
|
* gives us 0 or 1 in whatever the surface's format happens to be.
|
||||||
}
|
*/
|
||||||
} else {
|
if (isl_format_has_int_channel(info->view->format)) {
|
||||||
for (unsigned i = 0; i < 4; i++) {
|
for (unsigned i = 0; i < 4; i++) {
|
||||||
assert(info->clear_color.f32[i] == 0.0f ||
|
assert(info->clear_color.u32[i] == 0 ||
|
||||||
info->clear_color.f32[i] == 1.0f);
|
info->clear_color.u32[i] == 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s.RedClearColor = info->clear_color.u32[0] != 0;
|
s.RedClearColor = info->clear_color.u32[0] != 0;
|
||||||
s.GreenClearColor = info->clear_color.u32[1] != 0;
|
s.GreenClearColor = info->clear_color.u32[1] != 0;
|
||||||
s.BlueClearColor = info->clear_color.u32[2] != 0;
|
s.BlueClearColor = info->clear_color.u32[2] != 0;
|
||||||
s.AlphaClearColor = info->clear_color.u32[3] != 0;
|
s.AlphaClearColor = info->clear_color.u32[3] != 0;
|
||||||
} else {
|
} else {
|
||||||
s.RedClearColor = info->clear_color.u32[0];
|
for (unsigned i = 0; i < 4; i++) {
|
||||||
s.GreenClearColor = info->clear_color.u32[1];
|
assert(info->clear_color.f32[i] == 0.0f ||
|
||||||
s.BlueClearColor = info->clear_color.u32[2];
|
info->clear_color.f32[i] == 1.0f);
|
||||||
s.AlphaClearColor = info->clear_color.u32[3];
|
}
|
||||||
|
s.RedClearColor = info->clear_color.f32[0] != 0.0f;
|
||||||
|
s.GreenClearColor = info->clear_color.f32[1] != 0.0f;
|
||||||
|
s.BlueClearColor = info->clear_color.f32[2] != 0.0f;
|
||||||
|
s.AlphaClearColor = info->clear_color.f32[3] != 0.0f;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
|
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue