OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mojo/gpu/texture_uploader.h" | 5 #include "mojo/gpu/texture_uploader.h" |
6 | 6 |
7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 context->MakeCurrent(); | 39 context->MakeCurrent(); |
40 glBindTexture(GL_TEXTURE_2D, texture->texture_id()); | 40 glBindTexture(GL_TEXTURE_2D, texture->texture_id()); |
41 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | 41 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; |
42 glGenMailboxCHROMIUM(mailbox); | 42 glGenMailboxCHROMIUM(mailbox); |
43 glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox); | 43 glProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox); |
44 GLuint sync_point = glInsertSyncPointCHROMIUM(); | 44 GLuint sync_point = glInsertSyncPointCHROMIUM(); |
45 | 45 |
46 mojo::TransferableResourcePtr resource = mojo::TransferableResource::New(); | 46 mojo::TransferableResourcePtr resource = mojo::TransferableResource::New(); |
47 resource->id = resource_id; | 47 resource->id = resource_id; |
48 resource->format = mojo::RESOURCE_FORMAT_RGBA_8888; | 48 resource->format = mojo::ResourceFormat::RGBA_8888; |
49 resource->filter = GL_LINEAR; | 49 resource->filter = GL_LINEAR; |
50 resource->size = size.Clone(); | 50 resource->size = size.Clone(); |
51 mojo::MailboxHolderPtr mailbox_holder = mojo::MailboxHolder::New(); | 51 mojo::MailboxHolderPtr mailbox_holder = mojo::MailboxHolder::New(); |
52 mailbox_holder->mailbox = mojo::Mailbox::New(); | 52 mailbox_holder->mailbox = mojo::Mailbox::New(); |
53 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) | 53 for (int i = 0; i < GL_MAILBOX_SIZE_CHROMIUM; ++i) |
54 mailbox_holder->mailbox->name.push_back(mailbox[i]); | 54 mailbox_holder->mailbox->name.push_back(mailbox[i]); |
55 mailbox_holder->texture_target = GL_TEXTURE_2D; | 55 mailbox_holder->texture_target = GL_TEXTURE_2D; |
56 mailbox_holder->sync_point = sync_point; | 56 mailbox_holder->sync_point = sync_point; |
57 resource->mailbox_holder = mailbox_holder.Pass(); | 57 resource->mailbox_holder = mailbox_holder.Pass(); |
58 resource->is_repeated = false; | 58 resource->is_repeated = false; |
59 resource->is_software = false; | 59 resource->is_software = false; |
60 | 60 |
61 mojo::QuadPtr quad = mojo::Quad::New(); | 61 mojo::QuadPtr quad = mojo::Quad::New(); |
62 quad->material = mojo::MATERIAL_TEXTURE_CONTENT; | 62 quad->material = mojo::Material::TEXTURE_CONTENT; |
63 | 63 |
64 mojo::RectPtr rect = mojo::Rect::New(); | 64 mojo::RectPtr rect = mojo::Rect::New(); |
65 rect->width = size.width; | 65 rect->width = size.width; |
66 rect->height = size.height; | 66 rect->height = size.height; |
67 quad->rect = rect.Clone(); | 67 quad->rect = rect.Clone(); |
68 quad->opaque_rect = rect.Clone(); | 68 quad->opaque_rect = rect.Clone(); |
69 quad->visible_rect = rect.Clone(); | 69 quad->visible_rect = rect.Clone(); |
70 quad->needs_blending = true; | 70 quad->needs_blending = true; |
71 quad->shared_quad_state_index = 0u; | 71 quad->shared_quad_state_index = 0u; |
72 | 72 |
(...skipping 12 matching lines...) Expand all Loading... |
85 | 85 |
86 frame->resources.push_back(resource.Pass()); | 86 frame->resources.push_back(resource.Pass()); |
87 quad->texture_quad_state = texture_state.Pass(); | 87 quad->texture_quad_state = texture_state.Pass(); |
88 pass->quads.push_back(quad.Pass()); | 88 pass->quads.push_back(quad.Pass()); |
89 | 89 |
90 frame->passes.push_back(pass.Pass()); | 90 frame->passes.push_back(pass.Pass()); |
91 return frame.Pass(); | 91 return frame.Pass(); |
92 } | 92 } |
93 | 93 |
94 } // namespace mojo | 94 } // namespace mojo |
OLD | NEW |