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

Side by Side Diff: gpu/command_buffer/client/gles2_demo.cc

Issue 7792008: Manually merging trunk revs 95836 and 96904 to 835 branch (third attempt, nacl should be fixed) (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file implements a standalone executable demo of using GLES2 over 5 // This file implements a standalone executable demo of using GLES2 over
6 // command buffers. This code is temporary as the setup that happens 6 // command buffers. This code is temporary as the setup that happens
7 // here is in a state of flux. Eventually there will be several versions of 7 // here is in a state of flux. Eventually there will be several versions of
8 // setup, one for trusted code, one for pepper, one for NaCl, and maybe others. 8 // setup, one for trusted code, one for pepper, one for NaCl, and maybe others.
9 9
10 #include <windows.h> 10 #include <windows.h>
11 #include <windowsx.h> 11 #include <windowsx.h>
12 #include <shellapi.h> 12 #include <shellapi.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 #include "base/at_exit.h" 15 #include "base/at_exit.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/message_loop.h" 20 #include "base/message_loop.h"
21 #include "base/shared_memory.h" 21 #include "base/shared_memory.h"
22 #include "gpu/command_buffer/service/context_group.h"
22 #include "gpu/command_buffer/service/gpu_scheduler.h" 23 #include "gpu/command_buffer/service/gpu_scheduler.h"
23 #include "gpu/command_buffer/service/command_buffer_service.h" 24 #include "gpu/command_buffer/service/command_buffer_service.h"
24 #include "gpu/command_buffer/client/gles2_implementation.h" 25 #include "gpu/command_buffer/client/gles2_implementation.h"
25 #include "gpu/command_buffer/client/gles2_lib.h" 26 #include "gpu/command_buffer/client/gles2_lib.h"
26 #include "gpu/command_buffer/client/gles2_demo_c.h" 27 #include "gpu/command_buffer/client/gles2_demo_c.h"
27 #include "gpu/command_buffer/client/gles2_demo_cc.h" 28 #include "gpu/command_buffer/client/gles2_demo_cc.h"
28 #include "ui/gfx/gl/gl_surface.h" 29 #include "ui/gfx/gl/gl_surface.h"
29 30
30 using base::SharedMemory; 31 using base::SharedMemory;
31 using gpu::Buffer; 32 using gpu::Buffer;
(...skipping 17 matching lines...) Expand all
49 }; 50 };
50 51
51 GLES2Demo::GLES2Demo() { 52 GLES2Demo::GLES2Demo() {
52 } 53 }
53 54
54 bool GLES2Demo::Setup(void* hwnd, int32 size) { 55 bool GLES2Demo::Setup(void* hwnd, int32 size) {
55 scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService); 56 scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService);
56 if (!command_buffer->Initialize(size)) 57 if (!command_buffer->Initialize(size))
57 return NULL; 58 return NULL;
58 59
60 gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(true));
59 GpuScheduler* gpu_scheduler = GpuScheduler::Create(command_buffer.get(), 61 GpuScheduler* gpu_scheduler = GpuScheduler::Create(command_buffer.get(),
60 NULL, 62 NULL,
61 NULL); 63 NULL);
62 if (!gpu_scheduler->Initialize(reinterpret_cast<HWND>(hwnd), 64 if (!gpu_scheduler->Initialize(reinterpret_cast<HWND>(hwnd),
63 gfx::Size(), 65 gfx::Size(),
64 false, 66 false,
65 gpu::gles2::DisallowedExtensions(), 67 gpu::gles2::DisallowedExtensions(),
66 NULL, 68 NULL,
67 std::vector<int32>(), 69 std::vector<int32>(),
68 NULL)) { 70 NULL)) {
(...skipping 16 matching lines...) Expand all
85 command_buffer->GetTransferBuffer(transfer_buffer_id); 87 command_buffer->GetTransferBuffer(transfer_buffer_id);
86 if (!transfer_buffer.ptr) 88 if (!transfer_buffer.ptr)
87 return false; 89 return false;
88 90
89 91
90 gles2::Initialize(); 92 gles2::Initialize();
91 gles2::SetGLContext(new GLES2Implementation(helper, 93 gles2::SetGLContext(new GLES2Implementation(helper,
92 transfer_buffer.size, 94 transfer_buffer.size,
93 transfer_buffer.ptr, 95 transfer_buffer.ptr,
94 transfer_buffer_id, 96 transfer_buffer_id,
95 false)); 97 false,
98 true));
96 99
97 GLFromCPPInit(); 100 GLFromCPPInit();
98 101
99 return command_buffer.release() != NULL; 102 return command_buffer.release() != NULL;
100 } 103 }
101 104
102 #if defined(OS_WIN) 105 #if defined(OS_WIN)
103 LRESULT CALLBACK WindowProc( 106 LRESULT CALLBACK WindowProc(
104 HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { 107 HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
105 switch (msg) { 108 switch (msg) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ::fprintf(stdout, "Could not setup window.\n"); 226 ::fprintf(stdout, "Could not setup window.\n");
224 return EXIT_FAILURE; 227 return EXIT_FAILURE;
225 } 228 }
226 229
227 demo->Setup(hwnd, kCommandBufferSize); 230 demo->Setup(hwnd, kCommandBufferSize);
228 231
229 ProcessMessages(hwnd); 232 ProcessMessages(hwnd);
230 233
231 return EXIT_SUCCESS; 234 return EXIT_SUCCESS;
232 } 235 }
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/client/gles2_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698