nouveau: fix undefined behaviour when testing sample_count

NOTE: This is a candidate for the 9.0 branch.
This commit is contained in:
Christoph Bumiller 2013-01-19 20:53:22 +01:00
parent b0863c26d4
commit 7d2d450ea6
3 changed files with 6 additions and 0 deletions

View file

@ -244,6 +244,8 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen,
unsigned sample_count,
unsigned bindings)
{
if (sample_count > 4)
return FALSE;
if (!(0x00000017 & (1 << sample_count)))
return FALSE;

View file

@ -50,6 +50,8 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
unsigned sample_count,
unsigned bindings)
{
if (sample_count > 8)
return FALSE;
if (!(0x117 & (1 << sample_count))) /* 0, 1, 2, 4 or 8 */
return FALSE;
if (sample_count == 8 && util_format_get_blocksizebits(format) >= 128)

View file

@ -39,6 +39,8 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen,
unsigned sample_count,
unsigned bindings)
{
if (sample_count > 8)
return FALSE;
if (!(0x117 & (1 << sample_count))) /* 0, 1, 2, 4 or 8 */
return FALSE;