diff options
author | Chris Robinson <[email protected]> | 2018-05-23 19:49:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-05-23 19:49:49 -0700 |
commit | 422cf429e61c610f271a05c9b5ac44c60b7e58fe (patch) | |
tree | 050e7d59215ff448e2f34281da6db5530955e704 /Alc/ALc.c | |
parent | 93de5350b9d41c4106bc6a6ccfc23e1bc5f48482 (diff) |
Clamp the dither depth between 2 and 20 bits
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -2217,9 +2217,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) break; } } - else if(depth > 24) - depth = 24; - device->DitherDepth = (depth > 0) ? powf(2.0f, (ALfloat)(depth-1)) : 0.0f; + + if(depth > 0) + { + depth = clampi(depth, 2, 20); + device->DitherDepth = powf(2.0f, (ALfloat)(depth-1)); + } } if(!(device->DitherDepth > 0.0f)) TRACE("Dithering disabled\n"); |