Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| index 75809356337b366dc3d2653e2252e5034333a549..b7c4895deba062eeb31e613ccf50f94c05992442 100644 |
| --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp |
| @@ -340,7 +340,6 @@ ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* |
| return ScriptValue::createNull(scriptState); |
| } |
| - bool floatType = false; |
| switch (internalformat) { |
| // Renderbuffer doesn't support unsized internal formats, |
| @@ -395,7 +394,6 @@ ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* |
| synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invalid internalformat when EXT_color_buffer_float is not enabled"); |
| return ScriptValue::createNull(scriptState); |
| } |
| - floatType = true; |
| break; |
| default: |
| synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invalid internalformat"); |
| @@ -407,20 +405,14 @@ ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* |
| { |
| std::unique_ptr<GLint[]> values; |
| GLint length = -1; |
| - if (!floatType) { |
| - contextGL()->GetInternalformativ(target, internalformat, GL_NUM_SAMPLE_COUNTS, 1, &length); |
| - if (length <= 0) |
| - return WebGLAny(scriptState, DOMInt32Array::create(0)); |
| - |
| - values = wrapArrayUnique(new GLint[length]); |
| - for (GLint ii = 0; ii < length; ++ii) |
| - values[ii] = 0; |
| - contextGL()->GetInternalformativ(target, internalformat, GL_SAMPLES, length, values.get()); |
| - } else { |
| - length = 1; |
| - values = wrapArrayUnique(new GLint[1]); |
| - values[0] = 1; |
| - } |
| + contextGL()->GetInternalformativ(target, internalformat, GL_NUM_SAMPLE_COUNTS, 1, &length); |
| + if (length <= 0) |
| + return WebGLAny(scriptState, DOMInt32Array::create(0)); |
| + |
| + values = wrapArrayUnique(new GLint[length]); |
| + for (GLint ii = 0; ii < length; ++ii) |
| + values[ii] = 0; |
| + contextGL()->GetInternalformativ(target, internalformat, GL_SAMPLES, length, values.get()); |
| return WebGLAny(scriptState, DOMInt32Array::create(values.get(), length)); |
| } |
| default: |
| @@ -633,6 +625,7 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( |
| GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, |
| const char* functionName) |
| { |
| + bool floatType = false; |
| switch (internalformat) { |
| case GL_R8UI: |
| case GL_R8I: |
| @@ -658,6 +651,14 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( |
| "for integer formats, samples > 0"); |
| return; |
| } |
| + case GL_R16F: |
| + case GL_RG16F: |
| + case GL_RGBA16F: |
| + case GL_R32F: |
| + case GL_RG32F: |
| + case GL_RGBA32F: |
| + case GL_R11F_G11F_B10F: |
| + floatType = true; |
|
yunchao
2016/08/01 02:49:42
The fall-through code here will be executed for in
|
| case GL_R8: |
| case GL_RG8: |
| case GL_RGB8: |
| @@ -673,6 +674,10 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( |
| case GL_DEPTH24_STENCIL8: |
| case GL_DEPTH32F_STENCIL8: |
| case GL_STENCIL_INDEX8: |
| + if (floatType && !extensionEnabled(EXTColorBufferFloatName)) { |
| + synthesizeGLError(GL_INVALID_ENUM, functionName, "EXT_color_buffer_float not enabled"); |
| + return; |
| + } |
| if (!samples) { |
| contextGL()->RenderbufferStorage(target, internalformat, width, height); |
| } else { |
| @@ -694,23 +699,6 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( |
| } |
| contextGL()->RenderbufferStorage(target, GL_DEPTH24_STENCIL8, width, height); |
| break; |
| - case GL_R16F: |
| - case GL_RG16F: |
| - case GL_RGBA16F: |
| - case GL_R32F: |
| - case GL_RG32F: |
| - case GL_RGBA32F: |
| - case GL_R11F_G11F_B10F: |
| - if (!extensionEnabled(EXTColorBufferFloatName)) { |
| - synthesizeGLError(GL_INVALID_ENUM, functionName, "EXT_color_buffer_float not enabled"); |
| - return; |
| - } |
| - if (samples) { |
| - synthesizeGLError(GL_INVALID_VALUE, functionName, "multisampled float buffers not supported"); |
| - return; |
| - } |
| - contextGL()->RenderbufferStorage(target, internalformat, width, height); |
| - break; |
| default: |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat"); |
| return; |