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;
|
if (IsContextLost()) return;
|
||||||
auto& state = State();
|
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;
|
auto& cache = state.mBlendColor;
|
||||||
cache[0] = r;
|
cache[0] = r;
|
||||||
cache[1] = g;
|
cache[1] = g;
|
||||||
|
|||||||
@@ -16283,7 +16283,6 @@ subsuite = "webgl1-core"
|
|||||||
|
|
||||||
["generated/test_conformance__rendering__blending.html"]
|
["generated/test_conformance__rendering__blending.html"]
|
||||||
subsuite = "webgl1-core"
|
subsuite = "webgl1-core"
|
||||||
fail-if = ["true"]
|
|
||||||
|
|
||||||
["generated/test_conformance__rendering__canvas-alpha-bug.html"]
|
["generated/test_conformance__rendering__canvas-alpha-bug.html"]
|
||||||
subsuite = "webgl1-core"
|
subsuite = "webgl1-core"
|
||||||
|
|||||||
@@ -102,10 +102,6 @@ fail-if = ["true"]
|
|||||||
# Ditto
|
# Ditto
|
||||||
fail-if = ["true"]
|
fail-if = ["true"]
|
||||||
|
|
||||||
["generated/test_conformance__rendering__blending.html"]
|
|
||||||
# Expected [1,1,1,1], was [1000,1,1,1]
|
|
||||||
fail-if = ["true"]
|
|
||||||
|
|
||||||
["generated/test_2_conformance2__reading__read-pixels-into-pixel-pack-buffer.html"]
|
["generated/test_2_conformance2__reading__read-pixels-into-pixel-pack-buffer.html"]
|
||||||
# getError expected: INVALID_ENUM. Was INVALID_OPERATION : Format should not be able to read as DEPTH_STENCIL
|
# getError expected: INVALID_ENUM. Was INVALID_OPERATION : Format should not be able to read as DEPTH_STENCIL
|
||||||
fail-if = ["true"]
|
fail-if = ["true"]
|
||||||
|
|||||||
Reference in New Issue
Block a user