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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 program_manager()->GetProgramInfo(client_id); | 505 program_manager()->GetProgramInfo(client_id); |
506 return (info && !info->IsDeleted()) ? info : NULL; | 506 return (info && !info->IsDeleted()) ? info : NULL; |
507 } | 507 } |
508 | 508 |
509 // Deletes the program info for the given program. | 509 // Deletes the program info for the given program. |
510 void RemoveProgramInfo(GLuint client_id) { | 510 void RemoveProgramInfo(GLuint client_id) { |
511 program_manager()->RemoveProgramInfo(client_id); | 511 program_manager()->RemoveProgramInfo(client_id); |
512 } | 512 } |
513 | 513 |
514 // Creates a ShaderInfo for the given shader. | 514 // Creates a ShaderInfo for the given shader. |
515 void CreateShaderInfo(GLuint client_id, GLuint service_id) { | 515 void CreateShaderInfo(GLuint client_id, |
516 shader_manager()->CreateShaderInfo(client_id, service_id); | 516 GLuint service_id, |
| 517 GLenum shader_type) { |
| 518 shader_manager()->CreateShaderInfo(client_id, service_id, shader_type); |
517 } | 519 } |
518 | 520 |
519 // Gets the shader info for the given shader. Returns NULL if none exists. | 521 // Gets the shader info for the given shader. Returns NULL if none exists. |
520 ShaderManager::ShaderInfo* GetShaderInfo(GLuint client_id) { | 522 ShaderManager::ShaderInfo* GetShaderInfo(GLuint client_id) { |
521 ShaderManager::ShaderInfo* info = | 523 ShaderManager::ShaderInfo* info = |
522 shader_manager()->GetShaderInfo(client_id); | 524 shader_manager()->GetShaderInfo(client_id); |
523 return (info && !info->IsDeleted()) ? info : NULL; | 525 return (info && !info->IsDeleted()) ? info : NULL; |
524 } | 526 } |
525 | 527 |
526 // Deletes the shader info for the given shader. | 528 // Deletes the shader info for the given shader. |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 } | 1700 } |
1699 return true; | 1701 return true; |
1700 } | 1702 } |
1701 | 1703 |
1702 bool GLES2DecoderImpl::CreateShaderHelper(GLenum type, GLuint client_id) { | 1704 bool GLES2DecoderImpl::CreateShaderHelper(GLenum type, GLuint client_id) { |
1703 if (GetShaderInfo(client_id)) { | 1705 if (GetShaderInfo(client_id)) { |
1704 return false; | 1706 return false; |
1705 } | 1707 } |
1706 GLuint service_id = glCreateShader(type); | 1708 GLuint service_id = glCreateShader(type); |
1707 if (service_id != 0) { | 1709 if (service_id != 0) { |
1708 CreateShaderInfo(client_id, service_id); | 1710 CreateShaderInfo(client_id, service_id, type); |
1709 } | 1711 } |
1710 return true; | 1712 return true; |
1711 } | 1713 } |
1712 | 1714 |
1713 bool GLES2DecoderImpl::ValidateGLenumCompressedTextureInternalFormat(GLenum) { | 1715 bool GLES2DecoderImpl::ValidateGLenumCompressedTextureInternalFormat(GLenum) { |
1714 // TODO(gman): Add support for compressed texture formats. | 1716 // TODO(gman): Add support for compressed texture formats. |
1715 return false; | 1717 return false; |
1716 } | 1718 } |
1717 | 1719 |
1718 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { | 1720 void GLES2DecoderImpl::DoActiveTexture(GLenum texture_unit) { |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 if (!info) { | 2501 if (!info) { |
2500 SetGLError(GL_INVALID_VALUE); | 2502 SetGLError(GL_INVALID_VALUE); |
2501 return; | 2503 return; |
2502 } | 2504 } |
2503 // Translate GL ES 2.0 shader to Desktop GL shader and pass that to | 2505 // Translate GL ES 2.0 shader to Desktop GL shader and pass that to |
2504 // glShaderSource and then glCompileShader. | 2506 // glShaderSource and then glCompileShader. |
2505 const char* shader_src = info->source().c_str(); | 2507 const char* shader_src = info->source().c_str(); |
2506 #if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) | 2508 #if !defined(GLES2_GPU_SERVICE_BACKEND_NATIVE_GLES2) |
2507 #if defined(GLES2_GPU_SERVICE_TRANSLATE_SHADER) | 2509 #if defined(GLES2_GPU_SERVICE_TRANSLATE_SHADER) |
2508 int dbg_options = 0; | 2510 int dbg_options = 0; |
2509 EShLanguage language = EShLangVertex; | 2511 EShLanguage language = info->shader_type() == GL_VERTEX_SHADER ? |
| 2512 EShLangVertex : EShLangFragment; |
2510 TBuiltInResource resources; | 2513 TBuiltInResource resources; |
2511 // TODO(alokp): Ask gman how to get appropriate values. | 2514 // TODO(alokp): Ask gman how to get appropriate values. |
2512 resources.maxVertexAttribs = 8; | 2515 resources.maxVertexAttribs = 8; |
2513 resources.maxVertexUniformVectors = 128; | 2516 resources.maxVertexUniformVectors = 128; |
2514 resources.maxVaryingVectors = 8; | 2517 resources.maxVaryingVectors = 8; |
2515 resources.maxVertexTextureImageUnits = 0; | 2518 resources.maxVertexTextureImageUnits = 0; |
2516 resources.maxCombinedTextureImageUnits = 8; | 2519 resources.maxCombinedTextureImageUnits = 8; |
2517 resources.maxTextureImageUnits = 8; | 2520 resources.maxTextureImageUnits = 8; |
2518 resources.maxFragmentUniformVectors = 16; | 2521 resources.maxFragmentUniformVectors = 16; |
2519 resources.maxDrawBuffers = 1; | 2522 resources.maxDrawBuffers = 1; |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3604 return error::kNoError; | 3607 return error::kNoError; |
3605 } | 3608 } |
3606 | 3609 |
3607 // Include the auto-generated part of this file. We split this because it means | 3610 // Include the auto-generated part of this file. We split this because it means |
3608 // we can easily edit the non-auto generated parts right here in this file | 3611 // we can easily edit the non-auto generated parts right here in this file |
3609 // instead of having to edit some template or the code generator. | 3612 // instead of having to edit some template or the code generator. |
3610 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 3613 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
3611 | 3614 |
3612 } // namespace gles2 | 3615 } // namespace gles2 |
3613 } // namespace gpu | 3616 } // namespace gpu |
OLD | NEW |