Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "gpu/command_buffer/service/id_manager.h" | 28 #include "gpu/command_buffer/service/id_manager.h" |
| 29 #include "gpu/command_buffer/service/program_manager.h" | 29 #include "gpu/command_buffer/service/program_manager.h" |
| 30 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 30 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
| 31 #include "gpu/command_buffer/service/shader_manager.h" | 31 #include "gpu/command_buffer/service/shader_manager.h" |
| 32 #include "gpu/command_buffer/service/texture_manager.h" | 32 #include "gpu/command_buffer/service/texture_manager.h" |
| 33 | 33 |
| 34 #if !defined(GL_DEPTH24_STENCIL8) | 34 #if !defined(GL_DEPTH24_STENCIL8) |
| 35 #define GL_DEPTH24_STENCIL8 0x88F0 | 35 #define GL_DEPTH24_STENCIL8 0x88F0 |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #if defined(UNIT_TEST) | |
| 39 | |
| 40 // OpenGL constants not defined in OpenGL ES 2.0 needed when compiling | |
| 41 // unit tests. For native OpenGL ES 2.0 backend tese are not used. For OpenGL | |
|
Ken Russell (switch to Gerrit)
2010/04/13 16:46:05
tese -> these
| |
| 42 // backend these must be defined by the system. | |
| 43 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 | |
| 44 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A | |
| 45 #define GL_MAX_VARYING_FLOATS 0x8B4B | |
| 46 | |
| 47 #endif | |
| 48 | |
| 38 namespace gpu { | 49 namespace gpu { |
| 39 namespace gles2 { | 50 namespace gles2 { |
| 40 | 51 |
| 41 class GLES2DecoderImpl; | 52 class GLES2DecoderImpl; |
| 42 | 53 |
| 43 // Check that certain assumptions the code makes are true. There are places in | 54 // Check that certain assumptions the code makes are true. There are places in |
| 44 // the code where shared memory is passed direclty to GL. Example, glUniformiv, | 55 // the code where shared memory is passed direclty to GL. Example, glUniformiv, |
| 45 // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe | 56 // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe |
| 46 // a few others) are 32bits. If they are not 32bits the code will have to change | 57 // a few others) are 32bits. If they are not 32bits the code will have to change |
| 47 // to call those GL functions with service side memory and then copy the results | 58 // to call those GL functions with service side memory and then copy the results |
| (...skipping 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1841 return; | 1852 return; |
| 1842 } | 1853 } |
| 1843 glGenerateMipmapEXT(target); | 1854 glGenerateMipmapEXT(target); |
| 1844 } | 1855 } |
| 1845 | 1856 |
| 1846 bool GLES2DecoderImpl::GetHelper( | 1857 bool GLES2DecoderImpl::GetHelper( |
| 1847 GLenum pname, GLint* params, GLsizei* num_written) { | 1858 GLenum pname, GLint* params, GLsizei* num_written) { |
| 1848 DCHECK(params); | 1859 DCHECK(params); |
| 1849 DCHECK(num_written); | 1860 DCHECK(num_written); |
| 1850 switch (pname) { | 1861 switch (pname) { |
| 1862 #if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) | |
| 1851 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: | 1863 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: |
| 1852 *num_written = 1; | 1864 *num_written = 1; |
| 1853 *params = GL_RGB; // TODO(gman): get correct format. | 1865 *params = GL_RGBA; // TODO(gman): get correct format. |
| 1854 return true; | 1866 return true; |
| 1855 case GL_IMPLEMENTATION_COLOR_READ_TYPE: | 1867 case GL_IMPLEMENTATION_COLOR_READ_TYPE: |
| 1856 *num_written = 1; | 1868 *num_written = 1; |
| 1857 *params = GL_UNSIGNED_BYTE; // TODO(gman): get correct type. | 1869 *params = GL_UNSIGNED_BYTE; // TODO(gman): get correct type. |
| 1858 return true; | 1870 return true; |
| 1859 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: | 1871 case GL_MAX_FRAGMENT_UNIFORM_VECTORS: |
| 1872 glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, params); | |
| 1860 *num_written = 1; | 1873 *num_written = 1; |
| 1861 *params = 16; // TODO(gman): get correct value. | 1874 *params /= 4; |
| 1862 return true; | 1875 return true; |
| 1863 case GL_MAX_VARYING_VECTORS: | 1876 case GL_MAX_VARYING_VECTORS: |
| 1877 glGetIntegerv(GL_MAX_VARYING_FLOATS, params); | |
| 1864 *num_written = 1; | 1878 *num_written = 1; |
| 1865 *params = 8; // TODO(gman): get correct value. | 1879 *params /= 4; |
| 1866 return true; | 1880 return true; |
| 1867 case GL_MAX_VERTEX_UNIFORM_VECTORS: | 1881 case GL_MAX_VERTEX_UNIFORM_VECTORS: |
| 1882 glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, params); | |
| 1868 *num_written = 1; | 1883 *num_written = 1; |
| 1869 *params = 128; // TODO(gman): get correct value. | 1884 *params /= 4; |
| 1870 return true; | 1885 return true; |
| 1886 #endif | |
| 1871 case GL_NUM_COMPRESSED_TEXTURE_FORMATS: | 1887 case GL_NUM_COMPRESSED_TEXTURE_FORMATS: |
| 1872 *num_written = 1; | 1888 *num_written = 1; |
| 1873 *params = 0; // We don't support compressed textures. | 1889 *params = 0; // We don't support compressed textures. |
| 1874 return true; | 1890 return true; |
| 1875 case GL_NUM_SHADER_BINARY_FORMATS: | 1891 case GL_NUM_SHADER_BINARY_FORMATS: |
| 1876 *num_written = 1; | 1892 *num_written = 1; |
| 1877 *params = 0; // We don't support binary shader formats. | 1893 *params = 0; // We don't support binary shader formats. |
| 1878 return true; | 1894 return true; |
| 1879 case GL_SHADER_BINARY_FORMATS: | 1895 case GL_SHADER_BINARY_FORMATS: |
| 1880 *num_written = 0; | 1896 *num_written = 0; |
| (...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3396 return error::kNoError; | 3412 return error::kNoError; |
| 3397 } | 3413 } |
| 3398 | 3414 |
| 3399 // Include the auto-generated part of this file. We split this because it means | 3415 // Include the auto-generated part of this file. We split this because it means |
| 3400 // we can easily edit the non-auto generated parts right here in this file | 3416 // we can easily edit the non-auto generated parts right here in this file |
| 3401 // instead of having to edit some template or the code generator. | 3417 // instead of having to edit some template or the code generator. |
| 3402 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 3418 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 3403 | 3419 |
| 3404 } // namespace gles2 | 3420 } // namespace gles2 |
| 3405 } // namespace gpu | 3421 } // namespace gpu |
| OLD | NEW |