Remove client-side validation for renderbufferStorageMultisample.
This code predates the command buffer's support for validating all of
ES 3.0. It causes a synchronous round-trip call which is very slow.
Move the check to the validating command decoder. ANGLE, via
passthrough, already handles this correctly.
Bug: 1103473
Change-Id: I253ddac05abb3145adfc2170da4515458e79dcbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2289057
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Reviewed-by: James Darpinian <jdarpinian@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#787465}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6bbe37f8ce023cc5959fafb0feb335dcec2c9c7c
diff --git a/command_buffer/service/gles2_cmd_decoder.cc b/command_buffer/service/gles2_cmd_decoder.cc
index 83a3951..ccba700 100644
--- a/command_buffer/service/gles2_cmd_decoder.cc
+++ b/command_buffer/service/gles2_cmd_decoder.cc
@@ -9427,6 +9427,25 @@
GLenum internalformat,
GLsizei width,
GLsizei height) {
+ // Must check against the internal format's maximum number of samples
+ // first in order to generate the correct INVALID_OPERATION rather than
+ // INVALID_VALUE, below.
+ if (feature_info_->IsES3Capable() &&
+ !GLES2Util::IsIntegerFormat(internalformat)) {
+ std::vector<GLint> sample_counts;
+ GLsizei num_sample_counts = InternalFormatSampleCountsHelper(
+ GL_RENDERBUFFER, internalformat, &sample_counts);
+ // SwiftShader reports 0 samples for GL_DEPTH24_STENCIL8; be robust to this.
+ if (num_sample_counts > 0) {
+ if (samples > sample_counts[0]) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
+ "glRenderbufferStorageMultisample",
+ "samples out of range for internalformat");
+ return false;
+ }
+ }
+ }
+
if (samples > renderbuffer_manager()->max_samples()) {
LOCAL_SET_GL_ERROR(
GL_INVALID_VALUE,