Bug 1784338 - Clamp webgl.blendColor in no-ext webgl1. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D215672
This commit is contained in:
@@ -2904,6 +2904,17 @@ void ClientWebGLContext::BlendColor(GLclampf r, GLclampf g, GLclampf b,
|
||||
if (IsContextLost()) return;
|
||||
auto& state = State();
|
||||
|
||||
const bool unclamped =
|
||||
(mIsWebGL2 ||
|
||||
IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float) ||
|
||||
IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float));
|
||||
if (!unclamped) {
|
||||
r = std::clamp(r, 0.0f, 1.0f);
|
||||
g = std::clamp(g, 0.0f, 1.0f);
|
||||
b = std::clamp(b, 0.0f, 1.0f);
|
||||
a = std::clamp(a, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
auto& cache = state.mBlendColor;
|
||||
cache[0] = r;
|
||||
cache[1] = g;
|
||||
|
||||
Reference in New Issue
Block a user