diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-12 17:23:58 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-12 17:23:58 +0000 |
commit | b273e43cebe9f829f9e871bc27ddf5cea4feef28 (patch) | |
tree | 2db79f311c3f080d44dc1f99fc5548b4beaf6112 /gpu/command_buffer/client | |
parent | d382b18cd1dafdadc6e55843e48cb78f0f99a1b9 (diff) | |
download | chromium_src-b273e43cebe9f829f9e871bc27ddf5cea4feef28.zip chromium_src-b273e43cebe9f829f9e871bc27ddf5cea4feef28.tar.gz chromium_src-b273e43cebe9f829f9e871bc27ddf5cea4feef28.tar.bz2 |
Adds stubs for glShaderBinary and glReleaseShaderCompiler.
Also handles certain GLES2 enums passed to glGetXXX that
have no corresponding OpenGL enums
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/1609016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44254 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client')
4 files changed, 58 insertions, 1 deletions
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h index 3aef7b8..777a2d6 100644 --- a/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -329,6 +329,9 @@ void GLES2ReadPixels( void* pixels) { gles2::GetGLContext()->ReadPixels(x, y, width, height, format, type, pixels); } +void GLES2ReleaseShaderCompiler() { + gles2::GetGLContext()->ReleaseShaderCompiler(); +} void GLES2RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { gles2::GetGLContext()->RenderbufferStorage( @@ -340,6 +343,12 @@ void GLES2SampleCoverage(GLclampf value, GLboolean invert) { void GLES2Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { gles2::GetGLContext()->Scissor(x, y, width, height); } +void GLES2ShaderBinary( + GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, + GLsizei length) { + gles2::GetGLContext()->ShaderBinary( + n, shaders, binaryformat, binary, length); +} void GLES2ShaderSource( GLuint shader, GLsizei count, const char** str, const GLint* length) { gles2::GetGLContext()->ShaderSource(shader, count, str, length); diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 97b5e25..42f6608 100644 --- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -668,6 +668,12 @@ result_shm_id, result_shm_offset); } + void ReleaseShaderCompiler() { + gles2::ReleaseShaderCompiler& c = + GetCmdSpace<gles2::ReleaseShaderCompiler>(); + c.Init(); + } + void RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { gles2::RenderbufferStorage& c = GetCmdSpace<gles2::RenderbufferStorage>(); @@ -684,6 +690,16 @@ c.Init(x, y, width, height); } + void ShaderBinary( + GLsizei n, uint32 shaders_shm_id, uint32 shaders_shm_offset, + GLenum binaryformat, uint32 binary_shm_id, uint32 binary_shm_offset, + GLsizei length) { + gles2::ShaderBinary& c = GetCmdSpace<gles2::ShaderBinary>(); + c.Init( + n, shaders_shm_id, shaders_shm_offset, binaryformat, binary_shm_id, + binary_shm_offset, length); + } + void ShaderSource( GLuint shader, uint32 data_shm_id, uint32 data_shm_offset, uint32 data_size) { diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 4eb6577..b3fe538 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc @@ -245,6 +245,30 @@ GLint GLES2Implementation::GetUniformLocation( return *result; } + +void GLES2Implementation::ShaderBinary( + GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, + GLsizei length) { + if (n < 0 || length < 0) { + SetGLError(GL_INVALID_VALUE); + return; + } + GLsizei shader_id_size = n * sizeof(*shaders); + void* shader_ids = transfer_buffer_.Alloc(shader_id_size); + void* shader_data = transfer_buffer_.Alloc(length); + memcpy(shader_ids, shaders, shader_id_size); + memcpy(shader_data, binary, length); + helper_->ShaderBinary( + n, + transfer_buffer_id_, transfer_buffer_.GetOffset(shader_ids), + binaryformat, + transfer_buffer_id_, transfer_buffer_.GetOffset(shader_data), + length); + int32 token = helper_->InsertToken(); + transfer_buffer_.FreePendingToken(shader_ids, token); + transfer_buffer_.FreePendingToken(shader_data, token); +} + void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { switch (pname) { case GL_PACK_ALIGNMENT: @@ -287,7 +311,7 @@ void GLES2Implementation::ShaderSource( for (GLsizei ii = 0; ii <= count; ++ii) { const char* src = ii < count ? source[ii] : ""; uint32 size = ii < count ? (length ? length[ii] : strlen(src)) : 1; - while(size) { + while (size) { uint32 part_size = std::min(size, max_size); void* buffer = transfer_buffer_.Alloc(part_size); memcpy(buffer, src, part_size); diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h index 3c21aea..04e5d76 100644 --- a/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -537,6 +537,10 @@ void ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels); +void ReleaseShaderCompiler() { + helper_->ReleaseShaderCompiler(); +} + void RenderbufferStorage( GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { if (width < 0) { @@ -566,6 +570,10 @@ void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { helper_->Scissor(x, y, width, height); } +void ShaderBinary( + GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, + GLsizei length); + void ShaderSource( GLuint shader, GLsizei count, const char** str, const GLint* length); |