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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_autogen.h

Issue 434063: Merged in recent changes to command buffer code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 // This file is auto-generated. DO NOT EDIT! 1 // This file is auto-generated. DO NOT EDIT!
2 2
3 // It is included by gles2_cmd_decoder.cc 3 // It is included by gles2_cmd_decoder.cc
4 4
5 parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( 5 parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture(
6 unsigned int arg_count, const gles2::ActiveTexture& c) { 6 uint32 immediate_data_size, const gles2::ActiveTexture& c) {
7 GLenum texture = static_cast<GLenum>(c.texture); 7 GLenum texture = static_cast<GLenum>(c.texture);
8 parse_error::ParseError result = 8 parse_error::ParseError result =
9 ValidateActiveTexture(this, arg_count, texture); 9 ValidateActiveTexture(this, immediate_data_size, texture);
10 if (result != parse_error::kParseNoError) { 10 if (result != parse_error::kParseNoError) {
11 return result; 11 return result;
12 } 12 }
13 glActiveTexture(texture); 13 glActiveTexture(texture);
14 return parse_error::kParseNoError; 14 return parse_error::kParseNoError;
15 } 15 }
16 16
17 parse_error::ParseError GLES2DecoderImpl::HandleAttachShader( 17 parse_error::ParseError GLES2DecoderImpl::HandleAttachShader(
18 unsigned int arg_count, const gles2::AttachShader& c) { 18 uint32 immediate_data_size, const gles2::AttachShader& c) {
19 GLuint program; 19 GLuint program;
20 if (!id_map_.GetServiceId(c.program, &program)) { 20 if (!id_map_.GetServiceId(c.program, &program)) {
21 SetGLError(GL_INVALID_VALUE); 21 SetGLError(GL_INVALID_VALUE);
22 return parse_error::kParseNoError; 22 return parse_error::kParseNoError;
23 } 23 }
24 GLuint shader; 24 GLuint shader;
25 if (!id_map_.GetServiceId(c.shader, &shader)) { 25 if (!id_map_.GetServiceId(c.shader, &shader)) {
26 SetGLError(GL_INVALID_VALUE); 26 SetGLError(GL_INVALID_VALUE);
27 return parse_error::kParseNoError; 27 return parse_error::kParseNoError;
28 } 28 }
29 parse_error::ParseError result = 29 parse_error::ParseError result =
30 ValidateAttachShader(this, arg_count, program, shader); 30 ValidateAttachShader(this, immediate_data_size, program, shader);
31 if (result != parse_error::kParseNoError) { 31 if (result != parse_error::kParseNoError) {
32 return result; 32 return result;
33 } 33 }
34 glAttachShader(program, shader); 34 glAttachShader(program, shader);
35 return parse_error::kParseNoError; 35 return parse_error::kParseNoError;
36 } 36 }
37 37
38 parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation( 38 parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocation(
39 unsigned int arg_count, const gles2::BindAttribLocation& c) { 39 uint32 immediate_data_size, const gles2::BindAttribLocation& c) {
40 GLuint program; 40 GLuint program;
41 if (!id_map_.GetServiceId(c.program, &program)) { 41 if (!id_map_.GetServiceId(c.program, &program)) {
42 SetGLError(GL_INVALID_VALUE); 42 SetGLError(GL_INVALID_VALUE);
43 return parse_error::kParseNoError; 43 return parse_error::kParseNoError;
44 } 44 }
45 GLuint index = static_cast<GLuint>(c.index); 45 GLuint index = static_cast<GLuint>(c.index);
46 uint32 name_size = c.data_size; 46 uint32 name_size = c.data_size;
47 const char* name = GetSharedMemoryAs<const char*>( 47 const char* name = GetSharedMemoryAs<const char*>(
48 c.name_shm_id, c.name_shm_offset, name_size); 48 c.name_shm_id, c.name_shm_offset, name_size);
49 parse_error::ParseError result = 49 parse_error::ParseError result =
50 ValidateBindAttribLocation(this, arg_count, program, index, name); 50 ValidateBindAttribLocation(
51 this, immediate_data_size, program, index, name);
51 if (result != parse_error::kParseNoError) { 52 if (result != parse_error::kParseNoError) {
52 return result; 53 return result;
53 } 54 }
54 String name_str(name, name_size); 55 String name_str(name, name_size);
55 glBindAttribLocation(program, index, name_str.c_str()); 56 glBindAttribLocation(program, index, name_str.c_str());
56 return parse_error::kParseNoError; 57 return parse_error::kParseNoError;
57 } 58 }
58 59
59 parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( 60 parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate(
60 unsigned int arg_count, const gles2::BindAttribLocationImmediate& c) { 61 uint32 immediate_data_size, const gles2::BindAttribLocationImmediate& c) {
61 GLuint program; 62 GLuint program;
62 if (!id_map_.GetServiceId(c.program, &program)) { 63 if (!id_map_.GetServiceId(c.program, &program)) {
63 SetGLError(GL_INVALID_VALUE); 64 SetGLError(GL_INVALID_VALUE);
64 return parse_error::kParseNoError; 65 return parse_error::kParseNoError;
65 } 66 }
66 GLuint index = static_cast<GLuint>(c.index); 67 GLuint index = static_cast<GLuint>(c.index);
67 uint32 name_size = c.data_size; 68 uint32 name_size = c.data_size;
68 const char* name = GetImmediateDataAs<const char*>(c); 69 const char* name = GetImmediateDataAs<const char*>(c);
69 // TODO(gman): Make sure validate checks arg_count 70 // TODO(gman): Make sure validate checks
70 // covers data_size. 71 // immediate_data_size covers data_size.
71 parse_error::ParseError result = 72 parse_error::ParseError result =
72 ValidateBindAttribLocationImmediate( 73 ValidateBindAttribLocationImmediate(
73 this, arg_count, program, index, name); 74 this, immediate_data_size, program, index, name);
74 if (result != parse_error::kParseNoError) { 75 if (result != parse_error::kParseNoError) {
75 return result; 76 return result;
76 } 77 }
77 String name_str(name, name_size); 78 String name_str(name, name_size);
78 glBindAttribLocation(program, index, name_str.c_str()); 79 glBindAttribLocation(program, index, name_str.c_str());
79 return parse_error::kParseNoError; 80 return parse_error::kParseNoError;
80 } 81 }
81 82
82 parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( 83 parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer(
83 unsigned int arg_count, const gles2::BindBuffer& c) { 84 uint32 immediate_data_size, const gles2::BindBuffer& c) {
84 GLenum target = static_cast<GLenum>(c.target); 85 GLenum target = static_cast<GLenum>(c.target);
85 GLuint buffer; 86 GLuint buffer;
86 if (!id_map_.GetServiceId(c.buffer, &buffer)) { 87 if (!id_map_.GetServiceId(c.buffer, &buffer)) {
87 SetGLError(GL_INVALID_VALUE); 88 SetGLError(GL_INVALID_VALUE);
88 return parse_error::kParseNoError; 89 return parse_error::kParseNoError;
89 } 90 }
90 parse_error::ParseError result = 91 parse_error::ParseError result =
91 ValidateBindBuffer(this, arg_count, target, buffer); 92 ValidateBindBuffer(this, immediate_data_size, target, buffer);
92 if (result != parse_error::kParseNoError) { 93 if (result != parse_error::kParseNoError) {
93 return result; 94 return result;
94 } 95 }
95 DoBindBuffer(target, buffer); 96 DoBindBuffer(target, buffer);
96 return parse_error::kParseNoError; 97 return parse_error::kParseNoError;
97 } 98 }
98 99
99 parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer( 100 parse_error::ParseError GLES2DecoderImpl::HandleBindFramebuffer(
100 unsigned int arg_count, const gles2::BindFramebuffer& c) { 101 uint32 immediate_data_size, const gles2::BindFramebuffer& c) {
101 GLenum target = static_cast<GLenum>(c.target); 102 GLenum target = static_cast<GLenum>(c.target);
102 GLuint framebuffer; 103 GLuint framebuffer;
103 if (!id_map_.GetServiceId(c.framebuffer, &framebuffer)) { 104 if (!id_map_.GetServiceId(c.framebuffer, &framebuffer)) {
104 SetGLError(GL_INVALID_VALUE); 105 SetGLError(GL_INVALID_VALUE);
105 return parse_error::kParseNoError; 106 return parse_error::kParseNoError;
106 } 107 }
107 parse_error::ParseError result = 108 parse_error::ParseError result =
108 ValidateBindFramebuffer(this, arg_count, target, framebuffer); 109 ValidateBindFramebuffer(this, immediate_data_size, target, framebuffer);
109 if (result != parse_error::kParseNoError) { 110 if (result != parse_error::kParseNoError) {
110 return result; 111 return result;
111 } 112 }
112 glBindFramebufferEXT(target, framebuffer); 113 glBindFramebufferEXT(target, framebuffer);
113 return parse_error::kParseNoError; 114 return parse_error::kParseNoError;
114 } 115 }
115 116
116 parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer( 117 parse_error::ParseError GLES2DecoderImpl::HandleBindRenderbuffer(
117 unsigned int arg_count, const gles2::BindRenderbuffer& c) { 118 uint32 immediate_data_size, const gles2::BindRenderbuffer& c) {
118 GLenum target = static_cast<GLenum>(c.target); 119 GLenum target = static_cast<GLenum>(c.target);
119 GLuint renderbuffer; 120 GLuint renderbuffer;
120 if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) { 121 if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) {
121 SetGLError(GL_INVALID_VALUE); 122 SetGLError(GL_INVALID_VALUE);
122 return parse_error::kParseNoError; 123 return parse_error::kParseNoError;
123 } 124 }
124 parse_error::ParseError result = 125 parse_error::ParseError result =
125 ValidateBindRenderbuffer(this, arg_count, target, renderbuffer); 126 ValidateBindRenderbuffer(
127 this, immediate_data_size, target, renderbuffer);
126 if (result != parse_error::kParseNoError) { 128 if (result != parse_error::kParseNoError) {
127 return result; 129 return result;
128 } 130 }
129 glBindRenderbufferEXT(target, renderbuffer); 131 glBindRenderbufferEXT(target, renderbuffer);
130 return parse_error::kParseNoError; 132 return parse_error::kParseNoError;
131 } 133 }
132 134
133 parse_error::ParseError GLES2DecoderImpl::HandleBindTexture( 135 parse_error::ParseError GLES2DecoderImpl::HandleBindTexture(
134 unsigned int arg_count, const gles2::BindTexture& c) { 136 uint32 immediate_data_size, const gles2::BindTexture& c) {
135 GLenum target = static_cast<GLenum>(c.target); 137 GLenum target = static_cast<GLenum>(c.target);
136 GLuint texture; 138 GLuint texture;
137 if (!id_map_.GetServiceId(c.texture, &texture)) { 139 if (!id_map_.GetServiceId(c.texture, &texture)) {
138 SetGLError(GL_INVALID_VALUE); 140 SetGLError(GL_INVALID_VALUE);
139 return parse_error::kParseNoError; 141 return parse_error::kParseNoError;
140 } 142 }
141 parse_error::ParseError result = 143 parse_error::ParseError result =
142 ValidateBindTexture(this, arg_count, target, texture); 144 ValidateBindTexture(this, immediate_data_size, target, texture);
143 if (result != parse_error::kParseNoError) { 145 if (result != parse_error::kParseNoError) {
144 return result; 146 return result;
145 } 147 }
146 glBindTexture(target, texture); 148 glBindTexture(target, texture);
147 return parse_error::kParseNoError; 149 return parse_error::kParseNoError;
148 } 150 }
149 151
150 parse_error::ParseError GLES2DecoderImpl::HandleBlendColor( 152 parse_error::ParseError GLES2DecoderImpl::HandleBlendColor(
151 unsigned int arg_count, const gles2::BlendColor& c) { 153 uint32 immediate_data_size, const gles2::BlendColor& c) {
152 GLclampf red = static_cast<GLclampf>(c.red); 154 GLclampf red = static_cast<GLclampf>(c.red);
153 GLclampf green = static_cast<GLclampf>(c.green); 155 GLclampf green = static_cast<GLclampf>(c.green);
154 GLclampf blue = static_cast<GLclampf>(c.blue); 156 GLclampf blue = static_cast<GLclampf>(c.blue);
155 GLclampf alpha = static_cast<GLclampf>(c.alpha); 157 GLclampf alpha = static_cast<GLclampf>(c.alpha);
156 parse_error::ParseError result = 158 parse_error::ParseError result =
157 ValidateBlendColor(this, arg_count, red, green, blue, alpha); 159 ValidateBlendColor(this, immediate_data_size, red, green, blue, alpha);
158 if (result != parse_error::kParseNoError) { 160 if (result != parse_error::kParseNoError) {
159 return result; 161 return result;
160 } 162 }
161 glBlendColor(red, green, blue, alpha); 163 glBlendColor(red, green, blue, alpha);
162 return parse_error::kParseNoError; 164 return parse_error::kParseNoError;
163 } 165 }
164 166
165 parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation( 167 parse_error::ParseError GLES2DecoderImpl::HandleBlendEquation(
166 unsigned int arg_count, const gles2::BlendEquation& c) { 168 uint32 immediate_data_size, const gles2::BlendEquation& c) {
167 GLenum mode = static_cast<GLenum>(c.mode); 169 GLenum mode = static_cast<GLenum>(c.mode);
168 parse_error::ParseError result = 170 parse_error::ParseError result =
169 ValidateBlendEquation(this, arg_count, mode); 171 ValidateBlendEquation(this, immediate_data_size, mode);
170 if (result != parse_error::kParseNoError) { 172 if (result != parse_error::kParseNoError) {
171 return result; 173 return result;
172 } 174 }
173 glBlendEquation(mode); 175 glBlendEquation(mode);
174 return parse_error::kParseNoError; 176 return parse_error::kParseNoError;
175 } 177 }
176 178
177 parse_error::ParseError GLES2DecoderImpl::HandleBlendEquationSeparate( 179 parse_error::ParseError GLES2DecoderImpl::HandleBlendEquationSeparate(
178 unsigned int arg_count, const gles2::BlendEquationSeparate& c) { 180 uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) {
179 GLenum modeRGB = static_cast<GLenum>(c.modeRGB); 181 GLenum modeRGB = static_cast<GLenum>(c.modeRGB);
180 GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); 182 GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha);
181 parse_error::ParseError result = 183 parse_error::ParseError result =
182 ValidateBlendEquationSeparate(this, arg_count, modeRGB, modeAlpha); 184 ValidateBlendEquationSeparate(
185 this, immediate_data_size, modeRGB, modeAlpha);
183 if (result != parse_error::kParseNoError) { 186 if (result != parse_error::kParseNoError) {
184 return result; 187 return result;
185 } 188 }
186 glBlendEquationSeparate(modeRGB, modeAlpha); 189 glBlendEquationSeparate(modeRGB, modeAlpha);
187 return parse_error::kParseNoError; 190 return parse_error::kParseNoError;
188 } 191 }
189 192
190 parse_error::ParseError GLES2DecoderImpl::HandleBlendFunc( 193 parse_error::ParseError GLES2DecoderImpl::HandleBlendFunc(
191 unsigned int arg_count, const gles2::BlendFunc& c) { 194 uint32 immediate_data_size, const gles2::BlendFunc& c) {
192 GLenum sfactor = static_cast<GLenum>(c.sfactor); 195 GLenum sfactor = static_cast<GLenum>(c.sfactor);
193 GLenum dfactor = static_cast<GLenum>(c.dfactor); 196 GLenum dfactor = static_cast<GLenum>(c.dfactor);
194 parse_error::ParseError result = 197 parse_error::ParseError result =
195 ValidateBlendFunc(this, arg_count, sfactor, dfactor); 198 ValidateBlendFunc(this, immediate_data_size, sfactor, dfactor);
196 if (result != parse_error::kParseNoError) { 199 if (result != parse_error::kParseNoError) {
197 return result; 200 return result;
198 } 201 }
199 glBlendFunc(sfactor, dfactor); 202 glBlendFunc(sfactor, dfactor);
200 return parse_error::kParseNoError; 203 return parse_error::kParseNoError;
201 } 204 }
202 205
203 parse_error::ParseError GLES2DecoderImpl::HandleBlendFuncSeparate( 206 parse_error::ParseError GLES2DecoderImpl::HandleBlendFuncSeparate(
204 unsigned int arg_count, const gles2::BlendFuncSeparate& c) { 207 uint32 immediate_data_size, const gles2::BlendFuncSeparate& c) {
205 GLenum srcRGB = static_cast<GLenum>(c.srcRGB); 208 GLenum srcRGB = static_cast<GLenum>(c.srcRGB);
206 GLenum dstRGB = static_cast<GLenum>(c.dstRGB); 209 GLenum dstRGB = static_cast<GLenum>(c.dstRGB);
207 GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); 210 GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha);
208 GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); 211 GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha);
209 parse_error::ParseError result = 212 parse_error::ParseError result =
210 ValidateBlendFuncSeparate( 213 ValidateBlendFuncSeparate(
211 this, arg_count, srcRGB, dstRGB, srcAlpha, dstAlpha); 214 this, immediate_data_size, srcRGB, dstRGB, srcAlpha, dstAlpha);
212 if (result != parse_error::kParseNoError) { 215 if (result != parse_error::kParseNoError) {
213 return result; 216 return result;
214 } 217 }
215 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); 218 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
216 return parse_error::kParseNoError; 219 return parse_error::kParseNoError;
217 } 220 }
218 221
219 parse_error::ParseError GLES2DecoderImpl::HandleBufferData(
220 unsigned int arg_count, const gles2::BufferData& c) {
221 GLenum target = static_cast<GLenum>(c.target);
222 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
223 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id);
224 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset);
225 GLenum usage = static_cast<GLenum>(c.usage);
226 uint32 data_size = size;
227 const void* data = GetSharedMemoryAs<const void*>(
228 data_shm_id, data_shm_offset, data_size);
229 parse_error::ParseError result =
230 ValidateBufferData(this, arg_count, target, size, data, usage);
231 if (result != parse_error::kParseNoError) {
232 return result;
233 }
234 glBufferData(target, size, data, usage);
235 return parse_error::kParseNoError;
236 }
237
238 parse_error::ParseError GLES2DecoderImpl::HandleBufferDataImmediate(
239 unsigned int arg_count, const gles2::BufferDataImmediate& c) {
240 GLenum target = static_cast<GLenum>(c.target);
241 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
242 const void* data = GetImmediateDataAs<const void*>(c);
243 GLenum usage = static_cast<GLenum>(c.usage);
244 // Immediate version.
245 parse_error::ParseError result =
246 ValidateBufferDataImmediate(this, arg_count, target, size, data, usage);
247 if (result != parse_error::kParseNoError) {
248 return result;
249 }
250 glBufferData(target, size, data, usage);
251 return parse_error::kParseNoError;
252 }
253
254 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( 222 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData(
255 unsigned int arg_count, const gles2::BufferSubData& c) { 223 uint32 immediate_data_size, const gles2::BufferSubData& c) {
256 GLenum target = static_cast<GLenum>(c.target); 224 GLenum target = static_cast<GLenum>(c.target);
257 GLintptr offset = static_cast<GLintptr>(c.offset); 225 GLintptr offset = static_cast<GLintptr>(c.offset);
258 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); 226 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
259 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); 227 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id);
260 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); 228 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset);
261 uint32 data_size = size; 229 uint32 data_size = size;
262 const void* data = GetSharedMemoryAs<const void*>( 230 const void* data = GetSharedMemoryAs<const void*>(
263 data_shm_id, data_shm_offset, data_size); 231 data_shm_id, data_shm_offset, data_size);
264 parse_error::ParseError result = 232 parse_error::ParseError result =
265 ValidateBufferSubData(this, arg_count, target, offset, size, data); 233 ValidateBufferSubData(
234 this, immediate_data_size, target, offset, size, data);
266 if (result != parse_error::kParseNoError) { 235 if (result != parse_error::kParseNoError) {
267 return result; 236 return result;
268 } 237 }
269 glBufferSubData(target, offset, size, data); 238 glBufferSubData(target, offset, size, data);
270 return parse_error::kParseNoError; 239 return parse_error::kParseNoError;
271 } 240 }
272 241
273 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( 242 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate(
274 unsigned int arg_count, const gles2::BufferSubDataImmediate& c) { 243 uint32 immediate_data_size, const gles2::BufferSubDataImmediate& c) {
275 GLenum target = static_cast<GLenum>(c.target); 244 GLenum target = static_cast<GLenum>(c.target);
276 GLintptr offset = static_cast<GLintptr>(c.offset); 245 GLintptr offset = static_cast<GLintptr>(c.offset);
277 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); 246 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
278 const void* data = GetImmediateDataAs<const void*>(c); 247 const void* data = GetImmediateDataAs<const void*>(c);
279 // Immediate version. 248 // Immediate version.
280 parse_error::ParseError result = 249 parse_error::ParseError result =
281 ValidateBufferSubDataImmediate( 250 ValidateBufferSubDataImmediate(
282 this, arg_count, target, offset, size, data); 251 this, immediate_data_size, target, offset, size, data);
283 if (result != parse_error::kParseNoError) { 252 if (result != parse_error::kParseNoError) {
284 return result; 253 return result;
285 } 254 }
286 glBufferSubData(target, offset, size, data); 255 glBufferSubData(target, offset, size, data);
287 return parse_error::kParseNoError; 256 return parse_error::kParseNoError;
288 } 257 }
289 258
290 parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( 259 parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus(
291 unsigned int arg_count, const gles2::CheckFramebufferStatus& c) { 260 uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) {
292 GLenum target = static_cast<GLenum>(c.target); 261 GLenum target = static_cast<GLenum>(c.target);
293 parse_error::ParseError result = 262 parse_error::ParseError result =
294 ValidateCheckFramebufferStatus(this, arg_count, target); 263 ValidateCheckFramebufferStatus(this, immediate_data_size, target);
295 if (result != parse_error::kParseNoError) { 264 if (result != parse_error::kParseNoError) {
296 return result; 265 return result;
297 } 266 }
298 glCheckFramebufferStatusEXT(target); 267 glCheckFramebufferStatusEXT(target);
299 return parse_error::kParseNoError; 268 return parse_error::kParseNoError;
300 } 269 }
301 270
302 parse_error::ParseError GLES2DecoderImpl::HandleClear( 271 parse_error::ParseError GLES2DecoderImpl::HandleClear(
303 unsigned int arg_count, const gles2::Clear& c) { 272 uint32 immediate_data_size, const gles2::Clear& c) {
304 GLbitfield mask = static_cast<GLbitfield>(c.mask); 273 GLbitfield mask = static_cast<GLbitfield>(c.mask);
305 parse_error::ParseError result = 274 parse_error::ParseError result =
306 ValidateClear(this, arg_count, mask); 275 ValidateClear(this, immediate_data_size, mask);
307 if (result != parse_error::kParseNoError) { 276 if (result != parse_error::kParseNoError) {
308 return result; 277 return result;
309 } 278 }
310 glClear(mask); 279 glClear(mask);
311 return parse_error::kParseNoError; 280 return parse_error::kParseNoError;
312 } 281 }
313 282
314 parse_error::ParseError GLES2DecoderImpl::HandleClearColor( 283 parse_error::ParseError GLES2DecoderImpl::HandleClearColor(
315 unsigned int arg_count, const gles2::ClearColor& c) { 284 uint32 immediate_data_size, const gles2::ClearColor& c) {
316 GLclampf red = static_cast<GLclampf>(c.red); 285 GLclampf red = static_cast<GLclampf>(c.red);
317 GLclampf green = static_cast<GLclampf>(c.green); 286 GLclampf green = static_cast<GLclampf>(c.green);
318 GLclampf blue = static_cast<GLclampf>(c.blue); 287 GLclampf blue = static_cast<GLclampf>(c.blue);
319 GLclampf alpha = static_cast<GLclampf>(c.alpha); 288 GLclampf alpha = static_cast<GLclampf>(c.alpha);
320 parse_error::ParseError result = 289 parse_error::ParseError result =
321 ValidateClearColor(this, arg_count, red, green, blue, alpha); 290 ValidateClearColor(this, immediate_data_size, red, green, blue, alpha);
322 if (result != parse_error::kParseNoError) { 291 if (result != parse_error::kParseNoError) {
323 return result; 292 return result;
324 } 293 }
325 glClearColor(red, green, blue, alpha); 294 glClearColor(red, green, blue, alpha);
326 return parse_error::kParseNoError; 295 return parse_error::kParseNoError;
327 } 296 }
328 297
329 parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf( 298 parse_error::ParseError GLES2DecoderImpl::HandleClearDepthf(
330 unsigned int arg_count, const gles2::ClearDepthf& c) { 299 uint32 immediate_data_size, const gles2::ClearDepthf& c) {
331 GLclampf depth = static_cast<GLclampf>(c.depth); 300 GLclampf depth = static_cast<GLclampf>(c.depth);
332 parse_error::ParseError result = 301 parse_error::ParseError result =
333 ValidateClearDepthf(this, arg_count, depth); 302 ValidateClearDepthf(this, immediate_data_size, depth);
334 if (result != parse_error::kParseNoError) { 303 if (result != parse_error::kParseNoError) {
335 return result; 304 return result;
336 } 305 }
337 glClearDepth(depth); 306 glClearDepth(depth);
338 return parse_error::kParseNoError; 307 return parse_error::kParseNoError;
339 } 308 }
340 309
341 parse_error::ParseError GLES2DecoderImpl::HandleClearStencil( 310 parse_error::ParseError GLES2DecoderImpl::HandleClearStencil(
342 unsigned int arg_count, const gles2::ClearStencil& c) { 311 uint32 immediate_data_size, const gles2::ClearStencil& c) {
343 GLint s = static_cast<GLint>(c.s); 312 GLint s = static_cast<GLint>(c.s);
344 parse_error::ParseError result = 313 parse_error::ParseError result =
345 ValidateClearStencil(this, arg_count, s); 314 ValidateClearStencil(this, immediate_data_size, s);
346 if (result != parse_error::kParseNoError) { 315 if (result != parse_error::kParseNoError) {
347 return result; 316 return result;
348 } 317 }
349 glClearStencil(s); 318 glClearStencil(s);
350 return parse_error::kParseNoError; 319 return parse_error::kParseNoError;
351 } 320 }
352 321
353 parse_error::ParseError GLES2DecoderImpl::HandleColorMask( 322 parse_error::ParseError GLES2DecoderImpl::HandleColorMask(
354 unsigned int arg_count, const gles2::ColorMask& c) { 323 uint32 immediate_data_size, const gles2::ColorMask& c) {
355 GLboolean red = static_cast<GLboolean>(c.red); 324 GLboolean red = static_cast<GLboolean>(c.red);
356 GLboolean green = static_cast<GLboolean>(c.green); 325 GLboolean green = static_cast<GLboolean>(c.green);
357 GLboolean blue = static_cast<GLboolean>(c.blue); 326 GLboolean blue = static_cast<GLboolean>(c.blue);
358 GLboolean alpha = static_cast<GLboolean>(c.alpha); 327 GLboolean alpha = static_cast<GLboolean>(c.alpha);
359 parse_error::ParseError result = 328 parse_error::ParseError result =
360 ValidateColorMask(this, arg_count, red, green, blue, alpha); 329 ValidateColorMask(this, immediate_data_size, red, green, blue, alpha);
361 if (result != parse_error::kParseNoError) { 330 if (result != parse_error::kParseNoError) {
362 return result; 331 return result;
363 } 332 }
364 glColorMask(red, green, blue, alpha); 333 glColorMask(red, green, blue, alpha);
365 return parse_error::kParseNoError; 334 return parse_error::kParseNoError;
366 } 335 }
367 336
368 parse_error::ParseError GLES2DecoderImpl::HandleCompileShader( 337 parse_error::ParseError GLES2DecoderImpl::HandleCompileShader(
369 unsigned int arg_count, const gles2::CompileShader& c) { 338 uint32 immediate_data_size, const gles2::CompileShader& c) {
370 GLuint shader; 339 GLuint shader;
371 if (!id_map_.GetServiceId(c.shader, &shader)) { 340 if (!id_map_.GetServiceId(c.shader, &shader)) {
372 SetGLError(GL_INVALID_VALUE); 341 SetGLError(GL_INVALID_VALUE);
373 return parse_error::kParseNoError; 342 return parse_error::kParseNoError;
374 } 343 }
375 parse_error::ParseError result = 344 parse_error::ParseError result =
376 ValidateCompileShader(this, arg_count, shader); 345 ValidateCompileShader(this, immediate_data_size, shader);
377 if (result != parse_error::kParseNoError) { 346 if (result != parse_error::kParseNoError) {
378 return result; 347 return result;
379 } 348 }
380 glCompileShader(shader); 349 glCompileShader(shader);
381 return parse_error::kParseNoError; 350 return parse_error::kParseNoError;
382 } 351 }
383 352
384 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2D(
385 unsigned int arg_count, const gles2::CompressedTexImage2D& c) {
386 GLenum target = static_cast<GLenum>(c.target);
387 GLint level = static_cast<GLint>(c.level);
388 GLenum internalformat = static_cast<GLenum>(c.internalformat);
389 GLsizei width = static_cast<GLsizei>(c.width);
390 GLsizei height = static_cast<GLsizei>(c.height);
391 GLint border = static_cast<GLint>(c.border);
392 GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
393 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id);
394 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset);
395 uint32 data_size = imageSize;
396 const void* data = GetSharedMemoryAs<const void*>(
397 data_shm_id, data_shm_offset, data_size);
398 parse_error::ParseError result =
399 ValidateCompressedTexImage2D(
400 this, arg_count, target, level, internalformat, width, height, border,
401 imageSize, data);
402 if (result != parse_error::kParseNoError) {
403 return result;
404 }
405 glCompressedTexImage2D(
406 target, level, internalformat, width, height, border, imageSize, data);
407 return parse_error::kParseNoError;
408 }
409
410 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexImage2DImmediate(
411 unsigned int arg_count, const gles2::CompressedTexImage2DImmediate& c) {
412 GLenum target = static_cast<GLenum>(c.target);
413 GLint level = static_cast<GLint>(c.level);
414 GLenum internalformat = static_cast<GLenum>(c.internalformat);
415 GLsizei width = static_cast<GLsizei>(c.width);
416 GLsizei height = static_cast<GLsizei>(c.height);
417 GLint border = static_cast<GLint>(c.border);
418 GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
419 const void* data = GetImmediateDataAs<const void*>(c);
420 // Immediate version.
421 parse_error::ParseError result =
422 ValidateCompressedTexImage2DImmediate(
423 this, arg_count, target, level, internalformat, width, height, border,
424 imageSize, data);
425 if (result != parse_error::kParseNoError) {
426 return result;
427 }
428 glCompressedTexImage2D(
429 target, level, internalformat, width, height, border, imageSize, data);
430 return parse_error::kParseNoError;
431 }
432
433 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( 353 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D(
434 unsigned int arg_count, const gles2::CompressedTexSubImage2D& c) { 354 uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) {
435 GLenum target = static_cast<GLenum>(c.target); 355 GLenum target = static_cast<GLenum>(c.target);
436 GLint level = static_cast<GLint>(c.level); 356 GLint level = static_cast<GLint>(c.level);
437 GLint xoffset = static_cast<GLint>(c.xoffset); 357 GLint xoffset = static_cast<GLint>(c.xoffset);
438 GLint yoffset = static_cast<GLint>(c.yoffset); 358 GLint yoffset = static_cast<GLint>(c.yoffset);
439 GLsizei width = static_cast<GLsizei>(c.width); 359 GLsizei width = static_cast<GLsizei>(c.width);
440 GLsizei height = static_cast<GLsizei>(c.height); 360 GLsizei height = static_cast<GLsizei>(c.height);
441 GLenum format = static_cast<GLenum>(c.format); 361 GLenum format = static_cast<GLenum>(c.format);
442 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); 362 GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
443 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); 363 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id);
444 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); 364 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset);
445 uint32 data_size = imageSize; 365 uint32 data_size = imageSize;
446 const void* data = GetSharedMemoryAs<const void*>( 366 const void* data = GetSharedMemoryAs<const void*>(
447 data_shm_id, data_shm_offset, data_size); 367 data_shm_id, data_shm_offset, data_size);
448 parse_error::ParseError result = 368 parse_error::ParseError result =
449 ValidateCompressedTexSubImage2D( 369 ValidateCompressedTexSubImage2D(
450 this, arg_count, target, level, xoffset, yoffset, width, height, 370 this, immediate_data_size, target, level, xoffset, yoffset, width,
451 format, imageSize, data); 371 height, format, imageSize, data);
452 if (result != parse_error::kParseNoError) { 372 if (result != parse_error::kParseNoError) {
453 return result; 373 return result;
454 } 374 }
455 glCompressedTexSubImage2D( 375 glCompressedTexSubImage2D(
456 target, level, xoffset, yoffset, width, height, format, imageSize, data); 376 target, level, xoffset, yoffset, width, height, format, imageSize, data);
457 return parse_error::kParseNoError; 377 return parse_error::kParseNoError;
458 } 378 }
459 379
460 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate ( 380 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate (
461 381
462 unsigned int arg_count, const gles2::CompressedTexSubImage2DImmediate& c) { 382 uint32 immediate_data_size,
383 const gles2::CompressedTexSubImage2DImmediate& c) {
463 GLenum target = static_cast<GLenum>(c.target); 384 GLenum target = static_cast<GLenum>(c.target);
464 GLint level = static_cast<GLint>(c.level); 385 GLint level = static_cast<GLint>(c.level);
465 GLint xoffset = static_cast<GLint>(c.xoffset); 386 GLint xoffset = static_cast<GLint>(c.xoffset);
466 GLint yoffset = static_cast<GLint>(c.yoffset); 387 GLint yoffset = static_cast<GLint>(c.yoffset);
467 GLsizei width = static_cast<GLsizei>(c.width); 388 GLsizei width = static_cast<GLsizei>(c.width);
468 GLsizei height = static_cast<GLsizei>(c.height); 389 GLsizei height = static_cast<GLsizei>(c.height);
469 GLenum format = static_cast<GLenum>(c.format); 390 GLenum format = static_cast<GLenum>(c.format);
470 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); 391 GLsizei imageSize = static_cast<GLsizei>(c.imageSize);
471 const void* data = GetImmediateDataAs<const void*>(c); 392 const void* data = GetImmediateDataAs<const void*>(c);
472 // Immediate version. 393 // Immediate version.
473 parse_error::ParseError result = 394 parse_error::ParseError result =
474 ValidateCompressedTexSubImage2DImmediate( 395 ValidateCompressedTexSubImage2DImmediate(
475 this, arg_count, target, level, xoffset, yoffset, width, height, 396 this, immediate_data_size, target, level, xoffset, yoffset, width,
476 format, imageSize, data); 397 height, format, imageSize, data);
477 if (result != parse_error::kParseNoError) { 398 if (result != parse_error::kParseNoError) {
478 return result; 399 return result;
479 } 400 }
480 glCompressedTexSubImage2D( 401 glCompressedTexSubImage2D(
481 target, level, xoffset, yoffset, width, height, format, imageSize, data); 402 target, level, xoffset, yoffset, width, height, format, imageSize, data);
482 return parse_error::kParseNoError; 403 return parse_error::kParseNoError;
483 } 404 }
484 405
485 parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( 406 parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D(
486 unsigned int arg_count, const gles2::CopyTexImage2D& c) { 407 uint32 immediate_data_size, const gles2::CopyTexImage2D& c) {
487 GLenum target = static_cast<GLenum>(c.target); 408 GLenum target = static_cast<GLenum>(c.target);
488 GLint level = static_cast<GLint>(c.level); 409 GLint level = static_cast<GLint>(c.level);
489 GLenum internalformat = static_cast<GLenum>(c.internalformat); 410 GLenum internalformat = static_cast<GLenum>(c.internalformat);
490 GLint x = static_cast<GLint>(c.x); 411 GLint x = static_cast<GLint>(c.x);
491 GLint y = static_cast<GLint>(c.y); 412 GLint y = static_cast<GLint>(c.y);
492 GLsizei width = static_cast<GLsizei>(c.width); 413 GLsizei width = static_cast<GLsizei>(c.width);
493 GLsizei height = static_cast<GLsizei>(c.height); 414 GLsizei height = static_cast<GLsizei>(c.height);
494 GLint border = static_cast<GLint>(c.border); 415 GLint border = static_cast<GLint>(c.border);
495 parse_error::ParseError result = 416 parse_error::ParseError result =
496 ValidateCopyTexImage2D( 417 ValidateCopyTexImage2D(
497 this, arg_count, target, level, internalformat, x, y, width, height, 418 this, immediate_data_size, target, level, internalformat, x, y, width,
498 border); 419 height, border);
499 if (result != parse_error::kParseNoError) { 420 if (result != parse_error::kParseNoError) {
500 return result; 421 return result;
501 } 422 }
502 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); 423 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
503 return parse_error::kParseNoError; 424 return parse_error::kParseNoError;
504 } 425 }
505 426
506 parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D( 427 parse_error::ParseError GLES2DecoderImpl::HandleCopyTexSubImage2D(
507 unsigned int arg_count, const gles2::CopyTexSubImage2D& c) { 428 uint32 immediate_data_size, const gles2::CopyTexSubImage2D& c) {
508 GLenum target = static_cast<GLenum>(c.target); 429 GLenum target = static_cast<GLenum>(c.target);
509 GLint level = static_cast<GLint>(c.level); 430 GLint level = static_cast<GLint>(c.level);
510 GLint xoffset = static_cast<GLint>(c.xoffset); 431 GLint xoffset = static_cast<GLint>(c.xoffset);
511 GLint yoffset = static_cast<GLint>(c.yoffset); 432 GLint yoffset = static_cast<GLint>(c.yoffset);
512 GLint x = static_cast<GLint>(c.x); 433 GLint x = static_cast<GLint>(c.x);
513 GLint y = static_cast<GLint>(c.y); 434 GLint y = static_cast<GLint>(c.y);
514 GLsizei width = static_cast<GLsizei>(c.width); 435 GLsizei width = static_cast<GLsizei>(c.width);
515 GLsizei height = static_cast<GLsizei>(c.height); 436 GLsizei height = static_cast<GLsizei>(c.height);
516 parse_error::ParseError result = 437 parse_error::ParseError result =
517 ValidateCopyTexSubImage2D( 438 ValidateCopyTexSubImage2D(
518 this, arg_count, target, level, xoffset, yoffset, x, y, width, 439 this, immediate_data_size, target, level, xoffset, yoffset, x, y,
519 height); 440 width, height);
520 if (result != parse_error::kParseNoError) { 441 if (result != parse_error::kParseNoError) {
521 return result; 442 return result;
522 } 443 }
523 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 444 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
524 return parse_error::kParseNoError; 445 return parse_error::kParseNoError;
525 } 446 }
526 447
527 parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram( 448 parse_error::ParseError GLES2DecoderImpl::HandleCreateProgram(
528 unsigned int arg_count, const gles2::CreateProgram& c) { 449 uint32 immediate_data_size, const gles2::CreateProgram& c) {
529 uint32 client_id = c.client_id; 450 uint32 client_id = c.client_id;
530 parse_error::ParseError result = 451 parse_error::ParseError result =
531 ValidateCreateProgram(this, arg_count); 452 ValidateCreateProgram(this, immediate_data_size);
532 if (result != parse_error::kParseNoError) { 453 if (result != parse_error::kParseNoError) {
533 return result; 454 return result;
534 } 455 }
535 CreateProgramHelper(client_id); 456 CreateProgramHelper(client_id);
536 return parse_error::kParseNoError; 457 return parse_error::kParseNoError;
537 } 458 }
538 459
539 parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( 460 parse_error::ParseError GLES2DecoderImpl::HandleCreateShader(
540 unsigned int arg_count, const gles2::CreateShader& c) { 461 uint32 immediate_data_size, const gles2::CreateShader& c) {
541 GLenum type = static_cast<GLenum>(c.type); 462 GLenum type = static_cast<GLenum>(c.type);
542 uint32 client_id = c.client_id; 463 uint32 client_id = c.client_id;
543 parse_error::ParseError result = 464 parse_error::ParseError result =
544 ValidateCreateShader(this, arg_count, type); 465 ValidateCreateShader(this, immediate_data_size, type);
545 if (result != parse_error::kParseNoError) { 466 if (result != parse_error::kParseNoError) {
546 return result; 467 return result;
547 } 468 }
548 CreateShaderHelper(type, client_id); 469 CreateShaderHelper(type, client_id);
549 return parse_error::kParseNoError; 470 return parse_error::kParseNoError;
550 } 471 }
551 472
552 parse_error::ParseError GLES2DecoderImpl::HandleCullFace( 473 parse_error::ParseError GLES2DecoderImpl::HandleCullFace(
553 unsigned int arg_count, const gles2::CullFace& c) { 474 uint32 immediate_data_size, const gles2::CullFace& c) {
554 GLenum mode = static_cast<GLenum>(c.mode); 475 GLenum mode = static_cast<GLenum>(c.mode);
555 parse_error::ParseError result = 476 parse_error::ParseError result =
556 ValidateCullFace(this, arg_count, mode); 477 ValidateCullFace(this, immediate_data_size, mode);
557 if (result != parse_error::kParseNoError) { 478 if (result != parse_error::kParseNoError) {
558 return result; 479 return result;
559 } 480 }
560 glCullFace(mode); 481 glCullFace(mode);
561 return parse_error::kParseNoError; 482 return parse_error::kParseNoError;
562 } 483 }
563 484
564 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers( 485 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers(
565 unsigned int arg_count, const gles2::DeleteBuffers& c) { 486 uint32 immediate_data_size, const gles2::DeleteBuffers& c) {
566 GLsizei n = static_cast<GLsizei>(c.n); 487 GLsizei n = static_cast<GLsizei>(c.n);
567 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( 488 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>(
568 c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); 489 c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */);
569 parse_error::ParseError result = 490 parse_error::ParseError result =
570 ValidateDeleteBuffers(this, arg_count, n, buffers); 491 ValidateDeleteBuffers(this, immediate_data_size, n, buffers);
571 if (result != parse_error::kParseNoError) { 492 if (result != parse_error::kParseNoError) {
572 return result; 493 return result;
573 } 494 }
574 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); 495 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers);
575 return parse_error::kParseNoError; 496 return parse_error::kParseNoError;
576 } 497 }
577 498
578 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate( 499 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate(
579 unsigned int arg_count, const gles2::DeleteBuffersImmediate& c) { 500 uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) {
580 GLsizei n = static_cast<GLsizei>(c.n); 501 GLsizei n = static_cast<GLsizei>(c.n);
581 const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c); 502 const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c);
582 parse_error::ParseError result = 503 parse_error::ParseError result =
583 ValidateDeleteBuffersImmediate(this, arg_count, n, buffers); 504 ValidateDeleteBuffersImmediate(this, immediate_data_size, n, buffers);
584 if (result != parse_error::kParseNoError) { 505 if (result != parse_error::kParseNoError) {
585 return result; 506 return result;
586 } 507 }
587 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); 508 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers);
588 return parse_error::kParseNoError; 509 return parse_error::kParseNoError;
589 } 510 }
590 511
591 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers( 512 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers(
592 unsigned int arg_count, const gles2::DeleteFramebuffers& c) { 513 uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) {
593 GLsizei n = static_cast<GLsizei>(c.n); 514 GLsizei n = static_cast<GLsizei>(c.n);
594 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( 515 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>(
595 c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( 516 c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO(
596 gman): size */); 517 gman): size */);
597 parse_error::ParseError result = 518 parse_error::ParseError result =
598 ValidateDeleteFramebuffers(this, arg_count, n, framebuffers); 519 ValidateDeleteFramebuffers(this, immediate_data_size, n, framebuffers);
599 if (result != parse_error::kParseNoError) { 520 if (result != parse_error::kParseNoError) {
600 return result; 521 return result;
601 } 522 }
602 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); 523 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
603 return parse_error::kParseNoError; 524 return parse_error::kParseNoError;
604 } 525 }
605 526
606 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( 527 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate(
607 unsigned int arg_count, const gles2::DeleteFramebuffersImmediate& c) { 528 uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) {
608 GLsizei n = static_cast<GLsizei>(c.n); 529 GLsizei n = static_cast<GLsizei>(c.n);
609 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c); 530 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c);
610 parse_error::ParseError result = 531 parse_error::ParseError result =
611 ValidateDeleteFramebuffersImmediate(this, arg_count, n, framebuffers); 532 ValidateDeleteFramebuffersImmediate(
533 this, immediate_data_size, n, framebuffers);
612 if (result != parse_error::kParseNoError) { 534 if (result != parse_error::kParseNoError) {
613 return result; 535 return result;
614 } 536 }
615 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); 537 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers);
616 return parse_error::kParseNoError; 538 return parse_error::kParseNoError;
617 } 539 }
618 540
619 parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram( 541 parse_error::ParseError GLES2DecoderImpl::HandleDeleteProgram(
620 unsigned int arg_count, const gles2::DeleteProgram& c) { 542 uint32 immediate_data_size, const gles2::DeleteProgram& c) {
621 GLuint program; 543 GLuint program;
622 if (!id_map_.GetServiceId(c.program, &program)) { 544 if (!id_map_.GetServiceId(c.program, &program)) {
623 SetGLError(GL_INVALID_VALUE); 545 SetGLError(GL_INVALID_VALUE);
624 return parse_error::kParseNoError; 546 return parse_error::kParseNoError;
625 } 547 }
626 parse_error::ParseError result = 548 parse_error::ParseError result =
627 ValidateDeleteProgram(this, arg_count, program); 549 ValidateDeleteProgram(this, immediate_data_size, program);
628 if (result != parse_error::kParseNoError) { 550 if (result != parse_error::kParseNoError) {
629 return result; 551 return result;
630 } 552 }
631 DoDeleteProgram(program); 553 DoDeleteProgram(program);
632 return parse_error::kParseNoError; 554 return parse_error::kParseNoError;
633 } 555 }
634 556
635 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( 557 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers(
636 unsigned int arg_count, const gles2::DeleteRenderbuffers& c) { 558 uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) {
637 GLsizei n = static_cast<GLsizei>(c.n); 559 GLsizei n = static_cast<GLsizei>(c.n);
638 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( 560 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>(
639 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( 561 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO(
640 gman): size */); 562 gman): size */);
641 parse_error::ParseError result = 563 parse_error::ParseError result =
642 ValidateDeleteRenderbuffers(this, arg_count, n, renderbuffers); 564 ValidateDeleteRenderbuffers(this, immediate_data_size, n, renderbuffers);
643 if (result != parse_error::kParseNoError) { 565 if (result != parse_error::kParseNoError) {
644 return result; 566 return result;
645 } 567 }
646 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); 568 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
647 return parse_error::kParseNoError; 569 return parse_error::kParseNoError;
648 } 570 }
649 571
650 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( 572 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate(
651 unsigned int arg_count, const gles2::DeleteRenderbuffersImmediate& c) { 573 uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) {
652 GLsizei n = static_cast<GLsizei>(c.n); 574 GLsizei n = static_cast<GLsizei>(c.n);
653 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c); 575 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c);
654 parse_error::ParseError result = 576 parse_error::ParseError result =
655 ValidateDeleteRenderbuffersImmediate(this, arg_count, n, renderbuffers); 577 ValidateDeleteRenderbuffersImmediate(
578 this, immediate_data_size, n, renderbuffers);
656 if (result != parse_error::kParseNoError) { 579 if (result != parse_error::kParseNoError) {
657 return result; 580 return result;
658 } 581 }
659 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); 582 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers);
660 return parse_error::kParseNoError; 583 return parse_error::kParseNoError;
661 } 584 }
662 585
663 parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader( 586 parse_error::ParseError GLES2DecoderImpl::HandleDeleteShader(
664 unsigned int arg_count, const gles2::DeleteShader& c) { 587 uint32 immediate_data_size, const gles2::DeleteShader& c) {
665 GLuint shader; 588 GLuint shader;
666 if (!id_map_.GetServiceId(c.shader, &shader)) { 589 if (!id_map_.GetServiceId(c.shader, &shader)) {
667 SetGLError(GL_INVALID_VALUE); 590 SetGLError(GL_INVALID_VALUE);
668 return parse_error::kParseNoError; 591 return parse_error::kParseNoError;
669 } 592 }
670 parse_error::ParseError result = 593 parse_error::ParseError result =
671 ValidateDeleteShader(this, arg_count, shader); 594 ValidateDeleteShader(this, immediate_data_size, shader);
672 if (result != parse_error::kParseNoError) { 595 if (result != parse_error::kParseNoError) {
673 return result; 596 return result;
674 } 597 }
675 DoDeleteShader(shader); 598 DoDeleteShader(shader);
676 return parse_error::kParseNoError; 599 return parse_error::kParseNoError;
677 } 600 }
678 601
679 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( 602 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures(
680 unsigned int arg_count, const gles2::DeleteTextures& c) { 603 uint32 immediate_data_size, const gles2::DeleteTextures& c) {
681 GLsizei n = static_cast<GLsizei>(c.n); 604 GLsizei n = static_cast<GLsizei>(c.n);
682 const GLuint* textures = GetSharedMemoryAs<const GLuint*>( 605 const GLuint* textures = GetSharedMemoryAs<const GLuint*>(
683 c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); 606 c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */);
684 parse_error::ParseError result = 607 parse_error::ParseError result =
685 ValidateDeleteTextures(this, arg_count, n, textures); 608 ValidateDeleteTextures(this, immediate_data_size, n, textures);
686 if (result != parse_error::kParseNoError) { 609 if (result != parse_error::kParseNoError) {
687 return result; 610 return result;
688 } 611 }
689 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); 612 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures);
690 return parse_error::kParseNoError; 613 return parse_error::kParseNoError;
691 } 614 }
692 615
693 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate( 616 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate(
694 unsigned int arg_count, const gles2::DeleteTexturesImmediate& c) { 617 uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) {
695 GLsizei n = static_cast<GLsizei>(c.n); 618 GLsizei n = static_cast<GLsizei>(c.n);
696 const GLuint* textures = GetImmediateDataAs<const GLuint*>(c); 619 const GLuint* textures = GetImmediateDataAs<const GLuint*>(c);
697 parse_error::ParseError result = 620 parse_error::ParseError result =
698 ValidateDeleteTexturesImmediate(this, arg_count, n, textures); 621 ValidateDeleteTexturesImmediate(this, immediate_data_size, n, textures);
699 if (result != parse_error::kParseNoError) { 622 if (result != parse_error::kParseNoError) {
700 return result; 623 return result;
701 } 624 }
702 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); 625 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures);
703 return parse_error::kParseNoError; 626 return parse_error::kParseNoError;
704 } 627 }
705 628
706 parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( 629 parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc(
707 unsigned int arg_count, const gles2::DepthFunc& c) { 630 uint32 immediate_data_size, const gles2::DepthFunc& c) {
708 GLenum func = static_cast<GLenum>(c.func); 631 GLenum func = static_cast<GLenum>(c.func);
709 parse_error::ParseError result = 632 parse_error::ParseError result =
710 ValidateDepthFunc(this, arg_count, func); 633 ValidateDepthFunc(this, immediate_data_size, func);
711 if (result != parse_error::kParseNoError) { 634 if (result != parse_error::kParseNoError) {
712 return result; 635 return result;
713 } 636 }
714 glDepthFunc(func); 637 glDepthFunc(func);
715 return parse_error::kParseNoError; 638 return parse_error::kParseNoError;
716 } 639 }
717 640
718 parse_error::ParseError GLES2DecoderImpl::HandleDepthMask( 641 parse_error::ParseError GLES2DecoderImpl::HandleDepthMask(
719 unsigned int arg_count, const gles2::DepthMask& c) { 642 uint32 immediate_data_size, const gles2::DepthMask& c) {
720 GLboolean flag = static_cast<GLboolean>(c.flag); 643 GLboolean flag = static_cast<GLboolean>(c.flag);
721 parse_error::ParseError result = 644 parse_error::ParseError result =
722 ValidateDepthMask(this, arg_count, flag); 645 ValidateDepthMask(this, immediate_data_size, flag);
723 if (result != parse_error::kParseNoError) { 646 if (result != parse_error::kParseNoError) {
724 return result; 647 return result;
725 } 648 }
726 glDepthMask(flag); 649 glDepthMask(flag);
727 return parse_error::kParseNoError; 650 return parse_error::kParseNoError;
728 } 651 }
729 652
730 parse_error::ParseError GLES2DecoderImpl::HandleDepthRangef( 653 parse_error::ParseError GLES2DecoderImpl::HandleDepthRangef(
731 unsigned int arg_count, const gles2::DepthRangef& c) { 654 uint32 immediate_data_size, const gles2::DepthRangef& c) {
732 GLclampf zNear = static_cast<GLclampf>(c.zNear); 655 GLclampf zNear = static_cast<GLclampf>(c.zNear);
733 GLclampf zFar = static_cast<GLclampf>(c.zFar); 656 GLclampf zFar = static_cast<GLclampf>(c.zFar);
734 parse_error::ParseError result = 657 parse_error::ParseError result =
735 ValidateDepthRangef(this, arg_count, zNear, zFar); 658 ValidateDepthRangef(this, immediate_data_size, zNear, zFar);
736 if (result != parse_error::kParseNoError) { 659 if (result != parse_error::kParseNoError) {
737 return result; 660 return result;
738 } 661 }
739 glDepthRange(zNear, zFar); 662 glDepthRange(zNear, zFar);
740 return parse_error::kParseNoError; 663 return parse_error::kParseNoError;
741 } 664 }
742 665
743 parse_error::ParseError GLES2DecoderImpl::HandleDetachShader( 666 parse_error::ParseError GLES2DecoderImpl::HandleDetachShader(
744 unsigned int arg_count, const gles2::DetachShader& c) { 667 uint32 immediate_data_size, const gles2::DetachShader& c) {
745 GLuint program; 668 GLuint program;
746 if (!id_map_.GetServiceId(c.program, &program)) { 669 if (!id_map_.GetServiceId(c.program, &program)) {
747 SetGLError(GL_INVALID_VALUE); 670 SetGLError(GL_INVALID_VALUE);
748 return parse_error::kParseNoError; 671 return parse_error::kParseNoError;
749 } 672 }
750 GLuint shader; 673 GLuint shader;
751 if (!id_map_.GetServiceId(c.shader, &shader)) { 674 if (!id_map_.GetServiceId(c.shader, &shader)) {
752 SetGLError(GL_INVALID_VALUE); 675 SetGLError(GL_INVALID_VALUE);
753 return parse_error::kParseNoError; 676 return parse_error::kParseNoError;
754 } 677 }
755 parse_error::ParseError result = 678 parse_error::ParseError result =
756 ValidateDetachShader(this, arg_count, program, shader); 679 ValidateDetachShader(this, immediate_data_size, program, shader);
757 if (result != parse_error::kParseNoError) { 680 if (result != parse_error::kParseNoError) {
758 return result; 681 return result;
759 } 682 }
760 glDetachShader(program, shader); 683 glDetachShader(program, shader);
761 return parse_error::kParseNoError; 684 return parse_error::kParseNoError;
762 } 685 }
763 686
764 parse_error::ParseError GLES2DecoderImpl::HandleDisable( 687 parse_error::ParseError GLES2DecoderImpl::HandleDisable(
765 unsigned int arg_count, const gles2::Disable& c) { 688 uint32 immediate_data_size, const gles2::Disable& c) {
766 GLenum cap = static_cast<GLenum>(c.cap); 689 GLenum cap = static_cast<GLenum>(c.cap);
767 parse_error::ParseError result = 690 parse_error::ParseError result =
768 ValidateDisable(this, arg_count, cap); 691 ValidateDisable(this, immediate_data_size, cap);
769 if (result != parse_error::kParseNoError) { 692 if (result != parse_error::kParseNoError) {
770 return result; 693 return result;
771 } 694 }
772 glDisable(cap); 695 glDisable(cap);
773 return parse_error::kParseNoError; 696 return parse_error::kParseNoError;
774 } 697 }
775 698
776 parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( 699 parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray(
777 unsigned int arg_count, const gles2::DisableVertexAttribArray& c) { 700 uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) {
778 GLuint index = static_cast<GLuint>(c.index); 701 GLuint index = static_cast<GLuint>(c.index);
779 parse_error::ParseError result = 702 parse_error::ParseError result =
780 ValidateDisableVertexAttribArray(this, arg_count, index); 703 ValidateDisableVertexAttribArray(this, immediate_data_size, index);
781 if (result != parse_error::kParseNoError) { 704 if (result != parse_error::kParseNoError) {
782 return result; 705 return result;
783 } 706 }
784 glDisableVertexAttribArray(index); 707 glDisableVertexAttribArray(index);
785 return parse_error::kParseNoError; 708 return parse_error::kParseNoError;
786 } 709 }
787 710
788 parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays( 711 parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays(
789 unsigned int arg_count, const gles2::DrawArrays& c) { 712 uint32 immediate_data_size, const gles2::DrawArrays& c) {
790 GLenum mode = static_cast<GLenum>(c.mode); 713 GLenum mode = static_cast<GLenum>(c.mode);
791 GLint first = static_cast<GLint>(c.first); 714 GLint first = static_cast<GLint>(c.first);
792 GLsizei count = static_cast<GLsizei>(c.count); 715 GLsizei count = static_cast<GLsizei>(c.count);
793 parse_error::ParseError result = 716 parse_error::ParseError result =
794 ValidateDrawArrays(this, arg_count, mode, first, count); 717 ValidateDrawArrays(this, immediate_data_size, mode, first, count);
795 if (result != parse_error::kParseNoError) { 718 if (result != parse_error::kParseNoError) {
796 return result; 719 return result;
797 } 720 }
798 glDrawArrays(mode, first, count); 721 glDrawArrays(mode, first, count);
799 return parse_error::kParseNoError; 722 return parse_error::kParseNoError;
800 } 723 }
801 724
802 parse_error::ParseError GLES2DecoderImpl::HandleEnable( 725 parse_error::ParseError GLES2DecoderImpl::HandleEnable(
803 unsigned int arg_count, const gles2::Enable& c) { 726 uint32 immediate_data_size, const gles2::Enable& c) {
804 GLenum cap = static_cast<GLenum>(c.cap); 727 GLenum cap = static_cast<GLenum>(c.cap);
805 parse_error::ParseError result = 728 parse_error::ParseError result =
806 ValidateEnable(this, arg_count, cap); 729 ValidateEnable(this, immediate_data_size, cap);
807 if (result != parse_error::kParseNoError) { 730 if (result != parse_error::kParseNoError) {
808 return result; 731 return result;
809 } 732 }
810 glEnable(cap); 733 glEnable(cap);
811 return parse_error::kParseNoError; 734 return parse_error::kParseNoError;
812 } 735 }
813 736
814 parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( 737 parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray(
815 unsigned int arg_count, const gles2::EnableVertexAttribArray& c) { 738 uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) {
816 GLuint index = static_cast<GLuint>(c.index); 739 GLuint index = static_cast<GLuint>(c.index);
817 parse_error::ParseError result = 740 parse_error::ParseError result =
818 ValidateEnableVertexAttribArray(this, arg_count, index); 741 ValidateEnableVertexAttribArray(this, immediate_data_size, index);
819 if (result != parse_error::kParseNoError) { 742 if (result != parse_error::kParseNoError) {
820 return result; 743 return result;
821 } 744 }
822 glEnableVertexAttribArray(index); 745 glEnableVertexAttribArray(index);
823 return parse_error::kParseNoError; 746 return parse_error::kParseNoError;
824 } 747 }
825 748
826 parse_error::ParseError GLES2DecoderImpl::HandleFinish( 749 parse_error::ParseError GLES2DecoderImpl::HandleFinish(
827 unsigned int arg_count, const gles2::Finish& c) { 750 uint32 immediate_data_size, const gles2::Finish& c) {
828 parse_error::ParseError result = 751 parse_error::ParseError result =
829 ValidateFinish(this, arg_count); 752 ValidateFinish(this, immediate_data_size);
830 if (result != parse_error::kParseNoError) { 753 if (result != parse_error::kParseNoError) {
831 return result; 754 return result;
832 } 755 }
833 glFinish(); 756 glFinish();
834 return parse_error::kParseNoError; 757 return parse_error::kParseNoError;
835 } 758 }
836 759
837 parse_error::ParseError GLES2DecoderImpl::HandleFlush( 760 parse_error::ParseError GLES2DecoderImpl::HandleFlush(
838 unsigned int arg_count, const gles2::Flush& c) { 761 uint32 immediate_data_size, const gles2::Flush& c) {
839 parse_error::ParseError result = 762 parse_error::ParseError result =
840 ValidateFlush(this, arg_count); 763 ValidateFlush(this, immediate_data_size);
841 if (result != parse_error::kParseNoError) { 764 if (result != parse_error::kParseNoError) {
842 return result; 765 return result;
843 } 766 }
844 glFlush(); 767 glFlush();
845 return parse_error::kParseNoError; 768 return parse_error::kParseNoError;
846 } 769 }
847 770
848 parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer( 771 parse_error::ParseError GLES2DecoderImpl::HandleFramebufferRenderbuffer(
849 unsigned int arg_count, const gles2::FramebufferRenderbuffer& c) { 772 uint32 immediate_data_size, const gles2::FramebufferRenderbuffer& c) {
850 GLenum target = static_cast<GLenum>(c.target); 773 GLenum target = static_cast<GLenum>(c.target);
851 GLenum attachment = static_cast<GLenum>(c.attachment); 774 GLenum attachment = static_cast<GLenum>(c.attachment);
852 GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget); 775 GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget);
853 GLuint renderbuffer; 776 GLuint renderbuffer;
854 if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) { 777 if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) {
855 SetGLError(GL_INVALID_VALUE); 778 SetGLError(GL_INVALID_VALUE);
856 return parse_error::kParseNoError; 779 return parse_error::kParseNoError;
857 } 780 }
858 parse_error::ParseError result = 781 parse_error::ParseError result =
859 ValidateFramebufferRenderbuffer( 782 ValidateFramebufferRenderbuffer(
860 this, arg_count, target, attachment, renderbuffertarget, 783 this, immediate_data_size, target, attachment, renderbuffertarget,
861 renderbuffer); 784 renderbuffer);
862 if (result != parse_error::kParseNoError) { 785 if (result != parse_error::kParseNoError) {
863 return result; 786 return result;
864 } 787 }
865 glFramebufferRenderbufferEXT( 788 glFramebufferRenderbufferEXT(
866 target, attachment, renderbuffertarget, renderbuffer); 789 target, attachment, renderbuffertarget, renderbuffer);
867 return parse_error::kParseNoError; 790 return parse_error::kParseNoError;
868 } 791 }
869 792
870 parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D( 793 parse_error::ParseError GLES2DecoderImpl::HandleFramebufferTexture2D(
871 unsigned int arg_count, const gles2::FramebufferTexture2D& c) { 794 uint32 immediate_data_size, const gles2::FramebufferTexture2D& c) {
872 GLenum target = static_cast<GLenum>(c.target); 795 GLenum target = static_cast<GLenum>(c.target);
873 GLenum attachment = static_cast<GLenum>(c.attachment); 796 GLenum attachment = static_cast<GLenum>(c.attachment);
874 GLenum textarget = static_cast<GLenum>(c.textarget); 797 GLenum textarget = static_cast<GLenum>(c.textarget);
875 GLuint texture; 798 GLuint texture;
876 if (!id_map_.GetServiceId(c.texture, &texture)) { 799 if (!id_map_.GetServiceId(c.texture, &texture)) {
877 SetGLError(GL_INVALID_VALUE); 800 SetGLError(GL_INVALID_VALUE);
878 return parse_error::kParseNoError; 801 return parse_error::kParseNoError;
879 } 802 }
880 GLint level = static_cast<GLint>(c.level); 803 GLint level = static_cast<GLint>(c.level);
881 parse_error::ParseError result = 804 parse_error::ParseError result =
882 ValidateFramebufferTexture2D( 805 ValidateFramebufferTexture2D(
883 this, arg_count, target, attachment, textarget, texture, level); 806 this, immediate_data_size, target, attachment, textarget, texture,
807 level);
884 if (result != parse_error::kParseNoError) { 808 if (result != parse_error::kParseNoError) {
885 return result; 809 return result;
886 } 810 }
887 glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); 811 glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
888 return parse_error::kParseNoError; 812 return parse_error::kParseNoError;
889 } 813 }
890 814
891 parse_error::ParseError GLES2DecoderImpl::HandleFrontFace( 815 parse_error::ParseError GLES2DecoderImpl::HandleFrontFace(
892 unsigned int arg_count, const gles2::FrontFace& c) { 816 uint32 immediate_data_size, const gles2::FrontFace& c) {
893 GLenum mode = static_cast<GLenum>(c.mode); 817 GLenum mode = static_cast<GLenum>(c.mode);
894 parse_error::ParseError result = 818 parse_error::ParseError result =
895 ValidateFrontFace(this, arg_count, mode); 819 ValidateFrontFace(this, immediate_data_size, mode);
896 if (result != parse_error::kParseNoError) { 820 if (result != parse_error::kParseNoError) {
897 return result; 821 return result;
898 } 822 }
899 glFrontFace(mode); 823 glFrontFace(mode);
900 return parse_error::kParseNoError; 824 return parse_error::kParseNoError;
901 } 825 }
902 826
903 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers( 827 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers(
904 unsigned int arg_count, const gles2::GenBuffers& c) { 828 uint32 immediate_data_size, const gles2::GenBuffers& c) {
905 GLsizei n = static_cast<GLsizei>(c.n); 829 GLsizei n = static_cast<GLsizei>(c.n);
906 GLuint* buffers = GetSharedMemoryAs<GLuint*>( 830 GLuint* buffers = GetSharedMemoryAs<GLuint*>(
907 c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); 831 c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */);
908 parse_error::ParseError result = 832 parse_error::ParseError result =
909 ValidateGenBuffers(this, arg_count, n, buffers); 833 ValidateGenBuffers(this, immediate_data_size, n, buffers);
910 if (result != parse_error::kParseNoError) { 834 if (result != parse_error::kParseNoError) {
911 return result; 835 return result;
912 } 836 }
913 GenGLObjects<GLGenBuffersHelper>(n, buffers); 837 GenGLObjects<GLGenBuffersHelper>(n, buffers);
914 return parse_error::kParseNoError; 838 return parse_error::kParseNoError;
915 } 839 }
916 840
917 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate( 841 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate(
918 unsigned int arg_count, const gles2::GenBuffersImmediate& c) { 842 uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) {
919 GLsizei n = static_cast<GLsizei>(c.n); 843 GLsizei n = static_cast<GLsizei>(c.n);
920 GLuint* buffers = GetImmediateDataAs<GLuint*>(c); 844 GLuint* buffers = GetImmediateDataAs<GLuint*>(c);
921 parse_error::ParseError result = 845 parse_error::ParseError result =
922 ValidateGenBuffersImmediate(this, arg_count, n, buffers); 846 ValidateGenBuffersImmediate(this, immediate_data_size, n, buffers);
923 if (result != parse_error::kParseNoError) { 847 if (result != parse_error::kParseNoError) {
924 return result; 848 return result;
925 } 849 }
926 GenGLObjects<GLGenBuffersHelper>(n, buffers); 850 GenGLObjects<GLGenBuffersHelper>(n, buffers);
927 return parse_error::kParseNoError; 851 return parse_error::kParseNoError;
928 } 852 }
929 853
930 parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( 854 parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap(
931 unsigned int arg_count, const gles2::GenerateMipmap& c) { 855 uint32 immediate_data_size, const gles2::GenerateMipmap& c) {
932 GLenum target = static_cast<GLenum>(c.target); 856 GLenum target = static_cast<GLenum>(c.target);
933 parse_error::ParseError result = 857 parse_error::ParseError result =
934 ValidateGenerateMipmap(this, arg_count, target); 858 ValidateGenerateMipmap(this, immediate_data_size, target);
935 if (result != parse_error::kParseNoError) { 859 if (result != parse_error::kParseNoError) {
936 return result; 860 return result;
937 } 861 }
938 glGenerateMipmapEXT(target); 862 glGenerateMipmapEXT(target);
939 return parse_error::kParseNoError; 863 return parse_error::kParseNoError;
940 } 864 }
941 865
942 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers( 866 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers(
943 unsigned int arg_count, const gles2::GenFramebuffers& c) { 867 uint32 immediate_data_size, const gles2::GenFramebuffers& c) {
944 GLsizei n = static_cast<GLsizei>(c.n); 868 GLsizei n = static_cast<GLsizei>(c.n);
945 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( 869 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>(
946 c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( 870 c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO(
947 gman): size */); 871 gman): size */);
948 parse_error::ParseError result = 872 parse_error::ParseError result =
949 ValidateGenFramebuffers(this, arg_count, n, framebuffers); 873 ValidateGenFramebuffers(this, immediate_data_size, n, framebuffers);
950 if (result != parse_error::kParseNoError) { 874 if (result != parse_error::kParseNoError) {
951 return result; 875 return result;
952 } 876 }
953 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); 877 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers);
954 return parse_error::kParseNoError; 878 return parse_error::kParseNoError;
955 } 879 }
956 880
957 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate( 881 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate(
958 unsigned int arg_count, const gles2::GenFramebuffersImmediate& c) { 882 uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) {
959 GLsizei n = static_cast<GLsizei>(c.n); 883 GLsizei n = static_cast<GLsizei>(c.n);
960 GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c); 884 GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c);
961 parse_error::ParseError result = 885 parse_error::ParseError result =
962 ValidateGenFramebuffersImmediate(this, arg_count, n, framebuffers); 886 ValidateGenFramebuffersImmediate(
887 this, immediate_data_size, n, framebuffers);
963 if (result != parse_error::kParseNoError) { 888 if (result != parse_error::kParseNoError) {
964 return result; 889 return result;
965 } 890 }
966 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); 891 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers);
967 return parse_error::kParseNoError; 892 return parse_error::kParseNoError;
968 } 893 }
969 894
970 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers( 895 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers(
971 unsigned int arg_count, const gles2::GenRenderbuffers& c) { 896 uint32 immediate_data_size, const gles2::GenRenderbuffers& c) {
972 GLsizei n = static_cast<GLsizei>(c.n); 897 GLsizei n = static_cast<GLsizei>(c.n);
973 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( 898 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>(
974 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( 899 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO(
975 gman): size */); 900 gman): size */);
976 parse_error::ParseError result = 901 parse_error::ParseError result =
977 ValidateGenRenderbuffers(this, arg_count, n, renderbuffers); 902 ValidateGenRenderbuffers(this, immediate_data_size, n, renderbuffers);
978 if (result != parse_error::kParseNoError) { 903 if (result != parse_error::kParseNoError) {
979 return result; 904 return result;
980 } 905 }
981 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); 906 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers);
982 return parse_error::kParseNoError; 907 return parse_error::kParseNoError;
983 } 908 }
984 909
985 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate( 910 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate(
986 unsigned int arg_count, const gles2::GenRenderbuffersImmediate& c) { 911 uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) {
987 GLsizei n = static_cast<GLsizei>(c.n); 912 GLsizei n = static_cast<GLsizei>(c.n);
988 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c); 913 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c);
989 parse_error::ParseError result = 914 parse_error::ParseError result =
990 ValidateGenRenderbuffersImmediate(this, arg_count, n, renderbuffers); 915 ValidateGenRenderbuffersImmediate(
916 this, immediate_data_size, n, renderbuffers);
991 if (result != parse_error::kParseNoError) { 917 if (result != parse_error::kParseNoError) {
992 return result; 918 return result;
993 } 919 }
994 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); 920 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers);
995 return parse_error::kParseNoError; 921 return parse_error::kParseNoError;
996 } 922 }
997 923
998 parse_error::ParseError GLES2DecoderImpl::HandleGenTextures( 924 parse_error::ParseError GLES2DecoderImpl::HandleGenTextures(
999 unsigned int arg_count, const gles2::GenTextures& c) { 925 uint32 immediate_data_size, const gles2::GenTextures& c) {
1000 GLsizei n = static_cast<GLsizei>(c.n); 926 GLsizei n = static_cast<GLsizei>(c.n);
1001 GLuint* textures = GetSharedMemoryAs<GLuint*>( 927 GLuint* textures = GetSharedMemoryAs<GLuint*>(
1002 c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); 928 c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */);
1003 parse_error::ParseError result = 929 parse_error::ParseError result =
1004 ValidateGenTextures(this, arg_count, n, textures); 930 ValidateGenTextures(this, immediate_data_size, n, textures);
1005 if (result != parse_error::kParseNoError) { 931 if (result != parse_error::kParseNoError) {
1006 return result; 932 return result;
1007 } 933 }
1008 GenGLObjects<GLGenTexturesHelper>(n, textures); 934 GenGLObjects<GLGenTexturesHelper>(n, textures);
1009 return parse_error::kParseNoError; 935 return parse_error::kParseNoError;
1010 } 936 }
1011 937
1012 parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate( 938 parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate(
1013 unsigned int arg_count, const gles2::GenTexturesImmediate& c) { 939 uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) {
1014 GLsizei n = static_cast<GLsizei>(c.n); 940 GLsizei n = static_cast<GLsizei>(c.n);
1015 GLuint* textures = GetImmediateDataAs<GLuint*>(c); 941 GLuint* textures = GetImmediateDataAs<GLuint*>(c);
1016 parse_error::ParseError result = 942 parse_error::ParseError result =
1017 ValidateGenTexturesImmediate(this, arg_count, n, textures); 943 ValidateGenTexturesImmediate(this, immediate_data_size, n, textures);
1018 if (result != parse_error::kParseNoError) { 944 if (result != parse_error::kParseNoError) {
1019 return result; 945 return result;
1020 } 946 }
1021 GenGLObjects<GLGenTexturesHelper>(n, textures); 947 GenGLObjects<GLGenTexturesHelper>(n, textures);
1022 return parse_error::kParseNoError; 948 return parse_error::kParseNoError;
1023 } 949 }
1024 950
1025 parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocation(
1026 unsigned int arg_count, const gles2::GetAttribLocation& c) {
1027 GLuint program;
1028 if (!id_map_.GetServiceId(c.program, &program)) {
1029 SetGLError(GL_INVALID_VALUE);
1030 return parse_error::kParseNoError;
1031 }
1032 uint32 name_size = c.data_size;
1033 const char* name = GetSharedMemoryAs<const char*>(
1034 c.name_shm_id, c.name_shm_offset, name_size);
1035 parse_error::ParseError result =
1036 ValidateGetAttribLocation(this, arg_count, program, name);
1037 if (result != parse_error::kParseNoError) {
1038 return result;
1039 }
1040 String name_str(name, name_size);
1041 GLint location = glGetAttribLocation(program, name_str.c_str());
1042 DCHECK(false); // TODO: return result.
1043 return parse_error::kParseNoError;
1044 }
1045
1046 parse_error::ParseError GLES2DecoderImpl::HandleGetAttribLocationImmediate(
1047 unsigned int arg_count, const gles2::GetAttribLocationImmediate& c) {
1048 GLuint program;
1049 if (!id_map_.GetServiceId(c.program, &program)) {
1050 SetGLError(GL_INVALID_VALUE);
1051 return parse_error::kParseNoError;
1052 }
1053 uint32 name_size = c.data_size;
1054 const char* name = GetImmediateDataAs<const char*>(c);
1055 // TODO(gman): Make sure validate checks arg_count
1056 // covers data_size.
1057 parse_error::ParseError result =
1058 ValidateGetAttribLocationImmediate(this, arg_count, program, name);
1059 if (result != parse_error::kParseNoError) {
1060 return result;
1061 }
1062 String name_str(name, name_size);
1063 GLint location = glGetAttribLocation(program, name_str.c_str());
1064 DCHECK(false); // TODO: return result.
1065 return parse_error::kParseNoError;
1066 }
1067
1068 parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( 951 parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv(
1069 unsigned int arg_count, const gles2::GetBooleanv& c) { 952 uint32 immediate_data_size, const gles2::GetBooleanv& c) {
1070 GLenum pname = static_cast<GLenum>(c.pname); 953 GLenum pname = static_cast<GLenum>(c.pname);
1071 GLboolean* params; 954 GLboolean* params;
1072 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 955 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1073 uint32 params_size = num_values * sizeof(*params); 956 uint32 params_size = num_values * sizeof(*params);
1074 params = GetSharedMemoryAs<GLboolean*>( 957 params = GetSharedMemoryAs<GLboolean*>(
1075 c.params_shm_id, c.params_shm_offset, params_size); 958 c.params_shm_id, c.params_shm_offset, params_size);
1076 parse_error::ParseError result = 959 parse_error::ParseError result =
1077 ValidateGetBooleanv(this, arg_count, pname, params); 960 ValidateGetBooleanv(this, immediate_data_size, pname, params);
1078 if (result != parse_error::kParseNoError) { 961 if (result != parse_error::kParseNoError) {
1079 return result; 962 return result;
1080 } 963 }
1081 glGetBooleanv(pname, params); 964 glGetBooleanv(pname, params);
1082 return parse_error::kParseNoError; 965 return parse_error::kParseNoError;
1083 } 966 }
1084 967
1085 parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv( 968 parse_error::ParseError GLES2DecoderImpl::HandleGetBufferParameteriv(
1086 unsigned int arg_count, const gles2::GetBufferParameteriv& c) { 969 uint32 immediate_data_size, const gles2::GetBufferParameteriv& c) {
1087 GLenum target = static_cast<GLenum>(c.target); 970 GLenum target = static_cast<GLenum>(c.target);
1088 GLenum pname = static_cast<GLenum>(c.pname); 971 GLenum pname = static_cast<GLenum>(c.pname);
1089 GLint* params; 972 GLint* params;
1090 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 973 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1091 uint32 params_size = num_values * sizeof(*params); 974 uint32 params_size = num_values * sizeof(*params);
1092 params = GetSharedMemoryAs<GLint*>( 975 params = GetSharedMemoryAs<GLint*>(
1093 c.params_shm_id, c.params_shm_offset, params_size); 976 c.params_shm_id, c.params_shm_offset, params_size);
1094 parse_error::ParseError result = 977 parse_error::ParseError result =
1095 ValidateGetBufferParameteriv(this, arg_count, target, pname, params); 978 ValidateGetBufferParameteriv(
979 this, immediate_data_size, target, pname, params);
1096 if (result != parse_error::kParseNoError) { 980 if (result != parse_error::kParseNoError) {
1097 return result; 981 return result;
1098 } 982 }
1099 glGetBufferParameteriv(target, pname, params); 983 glGetBufferParameteriv(target, pname, params);
1100 return parse_error::kParseNoError; 984 return parse_error::kParseNoError;
1101 } 985 }
1102 986
1103 parse_error::ParseError GLES2DecoderImpl::HandleGetError( 987 parse_error::ParseError GLES2DecoderImpl::HandleGetError(
1104 unsigned int arg_count, const gles2::GetError& c) { 988 uint32 immediate_data_size, const gles2::GetError& c) {
1105 GLenum* result_dst = GetSharedMemoryAs<GLenum*>( 989 GLenum* result_dst = GetSharedMemoryAs<GLenum*>(
1106 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 990 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1107 parse_error::ParseError result = 991 parse_error::ParseError result =
1108 ValidateGetError(this, arg_count); 992 ValidateGetError(this, immediate_data_size);
1109 if (result != parse_error::kParseNoError) { 993 if (result != parse_error::kParseNoError) {
1110 return result; 994 return result;
1111 } 995 }
1112 *result_dst = glGetError(); 996 *result_dst = GetGLError();
1113 return parse_error::kParseNoError; 997 return parse_error::kParseNoError;
1114 } 998 }
1115 999
1116 parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv( 1000 parse_error::ParseError GLES2DecoderImpl::HandleGetFloatv(
1117 unsigned int arg_count, const gles2::GetFloatv& c) { 1001 uint32 immediate_data_size, const gles2::GetFloatv& c) {
1118 GLenum pname = static_cast<GLenum>(c.pname); 1002 GLenum pname = static_cast<GLenum>(c.pname);
1119 GLfloat* params; 1003 GLfloat* params;
1120 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1004 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1121 uint32 params_size = num_values * sizeof(*params); 1005 uint32 params_size = num_values * sizeof(*params);
1122 params = GetSharedMemoryAs<GLfloat*>( 1006 params = GetSharedMemoryAs<GLfloat*>(
1123 c.params_shm_id, c.params_shm_offset, params_size); 1007 c.params_shm_id, c.params_shm_offset, params_size);
1124 parse_error::ParseError result = 1008 parse_error::ParseError result =
1125 ValidateGetFloatv(this, arg_count, pname, params); 1009 ValidateGetFloatv(this, immediate_data_size, pname, params);
1126 if (result != parse_error::kParseNoError) { 1010 if (result != parse_error::kParseNoError) {
1127 return result; 1011 return result;
1128 } 1012 }
1129 glGetFloatv(pname, params); 1013 glGetFloatv(pname, params);
1130 return parse_error::kParseNoError; 1014 return parse_error::kParseNoError;
1131 } 1015 }
1132 1016
1133 parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParamete riv( 1017 parse_error::ParseError GLES2DecoderImpl::HandleGetFramebufferAttachmentParamete riv(
1134 1018
1135 unsigned int arg_count, 1019 uint32 immediate_data_size,
1136 const gles2::GetFramebufferAttachmentParameteriv& c) { 1020 const gles2::GetFramebufferAttachmentParameteriv& c) {
1137 GLenum target = static_cast<GLenum>(c.target); 1021 GLenum target = static_cast<GLenum>(c.target);
1138 GLenum attachment = static_cast<GLenum>(c.attachment); 1022 GLenum attachment = static_cast<GLenum>(c.attachment);
1139 GLenum pname = static_cast<GLenum>(c.pname); 1023 GLenum pname = static_cast<GLenum>(c.pname);
1140 GLint* params; 1024 GLint* params;
1141 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1025 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1142 uint32 params_size = num_values * sizeof(*params); 1026 uint32 params_size = num_values * sizeof(*params);
1143 params = GetSharedMemoryAs<GLint*>( 1027 params = GetSharedMemoryAs<GLint*>(
1144 c.params_shm_id, c.params_shm_offset, params_size); 1028 c.params_shm_id, c.params_shm_offset, params_size);
1145 parse_error::ParseError result = 1029 parse_error::ParseError result =
1146 ValidateGetFramebufferAttachmentParameteriv( 1030 ValidateGetFramebufferAttachmentParameteriv(
1147 this, arg_count, target, attachment, pname, params); 1031 this, immediate_data_size, target, attachment, pname, params);
1148 if (result != parse_error::kParseNoError) { 1032 if (result != parse_error::kParseNoError) {
1149 return result; 1033 return result;
1150 } 1034 }
1151 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); 1035 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
1152 return parse_error::kParseNoError; 1036 return parse_error::kParseNoError;
1153 } 1037 }
1154 1038
1155 parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv( 1039 parse_error::ParseError GLES2DecoderImpl::HandleGetIntegerv(
1156 unsigned int arg_count, const gles2::GetIntegerv& c) { 1040 uint32 immediate_data_size, const gles2::GetIntegerv& c) {
1157 GLenum pname = static_cast<GLenum>(c.pname); 1041 GLenum pname = static_cast<GLenum>(c.pname);
1158 GLint* params; 1042 GLint* params;
1159 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1043 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1160 uint32 params_size = num_values * sizeof(*params); 1044 uint32 params_size = num_values * sizeof(*params);
1161 params = GetSharedMemoryAs<GLint*>( 1045 params = GetSharedMemoryAs<GLint*>(
1162 c.params_shm_id, c.params_shm_offset, params_size); 1046 c.params_shm_id, c.params_shm_offset, params_size);
1163 parse_error::ParseError result = 1047 parse_error::ParseError result =
1164 ValidateGetIntegerv(this, arg_count, pname, params); 1048 ValidateGetIntegerv(this, immediate_data_size, pname, params);
1165 if (result != parse_error::kParseNoError) { 1049 if (result != parse_error::kParseNoError) {
1166 return result; 1050 return result;
1167 } 1051 }
1168 glGetIntegerv(pname, params); 1052 glGetIntegerv(pname, params);
1169 return parse_error::kParseNoError; 1053 return parse_error::kParseNoError;
1170 } 1054 }
1171 1055
1172 parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv( 1056 parse_error::ParseError GLES2DecoderImpl::HandleGetProgramiv(
1173 unsigned int arg_count, const gles2::GetProgramiv& c) { 1057 uint32 immediate_data_size, const gles2::GetProgramiv& c) {
1174 GLuint program; 1058 GLuint program;
1175 if (!id_map_.GetServiceId(c.program, &program)) { 1059 if (!id_map_.GetServiceId(c.program, &program)) {
1176 SetGLError(GL_INVALID_VALUE); 1060 SetGLError(GL_INVALID_VALUE);
1177 return parse_error::kParseNoError; 1061 return parse_error::kParseNoError;
1178 } 1062 }
1179 GLenum pname = static_cast<GLenum>(c.pname); 1063 GLenum pname = static_cast<GLenum>(c.pname);
1180 GLint* params; 1064 GLint* params;
1181 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1065 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1182 uint32 params_size = num_values * sizeof(*params); 1066 uint32 params_size = num_values * sizeof(*params);
1183 params = GetSharedMemoryAs<GLint*>( 1067 params = GetSharedMemoryAs<GLint*>(
1184 c.params_shm_id, c.params_shm_offset, params_size); 1068 c.params_shm_id, c.params_shm_offset, params_size);
1185 parse_error::ParseError result = 1069 parse_error::ParseError result =
1186 ValidateGetProgramiv(this, arg_count, program, pname, params); 1070 ValidateGetProgramiv(this, immediate_data_size, program, pname, params);
1187 if (result != parse_error::kParseNoError) { 1071 if (result != parse_error::kParseNoError) {
1188 return result; 1072 return result;
1189 } 1073 }
1190 glGetProgramiv(program, pname, params); 1074 glGetProgramiv(program, pname, params);
1191 return parse_error::kParseNoError; 1075 return parse_error::kParseNoError;
1192 } 1076 }
1193 1077
1194 parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( 1078 parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog(
1195 unsigned int arg_count, const gles2::GetProgramInfoLog& c) { 1079 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) {
1196 GLuint program; 1080 GLuint program;
1197 if (!id_map_.GetServiceId(c.program, &program)) { 1081 if (!id_map_.GetServiceId(c.program, &program)) {
1198 SetGLError(GL_INVALID_VALUE); 1082 SetGLError(GL_INVALID_VALUE);
1199 return parse_error::kParseNoError; 1083 return parse_error::kParseNoError;
1200 } 1084 }
1201 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); 1085 GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
1202 GLsizei* length = GetSharedMemoryAs<GLsizei*>( 1086 GLsizei* length = GetSharedMemoryAs<GLsizei*>(
1203 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); 1087 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */);
1204 char* infolog = GetSharedMemoryAs<char*>( 1088 char* infolog = GetSharedMemoryAs<char*>(
1205 c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); 1089 c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */);
1206 parse_error::ParseError result = 1090 parse_error::ParseError result =
1207 ValidateGetProgramInfoLog( 1091 ValidateGetProgramInfoLog(
1208 this, arg_count, program, bufsize, length, infolog); 1092 this, immediate_data_size, program, bufsize, length, infolog);
1209 if (result != parse_error::kParseNoError) { 1093 if (result != parse_error::kParseNoError) {
1210 return result; 1094 return result;
1211 } 1095 }
1212 glGetProgramInfoLog(program, bufsize, length, infolog); 1096 glGetProgramInfoLog(program, bufsize, length, infolog);
1213 return parse_error::kParseNoError; 1097 return parse_error::kParseNoError;
1214 } 1098 }
1215 1099
1216 parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( 1100 parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv(
1217 unsigned int arg_count, const gles2::GetRenderbufferParameteriv& c) { 1101 uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) {
1218 GLenum target = static_cast<GLenum>(c.target); 1102 GLenum target = static_cast<GLenum>(c.target);
1219 GLenum pname = static_cast<GLenum>(c.pname); 1103 GLenum pname = static_cast<GLenum>(c.pname);
1220 GLint* params; 1104 GLint* params;
1221 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1105 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1222 uint32 params_size = num_values * sizeof(*params); 1106 uint32 params_size = num_values * sizeof(*params);
1223 params = GetSharedMemoryAs<GLint*>( 1107 params = GetSharedMemoryAs<GLint*>(
1224 c.params_shm_id, c.params_shm_offset, params_size); 1108 c.params_shm_id, c.params_shm_offset, params_size);
1225 parse_error::ParseError result = 1109 parse_error::ParseError result =
1226 ValidateGetRenderbufferParameteriv( 1110 ValidateGetRenderbufferParameteriv(
1227 this, arg_count, target, pname, params); 1111 this, immediate_data_size, target, pname, params);
1228 if (result != parse_error::kParseNoError) { 1112 if (result != parse_error::kParseNoError) {
1229 return result; 1113 return result;
1230 } 1114 }
1231 glGetRenderbufferParameterivEXT(target, pname, params); 1115 glGetRenderbufferParameterivEXT(target, pname, params);
1232 return parse_error::kParseNoError; 1116 return parse_error::kParseNoError;
1233 } 1117 }
1234 1118
1235 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv( 1119 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderiv(
1236 unsigned int arg_count, const gles2::GetShaderiv& c) { 1120 uint32 immediate_data_size, const gles2::GetShaderiv& c) {
1237 GLuint shader; 1121 GLuint shader;
1238 if (!id_map_.GetServiceId(c.shader, &shader)) { 1122 if (!id_map_.GetServiceId(c.shader, &shader)) {
1239 SetGLError(GL_INVALID_VALUE); 1123 SetGLError(GL_INVALID_VALUE);
1240 return parse_error::kParseNoError; 1124 return parse_error::kParseNoError;
1241 } 1125 }
1242 GLenum pname = static_cast<GLenum>(c.pname); 1126 GLenum pname = static_cast<GLenum>(c.pname);
1243 GLint* params; 1127 GLint* params;
1244 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1128 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1245 uint32 params_size = num_values * sizeof(*params); 1129 uint32 params_size = num_values * sizeof(*params);
1246 params = GetSharedMemoryAs<GLint*>( 1130 params = GetSharedMemoryAs<GLint*>(
1247 c.params_shm_id, c.params_shm_offset, params_size); 1131 c.params_shm_id, c.params_shm_offset, params_size);
1248 parse_error::ParseError result = 1132 parse_error::ParseError result =
1249 ValidateGetShaderiv(this, arg_count, shader, pname, params); 1133 ValidateGetShaderiv(this, immediate_data_size, shader, pname, params);
1250 if (result != parse_error::kParseNoError) { 1134 if (result != parse_error::kParseNoError) {
1251 return result; 1135 return result;
1252 } 1136 }
1253 glGetShaderiv(shader, pname, params); 1137 glGetShaderiv(shader, pname, params);
1254 return parse_error::kParseNoError; 1138 return parse_error::kParseNoError;
1255 } 1139 }
1256 1140
1257 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( 1141 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog(
1258 unsigned int arg_count, const gles2::GetShaderInfoLog& c) { 1142 uint32 immediate_data_size, const gles2::GetShaderInfoLog& c) {
1259 GLuint shader; 1143 GLuint shader;
1260 if (!id_map_.GetServiceId(c.shader, &shader)) { 1144 if (!id_map_.GetServiceId(c.shader, &shader)) {
1261 SetGLError(GL_INVALID_VALUE); 1145 SetGLError(GL_INVALID_VALUE);
1262 return parse_error::kParseNoError; 1146 return parse_error::kParseNoError;
1263 } 1147 }
1264 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); 1148 GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
1265 GLsizei* length = GetSharedMemoryAs<GLsizei*>( 1149 GLsizei* length = GetSharedMemoryAs<GLsizei*>(
1266 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); 1150 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */);
1267 char* infolog = GetSharedMemoryAs<char*>( 1151 char* infolog = GetSharedMemoryAs<char*>(
1268 c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); 1152 c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */);
1269 parse_error::ParseError result = 1153 parse_error::ParseError result =
1270 ValidateGetShaderInfoLog( 1154 ValidateGetShaderInfoLog(
1271 this, arg_count, shader, bufsize, length, infolog); 1155 this, immediate_data_size, shader, bufsize, length, infolog);
1272 if (result != parse_error::kParseNoError) { 1156 if (result != parse_error::kParseNoError) {
1273 return result; 1157 return result;
1274 } 1158 }
1275 glGetShaderInfoLog(shader, bufsize, length, infolog); 1159 glGetShaderInfoLog(shader, bufsize, length, infolog);
1276 return parse_error::kParseNoError; 1160 return parse_error::kParseNoError;
1277 } 1161 }
1278 1162
1279 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( 1163 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource(
1280 unsigned int arg_count, const gles2::GetShaderSource& c) { 1164 uint32 immediate_data_size, const gles2::GetShaderSource& c) {
1281 GLuint shader; 1165 GLuint shader;
1282 if (!id_map_.GetServiceId(c.shader, &shader)) { 1166 if (!id_map_.GetServiceId(c.shader, &shader)) {
1283 SetGLError(GL_INVALID_VALUE); 1167 SetGLError(GL_INVALID_VALUE);
1284 return parse_error::kParseNoError; 1168 return parse_error::kParseNoError;
1285 } 1169 }
1286 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); 1170 GLsizei bufsize = static_cast<GLsizei>(c.bufsize);
1287 GLsizei* length = GetSharedMemoryAs<GLsizei*>( 1171 GLsizei* length = GetSharedMemoryAs<GLsizei*>(
1288 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); 1172 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */);
1289 char* source = GetSharedMemoryAs<char*>( 1173 char* source = GetSharedMemoryAs<char*>(
1290 c.source_shm_id, c.source_shm_offset, 0 /* TODO(gman): size */); 1174 c.source_shm_id, c.source_shm_offset, 0 /* TODO(gman): size */);
1291 parse_error::ParseError result = 1175 parse_error::ParseError result =
1292 ValidateGetShaderSource( 1176 ValidateGetShaderSource(
1293 this, arg_count, shader, bufsize, length, source); 1177 this, immediate_data_size, shader, bufsize, length, source);
1294 if (result != parse_error::kParseNoError) { 1178 if (result != parse_error::kParseNoError) {
1295 return result; 1179 return result;
1296 } 1180 }
1297 glGetShaderSource(shader, bufsize, length, source); 1181 glGetShaderSource(shader, bufsize, length, source);
1298 return parse_error::kParseNoError; 1182 return parse_error::kParseNoError;
1299 } 1183 }
1300 1184
1301 parse_error::ParseError GLES2DecoderImpl::HandleGetString( 1185 parse_error::ParseError GLES2DecoderImpl::HandleGetString(
1302 unsigned int arg_count, const gles2::GetString& c) { 1186 uint32 immediate_data_size, const gles2::GetString& c) {
1303 GLenum name = static_cast<GLenum>(c.name); 1187 GLenum name = static_cast<GLenum>(c.name);
1304 parse_error::ParseError result = 1188 parse_error::ParseError result =
1305 ValidateGetString(this, arg_count, name); 1189 ValidateGetString(this, immediate_data_size, name);
1306 if (result != parse_error::kParseNoError) { 1190 if (result != parse_error::kParseNoError) {
1307 return result; 1191 return result;
1308 } 1192 }
1309 glGetString(name); 1193 glGetString(name);
1310 return parse_error::kParseNoError; 1194 return parse_error::kParseNoError;
1311 } 1195 }
1312 1196
1313 parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv( 1197 parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameterfv(
1314 unsigned int arg_count, const gles2::GetTexParameterfv& c) { 1198 uint32 immediate_data_size, const gles2::GetTexParameterfv& c) {
1315 GLenum target = static_cast<GLenum>(c.target); 1199 GLenum target = static_cast<GLenum>(c.target);
1316 GLenum pname = static_cast<GLenum>(c.pname); 1200 GLenum pname = static_cast<GLenum>(c.pname);
1317 GLfloat* params; 1201 GLfloat* params;
1318 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1202 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1319 uint32 params_size = num_values * sizeof(*params); 1203 uint32 params_size = num_values * sizeof(*params);
1320 params = GetSharedMemoryAs<GLfloat*>( 1204 params = GetSharedMemoryAs<GLfloat*>(
1321 c.params_shm_id, c.params_shm_offset, params_size); 1205 c.params_shm_id, c.params_shm_offset, params_size);
1322 parse_error::ParseError result = 1206 parse_error::ParseError result =
1323 ValidateGetTexParameterfv(this, arg_count, target, pname, params); 1207 ValidateGetTexParameterfv(
1208 this, immediate_data_size, target, pname, params);
1324 if (result != parse_error::kParseNoError) { 1209 if (result != parse_error::kParseNoError) {
1325 return result; 1210 return result;
1326 } 1211 }
1327 glGetTexParameterfv(target, pname, params); 1212 glGetTexParameterfv(target, pname, params);
1328 return parse_error::kParseNoError; 1213 return parse_error::kParseNoError;
1329 } 1214 }
1330 1215
1331 parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv( 1216 parse_error::ParseError GLES2DecoderImpl::HandleGetTexParameteriv(
1332 unsigned int arg_count, const gles2::GetTexParameteriv& c) { 1217 uint32 immediate_data_size, const gles2::GetTexParameteriv& c) {
1333 GLenum target = static_cast<GLenum>(c.target); 1218 GLenum target = static_cast<GLenum>(c.target);
1334 GLenum pname = static_cast<GLenum>(c.pname); 1219 GLenum pname = static_cast<GLenum>(c.pname);
1335 GLint* params; 1220 GLint* params;
1336 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1221 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1337 uint32 params_size = num_values * sizeof(*params); 1222 uint32 params_size = num_values * sizeof(*params);
1338 params = GetSharedMemoryAs<GLint*>( 1223 params = GetSharedMemoryAs<GLint*>(
1339 c.params_shm_id, c.params_shm_offset, params_size); 1224 c.params_shm_id, c.params_shm_offset, params_size);
1340 parse_error::ParseError result = 1225 parse_error::ParseError result =
1341 ValidateGetTexParameteriv(this, arg_count, target, pname, params); 1226 ValidateGetTexParameteriv(
1227 this, immediate_data_size, target, pname, params);
1342 if (result != parse_error::kParseNoError) { 1228 if (result != parse_error::kParseNoError) {
1343 return result; 1229 return result;
1344 } 1230 }
1345 glGetTexParameteriv(target, pname, params); 1231 glGetTexParameteriv(target, pname, params);
1346 return parse_error::kParseNoError; 1232 return parse_error::kParseNoError;
1347 } 1233 }
1348 1234
1349 parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocation(
1350 unsigned int arg_count, const gles2::GetUniformLocation& c) {
1351 GLuint program;
1352 if (!id_map_.GetServiceId(c.program, &program)) {
1353 SetGLError(GL_INVALID_VALUE);
1354 return parse_error::kParseNoError;
1355 }
1356 uint32 name_size = c.data_size;
1357 const char* name = GetSharedMemoryAs<const char*>(
1358 c.name_shm_id, c.name_shm_offset, name_size);
1359 parse_error::ParseError result =
1360 ValidateGetUniformLocation(this, arg_count, program, name);
1361 if (result != parse_error::kParseNoError) {
1362 return result;
1363 }
1364 String name_str(name, name_size);
1365 GLint location = glGetUniformLocation(program, name_str.c_str());
1366 DCHECK(false); // TODO: return result.
1367 return parse_error::kParseNoError;
1368 }
1369
1370 parse_error::ParseError GLES2DecoderImpl::HandleGetUniformLocationImmediate(
1371 unsigned int arg_count, const gles2::GetUniformLocationImmediate& c) {
1372 GLuint program;
1373 if (!id_map_.GetServiceId(c.program, &program)) {
1374 SetGLError(GL_INVALID_VALUE);
1375 return parse_error::kParseNoError;
1376 }
1377 uint32 name_size = c.data_size;
1378 const char* name = GetImmediateDataAs<const char*>(c);
1379 // TODO(gman): Make sure validate checks arg_count
1380 // covers data_size.
1381 parse_error::ParseError result =
1382 ValidateGetUniformLocationImmediate(this, arg_count, program, name);
1383 if (result != parse_error::kParseNoError) {
1384 return result;
1385 }
1386 String name_str(name, name_size);
1387 GLint location = glGetUniformLocation(program, name_str.c_str());
1388 DCHECK(false); // TODO: return result.
1389 return parse_error::kParseNoError;
1390 }
1391
1392 parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv( 1235 parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribfv(
1393 unsigned int arg_count, const gles2::GetVertexAttribfv& c) { 1236 uint32 immediate_data_size, const gles2::GetVertexAttribfv& c) {
1394 GLuint index = static_cast<GLuint>(c.index); 1237 GLuint index = static_cast<GLuint>(c.index);
1395 GLenum pname = static_cast<GLenum>(c.pname); 1238 GLenum pname = static_cast<GLenum>(c.pname);
1396 GLfloat* params; 1239 GLfloat* params;
1397 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1240 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1398 uint32 params_size = num_values * sizeof(*params); 1241 uint32 params_size = num_values * sizeof(*params);
1399 params = GetSharedMemoryAs<GLfloat*>( 1242 params = GetSharedMemoryAs<GLfloat*>(
1400 c.params_shm_id, c.params_shm_offset, params_size); 1243 c.params_shm_id, c.params_shm_offset, params_size);
1401 parse_error::ParseError result = 1244 parse_error::ParseError result =
1402 ValidateGetVertexAttribfv(this, arg_count, index, pname, params); 1245 ValidateGetVertexAttribfv(
1246 this, immediate_data_size, index, pname, params);
1403 if (result != parse_error::kParseNoError) { 1247 if (result != parse_error::kParseNoError) {
1404 return result; 1248 return result;
1405 } 1249 }
1406 glGetVertexAttribfv(index, pname, params); 1250 glGetVertexAttribfv(index, pname, params);
1407 return parse_error::kParseNoError; 1251 return parse_error::kParseNoError;
1408 } 1252 }
1409 1253
1410 parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv( 1254 parse_error::ParseError GLES2DecoderImpl::HandleGetVertexAttribiv(
1411 unsigned int arg_count, const gles2::GetVertexAttribiv& c) { 1255 uint32 immediate_data_size, const gles2::GetVertexAttribiv& c) {
1412 GLuint index = static_cast<GLuint>(c.index); 1256 GLuint index = static_cast<GLuint>(c.index);
1413 GLenum pname = static_cast<GLenum>(c.pname); 1257 GLenum pname = static_cast<GLenum>(c.pname);
1414 GLint* params; 1258 GLint* params;
1415 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1259 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1416 uint32 params_size = num_values * sizeof(*params); 1260 uint32 params_size = num_values * sizeof(*params);
1417 params = GetSharedMemoryAs<GLint*>( 1261 params = GetSharedMemoryAs<GLint*>(
1418 c.params_shm_id, c.params_shm_offset, params_size); 1262 c.params_shm_id, c.params_shm_offset, params_size);
1419 parse_error::ParseError result = 1263 parse_error::ParseError result =
1420 ValidateGetVertexAttribiv(this, arg_count, index, pname, params); 1264 ValidateGetVertexAttribiv(
1265 this, immediate_data_size, index, pname, params);
1421 if (result != parse_error::kParseNoError) { 1266 if (result != parse_error::kParseNoError) {
1422 return result; 1267 return result;
1423 } 1268 }
1424 glGetVertexAttribiv(index, pname, params); 1269 glGetVertexAttribiv(index, pname, params);
1425 return parse_error::kParseNoError; 1270 return parse_error::kParseNoError;
1426 } 1271 }
1427 1272
1428 parse_error::ParseError GLES2DecoderImpl::HandleHint( 1273 parse_error::ParseError GLES2DecoderImpl::HandleHint(
1429 unsigned int arg_count, const gles2::Hint& c) { 1274 uint32 immediate_data_size, const gles2::Hint& c) {
1430 GLenum target = static_cast<GLenum>(c.target); 1275 GLenum target = static_cast<GLenum>(c.target);
1431 GLenum mode = static_cast<GLenum>(c.mode); 1276 GLenum mode = static_cast<GLenum>(c.mode);
1432 parse_error::ParseError result = 1277 parse_error::ParseError result =
1433 ValidateHint(this, arg_count, target, mode); 1278 ValidateHint(this, immediate_data_size, target, mode);
1434 if (result != parse_error::kParseNoError) { 1279 if (result != parse_error::kParseNoError) {
1435 return result; 1280 return result;
1436 } 1281 }
1437 glHint(target, mode); 1282 glHint(target, mode);
1438 return parse_error::kParseNoError; 1283 return parse_error::kParseNoError;
1439 } 1284 }
1440 1285
1441 parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer( 1286 parse_error::ParseError GLES2DecoderImpl::HandleIsBuffer(
1442 unsigned int arg_count, const gles2::IsBuffer& c) { 1287 uint32 immediate_data_size, const gles2::IsBuffer& c) {
1443 GLuint buffer; 1288 GLuint buffer;
1444 if (!id_map_.GetServiceId(c.buffer, &buffer)) { 1289 if (!id_map_.GetServiceId(c.buffer, &buffer)) {
1445 SetGLError(GL_INVALID_VALUE); 1290 SetGLError(GL_INVALID_VALUE);
1446 return parse_error::kParseNoError; 1291 return parse_error::kParseNoError;
1447 } 1292 }
1448 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1293 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1449 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1294 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1450 parse_error::ParseError result = 1295 parse_error::ParseError result =
1451 ValidateIsBuffer(this, arg_count, buffer); 1296 ValidateIsBuffer(this, immediate_data_size, buffer);
1452 if (result != parse_error::kParseNoError) { 1297 if (result != parse_error::kParseNoError) {
1453 return result; 1298 return result;
1454 } 1299 }
1455 *result_dst = glIsBuffer(buffer); 1300 *result_dst = glIsBuffer(buffer);
1456 return parse_error::kParseNoError; 1301 return parse_error::kParseNoError;
1457 } 1302 }
1458 1303
1459 parse_error::ParseError GLES2DecoderImpl::HandleIsEnabled( 1304 parse_error::ParseError GLES2DecoderImpl::HandleIsEnabled(
1460 unsigned int arg_count, const gles2::IsEnabled& c) { 1305 uint32 immediate_data_size, const gles2::IsEnabled& c) {
1461 GLenum cap = static_cast<GLenum>(c.cap); 1306 GLenum cap = static_cast<GLenum>(c.cap);
1462 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1307 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1463 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1308 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1464 parse_error::ParseError result = 1309 parse_error::ParseError result =
1465 ValidateIsEnabled(this, arg_count, cap); 1310 ValidateIsEnabled(this, immediate_data_size, cap);
1466 if (result != parse_error::kParseNoError) { 1311 if (result != parse_error::kParseNoError) {
1467 return result; 1312 return result;
1468 } 1313 }
1469 *result_dst = glIsEnabled(cap); 1314 *result_dst = glIsEnabled(cap);
1470 return parse_error::kParseNoError; 1315 return parse_error::kParseNoError;
1471 } 1316 }
1472 1317
1473 parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer( 1318 parse_error::ParseError GLES2DecoderImpl::HandleIsFramebuffer(
1474 unsigned int arg_count, const gles2::IsFramebuffer& c) { 1319 uint32 immediate_data_size, const gles2::IsFramebuffer& c) {
1475 GLuint framebuffer; 1320 GLuint framebuffer;
1476 if (!id_map_.GetServiceId(c.framebuffer, &framebuffer)) { 1321 if (!id_map_.GetServiceId(c.framebuffer, &framebuffer)) {
1477 SetGLError(GL_INVALID_VALUE); 1322 SetGLError(GL_INVALID_VALUE);
1478 return parse_error::kParseNoError; 1323 return parse_error::kParseNoError;
1479 } 1324 }
1480 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1325 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1481 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1326 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1482 parse_error::ParseError result = 1327 parse_error::ParseError result =
1483 ValidateIsFramebuffer(this, arg_count, framebuffer); 1328 ValidateIsFramebuffer(this, immediate_data_size, framebuffer);
1484 if (result != parse_error::kParseNoError) { 1329 if (result != parse_error::kParseNoError) {
1485 return result; 1330 return result;
1486 } 1331 }
1487 *result_dst = glIsFramebufferEXT(framebuffer); 1332 *result_dst = glIsFramebufferEXT(framebuffer);
1488 return parse_error::kParseNoError; 1333 return parse_error::kParseNoError;
1489 } 1334 }
1490 1335
1491 parse_error::ParseError GLES2DecoderImpl::HandleIsProgram( 1336 parse_error::ParseError GLES2DecoderImpl::HandleIsProgram(
1492 unsigned int arg_count, const gles2::IsProgram& c) { 1337 uint32 immediate_data_size, const gles2::IsProgram& c) {
1493 GLuint program; 1338 GLuint program;
1494 if (!id_map_.GetServiceId(c.program, &program)) { 1339 if (!id_map_.GetServiceId(c.program, &program)) {
1495 SetGLError(GL_INVALID_VALUE); 1340 SetGLError(GL_INVALID_VALUE);
1496 return parse_error::kParseNoError; 1341 return parse_error::kParseNoError;
1497 } 1342 }
1498 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1343 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1499 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1344 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1500 parse_error::ParseError result = 1345 parse_error::ParseError result =
1501 ValidateIsProgram(this, arg_count, program); 1346 ValidateIsProgram(this, immediate_data_size, program);
1502 if (result != parse_error::kParseNoError) { 1347 if (result != parse_error::kParseNoError) {
1503 return result; 1348 return result;
1504 } 1349 }
1505 *result_dst = glIsProgram(program); 1350 *result_dst = glIsProgram(program);
1506 return parse_error::kParseNoError; 1351 return parse_error::kParseNoError;
1507 } 1352 }
1508 1353
1509 parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer( 1354 parse_error::ParseError GLES2DecoderImpl::HandleIsRenderbuffer(
1510 unsigned int arg_count, const gles2::IsRenderbuffer& c) { 1355 uint32 immediate_data_size, const gles2::IsRenderbuffer& c) {
1511 GLuint renderbuffer; 1356 GLuint renderbuffer;
1512 if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) { 1357 if (!id_map_.GetServiceId(c.renderbuffer, &renderbuffer)) {
1513 SetGLError(GL_INVALID_VALUE); 1358 SetGLError(GL_INVALID_VALUE);
1514 return parse_error::kParseNoError; 1359 return parse_error::kParseNoError;
1515 } 1360 }
1516 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1361 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1517 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1362 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1518 parse_error::ParseError result = 1363 parse_error::ParseError result =
1519 ValidateIsRenderbuffer(this, arg_count, renderbuffer); 1364 ValidateIsRenderbuffer(this, immediate_data_size, renderbuffer);
1520 if (result != parse_error::kParseNoError) { 1365 if (result != parse_error::kParseNoError) {
1521 return result; 1366 return result;
1522 } 1367 }
1523 *result_dst = glIsRenderbufferEXT(renderbuffer); 1368 *result_dst = glIsRenderbufferEXT(renderbuffer);
1524 return parse_error::kParseNoError; 1369 return parse_error::kParseNoError;
1525 } 1370 }
1526 1371
1527 parse_error::ParseError GLES2DecoderImpl::HandleIsShader( 1372 parse_error::ParseError GLES2DecoderImpl::HandleIsShader(
1528 unsigned int arg_count, const gles2::IsShader& c) { 1373 uint32 immediate_data_size, const gles2::IsShader& c) {
1529 GLuint shader; 1374 GLuint shader;
1530 if (!id_map_.GetServiceId(c.shader, &shader)) { 1375 if (!id_map_.GetServiceId(c.shader, &shader)) {
1531 SetGLError(GL_INVALID_VALUE); 1376 SetGLError(GL_INVALID_VALUE);
1532 return parse_error::kParseNoError; 1377 return parse_error::kParseNoError;
1533 } 1378 }
1534 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1379 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1535 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1380 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1536 parse_error::ParseError result = 1381 parse_error::ParseError result =
1537 ValidateIsShader(this, arg_count, shader); 1382 ValidateIsShader(this, immediate_data_size, shader);
1538 if (result != parse_error::kParseNoError) { 1383 if (result != parse_error::kParseNoError) {
1539 return result; 1384 return result;
1540 } 1385 }
1541 *result_dst = glIsShader(shader); 1386 *result_dst = glIsShader(shader);
1542 return parse_error::kParseNoError; 1387 return parse_error::kParseNoError;
1543 } 1388 }
1544 1389
1545 parse_error::ParseError GLES2DecoderImpl::HandleIsTexture( 1390 parse_error::ParseError GLES2DecoderImpl::HandleIsTexture(
1546 unsigned int arg_count, const gles2::IsTexture& c) { 1391 uint32 immediate_data_size, const gles2::IsTexture& c) {
1547 GLuint texture; 1392 GLuint texture;
1548 if (!id_map_.GetServiceId(c.texture, &texture)) { 1393 if (!id_map_.GetServiceId(c.texture, &texture)) {
1549 SetGLError(GL_INVALID_VALUE); 1394 SetGLError(GL_INVALID_VALUE);
1550 return parse_error::kParseNoError; 1395 return parse_error::kParseNoError;
1551 } 1396 }
1552 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>( 1397 GLboolean* result_dst = GetSharedMemoryAs<GLboolean*>(
1553 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1398 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1554 parse_error::ParseError result = 1399 parse_error::ParseError result =
1555 ValidateIsTexture(this, arg_count, texture); 1400 ValidateIsTexture(this, immediate_data_size, texture);
1556 if (result != parse_error::kParseNoError) { 1401 if (result != parse_error::kParseNoError) {
1557 return result; 1402 return result;
1558 } 1403 }
1559 *result_dst = glIsTexture(texture); 1404 *result_dst = glIsTexture(texture);
1560 return parse_error::kParseNoError; 1405 return parse_error::kParseNoError;
1561 } 1406 }
1562 1407
1563 parse_error::ParseError GLES2DecoderImpl::HandleLineWidth( 1408 parse_error::ParseError GLES2DecoderImpl::HandleLineWidth(
1564 unsigned int arg_count, const gles2::LineWidth& c) { 1409 uint32 immediate_data_size, const gles2::LineWidth& c) {
1565 GLfloat width = static_cast<GLfloat>(c.width); 1410 GLfloat width = static_cast<GLfloat>(c.width);
1566 parse_error::ParseError result = 1411 parse_error::ParseError result =
1567 ValidateLineWidth(this, arg_count, width); 1412 ValidateLineWidth(this, immediate_data_size, width);
1568 if (result != parse_error::kParseNoError) { 1413 if (result != parse_error::kParseNoError) {
1569 return result; 1414 return result;
1570 } 1415 }
1571 glLineWidth(width); 1416 glLineWidth(width);
1572 return parse_error::kParseNoError; 1417 return parse_error::kParseNoError;
1573 } 1418 }
1574 1419
1575 parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram( 1420 parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram(
1576 unsigned int arg_count, const gles2::LinkProgram& c) { 1421 uint32 immediate_data_size, const gles2::LinkProgram& c) {
1577 GLuint program; 1422 GLuint program;
1578 if (!id_map_.GetServiceId(c.program, &program)) { 1423 if (!id_map_.GetServiceId(c.program, &program)) {
1579 SetGLError(GL_INVALID_VALUE); 1424 SetGLError(GL_INVALID_VALUE);
1580 return parse_error::kParseNoError; 1425 return parse_error::kParseNoError;
1581 } 1426 }
1582 parse_error::ParseError result = 1427 parse_error::ParseError result =
1583 ValidateLinkProgram(this, arg_count, program); 1428 ValidateLinkProgram(this, immediate_data_size, program);
1584 if (result != parse_error::kParseNoError) { 1429 if (result != parse_error::kParseNoError) {
1585 return result; 1430 return result;
1586 } 1431 }
1587 glLinkProgram(program); 1432 glLinkProgram(program);
1588 return parse_error::kParseNoError; 1433 return parse_error::kParseNoError;
1589 } 1434 }
1590 1435
1591 parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset( 1436 parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset(
1592 unsigned int arg_count, const gles2::PolygonOffset& c) { 1437 uint32 immediate_data_size, const gles2::PolygonOffset& c) {
1593 GLfloat factor = static_cast<GLfloat>(c.factor); 1438 GLfloat factor = static_cast<GLfloat>(c.factor);
1594 GLfloat units = static_cast<GLfloat>(c.units); 1439 GLfloat units = static_cast<GLfloat>(c.units);
1595 parse_error::ParseError result = 1440 parse_error::ParseError result =
1596 ValidatePolygonOffset(this, arg_count, factor, units); 1441 ValidatePolygonOffset(this, immediate_data_size, factor, units);
1597 if (result != parse_error::kParseNoError) { 1442 if (result != parse_error::kParseNoError) {
1598 return result; 1443 return result;
1599 } 1444 }
1600 glPolygonOffset(factor, units); 1445 glPolygonOffset(factor, units);
1601 return parse_error::kParseNoError; 1446 return parse_error::kParseNoError;
1602 } 1447 }
1603 1448
1604 parse_error::ParseError GLES2DecoderImpl::HandleRenderbufferStorage( 1449 parse_error::ParseError GLES2DecoderImpl::HandleRenderbufferStorage(
1605 unsigned int arg_count, const gles2::RenderbufferStorage& c) { 1450 uint32 immediate_data_size, const gles2::RenderbufferStorage& c) {
1606 GLenum target = static_cast<GLenum>(c.target); 1451 GLenum target = static_cast<GLenum>(c.target);
1607 GLenum internalformat = static_cast<GLenum>(c.internalformat); 1452 GLenum internalformat = static_cast<GLenum>(c.internalformat);
1608 GLsizei width = static_cast<GLsizei>(c.width); 1453 GLsizei width = static_cast<GLsizei>(c.width);
1609 GLsizei height = static_cast<GLsizei>(c.height); 1454 GLsizei height = static_cast<GLsizei>(c.height);
1610 parse_error::ParseError result = 1455 parse_error::ParseError result =
1611 ValidateRenderbufferStorage( 1456 ValidateRenderbufferStorage(
1612 this, arg_count, target, internalformat, width, height); 1457 this, immediate_data_size, target, internalformat, width, height);
1613 if (result != parse_error::kParseNoError) { 1458 if (result != parse_error::kParseNoError) {
1614 return result; 1459 return result;
1615 } 1460 }
1616 glRenderbufferStorageEXT(target, internalformat, width, height); 1461 glRenderbufferStorageEXT(target, internalformat, width, height);
1617 return parse_error::kParseNoError; 1462 return parse_error::kParseNoError;
1618 } 1463 }
1619 1464
1620 parse_error::ParseError GLES2DecoderImpl::HandleSampleCoverage( 1465 parse_error::ParseError GLES2DecoderImpl::HandleSampleCoverage(
1621 unsigned int arg_count, const gles2::SampleCoverage& c) { 1466 uint32 immediate_data_size, const gles2::SampleCoverage& c) {
1622 GLclampf value = static_cast<GLclampf>(c.value); 1467 GLclampf value = static_cast<GLclampf>(c.value);
1623 GLboolean invert = static_cast<GLboolean>(c.invert); 1468 GLboolean invert = static_cast<GLboolean>(c.invert);
1624 parse_error::ParseError result = 1469 parse_error::ParseError result =
1625 ValidateSampleCoverage(this, arg_count, value, invert); 1470 ValidateSampleCoverage(this, immediate_data_size, value, invert);
1626 if (result != parse_error::kParseNoError) { 1471 if (result != parse_error::kParseNoError) {
1627 return result; 1472 return result;
1628 } 1473 }
1629 glSampleCoverage(value, invert); 1474 glSampleCoverage(value, invert);
1630 return parse_error::kParseNoError; 1475 return parse_error::kParseNoError;
1631 } 1476 }
1632 1477
1633 parse_error::ParseError GLES2DecoderImpl::HandleScissor( 1478 parse_error::ParseError GLES2DecoderImpl::HandleScissor(
1634 unsigned int arg_count, const gles2::Scissor& c) { 1479 uint32 immediate_data_size, const gles2::Scissor& c) {
1635 GLint x = static_cast<GLint>(c.x); 1480 GLint x = static_cast<GLint>(c.x);
1636 GLint y = static_cast<GLint>(c.y); 1481 GLint y = static_cast<GLint>(c.y);
1637 GLsizei width = static_cast<GLsizei>(c.width); 1482 GLsizei width = static_cast<GLsizei>(c.width);
1638 GLsizei height = static_cast<GLsizei>(c.height); 1483 GLsizei height = static_cast<GLsizei>(c.height);
1639 parse_error::ParseError result = 1484 parse_error::ParseError result =
1640 ValidateScissor(this, arg_count, x, y, width, height); 1485 ValidateScissor(this, immediate_data_size, x, y, width, height);
1641 if (result != parse_error::kParseNoError) { 1486 if (result != parse_error::kParseNoError) {
1642 return result; 1487 return result;
1643 } 1488 }
1644 glScissor(x, y, width, height); 1489 glScissor(x, y, width, height);
1645 return parse_error::kParseNoError; 1490 return parse_error::kParseNoError;
1646 } 1491 }
1647 1492
1648 parse_error::ParseError GLES2DecoderImpl::HandleStencilFunc( 1493 parse_error::ParseError GLES2DecoderImpl::HandleStencilFunc(
1649 unsigned int arg_count, const gles2::StencilFunc& c) { 1494 uint32 immediate_data_size, const gles2::StencilFunc& c) {
1650 GLenum func = static_cast<GLenum>(c.func); 1495 GLenum func = static_cast<GLenum>(c.func);
1651 GLint ref = static_cast<GLint>(c.ref); 1496 GLint ref = static_cast<GLint>(c.ref);
1652 GLuint mask = static_cast<GLuint>(c.mask); 1497 GLuint mask = static_cast<GLuint>(c.mask);
1653 parse_error::ParseError result = 1498 parse_error::ParseError result =
1654 ValidateStencilFunc(this, arg_count, func, ref, mask); 1499 ValidateStencilFunc(this, immediate_data_size, func, ref, mask);
1655 if (result != parse_error::kParseNoError) { 1500 if (result != parse_error::kParseNoError) {
1656 return result; 1501 return result;
1657 } 1502 }
1658 glStencilFunc(func, ref, mask); 1503 glStencilFunc(func, ref, mask);
1659 return parse_error::kParseNoError; 1504 return parse_error::kParseNoError;
1660 } 1505 }
1661 1506
1662 parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate( 1507 parse_error::ParseError GLES2DecoderImpl::HandleStencilFuncSeparate(
1663 unsigned int arg_count, const gles2::StencilFuncSeparate& c) { 1508 uint32 immediate_data_size, const gles2::StencilFuncSeparate& c) {
1664 GLenum face = static_cast<GLenum>(c.face); 1509 GLenum face = static_cast<GLenum>(c.face);
1665 GLenum func = static_cast<GLenum>(c.func); 1510 GLenum func = static_cast<GLenum>(c.func);
1666 GLint ref = static_cast<GLint>(c.ref); 1511 GLint ref = static_cast<GLint>(c.ref);
1667 GLuint mask = static_cast<GLuint>(c.mask); 1512 GLuint mask = static_cast<GLuint>(c.mask);
1668 parse_error::ParseError result = 1513 parse_error::ParseError result =
1669 ValidateStencilFuncSeparate(this, arg_count, face, func, ref, mask); 1514 ValidateStencilFuncSeparate(
1515 this, immediate_data_size, face, func, ref, mask);
1670 if (result != parse_error::kParseNoError) { 1516 if (result != parse_error::kParseNoError) {
1671 return result; 1517 return result;
1672 } 1518 }
1673 glStencilFuncSeparate(face, func, ref, mask); 1519 glStencilFuncSeparate(face, func, ref, mask);
1674 return parse_error::kParseNoError; 1520 return parse_error::kParseNoError;
1675 } 1521 }
1676 1522
1677 parse_error::ParseError GLES2DecoderImpl::HandleStencilMask( 1523 parse_error::ParseError GLES2DecoderImpl::HandleStencilMask(
1678 unsigned int arg_count, const gles2::StencilMask& c) { 1524 uint32 immediate_data_size, const gles2::StencilMask& c) {
1679 GLuint mask = static_cast<GLuint>(c.mask); 1525 GLuint mask = static_cast<GLuint>(c.mask);
1680 parse_error::ParseError result = 1526 parse_error::ParseError result =
1681 ValidateStencilMask(this, arg_count, mask); 1527 ValidateStencilMask(this, immediate_data_size, mask);
1682 if (result != parse_error::kParseNoError) { 1528 if (result != parse_error::kParseNoError) {
1683 return result; 1529 return result;
1684 } 1530 }
1685 glStencilMask(mask); 1531 glStencilMask(mask);
1686 return parse_error::kParseNoError; 1532 return parse_error::kParseNoError;
1687 } 1533 }
1688 1534
1689 parse_error::ParseError GLES2DecoderImpl::HandleStencilMaskSeparate( 1535 parse_error::ParseError GLES2DecoderImpl::HandleStencilMaskSeparate(
1690 unsigned int arg_count, const gles2::StencilMaskSeparate& c) { 1536 uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) {
1691 GLenum face = static_cast<GLenum>(c.face); 1537 GLenum face = static_cast<GLenum>(c.face);
1692 GLuint mask = static_cast<GLuint>(c.mask); 1538 GLuint mask = static_cast<GLuint>(c.mask);
1693 parse_error::ParseError result = 1539 parse_error::ParseError result =
1694 ValidateStencilMaskSeparate(this, arg_count, face, mask); 1540 ValidateStencilMaskSeparate(this, immediate_data_size, face, mask);
1695 if (result != parse_error::kParseNoError) { 1541 if (result != parse_error::kParseNoError) {
1696 return result; 1542 return result;
1697 } 1543 }
1698 glStencilMaskSeparate(face, mask); 1544 glStencilMaskSeparate(face, mask);
1699 return parse_error::kParseNoError; 1545 return parse_error::kParseNoError;
1700 } 1546 }
1701 1547
1702 parse_error::ParseError GLES2DecoderImpl::HandleStencilOp( 1548 parse_error::ParseError GLES2DecoderImpl::HandleStencilOp(
1703 unsigned int arg_count, const gles2::StencilOp& c) { 1549 uint32 immediate_data_size, const gles2::StencilOp& c) {
1704 GLenum fail = static_cast<GLenum>(c.fail); 1550 GLenum fail = static_cast<GLenum>(c.fail);
1705 GLenum zfail = static_cast<GLenum>(c.zfail); 1551 GLenum zfail = static_cast<GLenum>(c.zfail);
1706 GLenum zpass = static_cast<GLenum>(c.zpass); 1552 GLenum zpass = static_cast<GLenum>(c.zpass);
1707 parse_error::ParseError result = 1553 parse_error::ParseError result =
1708 ValidateStencilOp(this, arg_count, fail, zfail, zpass); 1554 ValidateStencilOp(this, immediate_data_size, fail, zfail, zpass);
1709 if (result != parse_error::kParseNoError) { 1555 if (result != parse_error::kParseNoError) {
1710 return result; 1556 return result;
1711 } 1557 }
1712 glStencilOp(fail, zfail, zpass); 1558 glStencilOp(fail, zfail, zpass);
1713 return parse_error::kParseNoError; 1559 return parse_error::kParseNoError;
1714 } 1560 }
1715 1561
1716 parse_error::ParseError GLES2DecoderImpl::HandleStencilOpSeparate( 1562 parse_error::ParseError GLES2DecoderImpl::HandleStencilOpSeparate(
1717 unsigned int arg_count, const gles2::StencilOpSeparate& c) { 1563 uint32 immediate_data_size, const gles2::StencilOpSeparate& c) {
1718 GLenum face = static_cast<GLenum>(c.face); 1564 GLenum face = static_cast<GLenum>(c.face);
1719 GLenum fail = static_cast<GLenum>(c.fail); 1565 GLenum fail = static_cast<GLenum>(c.fail);
1720 GLenum zfail = static_cast<GLenum>(c.zfail); 1566 GLenum zfail = static_cast<GLenum>(c.zfail);
1721 GLenum zpass = static_cast<GLenum>(c.zpass); 1567 GLenum zpass = static_cast<GLenum>(c.zpass);
1722 parse_error::ParseError result = 1568 parse_error::ParseError result =
1723 ValidateStencilOpSeparate(this, arg_count, face, fail, zfail, zpass); 1569 ValidateStencilOpSeparate(
1570 this, immediate_data_size, face, fail, zfail, zpass);
1724 if (result != parse_error::kParseNoError) { 1571 if (result != parse_error::kParseNoError) {
1725 return result; 1572 return result;
1726 } 1573 }
1727 glStencilOpSeparate(face, fail, zfail, zpass); 1574 glStencilOpSeparate(face, fail, zfail, zpass);
1728 return parse_error::kParseNoError; 1575 return parse_error::kParseNoError;
1729 } 1576 }
1730 1577
1731 parse_error::ParseError GLES2DecoderImpl::HandleTexImage2D(
1732 unsigned int arg_count, const gles2::TexImage2D& c) {
1733 GLenum target = static_cast<GLenum>(c.target);
1734 GLint level = static_cast<GLint>(c.level);
1735 GLint internalformat = static_cast<GLint>(c.internalformat);
1736 GLsizei width = static_cast<GLsizei>(c.width);
1737 GLsizei height = static_cast<GLsizei>(c.height);
1738 GLint border = static_cast<GLint>(c.border);
1739 GLenum format = static_cast<GLenum>(c.format);
1740 GLenum type = static_cast<GLenum>(c.type);
1741 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id);
1742 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset);
1743 uint32 pixels_size = GLES2Util::ComputeImageDataSize(
1744 width, height, format, type, unpack_alignment_);
1745 const void* pixels = GetSharedMemoryAs<const void*>(
1746 pixels_shm_id, pixels_shm_offset, pixels_size);
1747 parse_error::ParseError result =
1748 ValidateTexImage2D(
1749 this, arg_count, target, level, internalformat, width, height, border,
1750 format, type, pixels);
1751 if (result != parse_error::kParseNoError) {
1752 return result;
1753 }
1754 glTexImage2D(
1755 target, level, internalformat, width, height, border, format, type,
1756 pixels);
1757 return parse_error::kParseNoError;
1758 }
1759
1760 parse_error::ParseError GLES2DecoderImpl::HandleTexImage2DImmediate(
1761 unsigned int arg_count, const gles2::TexImage2DImmediate& c) {
1762 GLenum target = static_cast<GLenum>(c.target);
1763 GLint level = static_cast<GLint>(c.level);
1764 GLint internalformat = static_cast<GLint>(c.internalformat);
1765 GLsizei width = static_cast<GLsizei>(c.width);
1766 GLsizei height = static_cast<GLsizei>(c.height);
1767 GLint border = static_cast<GLint>(c.border);
1768 GLenum format = static_cast<GLenum>(c.format);
1769 GLenum type = static_cast<GLenum>(c.type);
1770 const void* pixels = GetImmediateDataAs<const void*>(c);
1771 // Immediate version.
1772 parse_error::ParseError result =
1773 ValidateTexImage2DImmediate(
1774 this, arg_count, target, level, internalformat, width, height, border,
1775 format, type, pixels);
1776 if (result != parse_error::kParseNoError) {
1777 return result;
1778 }
1779 glTexImage2D(
1780 target, level, internalformat, width, height, border, format, type,
1781 pixels);
1782 return parse_error::kParseNoError;
1783 }
1784
1785 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterf( 1578 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterf(
1786 unsigned int arg_count, const gles2::TexParameterf& c) { 1579 uint32 immediate_data_size, const gles2::TexParameterf& c) {
1787 GLenum target = static_cast<GLenum>(c.target); 1580 GLenum target = static_cast<GLenum>(c.target);
1788 GLenum pname = static_cast<GLenum>(c.pname); 1581 GLenum pname = static_cast<GLenum>(c.pname);
1789 GLfloat param = static_cast<GLfloat>(c.param); 1582 GLfloat param = static_cast<GLfloat>(c.param);
1790 parse_error::ParseError result = 1583 parse_error::ParseError result =
1791 ValidateTexParameterf(this, arg_count, target, pname, param); 1584 ValidateTexParameterf(this, immediate_data_size, target, pname, param);
1792 if (result != parse_error::kParseNoError) { 1585 if (result != parse_error::kParseNoError) {
1793 return result; 1586 return result;
1794 } 1587 }
1795 glTexParameterf(target, pname, param); 1588 glTexParameterf(target, pname, param);
1796 return parse_error::kParseNoError; 1589 return parse_error::kParseNoError;
1797 } 1590 }
1798 1591
1799 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv( 1592 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv(
1800 unsigned int arg_count, const gles2::TexParameterfv& c) { 1593 uint32 immediate_data_size, const gles2::TexParameterfv& c) {
1801 GLenum target = static_cast<GLenum>(c.target); 1594 GLenum target = static_cast<GLenum>(c.target);
1802 GLenum pname = static_cast<GLenum>(c.pname); 1595 GLenum pname = static_cast<GLenum>(c.pname);
1803 const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( 1596 const GLfloat* params = GetSharedMemoryAs<const GLfloat*>(
1804 c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); 1597 c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */);
1805 parse_error::ParseError result = 1598 parse_error::ParseError result =
1806 ValidateTexParameterfv(this, arg_count, target, pname, params); 1599 ValidateTexParameterfv(this, immediate_data_size, target, pname, params);
1807 if (result != parse_error::kParseNoError) { 1600 if (result != parse_error::kParseNoError) {
1808 return result; 1601 return result;
1809 } 1602 }
1810 glTexParameterfv(target, pname, params); 1603 glTexParameterfv(target, pname, params);
1811 return parse_error::kParseNoError; 1604 return parse_error::kParseNoError;
1812 } 1605 }
1813 1606
1814 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate( 1607 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate(
1815 unsigned int arg_count, const gles2::TexParameterfvImmediate& c) { 1608 uint32 immediate_data_size, const gles2::TexParameterfvImmediate& c) {
1816 GLenum target = static_cast<GLenum>(c.target); 1609 GLenum target = static_cast<GLenum>(c.target);
1817 GLenum pname = static_cast<GLenum>(c.pname); 1610 GLenum pname = static_cast<GLenum>(c.pname);
1818 const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c); 1611 const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c);
1819 // Immediate version. 1612 // Immediate version.
1820 parse_error::ParseError result = 1613 parse_error::ParseError result =
1821 ValidateTexParameterfvImmediate(this, arg_count, target, pname, params); 1614 ValidateTexParameterfvImmediate(
1615 this, immediate_data_size, target, pname, params);
1822 if (result != parse_error::kParseNoError) { 1616 if (result != parse_error::kParseNoError) {
1823 return result; 1617 return result;
1824 } 1618 }
1825 glTexParameterfv(target, pname, params); 1619 glTexParameterfv(target, pname, params);
1826 return parse_error::kParseNoError; 1620 return parse_error::kParseNoError;
1827 } 1621 }
1828 1622
1829 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri( 1623 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri(
1830 unsigned int arg_count, const gles2::TexParameteri& c) { 1624 uint32 immediate_data_size, const gles2::TexParameteri& c) {
1831 GLenum target = static_cast<GLenum>(c.target); 1625 GLenum target = static_cast<GLenum>(c.target);
1832 GLenum pname = static_cast<GLenum>(c.pname); 1626 GLenum pname = static_cast<GLenum>(c.pname);
1833 GLint param = static_cast<GLint>(c.param); 1627 GLint param = static_cast<GLint>(c.param);
1834 parse_error::ParseError result = 1628 parse_error::ParseError result =
1835 ValidateTexParameteri(this, arg_count, target, pname, param); 1629 ValidateTexParameteri(this, immediate_data_size, target, pname, param);
1836 if (result != parse_error::kParseNoError) { 1630 if (result != parse_error::kParseNoError) {
1837 return result; 1631 return result;
1838 } 1632 }
1839 glTexParameteri(target, pname, param); 1633 glTexParameteri(target, pname, param);
1840 return parse_error::kParseNoError; 1634 return parse_error::kParseNoError;
1841 } 1635 }
1842 1636
1843 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv( 1637 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv(
1844 unsigned int arg_count, const gles2::TexParameteriv& c) { 1638 uint32 immediate_data_size, const gles2::TexParameteriv& c) {
1845 GLenum target = static_cast<GLenum>(c.target); 1639 GLenum target = static_cast<GLenum>(c.target);
1846 GLenum pname = static_cast<GLenum>(c.pname); 1640 GLenum pname = static_cast<GLenum>(c.pname);
1847 const GLint* params = GetSharedMemoryAs<const GLint*>( 1641 const GLint* params = GetSharedMemoryAs<const GLint*>(
1848 c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); 1642 c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */);
1849 parse_error::ParseError result = 1643 parse_error::ParseError result =
1850 ValidateTexParameteriv(this, arg_count, target, pname, params); 1644 ValidateTexParameteriv(this, immediate_data_size, target, pname, params);
1851 if (result != parse_error::kParseNoError) { 1645 if (result != parse_error::kParseNoError) {
1852 return result; 1646 return result;
1853 } 1647 }
1854 glTexParameteriv(target, pname, params); 1648 glTexParameteriv(target, pname, params);
1855 return parse_error::kParseNoError; 1649 return parse_error::kParseNoError;
1856 } 1650 }
1857 1651
1858 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate( 1652 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate(
1859 unsigned int arg_count, const gles2::TexParameterivImmediate& c) { 1653 uint32 immediate_data_size, const gles2::TexParameterivImmediate& c) {
1860 GLenum target = static_cast<GLenum>(c.target); 1654 GLenum target = static_cast<GLenum>(c.target);
1861 GLenum pname = static_cast<GLenum>(c.pname); 1655 GLenum pname = static_cast<GLenum>(c.pname);
1862 const GLint* params = GetImmediateDataAs<const GLint*>(c); 1656 const GLint* params = GetImmediateDataAs<const GLint*>(c);
1863 // Immediate version. 1657 // Immediate version.
1864 parse_error::ParseError result = 1658 parse_error::ParseError result =
1865 ValidateTexParameterivImmediate(this, arg_count, target, pname, params); 1659 ValidateTexParameterivImmediate(
1660 this, immediate_data_size, target, pname, params);
1866 if (result != parse_error::kParseNoError) { 1661 if (result != parse_error::kParseNoError) {
1867 return result; 1662 return result;
1868 } 1663 }
1869 glTexParameteriv(target, pname, params); 1664 glTexParameteriv(target, pname, params);
1870 return parse_error::kParseNoError; 1665 return parse_error::kParseNoError;
1871 } 1666 }
1872 1667
1873 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( 1668 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D(
1874 unsigned int arg_count, const gles2::TexSubImage2D& c) { 1669 uint32 immediate_data_size, const gles2::TexSubImage2D& c) {
1875 GLenum target = static_cast<GLenum>(c.target); 1670 GLenum target = static_cast<GLenum>(c.target);
1876 GLint level = static_cast<GLint>(c.level); 1671 GLint level = static_cast<GLint>(c.level);
1877 GLint xoffset = static_cast<GLint>(c.xoffset); 1672 GLint xoffset = static_cast<GLint>(c.xoffset);
1878 GLint yoffset = static_cast<GLint>(c.yoffset); 1673 GLint yoffset = static_cast<GLint>(c.yoffset);
1879 GLsizei width = static_cast<GLsizei>(c.width); 1674 GLsizei width = static_cast<GLsizei>(c.width);
1880 GLsizei height = static_cast<GLsizei>(c.height); 1675 GLsizei height = static_cast<GLsizei>(c.height);
1881 GLenum format = static_cast<GLenum>(c.format); 1676 GLenum format = static_cast<GLenum>(c.format);
1882 GLenum type = static_cast<GLenum>(c.type); 1677 GLenum type = static_cast<GLenum>(c.type);
1883 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); 1678 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id);
1884 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); 1679 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset);
1885 uint32 pixels_size = GLES2Util::ComputeImageDataSize( 1680 uint32 pixels_size = GLES2Util::ComputeImageDataSize(
1886 width, height, format, type, unpack_alignment_); 1681 width, height, format, type, unpack_alignment_);
1887 const void* pixels = GetSharedMemoryAs<const void*>( 1682 const void* pixels = GetSharedMemoryAs<const void*>(
1888 pixels_shm_id, pixels_shm_offset, pixels_size); 1683 pixels_shm_id, pixels_shm_offset, pixels_size);
1889 parse_error::ParseError result = 1684 parse_error::ParseError result =
1890 ValidateTexSubImage2D( 1685 ValidateTexSubImage2D(
1891 this, arg_count, target, level, xoffset, yoffset, width, height, 1686 this, immediate_data_size, target, level, xoffset, yoffset, width,
1892 format, type, pixels); 1687 height, format, type, pixels);
1893 if (result != parse_error::kParseNoError) { 1688 if (result != parse_error::kParseNoError) {
1894 return result; 1689 return result;
1895 } 1690 }
1896 glTexSubImage2D( 1691 glTexSubImage2D(
1897 target, level, xoffset, yoffset, width, height, format, type, pixels); 1692 target, level, xoffset, yoffset, width, height, format, type, pixels);
1898 return parse_error::kParseNoError; 1693 return parse_error::kParseNoError;
1899 } 1694 }
1900 1695
1901 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( 1696 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate(
1902 unsigned int arg_count, const gles2::TexSubImage2DImmediate& c) { 1697 uint32 immediate_data_size, const gles2::TexSubImage2DImmediate& c) {
1903 GLenum target = static_cast<GLenum>(c.target); 1698 GLenum target = static_cast<GLenum>(c.target);
1904 GLint level = static_cast<GLint>(c.level); 1699 GLint level = static_cast<GLint>(c.level);
1905 GLint xoffset = static_cast<GLint>(c.xoffset); 1700 GLint xoffset = static_cast<GLint>(c.xoffset);
1906 GLint yoffset = static_cast<GLint>(c.yoffset); 1701 GLint yoffset = static_cast<GLint>(c.yoffset);
1907 GLsizei width = static_cast<GLsizei>(c.width); 1702 GLsizei width = static_cast<GLsizei>(c.width);
1908 GLsizei height = static_cast<GLsizei>(c.height); 1703 GLsizei height = static_cast<GLsizei>(c.height);
1909 GLenum format = static_cast<GLenum>(c.format); 1704 GLenum format = static_cast<GLenum>(c.format);
1910 GLenum type = static_cast<GLenum>(c.type); 1705 GLenum type = static_cast<GLenum>(c.type);
1911 const void* pixels = GetImmediateDataAs<const void*>(c); 1706 const void* pixels = GetImmediateDataAs<const void*>(c);
1912 // Immediate version. 1707 // Immediate version.
1913 parse_error::ParseError result = 1708 parse_error::ParseError result =
1914 ValidateTexSubImage2DImmediate( 1709 ValidateTexSubImage2DImmediate(
1915 this, arg_count, target, level, xoffset, yoffset, width, height, 1710 this, immediate_data_size, target, level, xoffset, yoffset, width,
1916 format, type, pixels); 1711 height, format, type, pixels);
1917 if (result != parse_error::kParseNoError) { 1712 if (result != parse_error::kParseNoError) {
1918 return result; 1713 return result;
1919 } 1714 }
1920 glTexSubImage2D( 1715 glTexSubImage2D(
1921 target, level, xoffset, yoffset, width, height, format, type, pixels); 1716 target, level, xoffset, yoffset, width, height, format, type, pixels);
1922 return parse_error::kParseNoError; 1717 return parse_error::kParseNoError;
1923 } 1718 }
1924 1719
1925 parse_error::ParseError GLES2DecoderImpl::HandleUniform1f( 1720 parse_error::ParseError GLES2DecoderImpl::HandleUniform1f(
1926 unsigned int arg_count, const gles2::Uniform1f& c) { 1721 uint32 immediate_data_size, const gles2::Uniform1f& c) {
1927 GLint location = static_cast<GLint>(c.location); 1722 GLint location = static_cast<GLint>(c.location);
1928 GLfloat x = static_cast<GLfloat>(c.x); 1723 GLfloat x = static_cast<GLfloat>(c.x);
1929 parse_error::ParseError result = 1724 parse_error::ParseError result =
1930 ValidateUniform1f(this, arg_count, location, x); 1725 ValidateUniform1f(this, immediate_data_size, location, x);
1931 if (result != parse_error::kParseNoError) { 1726 if (result != parse_error::kParseNoError) {
1932 return result; 1727 return result;
1933 } 1728 }
1934 glUniform1f(location, x); 1729 glUniform1f(location, x);
1935 return parse_error::kParseNoError; 1730 return parse_error::kParseNoError;
1936 } 1731 }
1937 1732
1938 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv( 1733 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv(
1939 unsigned int arg_count, const gles2::Uniform1fv& c) { 1734 uint32 immediate_data_size, const gles2::Uniform1fv& c) {
1940 GLint location = static_cast<GLint>(c.location); 1735 GLint location = static_cast<GLint>(c.location);
1941 GLsizei count = static_cast<GLsizei>(c.count); 1736 GLsizei count = static_cast<GLsizei>(c.count);
1942 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( 1737 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
1943 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 1738 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
1944 parse_error::ParseError result = 1739 parse_error::ParseError result =
1945 ValidateUniform1fv(this, arg_count, location, count, v); 1740 ValidateUniform1fv(this, immediate_data_size, location, count, v);
1946 if (result != parse_error::kParseNoError) { 1741 if (result != parse_error::kParseNoError) {
1947 return result; 1742 return result;
1948 } 1743 }
1949 glUniform1fv(location, count, v); 1744 glUniform1fv(location, count, v);
1950 return parse_error::kParseNoError; 1745 return parse_error::kParseNoError;
1951 } 1746 }
1952 1747
1953 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate( 1748 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate(
1954 unsigned int arg_count, const gles2::Uniform1fvImmediate& c) { 1749 uint32 immediate_data_size, const gles2::Uniform1fvImmediate& c) {
1955 GLint location = static_cast<GLint>(c.location); 1750 GLint location = static_cast<GLint>(c.location);
1956 GLsizei count = static_cast<GLsizei>(c.count); 1751 GLsizei count = static_cast<GLsizei>(c.count);
1957 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); 1752 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
1958 // Immediate version. 1753 // Immediate version.
1959 parse_error::ParseError result = 1754 parse_error::ParseError result =
1960 ValidateUniform1fvImmediate(this, arg_count, location, count, v); 1755 ValidateUniform1fvImmediate(
1756 this, immediate_data_size, location, count, v);
1961 if (result != parse_error::kParseNoError) { 1757 if (result != parse_error::kParseNoError) {
1962 return result; 1758 return result;
1963 } 1759 }
1964 glUniform1fv(location, count, v); 1760 glUniform1fv(location, count, v);
1965 return parse_error::kParseNoError; 1761 return parse_error::kParseNoError;
1966 } 1762 }
1967 1763
1968 parse_error::ParseError GLES2DecoderImpl::HandleUniform1i( 1764 parse_error::ParseError GLES2DecoderImpl::HandleUniform1i(
1969 unsigned int arg_count, const gles2::Uniform1i& c) { 1765 uint32 immediate_data_size, const gles2::Uniform1i& c) {
1970 GLint location = static_cast<GLint>(c.location); 1766 GLint location = static_cast<GLint>(c.location);
1971 GLint x = static_cast<GLint>(c.x); 1767 GLint x = static_cast<GLint>(c.x);
1972 parse_error::ParseError result = 1768 parse_error::ParseError result =
1973 ValidateUniform1i(this, arg_count, location, x); 1769 ValidateUniform1i(this, immediate_data_size, location, x);
1974 if (result != parse_error::kParseNoError) { 1770 if (result != parse_error::kParseNoError) {
1975 return result; 1771 return result;
1976 } 1772 }
1977 glUniform1i(location, x); 1773 glUniform1i(location, x);
1978 return parse_error::kParseNoError; 1774 return parse_error::kParseNoError;
1979 } 1775 }
1980 1776
1981 parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv( 1777 parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv(
1982 unsigned int arg_count, const gles2::Uniform1iv& c) { 1778 uint32 immediate_data_size, const gles2::Uniform1iv& c) {
1983 GLint location = static_cast<GLint>(c.location); 1779 GLint location = static_cast<GLint>(c.location);
1984 GLsizei count = static_cast<GLsizei>(c.count); 1780 GLsizei count = static_cast<GLsizei>(c.count);
1985 const GLint* v = GetSharedMemoryAs<const GLint*>( 1781 const GLint* v = GetSharedMemoryAs<const GLint*>(
1986 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 1782 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
1987 parse_error::ParseError result = 1783 parse_error::ParseError result =
1988 ValidateUniform1iv(this, arg_count, location, count, v); 1784 ValidateUniform1iv(this, immediate_data_size, location, count, v);
1989 if (result != parse_error::kParseNoError) { 1785 if (result != parse_error::kParseNoError) {
1990 return result; 1786 return result;
1991 } 1787 }
1992 glUniform1iv(location, count, v); 1788 glUniform1iv(location, count, v);
1993 return parse_error::kParseNoError; 1789 return parse_error::kParseNoError;
1994 } 1790 }
1995 1791
1996 parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate( 1792 parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate(
1997 unsigned int arg_count, const gles2::Uniform1ivImmediate& c) { 1793 uint32 immediate_data_size, const gles2::Uniform1ivImmediate& c) {
1998 GLint location = static_cast<GLint>(c.location); 1794 GLint location = static_cast<GLint>(c.location);
1999 GLsizei count = static_cast<GLsizei>(c.count); 1795 GLsizei count = static_cast<GLsizei>(c.count);
2000 const GLint* v = GetImmediateDataAs<const GLint*>(c); 1796 const GLint* v = GetImmediateDataAs<const GLint*>(c);
2001 // Immediate version. 1797 // Immediate version.
2002 parse_error::ParseError result = 1798 parse_error::ParseError result =
2003 ValidateUniform1ivImmediate(this, arg_count, location, count, v); 1799 ValidateUniform1ivImmediate(
1800 this, immediate_data_size, location, count, v);
2004 if (result != parse_error::kParseNoError) { 1801 if (result != parse_error::kParseNoError) {
2005 return result; 1802 return result;
2006 } 1803 }
2007 glUniform1iv(location, count, v); 1804 glUniform1iv(location, count, v);
2008 return parse_error::kParseNoError; 1805 return parse_error::kParseNoError;
2009 } 1806 }
2010 1807
2011 parse_error::ParseError GLES2DecoderImpl::HandleUniform2f( 1808 parse_error::ParseError GLES2DecoderImpl::HandleUniform2f(
2012 unsigned int arg_count, const gles2::Uniform2f& c) { 1809 uint32 immediate_data_size, const gles2::Uniform2f& c) {
2013 GLint location = static_cast<GLint>(c.location); 1810 GLint location = static_cast<GLint>(c.location);
2014 GLfloat x = static_cast<GLfloat>(c.x); 1811 GLfloat x = static_cast<GLfloat>(c.x);
2015 GLfloat y = static_cast<GLfloat>(c.y); 1812 GLfloat y = static_cast<GLfloat>(c.y);
2016 parse_error::ParseError result = 1813 parse_error::ParseError result =
2017 ValidateUniform2f(this, arg_count, location, x, y); 1814 ValidateUniform2f(this, immediate_data_size, location, x, y);
2018 if (result != parse_error::kParseNoError) { 1815 if (result != parse_error::kParseNoError) {
2019 return result; 1816 return result;
2020 } 1817 }
2021 glUniform2f(location, x, y); 1818 glUniform2f(location, x, y);
2022 return parse_error::kParseNoError; 1819 return parse_error::kParseNoError;
2023 } 1820 }
2024 1821
2025 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv( 1822 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv(
2026 unsigned int arg_count, const gles2::Uniform2fv& c) { 1823 uint32 immediate_data_size, const gles2::Uniform2fv& c) {
2027 GLint location = static_cast<GLint>(c.location); 1824 GLint location = static_cast<GLint>(c.location);
2028 GLsizei count = static_cast<GLsizei>(c.count); 1825 GLsizei count = static_cast<GLsizei>(c.count);
2029 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( 1826 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
2030 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 1827 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
2031 parse_error::ParseError result = 1828 parse_error::ParseError result =
2032 ValidateUniform2fv(this, arg_count, location, count, v); 1829 ValidateUniform2fv(this, immediate_data_size, location, count, v);
2033 if (result != parse_error::kParseNoError) { 1830 if (result != parse_error::kParseNoError) {
2034 return result; 1831 return result;
2035 } 1832 }
2036 glUniform2fv(location, count, v); 1833 glUniform2fv(location, count, v);
2037 return parse_error::kParseNoError; 1834 return parse_error::kParseNoError;
2038 } 1835 }
2039 1836
2040 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate( 1837 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate(
2041 unsigned int arg_count, const gles2::Uniform2fvImmediate& c) { 1838 uint32 immediate_data_size, const gles2::Uniform2fvImmediate& c) {
2042 GLint location = static_cast<GLint>(c.location); 1839 GLint location = static_cast<GLint>(c.location);
2043 GLsizei count = static_cast<GLsizei>(c.count); 1840 GLsizei count = static_cast<GLsizei>(c.count);
2044 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); 1841 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
2045 // Immediate version. 1842 // Immediate version.
2046 parse_error::ParseError result = 1843 parse_error::ParseError result =
2047 ValidateUniform2fvImmediate(this, arg_count, location, count, v); 1844 ValidateUniform2fvImmediate(
1845 this, immediate_data_size, location, count, v);
2048 if (result != parse_error::kParseNoError) { 1846 if (result != parse_error::kParseNoError) {
2049 return result; 1847 return result;
2050 } 1848 }
2051 glUniform2fv(location, count, v); 1849 glUniform2fv(location, count, v);
2052 return parse_error::kParseNoError; 1850 return parse_error::kParseNoError;
2053 } 1851 }
2054 1852
2055 parse_error::ParseError GLES2DecoderImpl::HandleUniform2i( 1853 parse_error::ParseError GLES2DecoderImpl::HandleUniform2i(
2056 unsigned int arg_count, const gles2::Uniform2i& c) { 1854 uint32 immediate_data_size, const gles2::Uniform2i& c) {
2057 GLint location = static_cast<GLint>(c.location); 1855 GLint location = static_cast<GLint>(c.location);
2058 GLint x = static_cast<GLint>(c.x); 1856 GLint x = static_cast<GLint>(c.x);
2059 GLint y = static_cast<GLint>(c.y); 1857 GLint y = static_cast<GLint>(c.y);
2060 parse_error::ParseError result = 1858 parse_error::ParseError result =
2061 ValidateUniform2i(this, arg_count, location, x, y); 1859 ValidateUniform2i(this, immediate_data_size, location, x, y);
2062 if (result != parse_error::kParseNoError) { 1860 if (result != parse_error::kParseNoError) {
2063 return result; 1861 return result;
2064 } 1862 }
2065 glUniform2i(location, x, y); 1863 glUniform2i(location, x, y);
2066 return parse_error::kParseNoError; 1864 return parse_error::kParseNoError;
2067 } 1865 }
2068 1866
2069 parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv( 1867 parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv(
2070 unsigned int arg_count, const gles2::Uniform2iv& c) { 1868 uint32 immediate_data_size, const gles2::Uniform2iv& c) {
2071 GLint location = static_cast<GLint>(c.location); 1869 GLint location = static_cast<GLint>(c.location);
2072 GLsizei count = static_cast<GLsizei>(c.count); 1870 GLsizei count = static_cast<GLsizei>(c.count);
2073 const GLint* v = GetSharedMemoryAs<const GLint*>( 1871 const GLint* v = GetSharedMemoryAs<const GLint*>(
2074 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 1872 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
2075 parse_error::ParseError result = 1873 parse_error::ParseError result =
2076 ValidateUniform2iv(this, arg_count, location, count, v); 1874 ValidateUniform2iv(this, immediate_data_size, location, count, v);
2077 if (result != parse_error::kParseNoError) { 1875 if (result != parse_error::kParseNoError) {
2078 return result; 1876 return result;
2079 } 1877 }
2080 glUniform2iv(location, count, v); 1878 glUniform2iv(location, count, v);
2081 return parse_error::kParseNoError; 1879 return parse_error::kParseNoError;
2082 } 1880 }
2083 1881
2084 parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate( 1882 parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate(
2085 unsigned int arg_count, const gles2::Uniform2ivImmediate& c) { 1883 uint32 immediate_data_size, const gles2::Uniform2ivImmediate& c) {
2086 GLint location = static_cast<GLint>(c.location); 1884 GLint location = static_cast<GLint>(c.location);
2087 GLsizei count = static_cast<GLsizei>(c.count); 1885 GLsizei count = static_cast<GLsizei>(c.count);
2088 const GLint* v = GetImmediateDataAs<const GLint*>(c); 1886 const GLint* v = GetImmediateDataAs<const GLint*>(c);
2089 // Immediate version. 1887 // Immediate version.
2090 parse_error::ParseError result = 1888 parse_error::ParseError result =
2091 ValidateUniform2ivImmediate(this, arg_count, location, count, v); 1889 ValidateUniform2ivImmediate(
1890 this, immediate_data_size, location, count, v);
2092 if (result != parse_error::kParseNoError) { 1891 if (result != parse_error::kParseNoError) {
2093 return result; 1892 return result;
2094 } 1893 }
2095 glUniform2iv(location, count, v); 1894 glUniform2iv(location, count, v);
2096 return parse_error::kParseNoError; 1895 return parse_error::kParseNoError;
2097 } 1896 }
2098 1897
2099 parse_error::ParseError GLES2DecoderImpl::HandleUniform3f( 1898 parse_error::ParseError GLES2DecoderImpl::HandleUniform3f(
2100 unsigned int arg_count, const gles2::Uniform3f& c) { 1899 uint32 immediate_data_size, const gles2::Uniform3f& c) {
2101 GLint location = static_cast<GLint>(c.location); 1900 GLint location = static_cast<GLint>(c.location);
2102 GLfloat x = static_cast<GLfloat>(c.x); 1901 GLfloat x = static_cast<GLfloat>(c.x);
2103 GLfloat y = static_cast<GLfloat>(c.y); 1902 GLfloat y = static_cast<GLfloat>(c.y);
2104 GLfloat z = static_cast<GLfloat>(c.z); 1903 GLfloat z = static_cast<GLfloat>(c.z);
2105 parse_error::ParseError result = 1904 parse_error::ParseError result =
2106 ValidateUniform3f(this, arg_count, location, x, y, z); 1905 ValidateUniform3f(this, immediate_data_size, location, x, y, z);
2107 if (result != parse_error::kParseNoError) { 1906 if (result != parse_error::kParseNoError) {
2108 return result; 1907 return result;
2109 } 1908 }
2110 glUniform3f(location, x, y, z); 1909 glUniform3f(location, x, y, z);
2111 return parse_error::kParseNoError; 1910 return parse_error::kParseNoError;
2112 } 1911 }
2113 1912
2114 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv( 1913 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv(
2115 unsigned int arg_count, const gles2::Uniform3fv& c) { 1914 uint32 immediate_data_size, const gles2::Uniform3fv& c) {
2116 GLint location = static_cast<GLint>(c.location); 1915 GLint location = static_cast<GLint>(c.location);
2117 GLsizei count = static_cast<GLsizei>(c.count); 1916 GLsizei count = static_cast<GLsizei>(c.count);
2118 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( 1917 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
2119 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 1918 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
2120 parse_error::ParseError result = 1919 parse_error::ParseError result =
2121 ValidateUniform3fv(this, arg_count, location, count, v); 1920 ValidateUniform3fv(this, immediate_data_size, location, count, v);
2122 if (result != parse_error::kParseNoError) { 1921 if (result != parse_error::kParseNoError) {
2123 return result; 1922 return result;
2124 } 1923 }
2125 glUniform3fv(location, count, v); 1924 glUniform3fv(location, count, v);
2126 return parse_error::kParseNoError; 1925 return parse_error::kParseNoError;
2127 } 1926 }
2128 1927
2129 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate( 1928 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate(
2130 unsigned int arg_count, const gles2::Uniform3fvImmediate& c) { 1929 uint32 immediate_data_size, const gles2::Uniform3fvImmediate& c) {
2131 GLint location = static_cast<GLint>(c.location); 1930 GLint location = static_cast<GLint>(c.location);
2132 GLsizei count = static_cast<GLsizei>(c.count); 1931 GLsizei count = static_cast<GLsizei>(c.count);
2133 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); 1932 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
2134 // Immediate version. 1933 // Immediate version.
2135 parse_error::ParseError result = 1934 parse_error::ParseError result =
2136 ValidateUniform3fvImmediate(this, arg_count, location, count, v); 1935 ValidateUniform3fvImmediate(
1936 this, immediate_data_size, location, count, v);
2137 if (result != parse_error::kParseNoError) { 1937 if (result != parse_error::kParseNoError) {
2138 return result; 1938 return result;
2139 } 1939 }
2140 glUniform3fv(location, count, v); 1940 glUniform3fv(location, count, v);
2141 return parse_error::kParseNoError; 1941 return parse_error::kParseNoError;
2142 } 1942 }
2143 1943
2144 parse_error::ParseError GLES2DecoderImpl::HandleUniform3i( 1944 parse_error::ParseError GLES2DecoderImpl::HandleUniform3i(
2145 unsigned int arg_count, const gles2::Uniform3i& c) { 1945 uint32 immediate_data_size, const gles2::Uniform3i& c) {
2146 GLint location = static_cast<GLint>(c.location); 1946 GLint location = static_cast<GLint>(c.location);
2147 GLint x = static_cast<GLint>(c.x); 1947 GLint x = static_cast<GLint>(c.x);
2148 GLint y = static_cast<GLint>(c.y); 1948 GLint y = static_cast<GLint>(c.y);
2149 GLint z = static_cast<GLint>(c.z); 1949 GLint z = static_cast<GLint>(c.z);
2150 parse_error::ParseError result = 1950 parse_error::ParseError result =
2151 ValidateUniform3i(this, arg_count, location, x, y, z); 1951 ValidateUniform3i(this, immediate_data_size, location, x, y, z);
2152 if (result != parse_error::kParseNoError) { 1952 if (result != parse_error::kParseNoError) {
2153 return result; 1953 return result;
2154 } 1954 }
2155 glUniform3i(location, x, y, z); 1955 glUniform3i(location, x, y, z);
2156 return parse_error::kParseNoError; 1956 return parse_error::kParseNoError;
2157 } 1957 }
2158 1958
2159 parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv( 1959 parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv(
2160 unsigned int arg_count, const gles2::Uniform3iv& c) { 1960 uint32 immediate_data_size, const gles2::Uniform3iv& c) {
2161 GLint location = static_cast<GLint>(c.location); 1961 GLint location = static_cast<GLint>(c.location);
2162 GLsizei count = static_cast<GLsizei>(c.count); 1962 GLsizei count = static_cast<GLsizei>(c.count);
2163 const GLint* v = GetSharedMemoryAs<const GLint*>( 1963 const GLint* v = GetSharedMemoryAs<const GLint*>(
2164 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 1964 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
2165 parse_error::ParseError result = 1965 parse_error::ParseError result =
2166 ValidateUniform3iv(this, arg_count, location, count, v); 1966 ValidateUniform3iv(this, immediate_data_size, location, count, v);
2167 if (result != parse_error::kParseNoError) { 1967 if (result != parse_error::kParseNoError) {
2168 return result; 1968 return result;
2169 } 1969 }
2170 glUniform3iv(location, count, v); 1970 glUniform3iv(location, count, v);
2171 return parse_error::kParseNoError; 1971 return parse_error::kParseNoError;
2172 } 1972 }
2173 1973
2174 parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate( 1974 parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate(
2175 unsigned int arg_count, const gles2::Uniform3ivImmediate& c) { 1975 uint32 immediate_data_size, const gles2::Uniform3ivImmediate& c) {
2176 GLint location = static_cast<GLint>(c.location); 1976 GLint location = static_cast<GLint>(c.location);
2177 GLsizei count = static_cast<GLsizei>(c.count); 1977 GLsizei count = static_cast<GLsizei>(c.count);
2178 const GLint* v = GetImmediateDataAs<const GLint*>(c); 1978 const GLint* v = GetImmediateDataAs<const GLint*>(c);
2179 // Immediate version. 1979 // Immediate version.
2180 parse_error::ParseError result = 1980 parse_error::ParseError result =
2181 ValidateUniform3ivImmediate(this, arg_count, location, count, v); 1981 ValidateUniform3ivImmediate(
1982 this, immediate_data_size, location, count, v);
2182 if (result != parse_error::kParseNoError) { 1983 if (result != parse_error::kParseNoError) {
2183 return result; 1984 return result;
2184 } 1985 }
2185 glUniform3iv(location, count, v); 1986 glUniform3iv(location, count, v);
2186 return parse_error::kParseNoError; 1987 return parse_error::kParseNoError;
2187 } 1988 }
2188 1989
2189 parse_error::ParseError GLES2DecoderImpl::HandleUniform4f( 1990 parse_error::ParseError GLES2DecoderImpl::HandleUniform4f(
2190 unsigned int arg_count, const gles2::Uniform4f& c) { 1991 uint32 immediate_data_size, const gles2::Uniform4f& c) {
2191 GLint location = static_cast<GLint>(c.location); 1992 GLint location = static_cast<GLint>(c.location);
2192 GLfloat x = static_cast<GLfloat>(c.x); 1993 GLfloat x = static_cast<GLfloat>(c.x);
2193 GLfloat y = static_cast<GLfloat>(c.y); 1994 GLfloat y = static_cast<GLfloat>(c.y);
2194 GLfloat z = static_cast<GLfloat>(c.z); 1995 GLfloat z = static_cast<GLfloat>(c.z);
2195 GLfloat w = static_cast<GLfloat>(c.w); 1996 GLfloat w = static_cast<GLfloat>(c.w);
2196 parse_error::ParseError result = 1997 parse_error::ParseError result =
2197 ValidateUniform4f(this, arg_count, location, x, y, z, w); 1998 ValidateUniform4f(this, immediate_data_size, location, x, y, z, w);
2198 if (result != parse_error::kParseNoError) { 1999 if (result != parse_error::kParseNoError) {
2199 return result; 2000 return result;
2200 } 2001 }
2201 glUniform4f(location, x, y, z, w); 2002 glUniform4f(location, x, y, z, w);
2202 return parse_error::kParseNoError; 2003 return parse_error::kParseNoError;
2203 } 2004 }
2204 2005
2205 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv( 2006 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv(
2206 unsigned int arg_count, const gles2::Uniform4fv& c) { 2007 uint32 immediate_data_size, const gles2::Uniform4fv& c) {
2207 GLint location = static_cast<GLint>(c.location); 2008 GLint location = static_cast<GLint>(c.location);
2208 GLsizei count = static_cast<GLsizei>(c.count); 2009 GLsizei count = static_cast<GLsizei>(c.count);
2209 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( 2010 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>(
2210 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 2011 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
2211 parse_error::ParseError result = 2012 parse_error::ParseError result =
2212 ValidateUniform4fv(this, arg_count, location, count, v); 2013 ValidateUniform4fv(this, immediate_data_size, location, count, v);
2213 if (result != parse_error::kParseNoError) { 2014 if (result != parse_error::kParseNoError) {
2214 return result; 2015 return result;
2215 } 2016 }
2216 glUniform4fv(location, count, v); 2017 glUniform4fv(location, count, v);
2217 return parse_error::kParseNoError; 2018 return parse_error::kParseNoError;
2218 } 2019 }
2219 2020
2220 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate( 2021 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate(
2221 unsigned int arg_count, const gles2::Uniform4fvImmediate& c) { 2022 uint32 immediate_data_size, const gles2::Uniform4fvImmediate& c) {
2222 GLint location = static_cast<GLint>(c.location); 2023 GLint location = static_cast<GLint>(c.location);
2223 GLsizei count = static_cast<GLsizei>(c.count); 2024 GLsizei count = static_cast<GLsizei>(c.count);
2224 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); 2025 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c);
2225 // Immediate version. 2026 // Immediate version.
2226 parse_error::ParseError result = 2027 parse_error::ParseError result =
2227 ValidateUniform4fvImmediate(this, arg_count, location, count, v); 2028 ValidateUniform4fvImmediate(
2029 this, immediate_data_size, location, count, v);
2228 if (result != parse_error::kParseNoError) { 2030 if (result != parse_error::kParseNoError) {
2229 return result; 2031 return result;
2230 } 2032 }
2231 glUniform4fv(location, count, v); 2033 glUniform4fv(location, count, v);
2232 return parse_error::kParseNoError; 2034 return parse_error::kParseNoError;
2233 } 2035 }
2234 2036
2235 parse_error::ParseError GLES2DecoderImpl::HandleUniform4i( 2037 parse_error::ParseError GLES2DecoderImpl::HandleUniform4i(
2236 unsigned int arg_count, const gles2::Uniform4i& c) { 2038 uint32 immediate_data_size, const gles2::Uniform4i& c) {
2237 GLint location = static_cast<GLint>(c.location); 2039 GLint location = static_cast<GLint>(c.location);
2238 GLint x = static_cast<GLint>(c.x); 2040 GLint x = static_cast<GLint>(c.x);
2239 GLint y = static_cast<GLint>(c.y); 2041 GLint y = static_cast<GLint>(c.y);
2240 GLint z = static_cast<GLint>(c.z); 2042 GLint z = static_cast<GLint>(c.z);
2241 GLint w = static_cast<GLint>(c.w); 2043 GLint w = static_cast<GLint>(c.w);
2242 parse_error::ParseError result = 2044 parse_error::ParseError result =
2243 ValidateUniform4i(this, arg_count, location, x, y, z, w); 2045 ValidateUniform4i(this, immediate_data_size, location, x, y, z, w);
2244 if (result != parse_error::kParseNoError) { 2046 if (result != parse_error::kParseNoError) {
2245 return result; 2047 return result;
2246 } 2048 }
2247 glUniform4i(location, x, y, z, w); 2049 glUniform4i(location, x, y, z, w);
2248 return parse_error::kParseNoError; 2050 return parse_error::kParseNoError;
2249 } 2051 }
2250 2052
2251 parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv( 2053 parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv(
2252 unsigned int arg_count, const gles2::Uniform4iv& c) { 2054 uint32 immediate_data_size, const gles2::Uniform4iv& c) {
2253 GLint location = static_cast<GLint>(c.location); 2055 GLint location = static_cast<GLint>(c.location);
2254 GLsizei count = static_cast<GLsizei>(c.count); 2056 GLsizei count = static_cast<GLsizei>(c.count);
2255 const GLint* v = GetSharedMemoryAs<const GLint*>( 2057 const GLint* v = GetSharedMemoryAs<const GLint*>(
2256 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); 2058 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */);
2257 parse_error::ParseError result = 2059 parse_error::ParseError result =
2258 ValidateUniform4iv(this, arg_count, location, count, v); 2060 ValidateUniform4iv(this, immediate_data_size, location, count, v);
2259 if (result != parse_error::kParseNoError) { 2061 if (result != parse_error::kParseNoError) {
2260 return result; 2062 return result;
2261 } 2063 }
2262 glUniform4iv(location, count, v); 2064 glUniform4iv(location, count, v);
2263 return parse_error::kParseNoError; 2065 return parse_error::kParseNoError;
2264 } 2066 }
2265 2067
2266 parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate( 2068 parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate(
2267 unsigned int arg_count, const gles2::Uniform4ivImmediate& c) { 2069 uint32 immediate_data_size, const gles2::Uniform4ivImmediate& c) {
2268 GLint location = static_cast<GLint>(c.location); 2070 GLint location = static_cast<GLint>(c.location);
2269 GLsizei count = static_cast<GLsizei>(c.count); 2071 GLsizei count = static_cast<GLsizei>(c.count);
2270 const GLint* v = GetImmediateDataAs<const GLint*>(c); 2072 const GLint* v = GetImmediateDataAs<const GLint*>(c);
2271 // Immediate version. 2073 // Immediate version.
2272 parse_error::ParseError result = 2074 parse_error::ParseError result =
2273 ValidateUniform4ivImmediate(this, arg_count, location, count, v); 2075 ValidateUniform4ivImmediate(
2076 this, immediate_data_size, location, count, v);
2274 if (result != parse_error::kParseNoError) { 2077 if (result != parse_error::kParseNoError) {
2275 return result; 2078 return result;
2276 } 2079 }
2277 glUniform4iv(location, count, v); 2080 glUniform4iv(location, count, v);
2278 return parse_error::kParseNoError; 2081 return parse_error::kParseNoError;
2279 } 2082 }
2280 2083
2281 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( 2084 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv(
2282 unsigned int arg_count, const gles2::UniformMatrix2fv& c) { 2085 uint32 immediate_data_size, const gles2::UniformMatrix2fv& c) {
2283 GLint location = static_cast<GLint>(c.location); 2086 GLint location = static_cast<GLint>(c.location);
2284 GLsizei count = static_cast<GLsizei>(c.count); 2087 GLsizei count = static_cast<GLsizei>(c.count);
2285 GLboolean transpose = static_cast<GLboolean>(c.transpose); 2088 GLboolean transpose = static_cast<GLboolean>(c.transpose);
2286 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( 2089 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
2287 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); 2090 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
2288 parse_error::ParseError result = 2091 parse_error::ParseError result =
2289 ValidateUniformMatrix2fv( 2092 ValidateUniformMatrix2fv(
2290 this, arg_count, location, count, transpose, value); 2093 this, immediate_data_size, location, count, transpose, value);
2291 if (result != parse_error::kParseNoError) { 2094 if (result != parse_error::kParseNoError) {
2292 return result; 2095 return result;
2293 } 2096 }
2294 glUniformMatrix2fv(location, count, transpose, value); 2097 glUniformMatrix2fv(location, count, transpose, value);
2295 return parse_error::kParseNoError; 2098 return parse_error::kParseNoError;
2296 } 2099 }
2297 2100
2298 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( 2101 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate(
2299 unsigned int arg_count, const gles2::UniformMatrix2fvImmediate& c) { 2102 uint32 immediate_data_size, const gles2::UniformMatrix2fvImmediate& c) {
2300 GLint location = static_cast<GLint>(c.location); 2103 GLint location = static_cast<GLint>(c.location);
2301 GLsizei count = static_cast<GLsizei>(c.count); 2104 GLsizei count = static_cast<GLsizei>(c.count);
2302 GLboolean transpose = static_cast<GLboolean>(c.transpose); 2105 GLboolean transpose = static_cast<GLboolean>(c.transpose);
2303 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); 2106 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
2304 // Immediate version. 2107 // Immediate version.
2305 parse_error::ParseError result = 2108 parse_error::ParseError result =
2306 ValidateUniformMatrix2fvImmediate( 2109 ValidateUniformMatrix2fvImmediate(
2307 this, arg_count, location, count, transpose, value); 2110 this, immediate_data_size, location, count, transpose, value);
2308 if (result != parse_error::kParseNoError) { 2111 if (result != parse_error::kParseNoError) {
2309 return result; 2112 return result;
2310 } 2113 }
2311 glUniformMatrix2fv(location, count, transpose, value); 2114 glUniformMatrix2fv(location, count, transpose, value);
2312 return parse_error::kParseNoError; 2115 return parse_error::kParseNoError;
2313 } 2116 }
2314 2117
2315 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( 2118 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv(
2316 unsigned int arg_count, const gles2::UniformMatrix3fv& c) { 2119 uint32 immediate_data_size, const gles2::UniformMatrix3fv& c) {
2317 GLint location = static_cast<GLint>(c.location); 2120 GLint location = static_cast<GLint>(c.location);
2318 GLsizei count = static_cast<GLsizei>(c.count); 2121 GLsizei count = static_cast<GLsizei>(c.count);
2319 GLboolean transpose = static_cast<GLboolean>(c.transpose); 2122 GLboolean transpose = static_cast<GLboolean>(c.transpose);
2320 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( 2123 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
2321 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); 2124 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
2322 parse_error::ParseError result = 2125 parse_error::ParseError result =
2323 ValidateUniformMatrix3fv( 2126 ValidateUniformMatrix3fv(
2324 this, arg_count, location, count, transpose, value); 2127 this, immediate_data_size, location, count, transpose, value);
2325 if (result != parse_error::kParseNoError) { 2128 if (result != parse_error::kParseNoError) {
2326 return result; 2129 return result;
2327 } 2130 }
2328 glUniformMatrix3fv(location, count, transpose, value); 2131 glUniformMatrix3fv(location, count, transpose, value);
2329 return parse_error::kParseNoError; 2132 return parse_error::kParseNoError;
2330 } 2133 }
2331 2134
2332 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( 2135 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate(
2333 unsigned int arg_count, const gles2::UniformMatrix3fvImmediate& c) { 2136 uint32 immediate_data_size, const gles2::UniformMatrix3fvImmediate& c) {
2334 GLint location = static_cast<GLint>(c.location); 2137 GLint location = static_cast<GLint>(c.location);
2335 GLsizei count = static_cast<GLsizei>(c.count); 2138 GLsizei count = static_cast<GLsizei>(c.count);
2336 GLboolean transpose = static_cast<GLboolean>(c.transpose); 2139 GLboolean transpose = static_cast<GLboolean>(c.transpose);
2337 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); 2140 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
2338 // Immediate version. 2141 // Immediate version.
2339 parse_error::ParseError result = 2142 parse_error::ParseError result =
2340 ValidateUniformMatrix3fvImmediate( 2143 ValidateUniformMatrix3fvImmediate(
2341 this, arg_count, location, count, transpose, value); 2144 this, immediate_data_size, location, count, transpose, value);
2342 if (result != parse_error::kParseNoError) { 2145 if (result != parse_error::kParseNoError) {
2343 return result; 2146 return result;
2344 } 2147 }
2345 glUniformMatrix3fv(location, count, transpose, value); 2148 glUniformMatrix3fv(location, count, transpose, value);
2346 return parse_error::kParseNoError; 2149 return parse_error::kParseNoError;
2347 } 2150 }
2348 2151
2349 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( 2152 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv(
2350 unsigned int arg_count, const gles2::UniformMatrix4fv& c) { 2153 uint32 immediate_data_size, const gles2::UniformMatrix4fv& c) {
2351 GLint location = static_cast<GLint>(c.location); 2154 GLint location = static_cast<GLint>(c.location);
2352 GLsizei count = static_cast<GLsizei>(c.count); 2155 GLsizei count = static_cast<GLsizei>(c.count);
2353 GLboolean transpose = static_cast<GLboolean>(c.transpose); 2156 GLboolean transpose = static_cast<GLboolean>(c.transpose);
2354 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( 2157 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>(
2355 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); 2158 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */);
2356 parse_error::ParseError result = 2159 parse_error::ParseError result =
2357 ValidateUniformMatrix4fv( 2160 ValidateUniformMatrix4fv(
2358 this, arg_count, location, count, transpose, value); 2161 this, immediate_data_size, location, count, transpose, value);
2359 if (result != parse_error::kParseNoError) { 2162 if (result != parse_error::kParseNoError) {
2360 return result; 2163 return result;
2361 } 2164 }
2362 glUniformMatrix4fv(location, count, transpose, value); 2165 glUniformMatrix4fv(location, count, transpose, value);
2363 return parse_error::kParseNoError; 2166 return parse_error::kParseNoError;
2364 } 2167 }
2365 2168
2366 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( 2169 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate(
2367 unsigned int arg_count, const gles2::UniformMatrix4fvImmediate& c) { 2170 uint32 immediate_data_size, const gles2::UniformMatrix4fvImmediate& c) {
2368 GLint location = static_cast<GLint>(c.location); 2171 GLint location = static_cast<GLint>(c.location);
2369 GLsizei count = static_cast<GLsizei>(c.count); 2172 GLsizei count = static_cast<GLsizei>(c.count);
2370 GLboolean transpose = static_cast<GLboolean>(c.transpose); 2173 GLboolean transpose = static_cast<GLboolean>(c.transpose);
2371 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); 2174 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c);
2372 // Immediate version. 2175 // Immediate version.
2373 parse_error::ParseError result = 2176 parse_error::ParseError result =
2374 ValidateUniformMatrix4fvImmediate( 2177 ValidateUniformMatrix4fvImmediate(
2375 this, arg_count, location, count, transpose, value); 2178 this, immediate_data_size, location, count, transpose, value);
2376 if (result != parse_error::kParseNoError) { 2179 if (result != parse_error::kParseNoError) {
2377 return result; 2180 return result;
2378 } 2181 }
2379 glUniformMatrix4fv(location, count, transpose, value); 2182 glUniformMatrix4fv(location, count, transpose, value);
2380 return parse_error::kParseNoError; 2183 return parse_error::kParseNoError;
2381 } 2184 }
2382 2185
2383 parse_error::ParseError GLES2DecoderImpl::HandleUseProgram( 2186 parse_error::ParseError GLES2DecoderImpl::HandleUseProgram(
2384 unsigned int arg_count, const gles2::UseProgram& c) { 2187 uint32 immediate_data_size, const gles2::UseProgram& c) {
2385 GLuint program; 2188 GLuint program;
2386 if (!id_map_.GetServiceId(c.program, &program)) { 2189 if (!id_map_.GetServiceId(c.program, &program)) {
2387 SetGLError(GL_INVALID_VALUE); 2190 SetGLError(GL_INVALID_VALUE);
2388 return parse_error::kParseNoError; 2191 return parse_error::kParseNoError;
2389 } 2192 }
2390 parse_error::ParseError result = 2193 parse_error::ParseError result =
2391 ValidateUseProgram(this, arg_count, program); 2194 ValidateUseProgram(this, immediate_data_size, program);
2392 if (result != parse_error::kParseNoError) { 2195 if (result != parse_error::kParseNoError) {
2393 return result; 2196 return result;
2394 } 2197 }
2395 glUseProgram(program); 2198 glUseProgram(program);
2396 return parse_error::kParseNoError; 2199 return parse_error::kParseNoError;
2397 } 2200 }
2398 2201
2399 parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram( 2202 parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram(
2400 unsigned int arg_count, const gles2::ValidateProgram& c) { 2203 uint32 immediate_data_size, const gles2::ValidateProgram& c) {
2401 GLuint program; 2204 GLuint program;
2402 if (!id_map_.GetServiceId(c.program, &program)) { 2205 if (!id_map_.GetServiceId(c.program, &program)) {
2403 SetGLError(GL_INVALID_VALUE); 2206 SetGLError(GL_INVALID_VALUE);
2404 return parse_error::kParseNoError; 2207 return parse_error::kParseNoError;
2405 } 2208 }
2406 parse_error::ParseError result = 2209 parse_error::ParseError result =
2407 ValidateValidateProgram(this, arg_count, program); 2210 ValidateValidateProgram(this, immediate_data_size, program);
2408 if (result != parse_error::kParseNoError) { 2211 if (result != parse_error::kParseNoError) {
2409 return result; 2212 return result;
2410 } 2213 }
2411 glValidateProgram(program); 2214 glValidateProgram(program);
2412 return parse_error::kParseNoError; 2215 return parse_error::kParseNoError;
2413 } 2216 }
2414 2217
2415 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f( 2218 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f(
2416 unsigned int arg_count, const gles2::VertexAttrib1f& c) { 2219 uint32 immediate_data_size, const gles2::VertexAttrib1f& c) {
2417 GLuint indx = static_cast<GLuint>(c.indx); 2220 GLuint indx = static_cast<GLuint>(c.indx);
2418 GLfloat x = static_cast<GLfloat>(c.x); 2221 GLfloat x = static_cast<GLfloat>(c.x);
2419 parse_error::ParseError result = 2222 parse_error::ParseError result =
2420 ValidateVertexAttrib1f(this, arg_count, indx, x); 2223 ValidateVertexAttrib1f(this, immediate_data_size, indx, x);
2421 if (result != parse_error::kParseNoError) { 2224 if (result != parse_error::kParseNoError) {
2422 return result; 2225 return result;
2423 } 2226 }
2424 glVertexAttrib1f(indx, x); 2227 glVertexAttrib1f(indx, x);
2425 return parse_error::kParseNoError; 2228 return parse_error::kParseNoError;
2426 } 2229 }
2427 2230
2428 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv( 2231 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv(
2429 unsigned int arg_count, const gles2::VertexAttrib1fv& c) { 2232 uint32 immediate_data_size, const gles2::VertexAttrib1fv& c) {
2430 GLuint indx = static_cast<GLuint>(c.indx); 2233 GLuint indx = static_cast<GLuint>(c.indx);
2431 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( 2234 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
2432 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); 2235 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
2433 parse_error::ParseError result = 2236 parse_error::ParseError result =
2434 ValidateVertexAttrib1fv(this, arg_count, indx, values); 2237 ValidateVertexAttrib1fv(this, immediate_data_size, indx, values);
2435 if (result != parse_error::kParseNoError) { 2238 if (result != parse_error::kParseNoError) {
2436 return result; 2239 return result;
2437 } 2240 }
2438 glVertexAttrib1fv(indx, values); 2241 glVertexAttrib1fv(indx, values);
2439 return parse_error::kParseNoError; 2242 return parse_error::kParseNoError;
2440 } 2243 }
2441 2244
2442 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( 2245 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate(
2443 unsigned int arg_count, const gles2::VertexAttrib1fvImmediate& c) { 2246 uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) {
2444 GLuint indx = static_cast<GLuint>(c.indx); 2247 GLuint indx = static_cast<GLuint>(c.indx);
2445 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); 2248 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
2446 // Immediate version. 2249 // Immediate version.
2447 parse_error::ParseError result = 2250 parse_error::ParseError result =
2448 ValidateVertexAttrib1fvImmediate(this, arg_count, indx, values); 2251 ValidateVertexAttrib1fvImmediate(
2252 this, immediate_data_size, indx, values);
2449 if (result != parse_error::kParseNoError) { 2253 if (result != parse_error::kParseNoError) {
2450 return result; 2254 return result;
2451 } 2255 }
2452 glVertexAttrib1fv(indx, values); 2256 glVertexAttrib1fv(indx, values);
2453 return parse_error::kParseNoError; 2257 return parse_error::kParseNoError;
2454 } 2258 }
2455 2259
2456 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f( 2260 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f(
2457 unsigned int arg_count, const gles2::VertexAttrib2f& c) { 2261 uint32 immediate_data_size, const gles2::VertexAttrib2f& c) {
2458 GLuint indx = static_cast<GLuint>(c.indx); 2262 GLuint indx = static_cast<GLuint>(c.indx);
2459 GLfloat x = static_cast<GLfloat>(c.x); 2263 GLfloat x = static_cast<GLfloat>(c.x);
2460 GLfloat y = static_cast<GLfloat>(c.y); 2264 GLfloat y = static_cast<GLfloat>(c.y);
2461 parse_error::ParseError result = 2265 parse_error::ParseError result =
2462 ValidateVertexAttrib2f(this, arg_count, indx, x, y); 2266 ValidateVertexAttrib2f(this, immediate_data_size, indx, x, y);
2463 if (result != parse_error::kParseNoError) { 2267 if (result != parse_error::kParseNoError) {
2464 return result; 2268 return result;
2465 } 2269 }
2466 glVertexAttrib2f(indx, x, y); 2270 glVertexAttrib2f(indx, x, y);
2467 return parse_error::kParseNoError; 2271 return parse_error::kParseNoError;
2468 } 2272 }
2469 2273
2470 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv( 2274 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv(
2471 unsigned int arg_count, const gles2::VertexAttrib2fv& c) { 2275 uint32 immediate_data_size, const gles2::VertexAttrib2fv& c) {
2472 GLuint indx = static_cast<GLuint>(c.indx); 2276 GLuint indx = static_cast<GLuint>(c.indx);
2473 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( 2277 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
2474 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); 2278 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
2475 parse_error::ParseError result = 2279 parse_error::ParseError result =
2476 ValidateVertexAttrib2fv(this, arg_count, indx, values); 2280 ValidateVertexAttrib2fv(this, immediate_data_size, indx, values);
2477 if (result != parse_error::kParseNoError) { 2281 if (result != parse_error::kParseNoError) {
2478 return result; 2282 return result;
2479 } 2283 }
2480 glVertexAttrib2fv(indx, values); 2284 glVertexAttrib2fv(indx, values);
2481 return parse_error::kParseNoError; 2285 return parse_error::kParseNoError;
2482 } 2286 }
2483 2287
2484 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( 2288 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate(
2485 unsigned int arg_count, const gles2::VertexAttrib2fvImmediate& c) { 2289 uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) {
2486 GLuint indx = static_cast<GLuint>(c.indx); 2290 GLuint indx = static_cast<GLuint>(c.indx);
2487 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); 2291 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
2488 // Immediate version. 2292 // Immediate version.
2489 parse_error::ParseError result = 2293 parse_error::ParseError result =
2490 ValidateVertexAttrib2fvImmediate(this, arg_count, indx, values); 2294 ValidateVertexAttrib2fvImmediate(
2295 this, immediate_data_size, indx, values);
2491 if (result != parse_error::kParseNoError) { 2296 if (result != parse_error::kParseNoError) {
2492 return result; 2297 return result;
2493 } 2298 }
2494 glVertexAttrib2fv(indx, values); 2299 glVertexAttrib2fv(indx, values);
2495 return parse_error::kParseNoError; 2300 return parse_error::kParseNoError;
2496 } 2301 }
2497 2302
2498 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f( 2303 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f(
2499 unsigned int arg_count, const gles2::VertexAttrib3f& c) { 2304 uint32 immediate_data_size, const gles2::VertexAttrib3f& c) {
2500 GLuint indx = static_cast<GLuint>(c.indx); 2305 GLuint indx = static_cast<GLuint>(c.indx);
2501 GLfloat x = static_cast<GLfloat>(c.x); 2306 GLfloat x = static_cast<GLfloat>(c.x);
2502 GLfloat y = static_cast<GLfloat>(c.y); 2307 GLfloat y = static_cast<GLfloat>(c.y);
2503 GLfloat z = static_cast<GLfloat>(c.z); 2308 GLfloat z = static_cast<GLfloat>(c.z);
2504 parse_error::ParseError result = 2309 parse_error::ParseError result =
2505 ValidateVertexAttrib3f(this, arg_count, indx, x, y, z); 2310 ValidateVertexAttrib3f(this, immediate_data_size, indx, x, y, z);
2506 if (result != parse_error::kParseNoError) { 2311 if (result != parse_error::kParseNoError) {
2507 return result; 2312 return result;
2508 } 2313 }
2509 glVertexAttrib3f(indx, x, y, z); 2314 glVertexAttrib3f(indx, x, y, z);
2510 return parse_error::kParseNoError; 2315 return parse_error::kParseNoError;
2511 } 2316 }
2512 2317
2513 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv( 2318 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv(
2514 unsigned int arg_count, const gles2::VertexAttrib3fv& c) { 2319 uint32 immediate_data_size, const gles2::VertexAttrib3fv& c) {
2515 GLuint indx = static_cast<GLuint>(c.indx); 2320 GLuint indx = static_cast<GLuint>(c.indx);
2516 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( 2321 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
2517 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); 2322 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
2518 parse_error::ParseError result = 2323 parse_error::ParseError result =
2519 ValidateVertexAttrib3fv(this, arg_count, indx, values); 2324 ValidateVertexAttrib3fv(this, immediate_data_size, indx, values);
2520 if (result != parse_error::kParseNoError) { 2325 if (result != parse_error::kParseNoError) {
2521 return result; 2326 return result;
2522 } 2327 }
2523 glVertexAttrib3fv(indx, values); 2328 glVertexAttrib3fv(indx, values);
2524 return parse_error::kParseNoError; 2329 return parse_error::kParseNoError;
2525 } 2330 }
2526 2331
2527 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( 2332 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate(
2528 unsigned int arg_count, const gles2::VertexAttrib3fvImmediate& c) { 2333 uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) {
2529 GLuint indx = static_cast<GLuint>(c.indx); 2334 GLuint indx = static_cast<GLuint>(c.indx);
2530 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); 2335 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
2531 // Immediate version. 2336 // Immediate version.
2532 parse_error::ParseError result = 2337 parse_error::ParseError result =
2533 ValidateVertexAttrib3fvImmediate(this, arg_count, indx, values); 2338 ValidateVertexAttrib3fvImmediate(
2339 this, immediate_data_size, indx, values);
2534 if (result != parse_error::kParseNoError) { 2340 if (result != parse_error::kParseNoError) {
2535 return result; 2341 return result;
2536 } 2342 }
2537 glVertexAttrib3fv(indx, values); 2343 glVertexAttrib3fv(indx, values);
2538 return parse_error::kParseNoError; 2344 return parse_error::kParseNoError;
2539 } 2345 }
2540 2346
2541 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f( 2347 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f(
2542 unsigned int arg_count, const gles2::VertexAttrib4f& c) { 2348 uint32 immediate_data_size, const gles2::VertexAttrib4f& c) {
2543 GLuint indx = static_cast<GLuint>(c.indx); 2349 GLuint indx = static_cast<GLuint>(c.indx);
2544 GLfloat x = static_cast<GLfloat>(c.x); 2350 GLfloat x = static_cast<GLfloat>(c.x);
2545 GLfloat y = static_cast<GLfloat>(c.y); 2351 GLfloat y = static_cast<GLfloat>(c.y);
2546 GLfloat z = static_cast<GLfloat>(c.z); 2352 GLfloat z = static_cast<GLfloat>(c.z);
2547 GLfloat w = static_cast<GLfloat>(c.w); 2353 GLfloat w = static_cast<GLfloat>(c.w);
2548 parse_error::ParseError result = 2354 parse_error::ParseError result =
2549 ValidateVertexAttrib4f(this, arg_count, indx, x, y, z, w); 2355 ValidateVertexAttrib4f(this, immediate_data_size, indx, x, y, z, w);
2550 if (result != parse_error::kParseNoError) { 2356 if (result != parse_error::kParseNoError) {
2551 return result; 2357 return result;
2552 } 2358 }
2553 glVertexAttrib4f(indx, x, y, z, w); 2359 glVertexAttrib4f(indx, x, y, z, w);
2554 return parse_error::kParseNoError; 2360 return parse_error::kParseNoError;
2555 } 2361 }
2556 2362
2557 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv( 2363 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv(
2558 unsigned int arg_count, const gles2::VertexAttrib4fv& c) { 2364 uint32 immediate_data_size, const gles2::VertexAttrib4fv& c) {
2559 GLuint indx = static_cast<GLuint>(c.indx); 2365 GLuint indx = static_cast<GLuint>(c.indx);
2560 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( 2366 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>(
2561 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); 2367 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */);
2562 parse_error::ParseError result = 2368 parse_error::ParseError result =
2563 ValidateVertexAttrib4fv(this, arg_count, indx, values); 2369 ValidateVertexAttrib4fv(this, immediate_data_size, indx, values);
2564 if (result != parse_error::kParseNoError) { 2370 if (result != parse_error::kParseNoError) {
2565 return result; 2371 return result;
2566 } 2372 }
2567 glVertexAttrib4fv(indx, values); 2373 glVertexAttrib4fv(indx, values);
2568 return parse_error::kParseNoError; 2374 return parse_error::kParseNoError;
2569 } 2375 }
2570 2376
2571 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( 2377 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate(
2572 unsigned int arg_count, const gles2::VertexAttrib4fvImmediate& c) { 2378 uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) {
2573 GLuint indx = static_cast<GLuint>(c.indx); 2379 GLuint indx = static_cast<GLuint>(c.indx);
2574 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); 2380 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c);
2575 // Immediate version. 2381 // Immediate version.
2576 parse_error::ParseError result = 2382 parse_error::ParseError result =
2577 ValidateVertexAttrib4fvImmediate(this, arg_count, indx, values); 2383 ValidateVertexAttrib4fvImmediate(
2384 this, immediate_data_size, indx, values);
2578 if (result != parse_error::kParseNoError) { 2385 if (result != parse_error::kParseNoError) {
2579 return result; 2386 return result;
2580 } 2387 }
2581 glVertexAttrib4fv(indx, values); 2388 glVertexAttrib4fv(indx, values);
2582 return parse_error::kParseNoError; 2389 return parse_error::kParseNoError;
2583 } 2390 }
2584 2391
2585 parse_error::ParseError GLES2DecoderImpl::HandleViewport( 2392 parse_error::ParseError GLES2DecoderImpl::HandleViewport(
2586 unsigned int arg_count, const gles2::Viewport& c) { 2393 uint32 immediate_data_size, const gles2::Viewport& c) {
2587 GLint x = static_cast<GLint>(c.x); 2394 GLint x = static_cast<GLint>(c.x);
2588 GLint y = static_cast<GLint>(c.y); 2395 GLint y = static_cast<GLint>(c.y);
2589 GLsizei width = static_cast<GLsizei>(c.width); 2396 GLsizei width = static_cast<GLsizei>(c.width);
2590 GLsizei height = static_cast<GLsizei>(c.height); 2397 GLsizei height = static_cast<GLsizei>(c.height);
2591 parse_error::ParseError result = 2398 parse_error::ParseError result =
2592 ValidateViewport(this, arg_count, x, y, width, height); 2399 ValidateViewport(this, immediate_data_size, x, y, width, height);
2593 if (result != parse_error::kParseNoError) { 2400 if (result != parse_error::kParseNoError) {
2594 return result; 2401 return result;
2595 } 2402 }
2596 glViewport(x, y, width, height); 2403 glViewport(x, y, width, height);
2597 return parse_error::kParseNoError; 2404 return parse_error::kParseNoError;
2598 } 2405 }
2599 2406
2600 parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers( 2407 parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers(
2601 unsigned int arg_count, const gles2::SwapBuffers& c) { 2408 uint32 immediate_data_size, const gles2::SwapBuffers& c) {
2602 parse_error::ParseError result = 2409 parse_error::ParseError result =
2603 ValidateSwapBuffers(this, arg_count); 2410 ValidateSwapBuffers(this, immediate_data_size);
2604 if (result != parse_error::kParseNoError) { 2411 if (result != parse_error::kParseNoError) {
2605 return result; 2412 return result;
2606 } 2413 }
2607 DoSwapBuffers(); 2414 DoSwapBuffers();
2608 return parse_error::kParseNoError; 2415 return parse_error::kParseNoError;
2609 } 2416 }
2610 2417
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_validate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698