Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 10795037: Revert 147328 - Current status of patch: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 10 #include <list>
(...skipping 20 matching lines...) Expand all
31 #include "gpu/command_buffer/service/buffer_manager.h" 31 #include "gpu/command_buffer/service/buffer_manager.h"
32 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 32 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
33 #include "gpu/command_buffer/service/context_group.h" 33 #include "gpu/command_buffer/service/context_group.h"
34 #include "gpu/command_buffer/service/feature_info.h" 34 #include "gpu/command_buffer/service/feature_info.h"
35 #include "gpu/command_buffer/service/framebuffer_manager.h" 35 #include "gpu/command_buffer/service/framebuffer_manager.h"
36 #include "gpu/command_buffer/service/gl_utils.h" 36 #include "gpu/command_buffer/service/gl_utils.h"
37 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 37 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
38 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 38 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
39 #include "gpu/command_buffer/service/gpu_switches.h" 39 #include "gpu/command_buffer/service/gpu_switches.h"
40 #include "gpu/command_buffer/service/mailbox_manager.h" 40 #include "gpu/command_buffer/service/mailbox_manager.h"
41 #include "gpu/command_buffer/service/program_cache.h"
42 #include "gpu/command_buffer/service/program_manager.h" 41 #include "gpu/command_buffer/service/program_manager.h"
43 #include "gpu/command_buffer/service/query_manager.h" 42 #include "gpu/command_buffer/service/query_manager.h"
44 #include "gpu/command_buffer/service/renderbuffer_manager.h" 43 #include "gpu/command_buffer/service/renderbuffer_manager.h"
45 #include "gpu/command_buffer/service/shader_manager.h" 44 #include "gpu/command_buffer/service/shader_manager.h"
46 #include "gpu/command_buffer/service/shader_translator.h" 45 #include "gpu/command_buffer/service/shader_translator.h"
47 #include "gpu/command_buffer/service/shader_translator_cache.h" 46 #include "gpu/command_buffer/service/shader_translator_cache.h"
48 #include "gpu/command_buffer/service/stream_texture.h" 47 #include "gpu/command_buffer/service/stream_texture.h"
49 #include "gpu/command_buffer/service/stream_texture_manager.h" 48 #include "gpu/command_buffer/service/stream_texture_manager.h"
50 #include "gpu/command_buffer/service/texture_definition.h" 49 #include "gpu/command_buffer/service/texture_definition.h"
51 #include "gpu/command_buffer/service/texture_manager.h" 50 #include "gpu/command_buffer/service/texture_manager.h"
(...skipping 4661 matching lines...) Expand 10 before | Expand all | Expand 10 after
4713 } 4712 }
4714 4713
4715 void GLES2DecoderImpl::DoLinkProgram(GLuint program) { 4714 void GLES2DecoderImpl::DoLinkProgram(GLuint program) {
4716 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram"); 4715 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram");
4717 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader( 4716 ProgramManager::ProgramInfo* info = GetProgramInfoNotShader(
4718 program, "glLinkProgram"); 4717 program, "glLinkProgram");
4719 if (!info) { 4718 if (!info) {
4720 return; 4719 return;
4721 } 4720 }
4722 4721
4723 ShaderTranslator* vertex_translator = NULL; 4722 if (info->Link()) {
4724 ShaderTranslator* fragment_translator = NULL;
4725 if (use_shader_translator_) {
4726 vertex_translator = vertex_translator_;
4727 fragment_translator = fragment_translator_;
4728 }
4729 if (info->Link(shader_manager(),
4730 vertex_translator,
4731 fragment_translator,
4732 feature_info_)) {
4733 if (info == current_program_.get()) { 4723 if (info == current_program_.get()) {
4734 program_manager()->ClearUniforms(info); 4724 program_manager()->ClearUniforms(info);
4735 } 4725 }
4736 } 4726 }
4737 }; 4727 };
4738 4728
4739 void GLES2DecoderImpl::DoTexParameterf( 4729 void GLES2DecoderImpl::DoTexParameterf(
4740 GLenum target, GLenum pname, GLfloat param) { 4730 GLenum target, GLenum pname, GLfloat param) {
4741 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); 4731 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
4742 if (!info) { 4732 if (!info) {
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
5809 bucket->size() - 1); 5799 bucket->size() - 1);
5810 } 5800 }
5811 5801
5812 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { 5802 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) {
5813 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader"); 5803 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader");
5814 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram( 5804 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram(
5815 client_id, "glCompileShader"); 5805 client_id, "glCompileShader");
5816 if (!info) { 5806 if (!info) {
5817 return; 5807 return;
5818 } 5808 }
5809 // Translate GL ES 2.0 shader to Desktop GL shader and pass that to
5810 // glShaderSource and then glCompileShader.
5811 const char* shader_src = info->source() ? info->source()->c_str() : "";
5819 ShaderTranslator* translator = NULL; 5812 ShaderTranslator* translator = NULL;
5820 if (use_shader_translator_) { 5813 if (use_shader_translator_) {
5821 translator = info->shader_type() == GL_VERTEX_SHADER ? 5814 translator = info->shader_type() == GL_VERTEX_SHADER ?
5822 vertex_translator_.get() : fragment_translator_.get(); 5815 vertex_translator_.get() : fragment_translator_.get();
5816
5817 if (!translator->Translate(shader_src)) {
5818 info->SetStatus(false, translator->info_log(), NULL);
5819 return;
5820 }
5821 shader_src = translator->translated_shader();
5822 if (!feature_info_->feature_flags().angle_translated_shader_source)
5823 info->UpdateTranslatedSource(shader_src);
5823 } 5824 }
5824 5825
5825 program_manager()->DoCompileShader(info, translator, feature_info_); 5826 glShaderSource(info->service_id(), 1, &shader_src, NULL);
5827 glCompileShader(info->service_id());
5828 if (feature_info_->feature_flags().angle_translated_shader_source) {
5829 GLint max_len = 0;
5830 glGetShaderiv(info->service_id(),
5831 GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE,
5832 &max_len);
5833 scoped_array<char> temp(new char[max_len]);
5834 GLint len = 0;
5835 glGetTranslatedShaderSourceANGLE(
5836 info->service_id(), max_len, &len, temp.get());
5837 DCHECK(max_len == 0 || len < max_len);
5838 DCHECK(len == 0 || temp[len] == '\0');
5839 info->UpdateTranslatedSource(temp.get());
5840 }
5841
5842 GLint status = GL_FALSE;
5843 glGetShaderiv(info->service_id(), GL_COMPILE_STATUS, &status);
5844 if (status) {
5845 info->SetStatus(true, "", translator);
5846 } else {
5847 // We cannot reach here if we are using the shader translator.
5848 // All invalid shaders must be rejected by the translator.
5849 // All translated shaders must compile.
5850 LOG_IF(ERROR, use_shader_translator_)
5851 << "Shader translator allowed/produced an invalid shader.";
5852 GLint max_len = 0;
5853 glGetShaderiv(info->service_id(), GL_INFO_LOG_LENGTH, &max_len);
5854 scoped_array<char> temp(new char[max_len]);
5855 GLint len = 0;
5856 glGetShaderInfoLog(info->service_id(), max_len, &len, temp.get());
5857 DCHECK(max_len == 0 || len < max_len);
5858 DCHECK(len == 0 || temp[len] == '\0');
5859 info->SetStatus(false, std::string(temp.get(), len).c_str(), NULL);
5860 }
5826 }; 5861 };
5827 5862
5828 void GLES2DecoderImpl::DoGetShaderiv( 5863 void GLES2DecoderImpl::DoGetShaderiv(
5829 GLuint shader, GLenum pname, GLint* params) { 5864 GLuint shader, GLenum pname, GLint* params) {
5830 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram( 5865 ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram(
5831 shader, "glGetShaderiv"); 5866 shader, "glGetShaderiv");
5832 if (!info) { 5867 if (!info) {
5833 return; 5868 return;
5834 } 5869 }
5835 switch (pname) { 5870 switch (pname) {
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
9151 BindAndApplyTextureParameters(info); 9186 BindAndApplyTextureParameters(info);
9152 } 9187 }
9153 9188
9154 // Include the auto-generated part of this file. We split this because it means 9189 // Include the auto-generated part of this file. We split this because it means
9155 // we can easily edit the non-auto generated parts right here in this file 9190 // we can easily edit the non-auto generated parts right here in this file
9156 // instead of having to edit some template or the code generator. 9191 // instead of having to edit some template or the code generator.
9157 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 9192 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
9158 9193
9159 } // namespace gles2 9194 } // namespace gles2
9160 } // namespace gpu 9195 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_utils.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698