| OLD | NEW |
| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, | 1056 void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, |
| 1057 const GLbyte* key); | 1057 const GLbyte* key); |
| 1058 void ProduceTextureRef(const char* func_name, | 1058 void ProduceTextureRef(const char* func_name, |
| 1059 bool clear, | 1059 bool clear, |
| 1060 TextureRef* texture_ref, | 1060 TextureRef* texture_ref, |
| 1061 GLenum target, | 1061 GLenum target, |
| 1062 const GLbyte* data); | 1062 const GLbyte* data); |
| 1063 | 1063 |
| 1064 void EnsureTextureForClientId(GLenum target, GLuint client_id); | 1064 void EnsureTextureForClientId(GLenum target, GLuint client_id); |
| 1065 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); | 1065 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); |
| 1066 void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key, | 1066 void DoCreateAndConsumeTextureINTERNAL(GLenum target, |
| 1067 GLuint client_id); | 1067 GLuint client_id, |
| 1068 const GLbyte* key); |
| 1068 void DoApplyScreenSpaceAntialiasingCHROMIUM(); | 1069 void DoApplyScreenSpaceAntialiasingCHROMIUM(); |
| 1069 | 1070 |
| 1070 void DoBindTexImage2DCHROMIUM( | 1071 void DoBindTexImage2DCHROMIUM( |
| 1071 GLenum target, | 1072 GLenum target, |
| 1072 GLint image_id); | 1073 GLint image_id); |
| 1073 void DoReleaseTexImage2DCHROMIUM( | 1074 void DoReleaseTexImage2DCHROMIUM( |
| 1074 GLenum target, | 1075 GLenum target, |
| 1075 GLint image_id); | 1076 GLint image_id); |
| 1076 | 1077 |
| 1077 void DoTraceEndCHROMIUM(void); | 1078 void DoTraceEndCHROMIUM(void); |
| (...skipping 14819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15897 GLuint service_id; | 15898 GLuint service_id; |
| 15898 glGenTextures(1, &service_id); | 15899 glGenTextures(1, &service_id); |
| 15899 DCHECK_NE(0u, service_id); | 15900 DCHECK_NE(0u, service_id); |
| 15900 texture_ref = CreateTexture(client_id, service_id); | 15901 texture_ref = CreateTexture(client_id, service_id); |
| 15901 texture_manager()->SetTarget(texture_ref, target); | 15902 texture_manager()->SetTarget(texture_ref, target); |
| 15902 glBindTexture(target, service_id); | 15903 glBindTexture(target, service_id); |
| 15903 RestoreCurrentTextureBindings(&state_, target); | 15904 RestoreCurrentTextureBindings(&state_, target); |
| 15904 } | 15905 } |
| 15905 } | 15906 } |
| 15906 | 15907 |
| 15907 // If CreateAndConsumeTexture fails we still need to ensure that the client_id | 15908 void GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL(GLenum target, |
| 15908 // provided is associated with a service_id/TextureRef for consistency, even if | 15909 GLuint client_id, |
| 15909 // the resulting texture is incomplete. | 15910 const GLbyte* data) { |
| 15910 error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate( | 15911 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL", |
| 15911 uint32_t immediate_data_size, | |
| 15912 const void* cmd_data) { | |
| 15913 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate& c = | |
| 15914 *static_cast< | |
| 15915 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate*>( | |
| 15916 cmd_data); | |
| 15917 GLenum target = static_cast<GLenum>(c.target); | |
| 15918 uint32_t data_size; | |
| 15919 if (!GLES2Util::ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | |
| 15920 return error::kOutOfBounds; | |
| 15921 } | |
| 15922 if (data_size > immediate_data_size) { | |
| 15923 return error::kOutOfBounds; | |
| 15924 } | |
| 15925 const GLbyte* mailbox = | |
| 15926 GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size); | |
| 15927 if (!validators_->texture_bind_target.IsValid(target)) { | |
| 15928 LOCAL_SET_GL_ERROR_INVALID_ENUM( | |
| 15929 "glCreateAndConsumeTextureCHROMIUM", target, "target"); | |
| 15930 return error::kNoError; | |
| 15931 } | |
| 15932 if (mailbox == NULL) { | |
| 15933 return error::kOutOfBounds; | |
| 15934 } | |
| 15935 uint32_t client_id = c.client_id; | |
| 15936 DoCreateAndConsumeTextureCHROMIUM(target, mailbox, client_id); | |
| 15937 return error::kNoError; | |
| 15938 } | |
| 15939 | |
| 15940 void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target, | |
| 15941 const GLbyte* data, GLuint client_id) { | |
| 15942 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM", | |
| 15943 "context", logger_.GetLogPrefix(), | 15912 "context", logger_.GetLogPrefix(), |
| 15944 "mailbox[0]", static_cast<unsigned char>(data[0])); | 15913 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 15945 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); | 15914 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
| 15946 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " | 15915 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " |
| 15947 "passed a mailbox that was not " | 15916 "passed a mailbox that was not " |
| 15948 "generated by GenMailboxCHROMIUM."; | 15917 "generated by GenMailboxCHROMIUM."; |
| 15949 | 15918 |
| 15950 TextureRef* texture_ref = GetTexture(client_id); | 15919 TextureRef* texture_ref = GetTexture(client_id); |
| 15951 if (texture_ref) { | 15920 if (texture_ref) { |
| 15952 // No need to call EnsureTextureForClientId here, the client_id already has | 15921 // No need to call EnsureTextureForClientId here, the client_id already has |
| (...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17744 } | 17713 } |
| 17745 | 17714 |
| 17746 // Include the auto-generated part of this file. We split this because it means | 17715 // Include the auto-generated part of this file. We split this because it means |
| 17747 // we can easily edit the non-auto generated parts right here in this file | 17716 // we can easily edit the non-auto generated parts right here in this file |
| 17748 // instead of having to edit some template or the code generator. | 17717 // instead of having to edit some template or the code generator. |
| 17749 #include "base/macros.h" | 17718 #include "base/macros.h" |
| 17750 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17719 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17751 | 17720 |
| 17752 } // namespace gles2 | 17721 } // namespace gles2 |
| 17753 } // namespace gpu | 17722 } // namespace gpu |
| OLD | NEW |