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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
928 | 928 |
929 // Wrapper for TexStorage2DEXT. | 929 // Wrapper for TexStorage2DEXT. |
930 void DoTexStorage2DEXT( | 930 void DoTexStorage2DEXT( |
931 GLenum target, | 931 GLenum target, |
932 GLint levels, | 932 GLint levels, |
933 GLenum internal_format, | 933 GLenum internal_format, |
934 GLsizei width, | 934 GLsizei width, |
935 GLsizei height); | 935 GLsizei height); |
936 | 936 |
937 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key); | 937 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key); |
938 void DoProduceTextureBindlessCHROMIUM(GLuint texture, GLenum target, | |
939 const GLbyte* key); | |
940 void ProduceTextureRef(std::string func_name, TextureRef* texture_ref, | |
941 GLenum target, const GLbyte* data); | |
942 | |
938 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); | 943 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); |
944 void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key, | |
945 GLuint client_id); | |
939 | 946 |
940 void DoBindTexImage2DCHROMIUM( | 947 void DoBindTexImage2DCHROMIUM( |
941 GLenum target, | 948 GLenum target, |
942 GLint image_id); | 949 GLint image_id); |
943 void DoReleaseTexImage2DCHROMIUM( | 950 void DoReleaseTexImage2DCHROMIUM( |
944 GLenum target, | 951 GLenum target, |
945 GLint image_id); | 952 GLint image_id); |
946 | 953 |
947 void DoTraceEndCHROMIUM(void); | 954 void DoTraceEndCHROMIUM(void); |
948 | 955 |
(...skipping 9228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10177 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { | 10184 uint32 immediate_data_size, const cmds::GenMailboxCHROMIUM& c) { |
10178 return error::kUnknownCommand; | 10185 return error::kUnknownCommand; |
10179 } | 10186 } |
10180 | 10187 |
10181 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, | 10188 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, |
10182 const GLbyte* data) { | 10189 const GLbyte* data) { |
10183 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", | 10190 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", |
10184 "context", logger_.GetLogPrefix(), | 10191 "context", logger_.GetLogPrefix(), |
10185 "mailbox[0]", static_cast<unsigned char>(data[0])); | 10192 "mailbox[0]", static_cast<unsigned char>(data[0])); |
10186 | 10193 |
10194 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | |
10195 &state_, target); | |
10196 ProduceTextureRef("ProduceTextureCHROMIUM", texture_ref, target, data); | |
10197 } | |
10198 | |
10199 void GLES2DecoderImpl::DoProduceTextureBindlessCHROMIUM(GLuint client_id, | |
10200 GLenum target, const GLbyte* data) { | |
10201 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureBindlessCHROMIUM", | |
10202 "context", logger_.GetLogPrefix(), | |
10203 "mailbox[0]", static_cast<unsigned char>(data[0])); | |
10204 | |
10205 ProduceTextureRef("ProduceTextureBindlessCHROMIUM", GetTexture(client_id), | |
10206 target, data); | |
10207 } | |
10208 | |
10209 void GLES2DecoderImpl::ProduceTextureRef(std::string func_name, | |
10210 TextureRef* texture_ref, GLenum target, const GLbyte* data) { | |
10187 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); | 10211 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); |
10188 DLOG_IF(ERROR, !mailbox.Verify()) << "ProduceTextureCHROMIUM was passed a " | 10212 DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a " |
10189 "mailbox that was not generated by " | 10213 "mailbox that was not generated by " |
10190 "GenMailboxCHROMIUM."; | 10214 "GenMailboxCHROMIUM."; |
10191 | 10215 |
10192 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( | |
10193 &state_, target); | |
10194 if (!texture_ref) { | 10216 if (!texture_ref) { |
10195 LOCAL_SET_GL_ERROR( | 10217 LOCAL_SET_GL_ERROR( |
10196 GL_INVALID_OPERATION, | 10218 GL_INVALID_OPERATION, |
10197 "glProduceTextureCHROMIUM", "unknown texture for target"); | 10219 "glProduceTextureCHROMIUM", "unknown texture for target"); |
10198 return; | 10220 return; |
10199 } | 10221 } |
10200 | 10222 |
10201 Texture* produced = texture_manager()->Produce(texture_ref); | 10223 Texture* produced = texture_manager()->Produce(texture_ref); |
piman
2014/05/22 21:53:58
You should check that target == produced->target()
| |
10202 if (!produced) { | 10224 if (!produced) { |
10203 LOCAL_SET_GL_ERROR( | 10225 LOCAL_SET_GL_ERROR( |
10204 GL_INVALID_OPERATION, | 10226 GL_INVALID_OPERATION, |
10205 "glProduceTextureCHROMIUM", "invalid texture"); | 10227 "glProduceTextureCHROMIUM", "invalid texture"); |
10206 return; | 10228 return; |
10207 } | 10229 } |
10208 | 10230 |
10209 group_->mailbox_manager()->ProduceTexture(target, mailbox, produced); | 10231 group_->mailbox_manager()->ProduceTexture(target, mailbox, produced); |
10210 } | 10232 } |
10211 | 10233 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10266 break; | 10288 break; |
10267 case GL_TEXTURE_RECTANGLE_ARB: | 10289 case GL_TEXTURE_RECTANGLE_ARB: |
10268 unit.bound_texture_rectangle_arb = texture_ref; | 10290 unit.bound_texture_rectangle_arb = texture_ref; |
10269 break; | 10291 break; |
10270 default: | 10292 default: |
10271 NOTREACHED(); // Validation should prevent us getting here. | 10293 NOTREACHED(); // Validation should prevent us getting here. |
10272 break; | 10294 break; |
10273 } | 10295 } |
10274 } | 10296 } |
10275 | 10297 |
10298 void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target, | |
10299 const GLbyte* data, GLuint client_id) { | |
10300 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM", | |
10301 "context", logger_.GetLogPrefix(), | |
10302 "mailbox[0]", static_cast<unsigned char>(data[0])); | |
10303 const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); | |
10304 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " | |
10305 "passed a mailbox that was not " | |
10306 "generated by GenMailboxCHROMIUM."; | |
10307 | |
10308 TextureRef* texture_ref = GetTexture(client_id); | |
10309 if (texture_ref) { | |
10310 LOCAL_SET_GL_ERROR( | |
10311 GL_INVALID_OPERATION, | |
10312 "glCreateAndConsumeTextureCHROMIUM", "client id already in use"); | |
10313 return; | |
10314 } | |
10315 Texture* texture = group_->mailbox_manager()->ConsumeTexture(target, mailbox); | |
10316 if (!texture) { | |
10317 LOCAL_SET_GL_ERROR( | |
10318 GL_INVALID_OPERATION, | |
10319 "glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name"); | |
10320 return; | |
10321 } | |
10322 if (texture->target() != target) { | |
10323 LOCAL_SET_GL_ERROR( | |
10324 GL_INVALID_OPERATION, | |
10325 "glCreateAndConsumeTextureCHROMIUM", "invalid target"); | |
10326 return; | |
10327 } | |
10328 | |
10329 texture_ref = texture_manager()->Consume(client_id, texture); | |
10330 } | |
10331 | |
10276 void GLES2DecoderImpl::DoInsertEventMarkerEXT( | 10332 void GLES2DecoderImpl::DoInsertEventMarkerEXT( |
10277 GLsizei length, const GLchar* marker) { | 10333 GLsizei length, const GLchar* marker) { |
10278 if (!marker) { | 10334 if (!marker) { |
10279 marker = ""; | 10335 marker = ""; |
10280 } | 10336 } |
10281 debug_marker_manager_.SetMarker( | 10337 debug_marker_manager_.SetMarker( |
10282 length ? std::string(marker, length) : std::string(marker)); | 10338 length ? std::string(marker, length) : std::string(marker)); |
10283 } | 10339 } |
10284 | 10340 |
10285 void GLES2DecoderImpl::DoPushGroupMarkerEXT( | 10341 void GLES2DecoderImpl::DoPushGroupMarkerEXT( |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10767 } | 10823 } |
10768 } | 10824 } |
10769 | 10825 |
10770 // Include the auto-generated part of this file. We split this because it means | 10826 // Include the auto-generated part of this file. We split this because it means |
10771 // we can easily edit the non-auto generated parts right here in this file | 10827 // we can easily edit the non-auto generated parts right here in this file |
10772 // instead of having to edit some template or the code generator. | 10828 // instead of having to edit some template or the code generator. |
10773 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10829 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
10774 | 10830 |
10775 } // namespace gles2 | 10831 } // namespace gles2 |
10776 } // namespace gpu | 10832 } // namespace gpu |
OLD | NEW |