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

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

Issue 492009: First batch of GCC fixes for GPU code. (Closed)
Patch Set: Minor fixes Created 11 years 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/cmd_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 // A class to emluate GLES2 over command buffers. 5 // A class to emluate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 // TODO(gman): remove when all functions have been implemented. 8 // TODO(gman): remove when all functions have been implemented.
9 #include "gpu/command_buffer/client/gles2_implementation_gen.h" 9 #include "gpu/command_buffer/client/gles2_implementation_gen.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
11 11
12 namespace command_buffer { 12 namespace command_buffer {
13 namespace gles2 { 13 namespace gles2 {
14 14
15 // A 32-bit and 64-bit compatible way of converting a pointer to a GLuint.
16 static GLuint ToGLuint(const void* ptr) {
17 return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
18 }
19
15 GLES2Implementation::GLES2Implementation( 20 GLES2Implementation::GLES2Implementation(
16 GLES2CmdHelper* helper, 21 GLES2CmdHelper* helper,
17 size_t transfer_buffer_size, 22 size_t transfer_buffer_size,
18 void* transfer_buffer, 23 void* transfer_buffer,
19 int32 transfer_buffer_id) 24 int32 transfer_buffer_id)
20 : util_(0), // TODO(gman): Get real number of compressed texture formats. 25 : util_(0), // TODO(gman): Get real number of compressed texture formats.
21 helper_(helper), 26 helper_(helper),
22 transfer_buffer_(transfer_buffer_size, helper, transfer_buffer), 27 transfer_buffer_(transfer_buffer_size, helper, transfer_buffer),
23 transfer_buffer_id_(transfer_buffer_id), 28 transfer_buffer_id_(transfer_buffer_id),
24 pack_alignment_(4), 29 pack_alignment_(4),
(...skipping 18 matching lines...) Expand all
43 } 48 }
44 } 49 }
45 50
46 void GLES2Implementation::WaitForCmd() { 51 void GLES2Implementation::WaitForCmd() {
47 int32 token = helper_->InsertToken(); 52 int32 token = helper_->InsertToken();
48 helper_->WaitForToken(token); 53 helper_->WaitForToken(token);
49 } 54 }
50 55
51 void GLES2Implementation::DrawElements( 56 void GLES2Implementation::DrawElements(
52 GLenum mode, GLsizei count, GLenum type, const void* indices) { 57 GLenum mode, GLsizei count, GLenum type, const void* indices) {
53 helper_->DrawElements(mode, count, type, reinterpret_cast<GLuint>(indices)); 58 helper_->DrawElements(mode, count, type, ToGLuint(indices));
54 } 59 }
55 60
56 GLint GLES2Implementation::GetAttribLocation( 61 GLint GLES2Implementation::GetAttribLocation(
57 GLuint program, const char* name) { 62 GLuint program, const char* name) {
58 helper_->GetAttribLocationImmediate( 63 helper_->GetAttribLocationImmediate(
59 program, name, result_shm_id(), result_shm_offset()); 64 program, name, result_shm_id(), result_shm_offset());
60 WaitForCmd(); 65 WaitForCmd();
61 return GetResultAs<GLint>(); 66 return GetResultAs<GLint>();
62 } 67 }
63 68
(...skipping 17 matching lines...) Expand all
81 break; 86 break;
82 } 87 }
83 helper_->PixelStorei(pname, param); 88 helper_->PixelStorei(pname, param);
84 } 89 }
85 90
86 91
87 void GLES2Implementation::VertexAttribPointer( 92 void GLES2Implementation::VertexAttribPointer(
88 GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, 93 GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
89 const void* ptr) { 94 const void* ptr) {
90 helper_->VertexAttribPointer(index, size, type, normalized, stride, 95 helper_->VertexAttribPointer(index, size, type, normalized, stride,
91 reinterpret_cast<GLuint>(ptr)); 96 ToGLuint(ptr));
92 } 97 }
93 98
94 void GLES2Implementation::ShaderSource( 99 void GLES2Implementation::ShaderSource(
95 GLuint shader, GLsizei count, const char** source, const GLint* length) { 100 GLuint shader, GLsizei count, const char** source, const GLint* length) {
96 // TODO(gman): change to use buckets and check that there is enough room. 101 // TODO(gman): change to use buckets and check that there is enough room.
97 102
98 // Compute the total size. 103 // Compute the total size.
99 uint32 total_size = count * sizeof(total_size); 104 uint32 total_size = count * sizeof(total_size);
100 for (GLsizei ii = 0; ii < count; ++ii) { 105 for (GLsizei ii = 0; ii < count; ++ii) {
101 total_size += length ? length[ii] : strlen(source[ii]); 106 total_size += length ? length[ii] : strlen(source[ii]);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 247 }
243 ++yoffset; 248 ++yoffset;
244 source += padded_row_size; 249 source += padded_row_size;
245 } 250 }
246 } 251 }
247 } 252 }
248 253
249 254
250 } // namespace gles2 255 } // namespace gles2
251 } // namespace command_buffer 256 } // namespace command_buffer
252
253
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/cmd_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698