diff options
author | heejin.r.chung <heejin.r.chung@samsung.com> | 2015-02-04 18:44:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-05 02:44:59 +0000 |
commit | 8f143294c4f57bb04e170283a917a577fadb40c8 (patch) | |
tree | a2d4c67f842af5a38245f41ff34c7ebc87cdb43e | |
parent | bde09712d6009e38b8c88316237d0736595814f7 (diff) | |
download | chromium_src-8f143294c4f57bb04e170283a917a577fadb40c8.zip chromium_src-8f143294c4f57bb04e170283a917a577fadb40c8.tar.gz chromium_src-8f143294c4f57bb04e170283a917a577fadb40c8.tar.bz2 |
gpu: Add TransformFeedback & Uniform Buffer related consts
Added max_transform_feedback_separate_attribs, max_uniform_buffer_bindings,
and uniform_buffer_offset_alignment to Capabilities.
These were introducted in GLES 3.0.
BUG=429053
TEST=gpu_unittests
Review URL: https://codereview.chromium.org/885013002
Cr-Commit-Position: refs/heads/master@{#314725}
9 files changed, 51 insertions, 19 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index b0884b6..94c8bda1 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1508,6 +1508,10 @@ _FUNCTION_INFO = { 'type': 'Bind', 'id_mapping': [ 'Buffer' ], 'gen_func': 'GenBuffersARB', + 'valid_args': { + '3': '4', + '4': '4' + }, 'unsafe': True, }, 'BindFramebuffer': { diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 7ef5444..b047a70 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -702,6 +702,15 @@ bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) { return true; } return false; + case GL_MAX_UNIFORM_BUFFER_BINDINGS: + *params = capabilities_.max_uniform_buffer_bindings; + return true; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: + *params = capabilities_.max_transform_feedback_separate_attribs; + return true; + case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: + *params = capabilities_.uniform_buffer_offset_alignment; + return true; default: return false; } @@ -2638,6 +2647,10 @@ void GLES2Implementation::GenTransformFeedbacksHelper( // the old model but possibly not true in the new model if another context has // deleted the resource. +// NOTE #2: There is a bug in some BindXXXHelpers, that IDs might be marked as +// used even when Bind has failed. However, the bug is minor compared to the +// overhead & duplicated checking in client side. + void GLES2Implementation::BindBufferHelper( GLenum target, GLuint buffer_id) { // TODO(gman): See note #1 above. @@ -2662,8 +2675,7 @@ void GLES2Implementation::BindBufferHelper( changed = true; break; } - // TODO(gman): There's a bug here. If the target is invalid the ID will not be - // used even though it's marked it as used here. + // TODO(gman): See note #2 above. if (changed) { GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind( this, target, buffer_id, &GLES2Implementation::BindBufferStub); @@ -2679,8 +2691,7 @@ void GLES2Implementation::BindBufferStub(GLenum target, GLuint buffer) { void GLES2Implementation::BindBufferBaseHelper( GLenum target, GLuint index, GLuint buffer_id) { // TODO(zmo): See note #1 above. - // TODO(zmo): There's a bug here. If the target or index is invalid the ID - // will not be used even though it's marked it as used here. + // TODO(zmo): See note #2 above. GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind( this, target, index, buffer_id, &GLES2Implementation::BindBufferBaseStub); } @@ -2696,8 +2707,7 @@ void GLES2Implementation::BindBufferRangeHelper( GLenum target, GLuint index, GLuint buffer_id, GLintptr offset, GLsizeiptr size) { // TODO(zmo): See note #1 above. - // TODO(zmo): There's a bug here. If an arguments is invalid the ID will not - // be used even though it's marked it as used here. + // TODO(zmo): See note #2 above. GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind( this, target, index, buffer_id, offset, size, &GLES2Implementation::BindBufferRangeStub); @@ -2777,8 +2787,7 @@ void GLES2Implementation::BindRenderbufferHelper( changed = true; break; } - // TODO(gman): There's a bug here. If the target is invalid the ID will not be - // used even though it's marked it as used here. + // TODO(zmo): See note #2 above. if (changed) { GetIdHandler(id_namespaces::kRenderbuffers)->MarkAsUsedForBind( this, target, renderbuffer, @@ -2827,8 +2836,7 @@ void GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { changed = true; break; } - // TODO(gman): There's a bug here. If the target is invalid the ID will not be - // used. even though it's marked it as used here. + // TODO(gman): See note #2 above. if (changed) { GetIdHandler(id_namespaces::kTextures)->MarkAsUsedForBind( this, target, texture, &GLES2Implementation::BindTextureStub); @@ -2847,7 +2855,6 @@ void GLES2Implementation::BindTransformFeedbackHelper( } void GLES2Implementation::BindVertexArrayOESHelper(GLuint array) { - // TODO(gman): See note #1 above. bool changed = false; if (vertex_array_object_manager_->BindVertexArray(array, &changed)) { if (changed) { @@ -2878,8 +2885,7 @@ void GLES2Implementation::BindValuebufferCHROMIUMHelper(GLenum target, changed = true; break; } - // TODO(gman): There's a bug here. If the target is invalid the ID will not be - // used even though it's marked it as used here. + // TODO(gman): See note #2 above. if (changed) { GetIdHandler(id_namespaces::kValuebuffers)->MarkAsUsedForBind( this, target, valuebuffer, diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc index c88ba64..4ed0184 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest.cc +++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc @@ -378,6 +378,8 @@ class GLES2ImplementationTest : public testing::Test { static const GLint kMaxVertexUniformVectors = 128; static const GLint kNumCompressedTextureFormats = 0; static const GLint kNumShaderBinaryFormats = 0; + static const GLuint kMaxTransformFeedbackSeparateAttribs = 4; + static const GLuint kMaxUniformBufferBindings = 36; static const GLuint kStartId = 1024; static const GLuint kBuffersStartId = GLES2Implementation::kClientSideArrayId + 2 * kNumTestContexts; @@ -439,6 +441,9 @@ class GLES2ImplementationTest : public testing::Test { capabilities.num_compressed_texture_formats = kNumCompressedTextureFormats; capabilities.num_shader_binary_formats = kNumShaderBinaryFormats; + capabilities.max_transform_feedback_separate_attribs = + kMaxTransformFeedbackSeparateAttribs; + capabilities.max_uniform_buffer_bindings = kMaxUniformBufferBindings; capabilities.bind_generates_resource_chromium = bind_generates_resource_service ? 1 : 0; EXPECT_CALL(*gpu_control_, GetCapabilities()) diff --git a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index 743458b..de66681 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -55,9 +55,9 @@ TEST_F(GLES2ImplementationTest, BindBufferRange) { cmds::BindBufferRange cmd; }; Cmds expected; - expected.cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3, 4, 5); + expected.cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3, 4, 4); - gl_->BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3, 4, 5); + gl_->BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 2, 3, 4, 4); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } diff --git a/gpu/command_buffer/common/capabilities.cc b/gpu/command_buffer/common/capabilities.cc index ab33aeb..97c26d8 100644 --- a/gpu/command_buffer/common/capabilities.cc +++ b/gpu/command_buffer/common/capabilities.cc @@ -23,6 +23,9 @@ Capabilities::Capabilities() num_compressed_texture_formats(0), num_shader_binary_formats(0), bind_generates_resource_chromium(0), + max_transform_feedback_separate_attribs(0), + max_uniform_buffer_bindings(0), + uniform_buffer_offset_alignment(1), post_sub_buffer(false), egl_image_external(false), texture_format_bgra8888(false), diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h index a465ca2..92c3c19 100644 --- a/gpu/command_buffer/common/capabilities.h +++ b/gpu/command_buffer/common/capabilities.h @@ -75,6 +75,9 @@ struct GPU_EXPORT Capabilities { int num_compressed_texture_formats; int num_shader_binary_formats; int bind_generates_resource_chromium; + int max_transform_feedback_separate_attribs; + int max_uniform_buffer_bindings; + int uniform_buffer_offset_alignment; bool post_sub_buffer; bool egl_image_external; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 9ad2677..9df13b8 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -2842,6 +2842,14 @@ Capabilities GLES2DecoderImpl::GetCapabilities() { DoGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps.num_shader_binary_formats); DoGetIntegerv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &caps.bind_generates_resource_chromium); + if (unsafe_es3_apis_enabled()) { + DoGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, + &caps.max_transform_feedback_separate_attribs); + DoGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, + &caps.max_uniform_buffer_bindings); + DoGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, + &caps.uniform_buffer_offset_alignment); + } caps.egl_image_external = feature_info_->feature_flags().oes_egl_image_external; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h index 2b6a38f..85dd9f3 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h @@ -85,10 +85,10 @@ TEST_P(GLES2DecoderTest1, BindBufferBaseValidArgsNewId) { TEST_P(GLES2DecoderTest1, BindBufferRangeValidArgs) { EXPECT_CALL(*gl_, BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 2, - kServiceBufferId, 4, 5)); + kServiceBufferId, 4, 4)); SpecializedSetup<cmds::BindBufferRange, 0>(true); cmds::BindBufferRange cmd; - cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, client_buffer_id_, 4, 5); + cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, client_buffer_id_, 4, 4); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_NO_ERROR, GetGLError()); @@ -98,12 +98,12 @@ TEST_P(GLES2DecoderTest1, BindBufferRangeValidArgs) { TEST_P(GLES2DecoderTest1, BindBufferRangeValidArgsNewId) { EXPECT_CALL(*gl_, BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 2, - kNewServiceId, 4, 5)); + kNewServiceId, 4, 4)); EXPECT_CALL(*gl_, GenBuffersARB(1, _)) .WillOnce(SetArgumentPointee<1>(kNewServiceId)); SpecializedSetup<cmds::BindBufferRange, 0>(true); cmds::BindBufferRange cmd; - cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewClientId, 4, 5); + cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewClientId, 4, 4); decoder_->set_unsafe_es3_apis_enabled(true); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_NO_ERROR, GetGLError()); diff --git a/gpu/ipc/gpu_command_buffer_traits_multi.h b/gpu/ipc/gpu_command_buffer_traits_multi.h index 8201f32..2f834a0 100644 --- a/gpu/ipc/gpu_command_buffer_traits_multi.h +++ b/gpu/ipc/gpu_command_buffer_traits_multi.h @@ -42,6 +42,9 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::Capabilities) IPC_STRUCT_TRAITS_MEMBER(num_compressed_texture_formats) IPC_STRUCT_TRAITS_MEMBER(num_shader_binary_formats) IPC_STRUCT_TRAITS_MEMBER(bind_generates_resource_chromium) + IPC_STRUCT_TRAITS_MEMBER(max_transform_feedback_separate_attribs) + IPC_STRUCT_TRAITS_MEMBER(max_uniform_buffer_bindings) + IPC_STRUCT_TRAITS_MEMBER(uniform_buffer_offset_alignment) IPC_STRUCT_TRAITS_MEMBER(post_sub_buffer) IPC_STRUCT_TRAITS_MEMBER(egl_image_external) IPC_STRUCT_TRAITS_MEMBER(texture_format_bgra8888) |