OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is auto-generated from | 5 // This file is auto-generated from |
6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
7 // DO NOT EDIT! | 7 // DO NOT EDIT! |
8 | 8 |
9 // It is included by gles2_cmd_decoder.cc | 9 // It is included by gles2_cmd_decoder.cc |
10 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ | 10 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ |
11 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ | 11 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ |
12 | 12 |
13 error::Error GLES2DecoderImpl::HandleActiveTexture( | 13 error::Error GLES2DecoderImpl::HandleActiveTexture( |
14 uint32 immediate_data_size, const gles2::ActiveTexture& c) { | 14 uint32 immediate_data_size, const gles2::cmds::ActiveTexture& c) { |
15 GLenum texture = static_cast<GLenum>(c.texture); | 15 GLenum texture = static_cast<GLenum>(c.texture); |
16 DoActiveTexture(texture); | 16 DoActiveTexture(texture); |
17 return error::kNoError; | 17 return error::kNoError; |
18 } | 18 } |
19 | 19 |
20 error::Error GLES2DecoderImpl::HandleAttachShader( | 20 error::Error GLES2DecoderImpl::HandleAttachShader( |
21 uint32 immediate_data_size, const gles2::AttachShader& c) { | 21 uint32 immediate_data_size, const gles2::cmds::AttachShader& c) { |
22 GLuint program = c.program; | 22 GLuint program = c.program; |
23 GLuint shader = c.shader; | 23 GLuint shader = c.shader; |
24 DoAttachShader(program, shader); | 24 DoAttachShader(program, shader); |
25 return error::kNoError; | 25 return error::kNoError; |
26 } | 26 } |
27 | 27 |
28 error::Error GLES2DecoderImpl::HandleBindBuffer( | 28 error::Error GLES2DecoderImpl::HandleBindBuffer( |
29 uint32 immediate_data_size, const gles2::BindBuffer& c) { | 29 uint32 immediate_data_size, const gles2::cmds::BindBuffer& c) { |
30 GLenum target = static_cast<GLenum>(c.target); | 30 GLenum target = static_cast<GLenum>(c.target); |
31 GLuint buffer = c.buffer; | 31 GLuint buffer = c.buffer; |
32 if (!validators_->buffer_target.IsValid(target)) { | 32 if (!validators_->buffer_target.IsValid(target)) { |
33 SetGLErrorInvalidEnum("glBindBuffer", target, "target"); | 33 SetGLErrorInvalidEnum("glBindBuffer", target, "target"); |
34 return error::kNoError; | 34 return error::kNoError; |
35 } | 35 } |
36 DoBindBuffer(target, buffer); | 36 DoBindBuffer(target, buffer); |
37 return error::kNoError; | 37 return error::kNoError; |
38 } | 38 } |
39 | 39 |
40 error::Error GLES2DecoderImpl::HandleBindFramebuffer( | 40 error::Error GLES2DecoderImpl::HandleBindFramebuffer( |
41 uint32 immediate_data_size, const gles2::BindFramebuffer& c) { | 41 uint32 immediate_data_size, const gles2::cmds::BindFramebuffer& c) { |
42 GLenum target = static_cast<GLenum>(c.target); | 42 GLenum target = static_cast<GLenum>(c.target); |
43 GLuint framebuffer = c.framebuffer; | 43 GLuint framebuffer = c.framebuffer; |
44 if (!validators_->frame_buffer_target.IsValid(target)) { | 44 if (!validators_->frame_buffer_target.IsValid(target)) { |
45 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); | 45 SetGLErrorInvalidEnum("glBindFramebuffer", target, "target"); |
46 return error::kNoError; | 46 return error::kNoError; |
47 } | 47 } |
48 DoBindFramebuffer(target, framebuffer); | 48 DoBindFramebuffer(target, framebuffer); |
49 return error::kNoError; | 49 return error::kNoError; |
50 } | 50 } |
51 | 51 |
52 error::Error GLES2DecoderImpl::HandleBindRenderbuffer( | 52 error::Error GLES2DecoderImpl::HandleBindRenderbuffer( |
53 uint32 immediate_data_size, const gles2::BindRenderbuffer& c) { | 53 uint32 immediate_data_size, const gles2::cmds::BindRenderbuffer& c) { |
54 GLenum target = static_cast<GLenum>(c.target); | 54 GLenum target = static_cast<GLenum>(c.target); |
55 GLuint renderbuffer = c.renderbuffer; | 55 GLuint renderbuffer = c.renderbuffer; |
56 if (!validators_->render_buffer_target.IsValid(target)) { | 56 if (!validators_->render_buffer_target.IsValid(target)) { |
57 SetGLErrorInvalidEnum("glBindRenderbuffer", target, "target"); | 57 SetGLErrorInvalidEnum("glBindRenderbuffer", target, "target"); |
58 return error::kNoError; | 58 return error::kNoError; |
59 } | 59 } |
60 DoBindRenderbuffer(target, renderbuffer); | 60 DoBindRenderbuffer(target, renderbuffer); |
61 return error::kNoError; | 61 return error::kNoError; |
62 } | 62 } |
63 | 63 |
64 error::Error GLES2DecoderImpl::HandleBindTexture( | 64 error::Error GLES2DecoderImpl::HandleBindTexture( |
65 uint32 immediate_data_size, const gles2::BindTexture& c) { | 65 uint32 immediate_data_size, const gles2::cmds::BindTexture& c) { |
66 GLenum target = static_cast<GLenum>(c.target); | 66 GLenum target = static_cast<GLenum>(c.target); |
67 GLuint texture = c.texture; | 67 GLuint texture = c.texture; |
68 if (!validators_->texture_bind_target.IsValid(target)) { | 68 if (!validators_->texture_bind_target.IsValid(target)) { |
69 SetGLErrorInvalidEnum("glBindTexture", target, "target"); | 69 SetGLErrorInvalidEnum("glBindTexture", target, "target"); |
70 return error::kNoError; | 70 return error::kNoError; |
71 } | 71 } |
72 DoBindTexture(target, texture); | 72 DoBindTexture(target, texture); |
73 return error::kNoError; | 73 return error::kNoError; |
74 } | 74 } |
75 | 75 |
76 error::Error GLES2DecoderImpl::HandleBlendColor( | 76 error::Error GLES2DecoderImpl::HandleBlendColor( |
77 uint32 immediate_data_size, const gles2::BlendColor& c) { | 77 uint32 immediate_data_size, const gles2::cmds::BlendColor& c) { |
78 GLclampf red = static_cast<GLclampf>(c.red); | 78 GLclampf red = static_cast<GLclampf>(c.red); |
79 GLclampf green = static_cast<GLclampf>(c.green); | 79 GLclampf green = static_cast<GLclampf>(c.green); |
80 GLclampf blue = static_cast<GLclampf>(c.blue); | 80 GLclampf blue = static_cast<GLclampf>(c.blue); |
81 GLclampf alpha = static_cast<GLclampf>(c.alpha); | 81 GLclampf alpha = static_cast<GLclampf>(c.alpha); |
82 if (state_.blend_color_red != red || | 82 if (state_.blend_color_red != red || |
83 state_.blend_color_green != green || | 83 state_.blend_color_green != green || |
84 state_.blend_color_blue != blue || | 84 state_.blend_color_blue != blue || |
85 state_.blend_color_alpha != alpha) { | 85 state_.blend_color_alpha != alpha) { |
86 state_.blend_color_red = red; | 86 state_.blend_color_red = red; |
87 state_.blend_color_green = green; | 87 state_.blend_color_green = green; |
88 state_.blend_color_blue = blue; | 88 state_.blend_color_blue = blue; |
89 state_.blend_color_alpha = alpha; | 89 state_.blend_color_alpha = alpha; |
90 glBlendColor(red, green, blue, alpha); | 90 glBlendColor(red, green, blue, alpha); |
91 } | 91 } |
92 return error::kNoError; | 92 return error::kNoError; |
93 } | 93 } |
94 | 94 |
95 error::Error GLES2DecoderImpl::HandleBlendEquation( | 95 error::Error GLES2DecoderImpl::HandleBlendEquation( |
96 uint32 immediate_data_size, const gles2::BlendEquation& c) { | 96 uint32 immediate_data_size, const gles2::cmds::BlendEquation& c) { |
97 GLenum mode = static_cast<GLenum>(c.mode); | 97 GLenum mode = static_cast<GLenum>(c.mode); |
98 if (!validators_->equation.IsValid(mode)) { | 98 if (!validators_->equation.IsValid(mode)) { |
99 SetGLErrorInvalidEnum("glBlendEquation", mode, "mode"); | 99 SetGLErrorInvalidEnum("glBlendEquation", mode, "mode"); |
100 return error::kNoError; | 100 return error::kNoError; |
101 } | 101 } |
102 if (state_.blend_equation_rgb != mode || | 102 if (state_.blend_equation_rgb != mode || |
103 state_.blend_equation_alpha != mode) { | 103 state_.blend_equation_alpha != mode) { |
104 state_.blend_equation_rgb = mode; | 104 state_.blend_equation_rgb = mode; |
105 state_.blend_equation_alpha = mode; | 105 state_.blend_equation_alpha = mode; |
106 glBlendEquation(mode); | 106 glBlendEquation(mode); |
107 } | 107 } |
108 return error::kNoError; | 108 return error::kNoError; |
109 } | 109 } |
110 | 110 |
111 error::Error GLES2DecoderImpl::HandleBlendEquationSeparate( | 111 error::Error GLES2DecoderImpl::HandleBlendEquationSeparate( |
112 uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) { | 112 uint32 immediate_data_size, const gles2::cmds::BlendEquationSeparate& c) { |
113 GLenum modeRGB = static_cast<GLenum>(c.modeRGB); | 113 GLenum modeRGB = static_cast<GLenum>(c.modeRGB); |
114 GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); | 114 GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); |
115 if (!validators_->equation.IsValid(modeRGB)) { | 115 if (!validators_->equation.IsValid(modeRGB)) { |
116 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeRGB, "modeRGB"); | 116 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeRGB, "modeRGB"); |
117 return error::kNoError; | 117 return error::kNoError; |
118 } | 118 } |
119 if (!validators_->equation.IsValid(modeAlpha)) { | 119 if (!validators_->equation.IsValid(modeAlpha)) { |
120 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeAlpha, "modeAlpha"); | 120 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeAlpha, "modeAlpha"); |
121 return error::kNoError; | 121 return error::kNoError; |
122 } | 122 } |
123 if (state_.blend_equation_rgb != modeRGB || | 123 if (state_.blend_equation_rgb != modeRGB || |
124 state_.blend_equation_alpha != modeAlpha) { | 124 state_.blend_equation_alpha != modeAlpha) { |
125 state_.blend_equation_rgb = modeRGB; | 125 state_.blend_equation_rgb = modeRGB; |
126 state_.blend_equation_alpha = modeAlpha; | 126 state_.blend_equation_alpha = modeAlpha; |
127 glBlendEquationSeparate(modeRGB, modeAlpha); | 127 glBlendEquationSeparate(modeRGB, modeAlpha); |
128 } | 128 } |
129 return error::kNoError; | 129 return error::kNoError; |
130 } | 130 } |
131 | 131 |
132 error::Error GLES2DecoderImpl::HandleBlendFunc( | 132 error::Error GLES2DecoderImpl::HandleBlendFunc( |
133 uint32 immediate_data_size, const gles2::BlendFunc& c) { | 133 uint32 immediate_data_size, const gles2::cmds::BlendFunc& c) { |
134 GLenum sfactor = static_cast<GLenum>(c.sfactor); | 134 GLenum sfactor = static_cast<GLenum>(c.sfactor); |
135 GLenum dfactor = static_cast<GLenum>(c.dfactor); | 135 GLenum dfactor = static_cast<GLenum>(c.dfactor); |
136 if (!validators_->src_blend_factor.IsValid(sfactor)) { | 136 if (!validators_->src_blend_factor.IsValid(sfactor)) { |
137 SetGLErrorInvalidEnum("glBlendFunc", sfactor, "sfactor"); | 137 SetGLErrorInvalidEnum("glBlendFunc", sfactor, "sfactor"); |
138 return error::kNoError; | 138 return error::kNoError; |
139 } | 139 } |
140 if (!validators_->dst_blend_factor.IsValid(dfactor)) { | 140 if (!validators_->dst_blend_factor.IsValid(dfactor)) { |
141 SetGLErrorInvalidEnum("glBlendFunc", dfactor, "dfactor"); | 141 SetGLErrorInvalidEnum("glBlendFunc", dfactor, "dfactor"); |
142 return error::kNoError; | 142 return error::kNoError; |
143 } | 143 } |
144 if (state_.blend_source_rgb != sfactor || | 144 if (state_.blend_source_rgb != sfactor || |
145 state_.blend_dest_rgb != dfactor || | 145 state_.blend_dest_rgb != dfactor || |
146 state_.blend_source_alpha != sfactor || | 146 state_.blend_source_alpha != sfactor || |
147 state_.blend_dest_alpha != dfactor) { | 147 state_.blend_dest_alpha != dfactor) { |
148 state_.blend_source_rgb = sfactor; | 148 state_.blend_source_rgb = sfactor; |
149 state_.blend_dest_rgb = dfactor; | 149 state_.blend_dest_rgb = dfactor; |
150 state_.blend_source_alpha = sfactor; | 150 state_.blend_source_alpha = sfactor; |
151 state_.blend_dest_alpha = dfactor; | 151 state_.blend_dest_alpha = dfactor; |
152 glBlendFunc(sfactor, dfactor); | 152 glBlendFunc(sfactor, dfactor); |
153 } | 153 } |
154 return error::kNoError; | 154 return error::kNoError; |
155 } | 155 } |
156 | 156 |
157 error::Error GLES2DecoderImpl::HandleBlendFuncSeparate( | 157 error::Error GLES2DecoderImpl::HandleBlendFuncSeparate( |
158 uint32 immediate_data_size, const gles2::BlendFuncSeparate& c) { | 158 uint32 immediate_data_size, const gles2::cmds::BlendFuncSeparate& c) { |
159 GLenum srcRGB = static_cast<GLenum>(c.srcRGB); | 159 GLenum srcRGB = static_cast<GLenum>(c.srcRGB); |
160 GLenum dstRGB = static_cast<GLenum>(c.dstRGB); | 160 GLenum dstRGB = static_cast<GLenum>(c.dstRGB); |
161 GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); | 161 GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); |
162 GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); | 162 GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); |
163 if (!validators_->src_blend_factor.IsValid(srcRGB)) { | 163 if (!validators_->src_blend_factor.IsValid(srcRGB)) { |
164 SetGLErrorInvalidEnum("glBlendFuncSeparate", srcRGB, "srcRGB"); | 164 SetGLErrorInvalidEnum("glBlendFuncSeparate", srcRGB, "srcRGB"); |
165 return error::kNoError; | 165 return error::kNoError; |
166 } | 166 } |
167 if (!validators_->dst_blend_factor.IsValid(dstRGB)) { | 167 if (!validators_->dst_blend_factor.IsValid(dstRGB)) { |
168 SetGLErrorInvalidEnum("glBlendFuncSeparate", dstRGB, "dstRGB"); | 168 SetGLErrorInvalidEnum("glBlendFuncSeparate", dstRGB, "dstRGB"); |
(...skipping 14 matching lines...) Expand all Loading... |
183 state_.blend_source_rgb = srcRGB; | 183 state_.blend_source_rgb = srcRGB; |
184 state_.blend_dest_rgb = dstRGB; | 184 state_.blend_dest_rgb = dstRGB; |
185 state_.blend_source_alpha = srcAlpha; | 185 state_.blend_source_alpha = srcAlpha; |
186 state_.blend_dest_alpha = dstAlpha; | 186 state_.blend_dest_alpha = dstAlpha; |
187 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); | 187 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
188 } | 188 } |
189 return error::kNoError; | 189 return error::kNoError; |
190 } | 190 } |
191 | 191 |
192 error::Error GLES2DecoderImpl::HandleBufferSubData( | 192 error::Error GLES2DecoderImpl::HandleBufferSubData( |
193 uint32 immediate_data_size, const gles2::BufferSubData& c) { | 193 uint32 immediate_data_size, const gles2::cmds::BufferSubData& c) { |
194 GLenum target = static_cast<GLenum>(c.target); | 194 GLenum target = static_cast<GLenum>(c.target); |
195 GLintptr offset = static_cast<GLintptr>(c.offset); | 195 GLintptr offset = static_cast<GLintptr>(c.offset); |
196 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 196 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
197 uint32 data_size = size; | 197 uint32 data_size = size; |
198 const void* data = GetSharedMemoryAs<const void*>( | 198 const void* data = GetSharedMemoryAs<const void*>( |
199 c.data_shm_id, c.data_shm_offset, data_size); | 199 c.data_shm_id, c.data_shm_offset, data_size); |
200 if (!validators_->buffer_target.IsValid(target)) { | 200 if (!validators_->buffer_target.IsValid(target)) { |
201 SetGLErrorInvalidEnum("glBufferSubData", target, "target"); | 201 SetGLErrorInvalidEnum("glBufferSubData", target, "target"); |
202 return error::kNoError; | 202 return error::kNoError; |
203 } | 203 } |
204 if (size < 0) { | 204 if (size < 0) { |
205 SetGLError(GL_INVALID_VALUE, "glBufferSubData", "size < 0"); | 205 SetGLError(GL_INVALID_VALUE, "glBufferSubData", "size < 0"); |
206 return error::kNoError; | 206 return error::kNoError; |
207 } | 207 } |
208 if (data == NULL) { | 208 if (data == NULL) { |
209 return error::kOutOfBounds; | 209 return error::kOutOfBounds; |
210 } | 210 } |
211 DoBufferSubData(target, offset, size, data); | 211 DoBufferSubData(target, offset, size, data); |
212 return error::kNoError; | 212 return error::kNoError; |
213 } | 213 } |
214 | 214 |
215 error::Error GLES2DecoderImpl::HandleBufferSubDataImmediate( | 215 error::Error GLES2DecoderImpl::HandleBufferSubDataImmediate( |
216 uint32 immediate_data_size, const gles2::BufferSubDataImmediate& c) { | 216 uint32 immediate_data_size, const gles2::cmds::BufferSubDataImmediate& c) { |
217 GLenum target = static_cast<GLenum>(c.target); | 217 GLenum target = static_cast<GLenum>(c.target); |
218 GLintptr offset = static_cast<GLintptr>(c.offset); | 218 GLintptr offset = static_cast<GLintptr>(c.offset); |
219 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 219 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
220 uint32 data_size = size; | 220 uint32 data_size = size; |
221 const void* data = GetImmediateDataAs<const void*>( | 221 const void* data = GetImmediateDataAs<const void*>( |
222 c, data_size, immediate_data_size); | 222 c, data_size, immediate_data_size); |
223 if (!validators_->buffer_target.IsValid(target)) { | 223 if (!validators_->buffer_target.IsValid(target)) { |
224 SetGLErrorInvalidEnum("glBufferSubData", target, "target"); | 224 SetGLErrorInvalidEnum("glBufferSubData", target, "target"); |
225 return error::kNoError; | 225 return error::kNoError; |
226 } | 226 } |
227 if (size < 0) { | 227 if (size < 0) { |
228 SetGLError(GL_INVALID_VALUE, "glBufferSubData", "size < 0"); | 228 SetGLError(GL_INVALID_VALUE, "glBufferSubData", "size < 0"); |
229 return error::kNoError; | 229 return error::kNoError; |
230 } | 230 } |
231 if (data == NULL) { | 231 if (data == NULL) { |
232 return error::kOutOfBounds; | 232 return error::kOutOfBounds; |
233 } | 233 } |
234 DoBufferSubData(target, offset, size, data); | 234 DoBufferSubData(target, offset, size, data); |
235 return error::kNoError; | 235 return error::kNoError; |
236 } | 236 } |
237 | 237 |
238 error::Error GLES2DecoderImpl::HandleCheckFramebufferStatus( | 238 error::Error GLES2DecoderImpl::HandleCheckFramebufferStatus( |
239 uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) { | 239 uint32 immediate_data_size, const gles2::cmds::CheckFramebufferStatus& c) { |
240 GLenum target = static_cast<GLenum>(c.target); | 240 GLenum target = static_cast<GLenum>(c.target); |
241 typedef CheckFramebufferStatus::Result Result; | 241 typedef cmds::CheckFramebufferStatus::Result Result; |
242 Result* result_dst = GetSharedMemoryAs<Result*>( | 242 Result* result_dst = GetSharedMemoryAs<Result*>( |
243 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 243 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
244 if (!result_dst) { | 244 if (!result_dst) { |
245 return error::kOutOfBounds; | 245 return error::kOutOfBounds; |
246 } | 246 } |
247 if (!validators_->frame_buffer_target.IsValid(target)) { | 247 if (!validators_->frame_buffer_target.IsValid(target)) { |
248 SetGLErrorInvalidEnum("glCheckFramebufferStatus", target, "target"); | 248 SetGLErrorInvalidEnum("glCheckFramebufferStatus", target, "target"); |
249 return error::kNoError; | 249 return error::kNoError; |
250 } | 250 } |
251 *result_dst = DoCheckFramebufferStatus(target); | 251 *result_dst = DoCheckFramebufferStatus(target); |
252 return error::kNoError; | 252 return error::kNoError; |
253 } | 253 } |
254 | 254 |
255 error::Error GLES2DecoderImpl::HandleClear( | 255 error::Error GLES2DecoderImpl::HandleClear( |
256 uint32 immediate_data_size, const gles2::Clear& c) { | 256 uint32 immediate_data_size, const gles2::cmds::Clear& c) { |
257 if (ShouldDeferDraws()) | 257 if (ShouldDeferDraws()) |
258 return error::kDeferCommandUntilLater; | 258 return error::kDeferCommandUntilLater; |
259 GLbitfield mask = static_cast<GLbitfield>(c.mask); | 259 GLbitfield mask = static_cast<GLbitfield>(c.mask); |
260 DoClear(mask); | 260 DoClear(mask); |
261 return error::kNoError; | 261 return error::kNoError; |
262 } | 262 } |
263 | 263 |
264 error::Error GLES2DecoderImpl::HandleClearColor( | 264 error::Error GLES2DecoderImpl::HandleClearColor( |
265 uint32 immediate_data_size, const gles2::ClearColor& c) { | 265 uint32 immediate_data_size, const gles2::cmds::ClearColor& c) { |
266 GLclampf red = static_cast<GLclampf>(c.red); | 266 GLclampf red = static_cast<GLclampf>(c.red); |
267 GLclampf green = static_cast<GLclampf>(c.green); | 267 GLclampf green = static_cast<GLclampf>(c.green); |
268 GLclampf blue = static_cast<GLclampf>(c.blue); | 268 GLclampf blue = static_cast<GLclampf>(c.blue); |
269 GLclampf alpha = static_cast<GLclampf>(c.alpha); | 269 GLclampf alpha = static_cast<GLclampf>(c.alpha); |
270 if (state_.color_clear_red != red || | 270 if (state_.color_clear_red != red || |
271 state_.color_clear_green != green || | 271 state_.color_clear_green != green || |
272 state_.color_clear_blue != blue || | 272 state_.color_clear_blue != blue || |
273 state_.color_clear_alpha != alpha) { | 273 state_.color_clear_alpha != alpha) { |
274 state_.color_clear_red = red; | 274 state_.color_clear_red = red; |
275 state_.color_clear_green = green; | 275 state_.color_clear_green = green; |
276 state_.color_clear_blue = blue; | 276 state_.color_clear_blue = blue; |
277 state_.color_clear_alpha = alpha; | 277 state_.color_clear_alpha = alpha; |
278 glClearColor(red, green, blue, alpha); | 278 glClearColor(red, green, blue, alpha); |
279 } | 279 } |
280 return error::kNoError; | 280 return error::kNoError; |
281 } | 281 } |
282 | 282 |
283 error::Error GLES2DecoderImpl::HandleClearDepthf( | 283 error::Error GLES2DecoderImpl::HandleClearDepthf( |
284 uint32 immediate_data_size, const gles2::ClearDepthf& c) { | 284 uint32 immediate_data_size, const gles2::cmds::ClearDepthf& c) { |
285 GLclampf depth = static_cast<GLclampf>(c.depth); | 285 GLclampf depth = static_cast<GLclampf>(c.depth); |
286 if (state_.depth_clear != depth) { | 286 if (state_.depth_clear != depth) { |
287 state_.depth_clear = depth; | 287 state_.depth_clear = depth; |
288 glClearDepth(depth); | 288 glClearDepth(depth); |
289 } | 289 } |
290 return error::kNoError; | 290 return error::kNoError; |
291 } | 291 } |
292 | 292 |
293 error::Error GLES2DecoderImpl::HandleClearStencil( | 293 error::Error GLES2DecoderImpl::HandleClearStencil( |
294 uint32 immediate_data_size, const gles2::ClearStencil& c) { | 294 uint32 immediate_data_size, const gles2::cmds::ClearStencil& c) { |
295 GLint s = static_cast<GLint>(c.s); | 295 GLint s = static_cast<GLint>(c.s); |
296 if (state_.stencil_clear != s) { | 296 if (state_.stencil_clear != s) { |
297 state_.stencil_clear = s; | 297 state_.stencil_clear = s; |
298 glClearStencil(s); | 298 glClearStencil(s); |
299 } | 299 } |
300 return error::kNoError; | 300 return error::kNoError; |
301 } | 301 } |
302 | 302 |
303 error::Error GLES2DecoderImpl::HandleColorMask( | 303 error::Error GLES2DecoderImpl::HandleColorMask( |
304 uint32 immediate_data_size, const gles2::ColorMask& c) { | 304 uint32 immediate_data_size, const gles2::cmds::ColorMask& c) { |
305 GLboolean red = static_cast<GLboolean>(c.red); | 305 GLboolean red = static_cast<GLboolean>(c.red); |
306 GLboolean green = static_cast<GLboolean>(c.green); | 306 GLboolean green = static_cast<GLboolean>(c.green); |
307 GLboolean blue = static_cast<GLboolean>(c.blue); | 307 GLboolean blue = static_cast<GLboolean>(c.blue); |
308 GLboolean alpha = static_cast<GLboolean>(c.alpha); | 308 GLboolean alpha = static_cast<GLboolean>(c.alpha); |
309 if (state_.color_mask_red != red || | 309 if (state_.color_mask_red != red || |
310 state_.color_mask_green != green || | 310 state_.color_mask_green != green || |
311 state_.color_mask_blue != blue || | 311 state_.color_mask_blue != blue || |
312 state_.color_mask_alpha != alpha) { | 312 state_.color_mask_alpha != alpha) { |
313 state_.color_mask_red = red; | 313 state_.color_mask_red = red; |
314 state_.color_mask_green = green; | 314 state_.color_mask_green = green; |
315 state_.color_mask_blue = blue; | 315 state_.color_mask_blue = blue; |
316 state_.color_mask_alpha = alpha; | 316 state_.color_mask_alpha = alpha; |
317 clear_state_dirty_ = true; | 317 clear_state_dirty_ = true; |
318 } | 318 } |
319 return error::kNoError; | 319 return error::kNoError; |
320 } | 320 } |
321 | 321 |
322 error::Error GLES2DecoderImpl::HandleCompileShader( | 322 error::Error GLES2DecoderImpl::HandleCompileShader( |
323 uint32 immediate_data_size, const gles2::CompileShader& c) { | 323 uint32 immediate_data_size, const gles2::cmds::CompileShader& c) { |
324 GLuint shader = c.shader; | 324 GLuint shader = c.shader; |
325 DoCompileShader(shader); | 325 DoCompileShader(shader); |
326 return error::kNoError; | 326 return error::kNoError; |
327 } | 327 } |
328 | 328 |
329 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2D( | 329 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2D( |
330 uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) { | 330 uint32 immediate_data_size, |
| 331 const gles2::cmds::CompressedTexSubImage2D& c) { |
331 GLenum target = static_cast<GLenum>(c.target); | 332 GLenum target = static_cast<GLenum>(c.target); |
332 GLint level = static_cast<GLint>(c.level); | 333 GLint level = static_cast<GLint>(c.level); |
333 GLint xoffset = static_cast<GLint>(c.xoffset); | 334 GLint xoffset = static_cast<GLint>(c.xoffset); |
334 GLint yoffset = static_cast<GLint>(c.yoffset); | 335 GLint yoffset = static_cast<GLint>(c.yoffset); |
335 GLsizei width = static_cast<GLsizei>(c.width); | 336 GLsizei width = static_cast<GLsizei>(c.width); |
336 GLsizei height = static_cast<GLsizei>(c.height); | 337 GLsizei height = static_cast<GLsizei>(c.height); |
337 GLenum format = static_cast<GLenum>(c.format); | 338 GLenum format = static_cast<GLenum>(c.format); |
338 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); | 339 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); |
339 uint32 data_size = imageSize; | 340 uint32 data_size = imageSize; |
340 const void* data = GetSharedMemoryAs<const void*>( | 341 const void* data = GetSharedMemoryAs<const void*>( |
(...skipping 21 matching lines...) Expand all Loading... |
362 if (data == NULL) { | 363 if (data == NULL) { |
363 return error::kOutOfBounds; | 364 return error::kOutOfBounds; |
364 } | 365 } |
365 DoCompressedTexSubImage2D( | 366 DoCompressedTexSubImage2D( |
366 target, level, xoffset, yoffset, width, height, format, imageSize, data); | 367 target, level, xoffset, yoffset, width, height, format, imageSize, data); |
367 return error::kNoError; | 368 return error::kNoError; |
368 } | 369 } |
369 | 370 |
370 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate( | 371 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate( |
371 uint32 immediate_data_size, | 372 uint32 immediate_data_size, |
372 const gles2::CompressedTexSubImage2DImmediate& c) { | 373 const gles2::cmds::CompressedTexSubImage2DImmediate& c) { |
373 GLenum target = static_cast<GLenum>(c.target); | 374 GLenum target = static_cast<GLenum>(c.target); |
374 GLint level = static_cast<GLint>(c.level); | 375 GLint level = static_cast<GLint>(c.level); |
375 GLint xoffset = static_cast<GLint>(c.xoffset); | 376 GLint xoffset = static_cast<GLint>(c.xoffset); |
376 GLint yoffset = static_cast<GLint>(c.yoffset); | 377 GLint yoffset = static_cast<GLint>(c.yoffset); |
377 GLsizei width = static_cast<GLsizei>(c.width); | 378 GLsizei width = static_cast<GLsizei>(c.width); |
378 GLsizei height = static_cast<GLsizei>(c.height); | 379 GLsizei height = static_cast<GLsizei>(c.height); |
379 GLenum format = static_cast<GLenum>(c.format); | 380 GLenum format = static_cast<GLenum>(c.format); |
380 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); | 381 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); |
381 uint32 data_size = imageSize; | 382 uint32 data_size = imageSize; |
382 const void* data = GetImmediateDataAs<const void*>( | 383 const void* data = GetImmediateDataAs<const void*>( |
(...skipping 20 matching lines...) Expand all Loading... |
403 } | 404 } |
404 if (data == NULL) { | 405 if (data == NULL) { |
405 return error::kOutOfBounds; | 406 return error::kOutOfBounds; |
406 } | 407 } |
407 DoCompressedTexSubImage2D( | 408 DoCompressedTexSubImage2D( |
408 target, level, xoffset, yoffset, width, height, format, imageSize, data); | 409 target, level, xoffset, yoffset, width, height, format, imageSize, data); |
409 return error::kNoError; | 410 return error::kNoError; |
410 } | 411 } |
411 | 412 |
412 error::Error GLES2DecoderImpl::HandleCopyTexImage2D( | 413 error::Error GLES2DecoderImpl::HandleCopyTexImage2D( |
413 uint32 immediate_data_size, const gles2::CopyTexImage2D& c) { | 414 uint32 immediate_data_size, const gles2::cmds::CopyTexImage2D& c) { |
414 if (ShouldDeferReads()) | 415 if (ShouldDeferReads()) |
415 return error::kDeferCommandUntilLater; | 416 return error::kDeferCommandUntilLater; |
416 GLenum target = static_cast<GLenum>(c.target); | 417 GLenum target = static_cast<GLenum>(c.target); |
417 GLint level = static_cast<GLint>(c.level); | 418 GLint level = static_cast<GLint>(c.level); |
418 GLenum internalformat = static_cast<GLenum>(c.internalformat); | 419 GLenum internalformat = static_cast<GLenum>(c.internalformat); |
419 GLint x = static_cast<GLint>(c.x); | 420 GLint x = static_cast<GLint>(c.x); |
420 GLint y = static_cast<GLint>(c.y); | 421 GLint y = static_cast<GLint>(c.y); |
421 GLsizei width = static_cast<GLsizei>(c.width); | 422 GLsizei width = static_cast<GLsizei>(c.width); |
422 GLsizei height = static_cast<GLsizei>(c.height); | 423 GLsizei height = static_cast<GLsizei>(c.height); |
423 GLint border = static_cast<GLint>(c.border); | 424 GLint border = static_cast<GLint>(c.border); |
(...skipping 17 matching lines...) Expand all Loading... |
441 if (!validators_->texture_border.IsValid(border)) { | 442 if (!validators_->texture_border.IsValid(border)) { |
442 SetGLError( | 443 SetGLError( |
443 GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE"); | 444 GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE"); |
444 return error::kNoError; | 445 return error::kNoError; |
445 } | 446 } |
446 DoCopyTexImage2D(target, level, internalformat, x, y, width, height, border); | 447 DoCopyTexImage2D(target, level, internalformat, x, y, width, height, border); |
447 return error::kNoError; | 448 return error::kNoError; |
448 } | 449 } |
449 | 450 |
450 error::Error GLES2DecoderImpl::HandleCopyTexSubImage2D( | 451 error::Error GLES2DecoderImpl::HandleCopyTexSubImage2D( |
451 uint32 immediate_data_size, const gles2::CopyTexSubImage2D& c) { | 452 uint32 immediate_data_size, const gles2::cmds::CopyTexSubImage2D& c) { |
452 if (ShouldDeferReads()) | 453 if (ShouldDeferReads()) |
453 return error::kDeferCommandUntilLater; | 454 return error::kDeferCommandUntilLater; |
454 GLenum target = static_cast<GLenum>(c.target); | 455 GLenum target = static_cast<GLenum>(c.target); |
455 GLint level = static_cast<GLint>(c.level); | 456 GLint level = static_cast<GLint>(c.level); |
456 GLint xoffset = static_cast<GLint>(c.xoffset); | 457 GLint xoffset = static_cast<GLint>(c.xoffset); |
457 GLint yoffset = static_cast<GLint>(c.yoffset); | 458 GLint yoffset = static_cast<GLint>(c.yoffset); |
458 GLint x = static_cast<GLint>(c.x); | 459 GLint x = static_cast<GLint>(c.x); |
459 GLint y = static_cast<GLint>(c.y); | 460 GLint y = static_cast<GLint>(c.y); |
460 GLsizei width = static_cast<GLsizei>(c.width); | 461 GLsizei width = static_cast<GLsizei>(c.width); |
461 GLsizei height = static_cast<GLsizei>(c.height); | 462 GLsizei height = static_cast<GLsizei>(c.height); |
462 if (!validators_->texture_target.IsValid(target)) { | 463 if (!validators_->texture_target.IsValid(target)) { |
463 SetGLErrorInvalidEnum("glCopyTexSubImage2D", target, "target"); | 464 SetGLErrorInvalidEnum("glCopyTexSubImage2D", target, "target"); |
464 return error::kNoError; | 465 return error::kNoError; |
465 } | 466 } |
466 if (width < 0) { | 467 if (width < 0) { |
467 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0"); | 468 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0"); |
468 return error::kNoError; | 469 return error::kNoError; |
469 } | 470 } |
470 if (height < 0) { | 471 if (height < 0) { |
471 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0"); | 472 SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "height < 0"); |
472 return error::kNoError; | 473 return error::kNoError; |
473 } | 474 } |
474 DoCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); | 475 DoCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
475 return error::kNoError; | 476 return error::kNoError; |
476 } | 477 } |
477 | 478 |
478 error::Error GLES2DecoderImpl::HandleCreateProgram( | 479 error::Error GLES2DecoderImpl::HandleCreateProgram( |
479 uint32 immediate_data_size, const gles2::CreateProgram& c) { | 480 uint32 immediate_data_size, const gles2::cmds::CreateProgram& c) { |
480 uint32 client_id = c.client_id; | 481 uint32 client_id = c.client_id; |
481 if (!CreateProgramHelper(client_id)) { | 482 if (!CreateProgramHelper(client_id)) { |
482 return error::kInvalidArguments; | 483 return error::kInvalidArguments; |
483 } | 484 } |
484 return error::kNoError; | 485 return error::kNoError; |
485 } | 486 } |
486 | 487 |
487 error::Error GLES2DecoderImpl::HandleCreateShader( | 488 error::Error GLES2DecoderImpl::HandleCreateShader( |
488 uint32 immediate_data_size, const gles2::CreateShader& c) { | 489 uint32 immediate_data_size, const gles2::cmds::CreateShader& c) { |
489 GLenum type = static_cast<GLenum>(c.type); | 490 GLenum type = static_cast<GLenum>(c.type); |
490 if (!validators_->shader_type.IsValid(type)) { | 491 if (!validators_->shader_type.IsValid(type)) { |
491 SetGLErrorInvalidEnum("glCreateShader", type, "type"); | 492 SetGLErrorInvalidEnum("glCreateShader", type, "type"); |
492 return error::kNoError; | 493 return error::kNoError; |
493 } | 494 } |
494 uint32 client_id = c.client_id; | 495 uint32 client_id = c.client_id; |
495 if (!CreateShaderHelper(type, client_id)) { | 496 if (!CreateShaderHelper(type, client_id)) { |
496 return error::kInvalidArguments; | 497 return error::kInvalidArguments; |
497 } | 498 } |
498 return error::kNoError; | 499 return error::kNoError; |
499 } | 500 } |
500 | 501 |
501 error::Error GLES2DecoderImpl::HandleCullFace( | 502 error::Error GLES2DecoderImpl::HandleCullFace( |
502 uint32 immediate_data_size, const gles2::CullFace& c) { | 503 uint32 immediate_data_size, const gles2::cmds::CullFace& c) { |
503 GLenum mode = static_cast<GLenum>(c.mode); | 504 GLenum mode = static_cast<GLenum>(c.mode); |
504 if (!validators_->face_type.IsValid(mode)) { | 505 if (!validators_->face_type.IsValid(mode)) { |
505 SetGLErrorInvalidEnum("glCullFace", mode, "mode"); | 506 SetGLErrorInvalidEnum("glCullFace", mode, "mode"); |
506 return error::kNoError; | 507 return error::kNoError; |
507 } | 508 } |
508 if (state_.cull_mode != mode) { | 509 if (state_.cull_mode != mode) { |
509 state_.cull_mode = mode; | 510 state_.cull_mode = mode; |
510 glCullFace(mode); | 511 glCullFace(mode); |
511 } | 512 } |
512 return error::kNoError; | 513 return error::kNoError; |
513 } | 514 } |
514 | 515 |
515 error::Error GLES2DecoderImpl::HandleDeleteBuffers( | 516 error::Error GLES2DecoderImpl::HandleDeleteBuffers( |
516 uint32 immediate_data_size, const gles2::DeleteBuffers& c) { | 517 uint32 immediate_data_size, const gles2::cmds::DeleteBuffers& c) { |
517 GLsizei n = static_cast<GLsizei>(c.n); | 518 GLsizei n = static_cast<GLsizei>(c.n); |
518 uint32 data_size; | 519 uint32 data_size; |
519 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 520 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
520 return error::kOutOfBounds; | 521 return error::kOutOfBounds; |
521 } | 522 } |
522 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( | 523 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( |
523 c.buffers_shm_id, c.buffers_shm_offset, data_size); | 524 c.buffers_shm_id, c.buffers_shm_offset, data_size); |
524 if (buffers == NULL) { | 525 if (buffers == NULL) { |
525 return error::kOutOfBounds; | 526 return error::kOutOfBounds; |
526 } | 527 } |
527 DeleteBuffersHelper(n, buffers); | 528 DeleteBuffersHelper(n, buffers); |
528 return error::kNoError; | 529 return error::kNoError; |
529 } | 530 } |
530 | 531 |
531 error::Error GLES2DecoderImpl::HandleDeleteBuffersImmediate( | 532 error::Error GLES2DecoderImpl::HandleDeleteBuffersImmediate( |
532 uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) { | 533 uint32 immediate_data_size, const gles2::cmds::DeleteBuffersImmediate& c) { |
533 GLsizei n = static_cast<GLsizei>(c.n); | 534 GLsizei n = static_cast<GLsizei>(c.n); |
534 uint32 data_size; | 535 uint32 data_size; |
535 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 536 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
536 return error::kOutOfBounds; | 537 return error::kOutOfBounds; |
537 } | 538 } |
538 const GLuint* buffers = GetImmediateDataAs<const GLuint*>( | 539 const GLuint* buffers = GetImmediateDataAs<const GLuint*>( |
539 c, data_size, immediate_data_size); | 540 c, data_size, immediate_data_size); |
540 if (buffers == NULL) { | 541 if (buffers == NULL) { |
541 return error::kOutOfBounds; | 542 return error::kOutOfBounds; |
542 } | 543 } |
543 DeleteBuffersHelper(n, buffers); | 544 DeleteBuffersHelper(n, buffers); |
544 return error::kNoError; | 545 return error::kNoError; |
545 } | 546 } |
546 | 547 |
547 error::Error GLES2DecoderImpl::HandleDeleteFramebuffers( | 548 error::Error GLES2DecoderImpl::HandleDeleteFramebuffers( |
548 uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) { | 549 uint32 immediate_data_size, const gles2::cmds::DeleteFramebuffers& c) { |
549 GLsizei n = static_cast<GLsizei>(c.n); | 550 GLsizei n = static_cast<GLsizei>(c.n); |
550 uint32 data_size; | 551 uint32 data_size; |
551 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 552 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
552 return error::kOutOfBounds; | 553 return error::kOutOfBounds; |
553 } | 554 } |
554 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( | 555 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( |
555 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); | 556 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); |
556 if (framebuffers == NULL) { | 557 if (framebuffers == NULL) { |
557 return error::kOutOfBounds; | 558 return error::kOutOfBounds; |
558 } | 559 } |
559 DeleteFramebuffersHelper(n, framebuffers); | 560 DeleteFramebuffersHelper(n, framebuffers); |
560 return error::kNoError; | 561 return error::kNoError; |
561 } | 562 } |
562 | 563 |
563 error::Error GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( | 564 error::Error GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( |
564 uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) { | 565 uint32 immediate_data_size, |
| 566 const gles2::cmds::DeleteFramebuffersImmediate& c) { |
565 GLsizei n = static_cast<GLsizei>(c.n); | 567 GLsizei n = static_cast<GLsizei>(c.n); |
566 uint32 data_size; | 568 uint32 data_size; |
567 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 569 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
568 return error::kOutOfBounds; | 570 return error::kOutOfBounds; |
569 } | 571 } |
570 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>( | 572 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>( |
571 c, data_size, immediate_data_size); | 573 c, data_size, immediate_data_size); |
572 if (framebuffers == NULL) { | 574 if (framebuffers == NULL) { |
573 return error::kOutOfBounds; | 575 return error::kOutOfBounds; |
574 } | 576 } |
575 DeleteFramebuffersHelper(n, framebuffers); | 577 DeleteFramebuffersHelper(n, framebuffers); |
576 return error::kNoError; | 578 return error::kNoError; |
577 } | 579 } |
578 | 580 |
579 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffers( | 581 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffers( |
580 uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) { | 582 uint32 immediate_data_size, const gles2::cmds::DeleteRenderbuffers& c) { |
581 GLsizei n = static_cast<GLsizei>(c.n); | 583 GLsizei n = static_cast<GLsizei>(c.n); |
582 uint32 data_size; | 584 uint32 data_size; |
583 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 585 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
584 return error::kOutOfBounds; | 586 return error::kOutOfBounds; |
585 } | 587 } |
586 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( | 588 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( |
587 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); | 589 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); |
588 if (renderbuffers == NULL) { | 590 if (renderbuffers == NULL) { |
589 return error::kOutOfBounds; | 591 return error::kOutOfBounds; |
590 } | 592 } |
591 DeleteRenderbuffersHelper(n, renderbuffers); | 593 DeleteRenderbuffersHelper(n, renderbuffers); |
592 return error::kNoError; | 594 return error::kNoError; |
593 } | 595 } |
594 | 596 |
595 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( | 597 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( |
596 uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) { | 598 uint32 immediate_data_size, |
| 599 const gles2::cmds::DeleteRenderbuffersImmediate& c) { |
597 GLsizei n = static_cast<GLsizei>(c.n); | 600 GLsizei n = static_cast<GLsizei>(c.n); |
598 uint32 data_size; | 601 uint32 data_size; |
599 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 602 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
600 return error::kOutOfBounds; | 603 return error::kOutOfBounds; |
601 } | 604 } |
602 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>( | 605 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>( |
603 c, data_size, immediate_data_size); | 606 c, data_size, immediate_data_size); |
604 if (renderbuffers == NULL) { | 607 if (renderbuffers == NULL) { |
605 return error::kOutOfBounds; | 608 return error::kOutOfBounds; |
606 } | 609 } |
607 DeleteRenderbuffersHelper(n, renderbuffers); | 610 DeleteRenderbuffersHelper(n, renderbuffers); |
608 return error::kNoError; | 611 return error::kNoError; |
609 } | 612 } |
610 | 613 |
611 error::Error GLES2DecoderImpl::HandleDeleteTextures( | 614 error::Error GLES2DecoderImpl::HandleDeleteTextures( |
612 uint32 immediate_data_size, const gles2::DeleteTextures& c) { | 615 uint32 immediate_data_size, const gles2::cmds::DeleteTextures& c) { |
613 GLsizei n = static_cast<GLsizei>(c.n); | 616 GLsizei n = static_cast<GLsizei>(c.n); |
614 uint32 data_size; | 617 uint32 data_size; |
615 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 618 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
616 return error::kOutOfBounds; | 619 return error::kOutOfBounds; |
617 } | 620 } |
618 const GLuint* textures = GetSharedMemoryAs<const GLuint*>( | 621 const GLuint* textures = GetSharedMemoryAs<const GLuint*>( |
619 c.textures_shm_id, c.textures_shm_offset, data_size); | 622 c.textures_shm_id, c.textures_shm_offset, data_size); |
620 if (textures == NULL) { | 623 if (textures == NULL) { |
621 return error::kOutOfBounds; | 624 return error::kOutOfBounds; |
622 } | 625 } |
623 DeleteTexturesHelper(n, textures); | 626 DeleteTexturesHelper(n, textures); |
624 return error::kNoError; | 627 return error::kNoError; |
625 } | 628 } |
626 | 629 |
627 error::Error GLES2DecoderImpl::HandleDeleteTexturesImmediate( | 630 error::Error GLES2DecoderImpl::HandleDeleteTexturesImmediate( |
628 uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) { | 631 uint32 immediate_data_size, |
| 632 const gles2::cmds::DeleteTexturesImmediate& c) { |
629 GLsizei n = static_cast<GLsizei>(c.n); | 633 GLsizei n = static_cast<GLsizei>(c.n); |
630 uint32 data_size; | 634 uint32 data_size; |
631 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 635 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
632 return error::kOutOfBounds; | 636 return error::kOutOfBounds; |
633 } | 637 } |
634 const GLuint* textures = GetImmediateDataAs<const GLuint*>( | 638 const GLuint* textures = GetImmediateDataAs<const GLuint*>( |
635 c, data_size, immediate_data_size); | 639 c, data_size, immediate_data_size); |
636 if (textures == NULL) { | 640 if (textures == NULL) { |
637 return error::kOutOfBounds; | 641 return error::kOutOfBounds; |
638 } | 642 } |
639 DeleteTexturesHelper(n, textures); | 643 DeleteTexturesHelper(n, textures); |
640 return error::kNoError; | 644 return error::kNoError; |
641 } | 645 } |
642 | 646 |
643 error::Error GLES2DecoderImpl::HandleDepthFunc( | 647 error::Error GLES2DecoderImpl::HandleDepthFunc( |
644 uint32 immediate_data_size, const gles2::DepthFunc& c) { | 648 uint32 immediate_data_size, const gles2::cmds::DepthFunc& c) { |
645 GLenum func = static_cast<GLenum>(c.func); | 649 GLenum func = static_cast<GLenum>(c.func); |
646 if (!validators_->cmp_function.IsValid(func)) { | 650 if (!validators_->cmp_function.IsValid(func)) { |
647 SetGLErrorInvalidEnum("glDepthFunc", func, "func"); | 651 SetGLErrorInvalidEnum("glDepthFunc", func, "func"); |
648 return error::kNoError; | 652 return error::kNoError; |
649 } | 653 } |
650 if (state_.depth_func != func) { | 654 if (state_.depth_func != func) { |
651 state_.depth_func = func; | 655 state_.depth_func = func; |
652 glDepthFunc(func); | 656 glDepthFunc(func); |
653 } | 657 } |
654 return error::kNoError; | 658 return error::kNoError; |
655 } | 659 } |
656 | 660 |
657 error::Error GLES2DecoderImpl::HandleDepthMask( | 661 error::Error GLES2DecoderImpl::HandleDepthMask( |
658 uint32 immediate_data_size, const gles2::DepthMask& c) { | 662 uint32 immediate_data_size, const gles2::cmds::DepthMask& c) { |
659 GLboolean flag = static_cast<GLboolean>(c.flag); | 663 GLboolean flag = static_cast<GLboolean>(c.flag); |
660 if (state_.depth_mask != flag) { | 664 if (state_.depth_mask != flag) { |
661 state_.depth_mask = flag; | 665 state_.depth_mask = flag; |
662 clear_state_dirty_ = true; | 666 clear_state_dirty_ = true; |
663 } | 667 } |
664 return error::kNoError; | 668 return error::kNoError; |
665 } | 669 } |
666 | 670 |
667 error::Error GLES2DecoderImpl::HandleDepthRangef( | 671 error::Error GLES2DecoderImpl::HandleDepthRangef( |
668 uint32 immediate_data_size, const gles2::DepthRangef& c) { | 672 uint32 immediate_data_size, const gles2::cmds::DepthRangef& c) { |
669 GLclampf zNear = static_cast<GLclampf>(c.zNear); | 673 GLclampf zNear = static_cast<GLclampf>(c.zNear); |
670 GLclampf zFar = static_cast<GLclampf>(c.zFar); | 674 GLclampf zFar = static_cast<GLclampf>(c.zFar); |
671 DoDepthRangef(zNear, zFar); | 675 DoDepthRangef(zNear, zFar); |
672 return error::kNoError; | 676 return error::kNoError; |
673 } | 677 } |
674 | 678 |
675 error::Error GLES2DecoderImpl::HandleDetachShader( | 679 error::Error GLES2DecoderImpl::HandleDetachShader( |
676 uint32 immediate_data_size, const gles2::DetachShader& c) { | 680 uint32 immediate_data_size, const gles2::cmds::DetachShader& c) { |
677 GLuint program = c.program; | 681 GLuint program = c.program; |
678 GLuint shader = c.shader; | 682 GLuint shader = c.shader; |
679 DoDetachShader(program, shader); | 683 DoDetachShader(program, shader); |
680 return error::kNoError; | 684 return error::kNoError; |
681 } | 685 } |
682 | 686 |
683 error::Error GLES2DecoderImpl::HandleDisable( | 687 error::Error GLES2DecoderImpl::HandleDisable( |
684 uint32 immediate_data_size, const gles2::Disable& c) { | 688 uint32 immediate_data_size, const gles2::cmds::Disable& c) { |
685 GLenum cap = static_cast<GLenum>(c.cap); | 689 GLenum cap = static_cast<GLenum>(c.cap); |
686 if (!validators_->capability.IsValid(cap)) { | 690 if (!validators_->capability.IsValid(cap)) { |
687 SetGLErrorInvalidEnum("glDisable", cap, "cap"); | 691 SetGLErrorInvalidEnum("glDisable", cap, "cap"); |
688 return error::kNoError; | 692 return error::kNoError; |
689 } | 693 } |
690 DoDisable(cap); | 694 DoDisable(cap); |
691 return error::kNoError; | 695 return error::kNoError; |
692 } | 696 } |
693 | 697 |
694 error::Error GLES2DecoderImpl::HandleDisableVertexAttribArray( | 698 error::Error GLES2DecoderImpl::HandleDisableVertexAttribArray( |
695 uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) { | 699 uint32 immediate_data_size, |
| 700 const gles2::cmds::DisableVertexAttribArray& c) { |
696 GLuint index = static_cast<GLuint>(c.index); | 701 GLuint index = static_cast<GLuint>(c.index); |
697 DoDisableVertexAttribArray(index); | 702 DoDisableVertexAttribArray(index); |
698 return error::kNoError; | 703 return error::kNoError; |
699 } | 704 } |
700 | 705 |
701 error::Error GLES2DecoderImpl::HandleEnable( | 706 error::Error GLES2DecoderImpl::HandleEnable( |
702 uint32 immediate_data_size, const gles2::Enable& c) { | 707 uint32 immediate_data_size, const gles2::cmds::Enable& c) { |
703 GLenum cap = static_cast<GLenum>(c.cap); | 708 GLenum cap = static_cast<GLenum>(c.cap); |
704 if (!validators_->capability.IsValid(cap)) { | 709 if (!validators_->capability.IsValid(cap)) { |
705 SetGLErrorInvalidEnum("glEnable", cap, "cap"); | 710 SetGLErrorInvalidEnum("glEnable", cap, "cap"); |
706 return error::kNoError; | 711 return error::kNoError; |
707 } | 712 } |
708 DoEnable(cap); | 713 DoEnable(cap); |
709 return error::kNoError; | 714 return error::kNoError; |
710 } | 715 } |
711 | 716 |
712 error::Error GLES2DecoderImpl::HandleEnableVertexAttribArray( | 717 error::Error GLES2DecoderImpl::HandleEnableVertexAttribArray( |
713 uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) { | 718 uint32 immediate_data_size, |
| 719 const gles2::cmds::EnableVertexAttribArray& c) { |
714 GLuint index = static_cast<GLuint>(c.index); | 720 GLuint index = static_cast<GLuint>(c.index); |
715 DoEnableVertexAttribArray(index); | 721 DoEnableVertexAttribArray(index); |
716 return error::kNoError; | 722 return error::kNoError; |
717 } | 723 } |
718 | 724 |
719 error::Error GLES2DecoderImpl::HandleFinish( | 725 error::Error GLES2DecoderImpl::HandleFinish( |
720 uint32 immediate_data_size, const gles2::Finish& c) { | 726 uint32 immediate_data_size, const gles2::cmds::Finish& c) { |
721 DoFinish(); | 727 DoFinish(); |
722 return error::kNoError; | 728 return error::kNoError; |
723 } | 729 } |
724 | 730 |
725 error::Error GLES2DecoderImpl::HandleFlush( | 731 error::Error GLES2DecoderImpl::HandleFlush( |
726 uint32 immediate_data_size, const gles2::Flush& c) { | 732 uint32 immediate_data_size, const gles2::cmds::Flush& c) { |
727 DoFlush(); | 733 DoFlush(); |
728 return error::kNoError; | 734 return error::kNoError; |
729 } | 735 } |
730 | 736 |
731 error::Error GLES2DecoderImpl::HandleFramebufferRenderbuffer( | 737 error::Error GLES2DecoderImpl::HandleFramebufferRenderbuffer( |
732 uint32 immediate_data_size, const gles2::FramebufferRenderbuffer& c) { | 738 uint32 immediate_data_size, |
| 739 const gles2::cmds::FramebufferRenderbuffer& c) { |
733 GLenum target = static_cast<GLenum>(c.target); | 740 GLenum target = static_cast<GLenum>(c.target); |
734 GLenum attachment = static_cast<GLenum>(c.attachment); | 741 GLenum attachment = static_cast<GLenum>(c.attachment); |
735 GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget); | 742 GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget); |
736 GLuint renderbuffer = c.renderbuffer; | 743 GLuint renderbuffer = c.renderbuffer; |
737 if (!validators_->frame_buffer_target.IsValid(target)) { | 744 if (!validators_->frame_buffer_target.IsValid(target)) { |
738 SetGLErrorInvalidEnum("glFramebufferRenderbuffer", target, "target"); | 745 SetGLErrorInvalidEnum("glFramebufferRenderbuffer", target, "target"); |
739 return error::kNoError; | 746 return error::kNoError; |
740 } | 747 } |
741 if (!validators_->attachment.IsValid(attachment)) { | 748 if (!validators_->attachment.IsValid(attachment)) { |
742 SetGLErrorInvalidEnum("glFramebufferRenderbuffer", attachment, | 749 SetGLErrorInvalidEnum("glFramebufferRenderbuffer", attachment, |
743 "attachment"); | 750 "attachment"); |
744 return error::kNoError; | 751 return error::kNoError; |
745 } | 752 } |
746 if (!validators_->render_buffer_target.IsValid(renderbuffertarget)) { | 753 if (!validators_->render_buffer_target.IsValid(renderbuffertarget)) { |
747 SetGLErrorInvalidEnum("glFramebufferRenderbuffer", renderbuffertarget, | 754 SetGLErrorInvalidEnum("glFramebufferRenderbuffer", renderbuffertarget, |
748 "renderbuffertarget"); | 755 "renderbuffertarget"); |
749 return error::kNoError; | 756 return error::kNoError; |
750 } | 757 } |
751 DoFramebufferRenderbuffer( | 758 DoFramebufferRenderbuffer( |
752 target, attachment, renderbuffertarget, renderbuffer); | 759 target, attachment, renderbuffertarget, renderbuffer); |
753 return error::kNoError; | 760 return error::kNoError; |
754 } | 761 } |
755 | 762 |
756 error::Error GLES2DecoderImpl::HandleFramebufferTexture2D( | 763 error::Error GLES2DecoderImpl::HandleFramebufferTexture2D( |
757 uint32 immediate_data_size, const gles2::FramebufferTexture2D& c) { | 764 uint32 immediate_data_size, const gles2::cmds::FramebufferTexture2D& c) { |
758 GLenum target = static_cast<GLenum>(c.target); | 765 GLenum target = static_cast<GLenum>(c.target); |
759 GLenum attachment = static_cast<GLenum>(c.attachment); | 766 GLenum attachment = static_cast<GLenum>(c.attachment); |
760 GLenum textarget = static_cast<GLenum>(c.textarget); | 767 GLenum textarget = static_cast<GLenum>(c.textarget); |
761 GLuint texture = c.texture; | 768 GLuint texture = c.texture; |
762 GLint level = static_cast<GLint>(c.level); | 769 GLint level = static_cast<GLint>(c.level); |
763 if (!validators_->frame_buffer_target.IsValid(target)) { | 770 if (!validators_->frame_buffer_target.IsValid(target)) { |
764 SetGLErrorInvalidEnum("glFramebufferTexture2D", target, "target"); | 771 SetGLErrorInvalidEnum("glFramebufferTexture2D", target, "target"); |
765 return error::kNoError; | 772 return error::kNoError; |
766 } | 773 } |
767 if (!validators_->attachment.IsValid(attachment)) { | 774 if (!validators_->attachment.IsValid(attachment)) { |
768 SetGLErrorInvalidEnum("glFramebufferTexture2D", attachment, "attachment"); | 775 SetGLErrorInvalidEnum("glFramebufferTexture2D", attachment, "attachment"); |
769 return error::kNoError; | 776 return error::kNoError; |
770 } | 777 } |
771 if (!validators_->texture_target.IsValid(textarget)) { | 778 if (!validators_->texture_target.IsValid(textarget)) { |
772 SetGLErrorInvalidEnum("glFramebufferTexture2D", textarget, "textarget"); | 779 SetGLErrorInvalidEnum("glFramebufferTexture2D", textarget, "textarget"); |
773 return error::kNoError; | 780 return error::kNoError; |
774 } | 781 } |
775 if (!validators_->zero_only.IsValid(level)) { | 782 if (!validators_->zero_only.IsValid(level)) { |
776 SetGLError( | 783 SetGLError( |
777 GL_INVALID_VALUE, "glFramebufferTexture2D", "level GL_INVALID_VALUE"); | 784 GL_INVALID_VALUE, "glFramebufferTexture2D", "level GL_INVALID_VALUE"); |
778 return error::kNoError; | 785 return error::kNoError; |
779 } | 786 } |
780 DoFramebufferTexture2D(target, attachment, textarget, texture, level); | 787 DoFramebufferTexture2D(target, attachment, textarget, texture, level); |
781 return error::kNoError; | 788 return error::kNoError; |
782 } | 789 } |
783 | 790 |
784 error::Error GLES2DecoderImpl::HandleFrontFace( | 791 error::Error GLES2DecoderImpl::HandleFrontFace( |
785 uint32 immediate_data_size, const gles2::FrontFace& c) { | 792 uint32 immediate_data_size, const gles2::cmds::FrontFace& c) { |
786 GLenum mode = static_cast<GLenum>(c.mode); | 793 GLenum mode = static_cast<GLenum>(c.mode); |
787 if (!validators_->face_mode.IsValid(mode)) { | 794 if (!validators_->face_mode.IsValid(mode)) { |
788 SetGLErrorInvalidEnum("glFrontFace", mode, "mode"); | 795 SetGLErrorInvalidEnum("glFrontFace", mode, "mode"); |
789 return error::kNoError; | 796 return error::kNoError; |
790 } | 797 } |
791 if (state_.front_face != mode) { | 798 if (state_.front_face != mode) { |
792 state_.front_face = mode; | 799 state_.front_face = mode; |
793 glFrontFace(mode); | 800 glFrontFace(mode); |
794 } | 801 } |
795 return error::kNoError; | 802 return error::kNoError; |
796 } | 803 } |
797 | 804 |
798 error::Error GLES2DecoderImpl::HandleGenBuffers( | 805 error::Error GLES2DecoderImpl::HandleGenBuffers( |
799 uint32 immediate_data_size, const gles2::GenBuffers& c) { | 806 uint32 immediate_data_size, const gles2::cmds::GenBuffers& c) { |
800 GLsizei n = static_cast<GLsizei>(c.n); | 807 GLsizei n = static_cast<GLsizei>(c.n); |
801 uint32 data_size; | 808 uint32 data_size; |
802 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 809 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
803 return error::kOutOfBounds; | 810 return error::kOutOfBounds; |
804 } | 811 } |
805 GLuint* buffers = GetSharedMemoryAs<GLuint*>( | 812 GLuint* buffers = GetSharedMemoryAs<GLuint*>( |
806 c.buffers_shm_id, c.buffers_shm_offset, data_size); | 813 c.buffers_shm_id, c.buffers_shm_offset, data_size); |
807 if (buffers == NULL) { | 814 if (buffers == NULL) { |
808 return error::kOutOfBounds; | 815 return error::kOutOfBounds; |
809 } | 816 } |
810 if (!GenBuffersHelper(n, buffers)) { | 817 if (!GenBuffersHelper(n, buffers)) { |
811 return error::kInvalidArguments; | 818 return error::kInvalidArguments; |
812 } | 819 } |
813 return error::kNoError; | 820 return error::kNoError; |
814 } | 821 } |
815 | 822 |
816 error::Error GLES2DecoderImpl::HandleGenBuffersImmediate( | 823 error::Error GLES2DecoderImpl::HandleGenBuffersImmediate( |
817 uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) { | 824 uint32 immediate_data_size, const gles2::cmds::GenBuffersImmediate& c) { |
818 GLsizei n = static_cast<GLsizei>(c.n); | 825 GLsizei n = static_cast<GLsizei>(c.n); |
819 uint32 data_size; | 826 uint32 data_size; |
820 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 827 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
821 return error::kOutOfBounds; | 828 return error::kOutOfBounds; |
822 } | 829 } |
823 GLuint* buffers = GetImmediateDataAs<GLuint*>( | 830 GLuint* buffers = GetImmediateDataAs<GLuint*>( |
824 c, data_size, immediate_data_size); | 831 c, data_size, immediate_data_size); |
825 if (buffers == NULL) { | 832 if (buffers == NULL) { |
826 return error::kOutOfBounds; | 833 return error::kOutOfBounds; |
827 } | 834 } |
828 if (!GenBuffersHelper(n, buffers)) { | 835 if (!GenBuffersHelper(n, buffers)) { |
829 return error::kInvalidArguments; | 836 return error::kInvalidArguments; |
830 } | 837 } |
831 return error::kNoError; | 838 return error::kNoError; |
832 } | 839 } |
833 | 840 |
834 error::Error GLES2DecoderImpl::HandleGenerateMipmap( | 841 error::Error GLES2DecoderImpl::HandleGenerateMipmap( |
835 uint32 immediate_data_size, const gles2::GenerateMipmap& c) { | 842 uint32 immediate_data_size, const gles2::cmds::GenerateMipmap& c) { |
836 GLenum target = static_cast<GLenum>(c.target); | 843 GLenum target = static_cast<GLenum>(c.target); |
837 if (!validators_->texture_bind_target.IsValid(target)) { | 844 if (!validators_->texture_bind_target.IsValid(target)) { |
838 SetGLErrorInvalidEnum("glGenerateMipmap", target, "target"); | 845 SetGLErrorInvalidEnum("glGenerateMipmap", target, "target"); |
839 return error::kNoError; | 846 return error::kNoError; |
840 } | 847 } |
841 DoGenerateMipmap(target); | 848 DoGenerateMipmap(target); |
842 return error::kNoError; | 849 return error::kNoError; |
843 } | 850 } |
844 | 851 |
845 error::Error GLES2DecoderImpl::HandleGenFramebuffers( | 852 error::Error GLES2DecoderImpl::HandleGenFramebuffers( |
846 uint32 immediate_data_size, const gles2::GenFramebuffers& c) { | 853 uint32 immediate_data_size, const gles2::cmds::GenFramebuffers& c) { |
847 GLsizei n = static_cast<GLsizei>(c.n); | 854 GLsizei n = static_cast<GLsizei>(c.n); |
848 uint32 data_size; | 855 uint32 data_size; |
849 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 856 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
850 return error::kOutOfBounds; | 857 return error::kOutOfBounds; |
851 } | 858 } |
852 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( | 859 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( |
853 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); | 860 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); |
854 if (framebuffers == NULL) { | 861 if (framebuffers == NULL) { |
855 return error::kOutOfBounds; | 862 return error::kOutOfBounds; |
856 } | 863 } |
857 if (!GenFramebuffersHelper(n, framebuffers)) { | 864 if (!GenFramebuffersHelper(n, framebuffers)) { |
858 return error::kInvalidArguments; | 865 return error::kInvalidArguments; |
859 } | 866 } |
860 return error::kNoError; | 867 return error::kNoError; |
861 } | 868 } |
862 | 869 |
863 error::Error GLES2DecoderImpl::HandleGenFramebuffersImmediate( | 870 error::Error GLES2DecoderImpl::HandleGenFramebuffersImmediate( |
864 uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) { | 871 uint32 immediate_data_size, |
| 872 const gles2::cmds::GenFramebuffersImmediate& c) { |
865 GLsizei n = static_cast<GLsizei>(c.n); | 873 GLsizei n = static_cast<GLsizei>(c.n); |
866 uint32 data_size; | 874 uint32 data_size; |
867 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 875 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
868 return error::kOutOfBounds; | 876 return error::kOutOfBounds; |
869 } | 877 } |
870 GLuint* framebuffers = GetImmediateDataAs<GLuint*>( | 878 GLuint* framebuffers = GetImmediateDataAs<GLuint*>( |
871 c, data_size, immediate_data_size); | 879 c, data_size, immediate_data_size); |
872 if (framebuffers == NULL) { | 880 if (framebuffers == NULL) { |
873 return error::kOutOfBounds; | 881 return error::kOutOfBounds; |
874 } | 882 } |
875 if (!GenFramebuffersHelper(n, framebuffers)) { | 883 if (!GenFramebuffersHelper(n, framebuffers)) { |
876 return error::kInvalidArguments; | 884 return error::kInvalidArguments; |
877 } | 885 } |
878 return error::kNoError; | 886 return error::kNoError; |
879 } | 887 } |
880 | 888 |
881 error::Error GLES2DecoderImpl::HandleGenRenderbuffers( | 889 error::Error GLES2DecoderImpl::HandleGenRenderbuffers( |
882 uint32 immediate_data_size, const gles2::GenRenderbuffers& c) { | 890 uint32 immediate_data_size, const gles2::cmds::GenRenderbuffers& c) { |
883 GLsizei n = static_cast<GLsizei>(c.n); | 891 GLsizei n = static_cast<GLsizei>(c.n); |
884 uint32 data_size; | 892 uint32 data_size; |
885 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 893 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
886 return error::kOutOfBounds; | 894 return error::kOutOfBounds; |
887 } | 895 } |
888 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( | 896 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( |
889 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); | 897 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); |
890 if (renderbuffers == NULL) { | 898 if (renderbuffers == NULL) { |
891 return error::kOutOfBounds; | 899 return error::kOutOfBounds; |
892 } | 900 } |
893 if (!GenRenderbuffersHelper(n, renderbuffers)) { | 901 if (!GenRenderbuffersHelper(n, renderbuffers)) { |
894 return error::kInvalidArguments; | 902 return error::kInvalidArguments; |
895 } | 903 } |
896 return error::kNoError; | 904 return error::kNoError; |
897 } | 905 } |
898 | 906 |
899 error::Error GLES2DecoderImpl::HandleGenRenderbuffersImmediate( | 907 error::Error GLES2DecoderImpl::HandleGenRenderbuffersImmediate( |
900 uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) { | 908 uint32 immediate_data_size, |
| 909 const gles2::cmds::GenRenderbuffersImmediate& c) { |
901 GLsizei n = static_cast<GLsizei>(c.n); | 910 GLsizei n = static_cast<GLsizei>(c.n); |
902 uint32 data_size; | 911 uint32 data_size; |
903 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 912 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
904 return error::kOutOfBounds; | 913 return error::kOutOfBounds; |
905 } | 914 } |
906 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>( | 915 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>( |
907 c, data_size, immediate_data_size); | 916 c, data_size, immediate_data_size); |
908 if (renderbuffers == NULL) { | 917 if (renderbuffers == NULL) { |
909 return error::kOutOfBounds; | 918 return error::kOutOfBounds; |
910 } | 919 } |
911 if (!GenRenderbuffersHelper(n, renderbuffers)) { | 920 if (!GenRenderbuffersHelper(n, renderbuffers)) { |
912 return error::kInvalidArguments; | 921 return error::kInvalidArguments; |
913 } | 922 } |
914 return error::kNoError; | 923 return error::kNoError; |
915 } | 924 } |
916 | 925 |
917 error::Error GLES2DecoderImpl::HandleGenTextures( | 926 error::Error GLES2DecoderImpl::HandleGenTextures( |
918 uint32 immediate_data_size, const gles2::GenTextures& c) { | 927 uint32 immediate_data_size, const gles2::cmds::GenTextures& c) { |
919 GLsizei n = static_cast<GLsizei>(c.n); | 928 GLsizei n = static_cast<GLsizei>(c.n); |
920 uint32 data_size; | 929 uint32 data_size; |
921 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 930 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
922 return error::kOutOfBounds; | 931 return error::kOutOfBounds; |
923 } | 932 } |
924 GLuint* textures = GetSharedMemoryAs<GLuint*>( | 933 GLuint* textures = GetSharedMemoryAs<GLuint*>( |
925 c.textures_shm_id, c.textures_shm_offset, data_size); | 934 c.textures_shm_id, c.textures_shm_offset, data_size); |
926 if (textures == NULL) { | 935 if (textures == NULL) { |
927 return error::kOutOfBounds; | 936 return error::kOutOfBounds; |
928 } | 937 } |
929 if (!GenTexturesHelper(n, textures)) { | 938 if (!GenTexturesHelper(n, textures)) { |
930 return error::kInvalidArguments; | 939 return error::kInvalidArguments; |
931 } | 940 } |
932 return error::kNoError; | 941 return error::kNoError; |
933 } | 942 } |
934 | 943 |
935 error::Error GLES2DecoderImpl::HandleGenTexturesImmediate( | 944 error::Error GLES2DecoderImpl::HandleGenTexturesImmediate( |
936 uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) { | 945 uint32 immediate_data_size, const gles2::cmds::GenTexturesImmediate& c) { |
937 GLsizei n = static_cast<GLsizei>(c.n); | 946 GLsizei n = static_cast<GLsizei>(c.n); |
938 uint32 data_size; | 947 uint32 data_size; |
939 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 948 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
940 return error::kOutOfBounds; | 949 return error::kOutOfBounds; |
941 } | 950 } |
942 GLuint* textures = GetImmediateDataAs<GLuint*>( | 951 GLuint* textures = GetImmediateDataAs<GLuint*>( |
943 c, data_size, immediate_data_size); | 952 c, data_size, immediate_data_size); |
944 if (textures == NULL) { | 953 if (textures == NULL) { |
945 return error::kOutOfBounds; | 954 return error::kOutOfBounds; |
946 } | 955 } |
947 if (!GenTexturesHelper(n, textures)) { | 956 if (!GenTexturesHelper(n, textures)) { |
948 return error::kInvalidArguments; | 957 return error::kInvalidArguments; |
949 } | 958 } |
950 return error::kNoError; | 959 return error::kNoError; |
951 } | 960 } |
952 | 961 |
953 error::Error GLES2DecoderImpl::HandleGetBooleanv( | 962 error::Error GLES2DecoderImpl::HandleGetBooleanv( |
954 uint32 immediate_data_size, const gles2::GetBooleanv& c) { | 963 uint32 immediate_data_size, const gles2::cmds::GetBooleanv& c) { |
955 GLenum pname = static_cast<GLenum>(c.pname); | 964 GLenum pname = static_cast<GLenum>(c.pname); |
956 typedef GetBooleanv::Result Result; | 965 typedef cmds::GetBooleanv::Result Result; |
957 GLsizei num_values = 0; | 966 GLsizei num_values = 0; |
958 GetNumValuesReturnedForGLGet(pname, &num_values); | 967 GetNumValuesReturnedForGLGet(pname, &num_values); |
959 Result* result = GetSharedMemoryAs<Result*>( | 968 Result* result = GetSharedMemoryAs<Result*>( |
960 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 969 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
961 GLboolean* params = result ? result->GetData() : NULL; | 970 GLboolean* params = result ? result->GetData() : NULL; |
962 if (!validators_->g_l_state.IsValid(pname)) { | 971 if (!validators_->g_l_state.IsValid(pname)) { |
963 SetGLErrorInvalidEnum("glGetBooleanv", pname, "pname"); | 972 SetGLErrorInvalidEnum("glGetBooleanv", pname, "pname"); |
964 return error::kNoError; | 973 return error::kNoError; |
965 } | 974 } |
966 if (params == NULL) { | 975 if (params == NULL) { |
967 return error::kOutOfBounds; | 976 return error::kOutOfBounds; |
968 } | 977 } |
969 // Check that the client initialized the result. | 978 // Check that the client initialized the result. |
970 if (result->size != 0) { | 979 if (result->size != 0) { |
971 return error::kInvalidArguments; | 980 return error::kInvalidArguments; |
972 } | 981 } |
973 CopyRealGLErrorsToWrapper(); | 982 CopyRealGLErrorsToWrapper(); |
974 DoGetBooleanv(pname, params); | 983 DoGetBooleanv(pname, params); |
975 GLenum error = glGetError(); | 984 GLenum error = glGetError(); |
976 if (error == GL_NO_ERROR) { | 985 if (error == GL_NO_ERROR) { |
977 result->SetNumResults(num_values); | 986 result->SetNumResults(num_values); |
978 } else { | 987 } else { |
979 SetGLError(error, "", ""); | 988 SetGLError(error, "", ""); |
980 } | 989 } |
981 return error::kNoError; | 990 return error::kNoError; |
982 } | 991 } |
983 | 992 |
984 error::Error GLES2DecoderImpl::HandleGetBufferParameteriv( | 993 error::Error GLES2DecoderImpl::HandleGetBufferParameteriv( |
985 uint32 immediate_data_size, const gles2::GetBufferParameteriv& c) { | 994 uint32 immediate_data_size, const gles2::cmds::GetBufferParameteriv& c) { |
986 GLenum target = static_cast<GLenum>(c.target); | 995 GLenum target = static_cast<GLenum>(c.target); |
987 GLenum pname = static_cast<GLenum>(c.pname); | 996 GLenum pname = static_cast<GLenum>(c.pname); |
988 typedef GetBufferParameteriv::Result Result; | 997 typedef cmds::GetBufferParameteriv::Result Result; |
989 GLsizei num_values = 0; | 998 GLsizei num_values = 0; |
990 GetNumValuesReturnedForGLGet(pname, &num_values); | 999 GetNumValuesReturnedForGLGet(pname, &num_values); |
991 Result* result = GetSharedMemoryAs<Result*>( | 1000 Result* result = GetSharedMemoryAs<Result*>( |
992 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1001 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
993 GLint* params = result ? result->GetData() : NULL; | 1002 GLint* params = result ? result->GetData() : NULL; |
994 if (!validators_->buffer_target.IsValid(target)) { | 1003 if (!validators_->buffer_target.IsValid(target)) { |
995 SetGLErrorInvalidEnum("glGetBufferParameteriv", target, "target"); | 1004 SetGLErrorInvalidEnum("glGetBufferParameteriv", target, "target"); |
996 return error::kNoError; | 1005 return error::kNoError; |
997 } | 1006 } |
998 if (!validators_->buffer_parameter.IsValid(pname)) { | 1007 if (!validators_->buffer_parameter.IsValid(pname)) { |
(...skipping 12 matching lines...) Expand all Loading... |
1011 GLenum error = glGetError(); | 1020 GLenum error = glGetError(); |
1012 if (error == GL_NO_ERROR) { | 1021 if (error == GL_NO_ERROR) { |
1013 result->SetNumResults(num_values); | 1022 result->SetNumResults(num_values); |
1014 } else { | 1023 } else { |
1015 SetGLError(error, "", ""); | 1024 SetGLError(error, "", ""); |
1016 } | 1025 } |
1017 return error::kNoError; | 1026 return error::kNoError; |
1018 } | 1027 } |
1019 | 1028 |
1020 error::Error GLES2DecoderImpl::HandleGetError( | 1029 error::Error GLES2DecoderImpl::HandleGetError( |
1021 uint32 immediate_data_size, const gles2::GetError& c) { | 1030 uint32 immediate_data_size, const gles2::cmds::GetError& c) { |
1022 typedef GetError::Result Result; | 1031 typedef cmds::GetError::Result Result; |
1023 Result* result_dst = GetSharedMemoryAs<Result*>( | 1032 Result* result_dst = GetSharedMemoryAs<Result*>( |
1024 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1033 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1025 if (!result_dst) { | 1034 if (!result_dst) { |
1026 return error::kOutOfBounds; | 1035 return error::kOutOfBounds; |
1027 } | 1036 } |
1028 *result_dst = GetGLError(); | 1037 *result_dst = GetGLError(); |
1029 return error::kNoError; | 1038 return error::kNoError; |
1030 } | 1039 } |
1031 | 1040 |
1032 error::Error GLES2DecoderImpl::HandleGetFloatv( | 1041 error::Error GLES2DecoderImpl::HandleGetFloatv( |
1033 uint32 immediate_data_size, const gles2::GetFloatv& c) { | 1042 uint32 immediate_data_size, const gles2::cmds::GetFloatv& c) { |
1034 GLenum pname = static_cast<GLenum>(c.pname); | 1043 GLenum pname = static_cast<GLenum>(c.pname); |
1035 typedef GetFloatv::Result Result; | 1044 typedef cmds::GetFloatv::Result Result; |
1036 GLsizei num_values = 0; | 1045 GLsizei num_values = 0; |
1037 GetNumValuesReturnedForGLGet(pname, &num_values); | 1046 GetNumValuesReturnedForGLGet(pname, &num_values); |
1038 Result* result = GetSharedMemoryAs<Result*>( | 1047 Result* result = GetSharedMemoryAs<Result*>( |
1039 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1048 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1040 GLfloat* params = result ? result->GetData() : NULL; | 1049 GLfloat* params = result ? result->GetData() : NULL; |
1041 if (!validators_->g_l_state.IsValid(pname)) { | 1050 if (!validators_->g_l_state.IsValid(pname)) { |
1042 SetGLErrorInvalidEnum("glGetFloatv", pname, "pname"); | 1051 SetGLErrorInvalidEnum("glGetFloatv", pname, "pname"); |
1043 return error::kNoError; | 1052 return error::kNoError; |
1044 } | 1053 } |
1045 if (params == NULL) { | 1054 if (params == NULL) { |
1046 return error::kOutOfBounds; | 1055 return error::kOutOfBounds; |
1047 } | 1056 } |
1048 // Check that the client initialized the result. | 1057 // Check that the client initialized the result. |
1049 if (result->size != 0) { | 1058 if (result->size != 0) { |
1050 return error::kInvalidArguments; | 1059 return error::kInvalidArguments; |
1051 } | 1060 } |
1052 CopyRealGLErrorsToWrapper(); | 1061 CopyRealGLErrorsToWrapper(); |
1053 DoGetFloatv(pname, params); | 1062 DoGetFloatv(pname, params); |
1054 GLenum error = glGetError(); | 1063 GLenum error = glGetError(); |
1055 if (error == GL_NO_ERROR) { | 1064 if (error == GL_NO_ERROR) { |
1056 result->SetNumResults(num_values); | 1065 result->SetNumResults(num_values); |
1057 } else { | 1066 } else { |
1058 SetGLError(error, "", ""); | 1067 SetGLError(error, "", ""); |
1059 } | 1068 } |
1060 return error::kNoError; | 1069 return error::kNoError; |
1061 } | 1070 } |
1062 | 1071 |
1063 error::Error GLES2DecoderImpl::HandleGetFramebufferAttachmentParameteriv( | 1072 error::Error GLES2DecoderImpl::HandleGetFramebufferAttachmentParameteriv( |
1064 uint32 immediate_data_size, | 1073 uint32 immediate_data_size, |
1065 const gles2::GetFramebufferAttachmentParameteriv& c) { | 1074 const gles2::cmds::GetFramebufferAttachmentParameteriv& c) { |
1066 GLenum target = static_cast<GLenum>(c.target); | 1075 GLenum target = static_cast<GLenum>(c.target); |
1067 GLenum attachment = static_cast<GLenum>(c.attachment); | 1076 GLenum attachment = static_cast<GLenum>(c.attachment); |
1068 GLenum pname = static_cast<GLenum>(c.pname); | 1077 GLenum pname = static_cast<GLenum>(c.pname); |
1069 typedef GetFramebufferAttachmentParameteriv::Result Result; | 1078 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result; |
1070 GLsizei num_values = 0; | 1079 GLsizei num_values = 0; |
1071 GetNumValuesReturnedForGLGet(pname, &num_values); | 1080 GetNumValuesReturnedForGLGet(pname, &num_values); |
1072 Result* result = GetSharedMemoryAs<Result*>( | 1081 Result* result = GetSharedMemoryAs<Result*>( |
1073 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1082 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1074 GLint* params = result ? result->GetData() : NULL; | 1083 GLint* params = result ? result->GetData() : NULL; |
1075 if (!validators_->frame_buffer_target.IsValid(target)) { | 1084 if (!validators_->frame_buffer_target.IsValid(target)) { |
1076 SetGLErrorInvalidEnum("glGetFramebufferAttachmentParameteriv", target, | 1085 SetGLErrorInvalidEnum("glGetFramebufferAttachmentParameteriv", target, |
1077 "target"); | 1086 "target"); |
1078 return error::kNoError; | 1087 return error::kNoError; |
1079 } | 1088 } |
(...skipping 19 matching lines...) Expand all Loading... |
1099 GLenum error = glGetError(); | 1108 GLenum error = glGetError(); |
1100 if (error == GL_NO_ERROR) { | 1109 if (error == GL_NO_ERROR) { |
1101 result->SetNumResults(num_values); | 1110 result->SetNumResults(num_values); |
1102 } else { | 1111 } else { |
1103 SetGLError(error, "", ""); | 1112 SetGLError(error, "", ""); |
1104 } | 1113 } |
1105 return error::kNoError; | 1114 return error::kNoError; |
1106 } | 1115 } |
1107 | 1116 |
1108 error::Error GLES2DecoderImpl::HandleGetIntegerv( | 1117 error::Error GLES2DecoderImpl::HandleGetIntegerv( |
1109 uint32 immediate_data_size, const gles2::GetIntegerv& c) { | 1118 uint32 immediate_data_size, const gles2::cmds::GetIntegerv& c) { |
1110 GLenum pname = static_cast<GLenum>(c.pname); | 1119 GLenum pname = static_cast<GLenum>(c.pname); |
1111 typedef GetIntegerv::Result Result; | 1120 typedef cmds::GetIntegerv::Result Result; |
1112 GLsizei num_values = 0; | 1121 GLsizei num_values = 0; |
1113 GetNumValuesReturnedForGLGet(pname, &num_values); | 1122 GetNumValuesReturnedForGLGet(pname, &num_values); |
1114 Result* result = GetSharedMemoryAs<Result*>( | 1123 Result* result = GetSharedMemoryAs<Result*>( |
1115 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1124 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1116 GLint* params = result ? result->GetData() : NULL; | 1125 GLint* params = result ? result->GetData() : NULL; |
1117 if (!validators_->g_l_state.IsValid(pname)) { | 1126 if (!validators_->g_l_state.IsValid(pname)) { |
1118 SetGLErrorInvalidEnum("glGetIntegerv", pname, "pname"); | 1127 SetGLErrorInvalidEnum("glGetIntegerv", pname, "pname"); |
1119 return error::kNoError; | 1128 return error::kNoError; |
1120 } | 1129 } |
1121 if (params == NULL) { | 1130 if (params == NULL) { |
1122 return error::kOutOfBounds; | 1131 return error::kOutOfBounds; |
1123 } | 1132 } |
1124 // Check that the client initialized the result. | 1133 // Check that the client initialized the result. |
1125 if (result->size != 0) { | 1134 if (result->size != 0) { |
1126 return error::kInvalidArguments; | 1135 return error::kInvalidArguments; |
1127 } | 1136 } |
1128 CopyRealGLErrorsToWrapper(); | 1137 CopyRealGLErrorsToWrapper(); |
1129 DoGetIntegerv(pname, params); | 1138 DoGetIntegerv(pname, params); |
1130 GLenum error = glGetError(); | 1139 GLenum error = glGetError(); |
1131 if (error == GL_NO_ERROR) { | 1140 if (error == GL_NO_ERROR) { |
1132 result->SetNumResults(num_values); | 1141 result->SetNumResults(num_values); |
1133 } else { | 1142 } else { |
1134 SetGLError(error, "", ""); | 1143 SetGLError(error, "", ""); |
1135 } | 1144 } |
1136 return error::kNoError; | 1145 return error::kNoError; |
1137 } | 1146 } |
1138 | 1147 |
1139 error::Error GLES2DecoderImpl::HandleGetProgramiv( | 1148 error::Error GLES2DecoderImpl::HandleGetProgramiv( |
1140 uint32 immediate_data_size, const gles2::GetProgramiv& c) { | 1149 uint32 immediate_data_size, const gles2::cmds::GetProgramiv& c) { |
1141 GLuint program = c.program; | 1150 GLuint program = c.program; |
1142 GLenum pname = static_cast<GLenum>(c.pname); | 1151 GLenum pname = static_cast<GLenum>(c.pname); |
1143 typedef GetProgramiv::Result Result; | 1152 typedef cmds::GetProgramiv::Result Result; |
1144 GLsizei num_values = 0; | 1153 GLsizei num_values = 0; |
1145 GetNumValuesReturnedForGLGet(pname, &num_values); | 1154 GetNumValuesReturnedForGLGet(pname, &num_values); |
1146 Result* result = GetSharedMemoryAs<Result*>( | 1155 Result* result = GetSharedMemoryAs<Result*>( |
1147 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1156 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1148 GLint* params = result ? result->GetData() : NULL; | 1157 GLint* params = result ? result->GetData() : NULL; |
1149 if (!validators_->program_parameter.IsValid(pname)) { | 1158 if (!validators_->program_parameter.IsValid(pname)) { |
1150 SetGLErrorInvalidEnum("glGetProgramiv", pname, "pname"); | 1159 SetGLErrorInvalidEnum("glGetProgramiv", pname, "pname"); |
1151 return error::kNoError; | 1160 return error::kNoError; |
1152 } | 1161 } |
1153 if (params == NULL) { | 1162 if (params == NULL) { |
1154 return error::kOutOfBounds; | 1163 return error::kOutOfBounds; |
1155 } | 1164 } |
1156 // Check that the client initialized the result. | 1165 // Check that the client initialized the result. |
1157 if (result->size != 0) { | 1166 if (result->size != 0) { |
1158 return error::kInvalidArguments; | 1167 return error::kInvalidArguments; |
1159 } | 1168 } |
1160 CopyRealGLErrorsToWrapper(); | 1169 CopyRealGLErrorsToWrapper(); |
1161 DoGetProgramiv(program, pname, params); | 1170 DoGetProgramiv(program, pname, params); |
1162 GLenum error = glGetError(); | 1171 GLenum error = glGetError(); |
1163 if (error == GL_NO_ERROR) { | 1172 if (error == GL_NO_ERROR) { |
1164 result->SetNumResults(num_values); | 1173 result->SetNumResults(num_values); |
1165 } else { | 1174 } else { |
1166 SetGLError(error, "", ""); | 1175 SetGLError(error, "", ""); |
1167 } | 1176 } |
1168 return error::kNoError; | 1177 return error::kNoError; |
1169 } | 1178 } |
1170 | 1179 |
1171 error::Error GLES2DecoderImpl::HandleGetRenderbufferParameteriv( | 1180 error::Error GLES2DecoderImpl::HandleGetRenderbufferParameteriv( |
1172 uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) { | 1181 uint32 immediate_data_size, |
| 1182 const gles2::cmds::GetRenderbufferParameteriv& c) { |
1173 GLenum target = static_cast<GLenum>(c.target); | 1183 GLenum target = static_cast<GLenum>(c.target); |
1174 GLenum pname = static_cast<GLenum>(c.pname); | 1184 GLenum pname = static_cast<GLenum>(c.pname); |
1175 typedef GetRenderbufferParameteriv::Result Result; | 1185 typedef cmds::GetRenderbufferParameteriv::Result Result; |
1176 GLsizei num_values = 0; | 1186 GLsizei num_values = 0; |
1177 GetNumValuesReturnedForGLGet(pname, &num_values); | 1187 GetNumValuesReturnedForGLGet(pname, &num_values); |
1178 Result* result = GetSharedMemoryAs<Result*>( | 1188 Result* result = GetSharedMemoryAs<Result*>( |
1179 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1189 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1180 GLint* params = result ? result->GetData() : NULL; | 1190 GLint* params = result ? result->GetData() : NULL; |
1181 if (!validators_->render_buffer_target.IsValid(target)) { | 1191 if (!validators_->render_buffer_target.IsValid(target)) { |
1182 SetGLErrorInvalidEnum("glGetRenderbufferParameteriv", target, "target"); | 1192 SetGLErrorInvalidEnum("glGetRenderbufferParameteriv", target, "target"); |
1183 return error::kNoError; | 1193 return error::kNoError; |
1184 } | 1194 } |
1185 if (!validators_->render_buffer_parameter.IsValid(pname)) { | 1195 if (!validators_->render_buffer_parameter.IsValid(pname)) { |
(...skipping 12 matching lines...) Expand all Loading... |
1198 GLenum error = glGetError(); | 1208 GLenum error = glGetError(); |
1199 if (error == GL_NO_ERROR) { | 1209 if (error == GL_NO_ERROR) { |
1200 result->SetNumResults(num_values); | 1210 result->SetNumResults(num_values); |
1201 } else { | 1211 } else { |
1202 SetGLError(error, "", ""); | 1212 SetGLError(error, "", ""); |
1203 } | 1213 } |
1204 return error::kNoError; | 1214 return error::kNoError; |
1205 } | 1215 } |
1206 | 1216 |
1207 error::Error GLES2DecoderImpl::HandleGetShaderiv( | 1217 error::Error GLES2DecoderImpl::HandleGetShaderiv( |
1208 uint32 immediate_data_size, const gles2::GetShaderiv& c) { | 1218 uint32 immediate_data_size, const gles2::cmds::GetShaderiv& c) { |
1209 GLuint shader = c.shader; | 1219 GLuint shader = c.shader; |
1210 GLenum pname = static_cast<GLenum>(c.pname); | 1220 GLenum pname = static_cast<GLenum>(c.pname); |
1211 typedef GetShaderiv::Result Result; | 1221 typedef cmds::GetShaderiv::Result Result; |
1212 GLsizei num_values = 0; | 1222 GLsizei num_values = 0; |
1213 GetNumValuesReturnedForGLGet(pname, &num_values); | 1223 GetNumValuesReturnedForGLGet(pname, &num_values); |
1214 Result* result = GetSharedMemoryAs<Result*>( | 1224 Result* result = GetSharedMemoryAs<Result*>( |
1215 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1225 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1216 GLint* params = result ? result->GetData() : NULL; | 1226 GLint* params = result ? result->GetData() : NULL; |
1217 if (!validators_->shader_parameter.IsValid(pname)) { | 1227 if (!validators_->shader_parameter.IsValid(pname)) { |
1218 SetGLErrorInvalidEnum("glGetShaderiv", pname, "pname"); | 1228 SetGLErrorInvalidEnum("glGetShaderiv", pname, "pname"); |
1219 return error::kNoError; | 1229 return error::kNoError; |
1220 } | 1230 } |
1221 if (params == NULL) { | 1231 if (params == NULL) { |
1222 return error::kOutOfBounds; | 1232 return error::kOutOfBounds; |
1223 } | 1233 } |
1224 // Check that the client initialized the result. | 1234 // Check that the client initialized the result. |
1225 if (result->size != 0) { | 1235 if (result->size != 0) { |
1226 return error::kInvalidArguments; | 1236 return error::kInvalidArguments; |
1227 } | 1237 } |
1228 CopyRealGLErrorsToWrapper(); | 1238 CopyRealGLErrorsToWrapper(); |
1229 DoGetShaderiv(shader, pname, params); | 1239 DoGetShaderiv(shader, pname, params); |
1230 GLenum error = glGetError(); | 1240 GLenum error = glGetError(); |
1231 if (error == GL_NO_ERROR) { | 1241 if (error == GL_NO_ERROR) { |
1232 result->SetNumResults(num_values); | 1242 result->SetNumResults(num_values); |
1233 } else { | 1243 } else { |
1234 SetGLError(error, "", ""); | 1244 SetGLError(error, "", ""); |
1235 } | 1245 } |
1236 return error::kNoError; | 1246 return error::kNoError; |
1237 } | 1247 } |
1238 | 1248 |
1239 error::Error GLES2DecoderImpl::HandleGetTexParameterfv( | 1249 error::Error GLES2DecoderImpl::HandleGetTexParameterfv( |
1240 uint32 immediate_data_size, const gles2::GetTexParameterfv& c) { | 1250 uint32 immediate_data_size, const gles2::cmds::GetTexParameterfv& c) { |
1241 GLenum target = static_cast<GLenum>(c.target); | 1251 GLenum target = static_cast<GLenum>(c.target); |
1242 GLenum pname = static_cast<GLenum>(c.pname); | 1252 GLenum pname = static_cast<GLenum>(c.pname); |
1243 typedef GetTexParameterfv::Result Result; | 1253 typedef cmds::GetTexParameterfv::Result Result; |
1244 GLsizei num_values = 0; | 1254 GLsizei num_values = 0; |
1245 GetNumValuesReturnedForGLGet(pname, &num_values); | 1255 GetNumValuesReturnedForGLGet(pname, &num_values); |
1246 Result* result = GetSharedMemoryAs<Result*>( | 1256 Result* result = GetSharedMemoryAs<Result*>( |
1247 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1257 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1248 GLfloat* params = result ? result->GetData() : NULL; | 1258 GLfloat* params = result ? result->GetData() : NULL; |
1249 if (!validators_->get_tex_param_target.IsValid(target)) { | 1259 if (!validators_->get_tex_param_target.IsValid(target)) { |
1250 SetGLErrorInvalidEnum("glGetTexParameterfv", target, "target"); | 1260 SetGLErrorInvalidEnum("glGetTexParameterfv", target, "target"); |
1251 return error::kNoError; | 1261 return error::kNoError; |
1252 } | 1262 } |
1253 if (!validators_->texture_parameter.IsValid(pname)) { | 1263 if (!validators_->texture_parameter.IsValid(pname)) { |
(...skipping 12 matching lines...) Expand all Loading... |
1266 GLenum error = glGetError(); | 1276 GLenum error = glGetError(); |
1267 if (error == GL_NO_ERROR) { | 1277 if (error == GL_NO_ERROR) { |
1268 result->SetNumResults(num_values); | 1278 result->SetNumResults(num_values); |
1269 } else { | 1279 } else { |
1270 SetGLError(error, "", ""); | 1280 SetGLError(error, "", ""); |
1271 } | 1281 } |
1272 return error::kNoError; | 1282 return error::kNoError; |
1273 } | 1283 } |
1274 | 1284 |
1275 error::Error GLES2DecoderImpl::HandleGetTexParameteriv( | 1285 error::Error GLES2DecoderImpl::HandleGetTexParameteriv( |
1276 uint32 immediate_data_size, const gles2::GetTexParameteriv& c) { | 1286 uint32 immediate_data_size, const gles2::cmds::GetTexParameteriv& c) { |
1277 GLenum target = static_cast<GLenum>(c.target); | 1287 GLenum target = static_cast<GLenum>(c.target); |
1278 GLenum pname = static_cast<GLenum>(c.pname); | 1288 GLenum pname = static_cast<GLenum>(c.pname); |
1279 typedef GetTexParameteriv::Result Result; | 1289 typedef cmds::GetTexParameteriv::Result Result; |
1280 GLsizei num_values = 0; | 1290 GLsizei num_values = 0; |
1281 GetNumValuesReturnedForGLGet(pname, &num_values); | 1291 GetNumValuesReturnedForGLGet(pname, &num_values); |
1282 Result* result = GetSharedMemoryAs<Result*>( | 1292 Result* result = GetSharedMemoryAs<Result*>( |
1283 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1293 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1284 GLint* params = result ? result->GetData() : NULL; | 1294 GLint* params = result ? result->GetData() : NULL; |
1285 if (!validators_->get_tex_param_target.IsValid(target)) { | 1295 if (!validators_->get_tex_param_target.IsValid(target)) { |
1286 SetGLErrorInvalidEnum("glGetTexParameteriv", target, "target"); | 1296 SetGLErrorInvalidEnum("glGetTexParameteriv", target, "target"); |
1287 return error::kNoError; | 1297 return error::kNoError; |
1288 } | 1298 } |
1289 if (!validators_->texture_parameter.IsValid(pname)) { | 1299 if (!validators_->texture_parameter.IsValid(pname)) { |
(...skipping 12 matching lines...) Expand all Loading... |
1302 GLenum error = glGetError(); | 1312 GLenum error = glGetError(); |
1303 if (error == GL_NO_ERROR) { | 1313 if (error == GL_NO_ERROR) { |
1304 result->SetNumResults(num_values); | 1314 result->SetNumResults(num_values); |
1305 } else { | 1315 } else { |
1306 SetGLError(error, "", ""); | 1316 SetGLError(error, "", ""); |
1307 } | 1317 } |
1308 return error::kNoError; | 1318 return error::kNoError; |
1309 } | 1319 } |
1310 | 1320 |
1311 error::Error GLES2DecoderImpl::HandleGetVertexAttribfv( | 1321 error::Error GLES2DecoderImpl::HandleGetVertexAttribfv( |
1312 uint32 immediate_data_size, const gles2::GetVertexAttribfv& c) { | 1322 uint32 immediate_data_size, const gles2::cmds::GetVertexAttribfv& c) { |
1313 GLuint index = static_cast<GLuint>(c.index); | 1323 GLuint index = static_cast<GLuint>(c.index); |
1314 GLenum pname = static_cast<GLenum>(c.pname); | 1324 GLenum pname = static_cast<GLenum>(c.pname); |
1315 typedef GetVertexAttribfv::Result Result; | 1325 typedef cmds::GetVertexAttribfv::Result Result; |
1316 GLsizei num_values = 0; | 1326 GLsizei num_values = 0; |
1317 GetNumValuesReturnedForGLGet(pname, &num_values); | 1327 GetNumValuesReturnedForGLGet(pname, &num_values); |
1318 Result* result = GetSharedMemoryAs<Result*>( | 1328 Result* result = GetSharedMemoryAs<Result*>( |
1319 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1329 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1320 GLfloat* params = result ? result->GetData() : NULL; | 1330 GLfloat* params = result ? result->GetData() : NULL; |
1321 if (!validators_->vertex_attribute.IsValid(pname)) { | 1331 if (!validators_->vertex_attribute.IsValid(pname)) { |
1322 SetGLErrorInvalidEnum("glGetVertexAttribfv", pname, "pname"); | 1332 SetGLErrorInvalidEnum("glGetVertexAttribfv", pname, "pname"); |
1323 return error::kNoError; | 1333 return error::kNoError; |
1324 } | 1334 } |
1325 if (params == NULL) { | 1335 if (params == NULL) { |
1326 return error::kOutOfBounds; | 1336 return error::kOutOfBounds; |
1327 } | 1337 } |
1328 // Check that the client initialized the result. | 1338 // Check that the client initialized the result. |
1329 if (result->size != 0) { | 1339 if (result->size != 0) { |
1330 return error::kInvalidArguments; | 1340 return error::kInvalidArguments; |
1331 } | 1341 } |
1332 CopyRealGLErrorsToWrapper(); | 1342 CopyRealGLErrorsToWrapper(); |
1333 DoGetVertexAttribfv(index, pname, params); | 1343 DoGetVertexAttribfv(index, pname, params); |
1334 GLenum error = glGetError(); | 1344 GLenum error = glGetError(); |
1335 if (error == GL_NO_ERROR) { | 1345 if (error == GL_NO_ERROR) { |
1336 result->SetNumResults(num_values); | 1346 result->SetNumResults(num_values); |
1337 } else { | 1347 } else { |
1338 SetGLError(error, "", ""); | 1348 SetGLError(error, "", ""); |
1339 } | 1349 } |
1340 return error::kNoError; | 1350 return error::kNoError; |
1341 } | 1351 } |
1342 | 1352 |
1343 error::Error GLES2DecoderImpl::HandleGetVertexAttribiv( | 1353 error::Error GLES2DecoderImpl::HandleGetVertexAttribiv( |
1344 uint32 immediate_data_size, const gles2::GetVertexAttribiv& c) { | 1354 uint32 immediate_data_size, const gles2::cmds::GetVertexAttribiv& c) { |
1345 GLuint index = static_cast<GLuint>(c.index); | 1355 GLuint index = static_cast<GLuint>(c.index); |
1346 GLenum pname = static_cast<GLenum>(c.pname); | 1356 GLenum pname = static_cast<GLenum>(c.pname); |
1347 typedef GetVertexAttribiv::Result Result; | 1357 typedef cmds::GetVertexAttribiv::Result Result; |
1348 GLsizei num_values = 0; | 1358 GLsizei num_values = 0; |
1349 GetNumValuesReturnedForGLGet(pname, &num_values); | 1359 GetNumValuesReturnedForGLGet(pname, &num_values); |
1350 Result* result = GetSharedMemoryAs<Result*>( | 1360 Result* result = GetSharedMemoryAs<Result*>( |
1351 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); | 1361 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
1352 GLint* params = result ? result->GetData() : NULL; | 1362 GLint* params = result ? result->GetData() : NULL; |
1353 if (!validators_->vertex_attribute.IsValid(pname)) { | 1363 if (!validators_->vertex_attribute.IsValid(pname)) { |
1354 SetGLErrorInvalidEnum("glGetVertexAttribiv", pname, "pname"); | 1364 SetGLErrorInvalidEnum("glGetVertexAttribiv", pname, "pname"); |
1355 return error::kNoError; | 1365 return error::kNoError; |
1356 } | 1366 } |
1357 if (params == NULL) { | 1367 if (params == NULL) { |
1358 return error::kOutOfBounds; | 1368 return error::kOutOfBounds; |
1359 } | 1369 } |
1360 // Check that the client initialized the result. | 1370 // Check that the client initialized the result. |
1361 if (result->size != 0) { | 1371 if (result->size != 0) { |
1362 return error::kInvalidArguments; | 1372 return error::kInvalidArguments; |
1363 } | 1373 } |
1364 CopyRealGLErrorsToWrapper(); | 1374 CopyRealGLErrorsToWrapper(); |
1365 DoGetVertexAttribiv(index, pname, params); | 1375 DoGetVertexAttribiv(index, pname, params); |
1366 GLenum error = glGetError(); | 1376 GLenum error = glGetError(); |
1367 if (error == GL_NO_ERROR) { | 1377 if (error == GL_NO_ERROR) { |
1368 result->SetNumResults(num_values); | 1378 result->SetNumResults(num_values); |
1369 } else { | 1379 } else { |
1370 SetGLError(error, "", ""); | 1380 SetGLError(error, "", ""); |
1371 } | 1381 } |
1372 return error::kNoError; | 1382 return error::kNoError; |
1373 } | 1383 } |
1374 | 1384 |
1375 error::Error GLES2DecoderImpl::HandleHint( | 1385 error::Error GLES2DecoderImpl::HandleHint( |
1376 uint32 immediate_data_size, const gles2::Hint& c) { | 1386 uint32 immediate_data_size, const gles2::cmds::Hint& c) { |
1377 GLenum target = static_cast<GLenum>(c.target); | 1387 GLenum target = static_cast<GLenum>(c.target); |
1378 GLenum mode = static_cast<GLenum>(c.mode); | 1388 GLenum mode = static_cast<GLenum>(c.mode); |
1379 if (!validators_->hint_target.IsValid(target)) { | 1389 if (!validators_->hint_target.IsValid(target)) { |
1380 SetGLErrorInvalidEnum("glHint", target, "target"); | 1390 SetGLErrorInvalidEnum("glHint", target, "target"); |
1381 return error::kNoError; | 1391 return error::kNoError; |
1382 } | 1392 } |
1383 if (!validators_->hint_mode.IsValid(mode)) { | 1393 if (!validators_->hint_mode.IsValid(mode)) { |
1384 SetGLErrorInvalidEnum("glHint", mode, "mode"); | 1394 SetGLErrorInvalidEnum("glHint", mode, "mode"); |
1385 return error::kNoError; | 1395 return error::kNoError; |
1386 } | 1396 } |
1387 DoHint(target, mode); | 1397 DoHint(target, mode); |
1388 return error::kNoError; | 1398 return error::kNoError; |
1389 } | 1399 } |
1390 | 1400 |
1391 error::Error GLES2DecoderImpl::HandleIsBuffer( | 1401 error::Error GLES2DecoderImpl::HandleIsBuffer( |
1392 uint32 immediate_data_size, const gles2::IsBuffer& c) { | 1402 uint32 immediate_data_size, const gles2::cmds::IsBuffer& c) { |
1393 GLuint buffer = c.buffer; | 1403 GLuint buffer = c.buffer; |
1394 typedef IsBuffer::Result Result; | 1404 typedef cmds::IsBuffer::Result Result; |
1395 Result* result_dst = GetSharedMemoryAs<Result*>( | 1405 Result* result_dst = GetSharedMemoryAs<Result*>( |
1396 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1406 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1397 if (!result_dst) { | 1407 if (!result_dst) { |
1398 return error::kOutOfBounds; | 1408 return error::kOutOfBounds; |
1399 } | 1409 } |
1400 *result_dst = DoIsBuffer(buffer); | 1410 *result_dst = DoIsBuffer(buffer); |
1401 return error::kNoError; | 1411 return error::kNoError; |
1402 } | 1412 } |
1403 | 1413 |
1404 error::Error GLES2DecoderImpl::HandleIsEnabled( | 1414 error::Error GLES2DecoderImpl::HandleIsEnabled( |
1405 uint32 immediate_data_size, const gles2::IsEnabled& c) { | 1415 uint32 immediate_data_size, const gles2::cmds::IsEnabled& c) { |
1406 GLenum cap = static_cast<GLenum>(c.cap); | 1416 GLenum cap = static_cast<GLenum>(c.cap); |
1407 typedef IsEnabled::Result Result; | 1417 typedef cmds::IsEnabled::Result Result; |
1408 Result* result_dst = GetSharedMemoryAs<Result*>( | 1418 Result* result_dst = GetSharedMemoryAs<Result*>( |
1409 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1419 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1410 if (!result_dst) { | 1420 if (!result_dst) { |
1411 return error::kOutOfBounds; | 1421 return error::kOutOfBounds; |
1412 } | 1422 } |
1413 if (!validators_->capability.IsValid(cap)) { | 1423 if (!validators_->capability.IsValid(cap)) { |
1414 SetGLErrorInvalidEnum("glIsEnabled", cap, "cap"); | 1424 SetGLErrorInvalidEnum("glIsEnabled", cap, "cap"); |
1415 return error::kNoError; | 1425 return error::kNoError; |
1416 } | 1426 } |
1417 *result_dst = DoIsEnabled(cap); | 1427 *result_dst = DoIsEnabled(cap); |
1418 return error::kNoError; | 1428 return error::kNoError; |
1419 } | 1429 } |
1420 | 1430 |
1421 error::Error GLES2DecoderImpl::HandleIsFramebuffer( | 1431 error::Error GLES2DecoderImpl::HandleIsFramebuffer( |
1422 uint32 immediate_data_size, const gles2::IsFramebuffer& c) { | 1432 uint32 immediate_data_size, const gles2::cmds::IsFramebuffer& c) { |
1423 GLuint framebuffer = c.framebuffer; | 1433 GLuint framebuffer = c.framebuffer; |
1424 typedef IsFramebuffer::Result Result; | 1434 typedef cmds::IsFramebuffer::Result Result; |
1425 Result* result_dst = GetSharedMemoryAs<Result*>( | 1435 Result* result_dst = GetSharedMemoryAs<Result*>( |
1426 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1436 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1427 if (!result_dst) { | 1437 if (!result_dst) { |
1428 return error::kOutOfBounds; | 1438 return error::kOutOfBounds; |
1429 } | 1439 } |
1430 *result_dst = DoIsFramebuffer(framebuffer); | 1440 *result_dst = DoIsFramebuffer(framebuffer); |
1431 return error::kNoError; | 1441 return error::kNoError; |
1432 } | 1442 } |
1433 | 1443 |
1434 error::Error GLES2DecoderImpl::HandleIsProgram( | 1444 error::Error GLES2DecoderImpl::HandleIsProgram( |
1435 uint32 immediate_data_size, const gles2::IsProgram& c) { | 1445 uint32 immediate_data_size, const gles2::cmds::IsProgram& c) { |
1436 GLuint program = c.program; | 1446 GLuint program = c.program; |
1437 typedef IsProgram::Result Result; | 1447 typedef cmds::IsProgram::Result Result; |
1438 Result* result_dst = GetSharedMemoryAs<Result*>( | 1448 Result* result_dst = GetSharedMemoryAs<Result*>( |
1439 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1449 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1440 if (!result_dst) { | 1450 if (!result_dst) { |
1441 return error::kOutOfBounds; | 1451 return error::kOutOfBounds; |
1442 } | 1452 } |
1443 *result_dst = DoIsProgram(program); | 1453 *result_dst = DoIsProgram(program); |
1444 return error::kNoError; | 1454 return error::kNoError; |
1445 } | 1455 } |
1446 | 1456 |
1447 error::Error GLES2DecoderImpl::HandleIsRenderbuffer( | 1457 error::Error GLES2DecoderImpl::HandleIsRenderbuffer( |
1448 uint32 immediate_data_size, const gles2::IsRenderbuffer& c) { | 1458 uint32 immediate_data_size, const gles2::cmds::IsRenderbuffer& c) { |
1449 GLuint renderbuffer = c.renderbuffer; | 1459 GLuint renderbuffer = c.renderbuffer; |
1450 typedef IsRenderbuffer::Result Result; | 1460 typedef cmds::IsRenderbuffer::Result Result; |
1451 Result* result_dst = GetSharedMemoryAs<Result*>( | 1461 Result* result_dst = GetSharedMemoryAs<Result*>( |
1452 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1462 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1453 if (!result_dst) { | 1463 if (!result_dst) { |
1454 return error::kOutOfBounds; | 1464 return error::kOutOfBounds; |
1455 } | 1465 } |
1456 *result_dst = DoIsRenderbuffer(renderbuffer); | 1466 *result_dst = DoIsRenderbuffer(renderbuffer); |
1457 return error::kNoError; | 1467 return error::kNoError; |
1458 } | 1468 } |
1459 | 1469 |
1460 error::Error GLES2DecoderImpl::HandleIsShader( | 1470 error::Error GLES2DecoderImpl::HandleIsShader( |
1461 uint32 immediate_data_size, const gles2::IsShader& c) { | 1471 uint32 immediate_data_size, const gles2::cmds::IsShader& c) { |
1462 GLuint shader = c.shader; | 1472 GLuint shader = c.shader; |
1463 typedef IsShader::Result Result; | 1473 typedef cmds::IsShader::Result Result; |
1464 Result* result_dst = GetSharedMemoryAs<Result*>( | 1474 Result* result_dst = GetSharedMemoryAs<Result*>( |
1465 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1475 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1466 if (!result_dst) { | 1476 if (!result_dst) { |
1467 return error::kOutOfBounds; | 1477 return error::kOutOfBounds; |
1468 } | 1478 } |
1469 *result_dst = DoIsShader(shader); | 1479 *result_dst = DoIsShader(shader); |
1470 return error::kNoError; | 1480 return error::kNoError; |
1471 } | 1481 } |
1472 | 1482 |
1473 error::Error GLES2DecoderImpl::HandleIsTexture( | 1483 error::Error GLES2DecoderImpl::HandleIsTexture( |
1474 uint32 immediate_data_size, const gles2::IsTexture& c) { | 1484 uint32 immediate_data_size, const gles2::cmds::IsTexture& c) { |
1475 GLuint texture = c.texture; | 1485 GLuint texture = c.texture; |
1476 typedef IsTexture::Result Result; | 1486 typedef cmds::IsTexture::Result Result; |
1477 Result* result_dst = GetSharedMemoryAs<Result*>( | 1487 Result* result_dst = GetSharedMemoryAs<Result*>( |
1478 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 1488 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
1479 if (!result_dst) { | 1489 if (!result_dst) { |
1480 return error::kOutOfBounds; | 1490 return error::kOutOfBounds; |
1481 } | 1491 } |
1482 *result_dst = DoIsTexture(texture); | 1492 *result_dst = DoIsTexture(texture); |
1483 return error::kNoError; | 1493 return error::kNoError; |
1484 } | 1494 } |
1485 | 1495 |
1486 error::Error GLES2DecoderImpl::HandleLineWidth( | 1496 error::Error GLES2DecoderImpl::HandleLineWidth( |
1487 uint32 immediate_data_size, const gles2::LineWidth& c) { | 1497 uint32 immediate_data_size, const gles2::cmds::LineWidth& c) { |
1488 GLfloat width = static_cast<GLfloat>(c.width); | 1498 GLfloat width = static_cast<GLfloat>(c.width); |
1489 if (width <= 0.0f) { | 1499 if (width <= 0.0f) { |
1490 SetGLError(GL_INVALID_VALUE, "LineWidth", "width out of range"); | 1500 SetGLError(GL_INVALID_VALUE, "LineWidth", "width out of range"); |
1491 return error::kNoError; | 1501 return error::kNoError; |
1492 } | 1502 } |
1493 if (state_.line_width != width) { | 1503 if (state_.line_width != width) { |
1494 state_.line_width = width; | 1504 state_.line_width = width; |
1495 glLineWidth(width); | 1505 glLineWidth(width); |
1496 } | 1506 } |
1497 return error::kNoError; | 1507 return error::kNoError; |
1498 } | 1508 } |
1499 | 1509 |
1500 error::Error GLES2DecoderImpl::HandleLinkProgram( | 1510 error::Error GLES2DecoderImpl::HandleLinkProgram( |
1501 uint32 immediate_data_size, const gles2::LinkProgram& c) { | 1511 uint32 immediate_data_size, const gles2::cmds::LinkProgram& c) { |
1502 GLuint program = c.program; | 1512 GLuint program = c.program; |
1503 DoLinkProgram(program); | 1513 DoLinkProgram(program); |
1504 return error::kNoError; | 1514 return error::kNoError; |
1505 } | 1515 } |
1506 | 1516 |
1507 error::Error GLES2DecoderImpl::HandlePolygonOffset( | 1517 error::Error GLES2DecoderImpl::HandlePolygonOffset( |
1508 uint32 immediate_data_size, const gles2::PolygonOffset& c) { | 1518 uint32 immediate_data_size, const gles2::cmds::PolygonOffset& c) { |
1509 GLfloat factor = static_cast<GLfloat>(c.factor); | 1519 GLfloat factor = static_cast<GLfloat>(c.factor); |
1510 GLfloat units = static_cast<GLfloat>(c.units); | 1520 GLfloat units = static_cast<GLfloat>(c.units); |
1511 if (state_.polygon_offset_factor != factor || | 1521 if (state_.polygon_offset_factor != factor || |
1512 state_.polygon_offset_units != units) { | 1522 state_.polygon_offset_units != units) { |
1513 state_.polygon_offset_factor = factor; | 1523 state_.polygon_offset_factor = factor; |
1514 state_.polygon_offset_units = units; | 1524 state_.polygon_offset_units = units; |
1515 glPolygonOffset(factor, units); | 1525 glPolygonOffset(factor, units); |
1516 } | 1526 } |
1517 return error::kNoError; | 1527 return error::kNoError; |
1518 } | 1528 } |
1519 | 1529 |
1520 error::Error GLES2DecoderImpl::HandleReleaseShaderCompiler( | 1530 error::Error GLES2DecoderImpl::HandleReleaseShaderCompiler( |
1521 uint32 immediate_data_size, const gles2::ReleaseShaderCompiler& c) { | 1531 uint32 immediate_data_size, const gles2::cmds::ReleaseShaderCompiler& c) { |
1522 DoReleaseShaderCompiler(); | 1532 DoReleaseShaderCompiler(); |
1523 return error::kNoError; | 1533 return error::kNoError; |
1524 } | 1534 } |
1525 | 1535 |
1526 error::Error GLES2DecoderImpl::HandleRenderbufferStorage( | 1536 error::Error GLES2DecoderImpl::HandleRenderbufferStorage( |
1527 uint32 immediate_data_size, const gles2::RenderbufferStorage& c) { | 1537 uint32 immediate_data_size, const gles2::cmds::RenderbufferStorage& c) { |
1528 GLenum target = static_cast<GLenum>(c.target); | 1538 GLenum target = static_cast<GLenum>(c.target); |
1529 GLenum internalformat = static_cast<GLenum>(c.internalformat); | 1539 GLenum internalformat = static_cast<GLenum>(c.internalformat); |
1530 GLsizei width = static_cast<GLsizei>(c.width); | 1540 GLsizei width = static_cast<GLsizei>(c.width); |
1531 GLsizei height = static_cast<GLsizei>(c.height); | 1541 GLsizei height = static_cast<GLsizei>(c.height); |
1532 if (!validators_->render_buffer_target.IsValid(target)) { | 1542 if (!validators_->render_buffer_target.IsValid(target)) { |
1533 SetGLErrorInvalidEnum("glRenderbufferStorage", target, "target"); | 1543 SetGLErrorInvalidEnum("glRenderbufferStorage", target, "target"); |
1534 return error::kNoError; | 1544 return error::kNoError; |
1535 } | 1545 } |
1536 if (!validators_->render_buffer_format.IsValid(internalformat)) { | 1546 if (!validators_->render_buffer_format.IsValid(internalformat)) { |
1537 SetGLErrorInvalidEnum("glRenderbufferStorage", internalformat, | 1547 SetGLErrorInvalidEnum("glRenderbufferStorage", internalformat, |
1538 "internalformat"); | 1548 "internalformat"); |
1539 return error::kNoError; | 1549 return error::kNoError; |
1540 } | 1550 } |
1541 if (width < 0) { | 1551 if (width < 0) { |
1542 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0"); | 1552 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0"); |
1543 return error::kNoError; | 1553 return error::kNoError; |
1544 } | 1554 } |
1545 if (height < 0) { | 1555 if (height < 0) { |
1546 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0"); | 1556 SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "height < 0"); |
1547 return error::kNoError; | 1557 return error::kNoError; |
1548 } | 1558 } |
1549 DoRenderbufferStorage(target, internalformat, width, height); | 1559 DoRenderbufferStorage(target, internalformat, width, height); |
1550 return error::kNoError; | 1560 return error::kNoError; |
1551 } | 1561 } |
1552 | 1562 |
1553 error::Error GLES2DecoderImpl::HandleSampleCoverage( | 1563 error::Error GLES2DecoderImpl::HandleSampleCoverage( |
1554 uint32 immediate_data_size, const gles2::SampleCoverage& c) { | 1564 uint32 immediate_data_size, const gles2::cmds::SampleCoverage& c) { |
1555 GLclampf value = static_cast<GLclampf>(c.value); | 1565 GLclampf value = static_cast<GLclampf>(c.value); |
1556 GLboolean invert = static_cast<GLboolean>(c.invert); | 1566 GLboolean invert = static_cast<GLboolean>(c.invert); |
1557 DoSampleCoverage(value, invert); | 1567 DoSampleCoverage(value, invert); |
1558 return error::kNoError; | 1568 return error::kNoError; |
1559 } | 1569 } |
1560 | 1570 |
1561 error::Error GLES2DecoderImpl::HandleScissor( | 1571 error::Error GLES2DecoderImpl::HandleScissor( |
1562 uint32 immediate_data_size, const gles2::Scissor& c) { | 1572 uint32 immediate_data_size, const gles2::cmds::Scissor& c) { |
1563 GLint x = static_cast<GLint>(c.x); | 1573 GLint x = static_cast<GLint>(c.x); |
1564 GLint y = static_cast<GLint>(c.y); | 1574 GLint y = static_cast<GLint>(c.y); |
1565 GLsizei width = static_cast<GLsizei>(c.width); | 1575 GLsizei width = static_cast<GLsizei>(c.width); |
1566 GLsizei height = static_cast<GLsizei>(c.height); | 1576 GLsizei height = static_cast<GLsizei>(c.height); |
1567 if (width < 0) { | 1577 if (width < 0) { |
1568 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0"); | 1578 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0"); |
1569 return error::kNoError; | 1579 return error::kNoError; |
1570 } | 1580 } |
1571 if (height < 0) { | 1581 if (height < 0) { |
1572 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0"); | 1582 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0"); |
1573 return error::kNoError; | 1583 return error::kNoError; |
1574 } | 1584 } |
1575 if (state_.scissor_x != x || | 1585 if (state_.scissor_x != x || |
1576 state_.scissor_y != y || | 1586 state_.scissor_y != y || |
1577 state_.scissor_width != width || | 1587 state_.scissor_width != width || |
1578 state_.scissor_height != height) { | 1588 state_.scissor_height != height) { |
1579 state_.scissor_x = x; | 1589 state_.scissor_x = x; |
1580 state_.scissor_y = y; | 1590 state_.scissor_y = y; |
1581 state_.scissor_width = width; | 1591 state_.scissor_width = width; |
1582 state_.scissor_height = height; | 1592 state_.scissor_height = height; |
1583 glScissor(x, y, width, height); | 1593 glScissor(x, y, width, height); |
1584 } | 1594 } |
1585 return error::kNoError; | 1595 return error::kNoError; |
1586 } | 1596 } |
1587 | 1597 |
1588 error::Error GLES2DecoderImpl::HandleStencilFunc( | 1598 error::Error GLES2DecoderImpl::HandleStencilFunc( |
1589 uint32 immediate_data_size, const gles2::StencilFunc& c) { | 1599 uint32 immediate_data_size, const gles2::cmds::StencilFunc& c) { |
1590 GLenum func = static_cast<GLenum>(c.func); | 1600 GLenum func = static_cast<GLenum>(c.func); |
1591 GLint ref = static_cast<GLint>(c.ref); | 1601 GLint ref = static_cast<GLint>(c.ref); |
1592 GLuint mask = static_cast<GLuint>(c.mask); | 1602 GLuint mask = static_cast<GLuint>(c.mask); |
1593 if (!validators_->cmp_function.IsValid(func)) { | 1603 if (!validators_->cmp_function.IsValid(func)) { |
1594 SetGLErrorInvalidEnum("glStencilFunc", func, "func"); | 1604 SetGLErrorInvalidEnum("glStencilFunc", func, "func"); |
1595 return error::kNoError; | 1605 return error::kNoError; |
1596 } | 1606 } |
1597 if (state_.stencil_front_func != func || | 1607 if (state_.stencil_front_func != func || |
1598 state_.stencil_front_ref != ref || | 1608 state_.stencil_front_ref != ref || |
1599 state_.stencil_front_mask != mask || | 1609 state_.stencil_front_mask != mask || |
1600 state_.stencil_back_func != func || | 1610 state_.stencil_back_func != func || |
1601 state_.stencil_back_ref != ref || | 1611 state_.stencil_back_ref != ref || |
1602 state_.stencil_back_mask != mask) { | 1612 state_.stencil_back_mask != mask) { |
1603 state_.stencil_front_func = func; | 1613 state_.stencil_front_func = func; |
1604 state_.stencil_front_ref = ref; | 1614 state_.stencil_front_ref = ref; |
1605 state_.stencil_front_mask = mask; | 1615 state_.stencil_front_mask = mask; |
1606 state_.stencil_back_func = func; | 1616 state_.stencil_back_func = func; |
1607 state_.stencil_back_ref = ref; | 1617 state_.stencil_back_ref = ref; |
1608 state_.stencil_back_mask = mask; | 1618 state_.stencil_back_mask = mask; |
1609 glStencilFunc(func, ref, mask); | 1619 glStencilFunc(func, ref, mask); |
1610 } | 1620 } |
1611 return error::kNoError; | 1621 return error::kNoError; |
1612 } | 1622 } |
1613 | 1623 |
1614 error::Error GLES2DecoderImpl::HandleStencilFuncSeparate( | 1624 error::Error GLES2DecoderImpl::HandleStencilFuncSeparate( |
1615 uint32 immediate_data_size, const gles2::StencilFuncSeparate& c) { | 1625 uint32 immediate_data_size, const gles2::cmds::StencilFuncSeparate& c) { |
1616 GLenum face = static_cast<GLenum>(c.face); | 1626 GLenum face = static_cast<GLenum>(c.face); |
1617 GLenum func = static_cast<GLenum>(c.func); | 1627 GLenum func = static_cast<GLenum>(c.func); |
1618 GLint ref = static_cast<GLint>(c.ref); | 1628 GLint ref = static_cast<GLint>(c.ref); |
1619 GLuint mask = static_cast<GLuint>(c.mask); | 1629 GLuint mask = static_cast<GLuint>(c.mask); |
1620 if (!validators_->face_type.IsValid(face)) { | 1630 if (!validators_->face_type.IsValid(face)) { |
1621 SetGLErrorInvalidEnum("glStencilFuncSeparate", face, "face"); | 1631 SetGLErrorInvalidEnum("glStencilFuncSeparate", face, "face"); |
1622 return error::kNoError; | 1632 return error::kNoError; |
1623 } | 1633 } |
1624 if (!validators_->cmp_function.IsValid(func)) { | 1634 if (!validators_->cmp_function.IsValid(func)) { |
1625 SetGLErrorInvalidEnum("glStencilFuncSeparate", func, "func"); | 1635 SetGLErrorInvalidEnum("glStencilFuncSeparate", func, "func"); |
(...skipping 20 matching lines...) Expand all Loading... |
1646 state_.stencil_back_func = func; | 1656 state_.stencil_back_func = func; |
1647 state_.stencil_back_ref = ref; | 1657 state_.stencil_back_ref = ref; |
1648 state_.stencil_back_mask = mask; | 1658 state_.stencil_back_mask = mask; |
1649 } | 1659 } |
1650 glStencilFuncSeparate(face, func, ref, mask); | 1660 glStencilFuncSeparate(face, func, ref, mask); |
1651 } | 1661 } |
1652 return error::kNoError; | 1662 return error::kNoError; |
1653 } | 1663 } |
1654 | 1664 |
1655 error::Error GLES2DecoderImpl::HandleStencilMask( | 1665 error::Error GLES2DecoderImpl::HandleStencilMask( |
1656 uint32 immediate_data_size, const gles2::StencilMask& c) { | 1666 uint32 immediate_data_size, const gles2::cmds::StencilMask& c) { |
1657 GLuint mask = static_cast<GLuint>(c.mask); | 1667 GLuint mask = static_cast<GLuint>(c.mask); |
1658 if (state_.stencil_front_writemask != mask || | 1668 if (state_.stencil_front_writemask != mask || |
1659 state_.stencil_back_writemask != mask) { | 1669 state_.stencil_back_writemask != mask) { |
1660 state_.stencil_front_writemask = mask; | 1670 state_.stencil_front_writemask = mask; |
1661 state_.stencil_back_writemask = mask; | 1671 state_.stencil_back_writemask = mask; |
1662 clear_state_dirty_ = true; | 1672 clear_state_dirty_ = true; |
1663 } | 1673 } |
1664 return error::kNoError; | 1674 return error::kNoError; |
1665 } | 1675 } |
1666 | 1676 |
1667 error::Error GLES2DecoderImpl::HandleStencilMaskSeparate( | 1677 error::Error GLES2DecoderImpl::HandleStencilMaskSeparate( |
1668 uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) { | 1678 uint32 immediate_data_size, const gles2::cmds::StencilMaskSeparate& c) { |
1669 GLenum face = static_cast<GLenum>(c.face); | 1679 GLenum face = static_cast<GLenum>(c.face); |
1670 GLuint mask = static_cast<GLuint>(c.mask); | 1680 GLuint mask = static_cast<GLuint>(c.mask); |
1671 if (!validators_->face_type.IsValid(face)) { | 1681 if (!validators_->face_type.IsValid(face)) { |
1672 SetGLErrorInvalidEnum("glStencilMaskSeparate", face, "face"); | 1682 SetGLErrorInvalidEnum("glStencilMaskSeparate", face, "face"); |
1673 return error::kNoError; | 1683 return error::kNoError; |
1674 } | 1684 } |
1675 bool changed = false; | 1685 bool changed = false; |
1676 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { | 1686 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
1677 changed |= state_.stencil_front_writemask != mask; | 1687 changed |= state_.stencil_front_writemask != mask; |
1678 } | 1688 } |
1679 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { | 1689 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
1680 changed |= state_.stencil_back_writemask != mask; | 1690 changed |= state_.stencil_back_writemask != mask; |
1681 } | 1691 } |
1682 if (changed) { | 1692 if (changed) { |
1683 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { | 1693 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
1684 state_.stencil_front_writemask = mask; | 1694 state_.stencil_front_writemask = mask; |
1685 } | 1695 } |
1686 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { | 1696 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
1687 state_.stencil_back_writemask = mask; | 1697 state_.stencil_back_writemask = mask; |
1688 } | 1698 } |
1689 clear_state_dirty_ = true; | 1699 clear_state_dirty_ = true; |
1690 } | 1700 } |
1691 return error::kNoError; | 1701 return error::kNoError; |
1692 } | 1702 } |
1693 | 1703 |
1694 error::Error GLES2DecoderImpl::HandleStencilOp( | 1704 error::Error GLES2DecoderImpl::HandleStencilOp( |
1695 uint32 immediate_data_size, const gles2::StencilOp& c) { | 1705 uint32 immediate_data_size, const gles2::cmds::StencilOp& c) { |
1696 GLenum fail = static_cast<GLenum>(c.fail); | 1706 GLenum fail = static_cast<GLenum>(c.fail); |
1697 GLenum zfail = static_cast<GLenum>(c.zfail); | 1707 GLenum zfail = static_cast<GLenum>(c.zfail); |
1698 GLenum zpass = static_cast<GLenum>(c.zpass); | 1708 GLenum zpass = static_cast<GLenum>(c.zpass); |
1699 if (!validators_->stencil_op.IsValid(fail)) { | 1709 if (!validators_->stencil_op.IsValid(fail)) { |
1700 SetGLErrorInvalidEnum("glStencilOp", fail, "fail"); | 1710 SetGLErrorInvalidEnum("glStencilOp", fail, "fail"); |
1701 return error::kNoError; | 1711 return error::kNoError; |
1702 } | 1712 } |
1703 if (!validators_->stencil_op.IsValid(zfail)) { | 1713 if (!validators_->stencil_op.IsValid(zfail)) { |
1704 SetGLErrorInvalidEnum("glStencilOp", zfail, "zfail"); | 1714 SetGLErrorInvalidEnum("glStencilOp", zfail, "zfail"); |
1705 return error::kNoError; | 1715 return error::kNoError; |
(...skipping 13 matching lines...) Expand all Loading... |
1719 state_.stencil_front_z_pass_op = zpass; | 1729 state_.stencil_front_z_pass_op = zpass; |
1720 state_.stencil_back_fail_op = fail; | 1730 state_.stencil_back_fail_op = fail; |
1721 state_.stencil_back_z_fail_op = zfail; | 1731 state_.stencil_back_z_fail_op = zfail; |
1722 state_.stencil_back_z_pass_op = zpass; | 1732 state_.stencil_back_z_pass_op = zpass; |
1723 glStencilOp(fail, zfail, zpass); | 1733 glStencilOp(fail, zfail, zpass); |
1724 } | 1734 } |
1725 return error::kNoError; | 1735 return error::kNoError; |
1726 } | 1736 } |
1727 | 1737 |
1728 error::Error GLES2DecoderImpl::HandleStencilOpSeparate( | 1738 error::Error GLES2DecoderImpl::HandleStencilOpSeparate( |
1729 uint32 immediate_data_size, const gles2::StencilOpSeparate& c) { | 1739 uint32 immediate_data_size, const gles2::cmds::StencilOpSeparate& c) { |
1730 GLenum face = static_cast<GLenum>(c.face); | 1740 GLenum face = static_cast<GLenum>(c.face); |
1731 GLenum fail = static_cast<GLenum>(c.fail); | 1741 GLenum fail = static_cast<GLenum>(c.fail); |
1732 GLenum zfail = static_cast<GLenum>(c.zfail); | 1742 GLenum zfail = static_cast<GLenum>(c.zfail); |
1733 GLenum zpass = static_cast<GLenum>(c.zpass); | 1743 GLenum zpass = static_cast<GLenum>(c.zpass); |
1734 if (!validators_->face_type.IsValid(face)) { | 1744 if (!validators_->face_type.IsValid(face)) { |
1735 SetGLErrorInvalidEnum("glStencilOpSeparate", face, "face"); | 1745 SetGLErrorInvalidEnum("glStencilOpSeparate", face, "face"); |
1736 return error::kNoError; | 1746 return error::kNoError; |
1737 } | 1747 } |
1738 if (!validators_->stencil_op.IsValid(fail)) { | 1748 if (!validators_->stencil_op.IsValid(fail)) { |
1739 SetGLErrorInvalidEnum("glStencilOpSeparate", fail, "fail"); | 1749 SetGLErrorInvalidEnum("glStencilOpSeparate", fail, "fail"); |
(...skipping 28 matching lines...) Expand all Loading... |
1768 state_.stencil_back_fail_op = fail; | 1778 state_.stencil_back_fail_op = fail; |
1769 state_.stencil_back_z_fail_op = zfail; | 1779 state_.stencil_back_z_fail_op = zfail; |
1770 state_.stencil_back_z_pass_op = zpass; | 1780 state_.stencil_back_z_pass_op = zpass; |
1771 } | 1781 } |
1772 glStencilOpSeparate(face, fail, zfail, zpass); | 1782 glStencilOpSeparate(face, fail, zfail, zpass); |
1773 } | 1783 } |
1774 return error::kNoError; | 1784 return error::kNoError; |
1775 } | 1785 } |
1776 | 1786 |
1777 error::Error GLES2DecoderImpl::HandleTexParameterf( | 1787 error::Error GLES2DecoderImpl::HandleTexParameterf( |
1778 uint32 immediate_data_size, const gles2::TexParameterf& c) { | 1788 uint32 immediate_data_size, const gles2::cmds::TexParameterf& c) { |
1779 GLenum target = static_cast<GLenum>(c.target); | 1789 GLenum target = static_cast<GLenum>(c.target); |
1780 GLenum pname = static_cast<GLenum>(c.pname); | 1790 GLenum pname = static_cast<GLenum>(c.pname); |
1781 GLfloat param = static_cast<GLfloat>(c.param); | 1791 GLfloat param = static_cast<GLfloat>(c.param); |
1782 if (!validators_->texture_bind_target.IsValid(target)) { | 1792 if (!validators_->texture_bind_target.IsValid(target)) { |
1783 SetGLErrorInvalidEnum("glTexParameterf", target, "target"); | 1793 SetGLErrorInvalidEnum("glTexParameterf", target, "target"); |
1784 return error::kNoError; | 1794 return error::kNoError; |
1785 } | 1795 } |
1786 if (!validators_->texture_parameter.IsValid(pname)) { | 1796 if (!validators_->texture_parameter.IsValid(pname)) { |
1787 SetGLErrorInvalidEnum("glTexParameterf", pname, "pname"); | 1797 SetGLErrorInvalidEnum("glTexParameterf", pname, "pname"); |
1788 return error::kNoError; | 1798 return error::kNoError; |
1789 } | 1799 } |
1790 DoTexParameterf(target, pname, param); | 1800 DoTexParameterf(target, pname, param); |
1791 return error::kNoError; | 1801 return error::kNoError; |
1792 } | 1802 } |
1793 | 1803 |
1794 error::Error GLES2DecoderImpl::HandleTexParameterfv( | 1804 error::Error GLES2DecoderImpl::HandleTexParameterfv( |
1795 uint32 immediate_data_size, const gles2::TexParameterfv& c) { | 1805 uint32 immediate_data_size, const gles2::cmds::TexParameterfv& c) { |
1796 GLenum target = static_cast<GLenum>(c.target); | 1806 GLenum target = static_cast<GLenum>(c.target); |
1797 GLenum pname = static_cast<GLenum>(c.pname); | 1807 GLenum pname = static_cast<GLenum>(c.pname); |
1798 uint32 data_size; | 1808 uint32 data_size; |
1799 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { | 1809 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { |
1800 return error::kOutOfBounds; | 1810 return error::kOutOfBounds; |
1801 } | 1811 } |
1802 const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( | 1812 const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( |
1803 c.params_shm_id, c.params_shm_offset, data_size); | 1813 c.params_shm_id, c.params_shm_offset, data_size); |
1804 if (!validators_->texture_bind_target.IsValid(target)) { | 1814 if (!validators_->texture_bind_target.IsValid(target)) { |
1805 SetGLErrorInvalidEnum("glTexParameterfv", target, "target"); | 1815 SetGLErrorInvalidEnum("glTexParameterfv", target, "target"); |
1806 return error::kNoError; | 1816 return error::kNoError; |
1807 } | 1817 } |
1808 if (!validators_->texture_parameter.IsValid(pname)) { | 1818 if (!validators_->texture_parameter.IsValid(pname)) { |
1809 SetGLErrorInvalidEnum("glTexParameterfv", pname, "pname"); | 1819 SetGLErrorInvalidEnum("glTexParameterfv", pname, "pname"); |
1810 return error::kNoError; | 1820 return error::kNoError; |
1811 } | 1821 } |
1812 if (params == NULL) { | 1822 if (params == NULL) { |
1813 return error::kOutOfBounds; | 1823 return error::kOutOfBounds; |
1814 } | 1824 } |
1815 DoTexParameterfv(target, pname, params); | 1825 DoTexParameterfv(target, pname, params); |
1816 return error::kNoError; | 1826 return error::kNoError; |
1817 } | 1827 } |
1818 | 1828 |
1819 error::Error GLES2DecoderImpl::HandleTexParameterfvImmediate( | 1829 error::Error GLES2DecoderImpl::HandleTexParameterfvImmediate( |
1820 uint32 immediate_data_size, const gles2::TexParameterfvImmediate& c) { | 1830 uint32 immediate_data_size, |
| 1831 const gles2::cmds::TexParameterfvImmediate& c) { |
1821 GLenum target = static_cast<GLenum>(c.target); | 1832 GLenum target = static_cast<GLenum>(c.target); |
1822 GLenum pname = static_cast<GLenum>(c.pname); | 1833 GLenum pname = static_cast<GLenum>(c.pname); |
1823 uint32 data_size; | 1834 uint32 data_size; |
1824 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { | 1835 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { |
1825 return error::kOutOfBounds; | 1836 return error::kOutOfBounds; |
1826 } | 1837 } |
1827 if (data_size > immediate_data_size) { | 1838 if (data_size > immediate_data_size) { |
1828 return error::kOutOfBounds; | 1839 return error::kOutOfBounds; |
1829 } | 1840 } |
1830 const GLfloat* params = GetImmediateDataAs<const GLfloat*>( | 1841 const GLfloat* params = GetImmediateDataAs<const GLfloat*>( |
1831 c, data_size, immediate_data_size); | 1842 c, data_size, immediate_data_size); |
1832 if (!validators_->texture_bind_target.IsValid(target)) { | 1843 if (!validators_->texture_bind_target.IsValid(target)) { |
1833 SetGLErrorInvalidEnum("glTexParameterfv", target, "target"); | 1844 SetGLErrorInvalidEnum("glTexParameterfv", target, "target"); |
1834 return error::kNoError; | 1845 return error::kNoError; |
1835 } | 1846 } |
1836 if (!validators_->texture_parameter.IsValid(pname)) { | 1847 if (!validators_->texture_parameter.IsValid(pname)) { |
1837 SetGLErrorInvalidEnum("glTexParameterfv", pname, "pname"); | 1848 SetGLErrorInvalidEnum("glTexParameterfv", pname, "pname"); |
1838 return error::kNoError; | 1849 return error::kNoError; |
1839 } | 1850 } |
1840 if (params == NULL) { | 1851 if (params == NULL) { |
1841 return error::kOutOfBounds; | 1852 return error::kOutOfBounds; |
1842 } | 1853 } |
1843 DoTexParameterfv(target, pname, params); | 1854 DoTexParameterfv(target, pname, params); |
1844 return error::kNoError; | 1855 return error::kNoError; |
1845 } | 1856 } |
1846 | 1857 |
1847 error::Error GLES2DecoderImpl::HandleTexParameteri( | 1858 error::Error GLES2DecoderImpl::HandleTexParameteri( |
1848 uint32 immediate_data_size, const gles2::TexParameteri& c) { | 1859 uint32 immediate_data_size, const gles2::cmds::TexParameteri& c) { |
1849 GLenum target = static_cast<GLenum>(c.target); | 1860 GLenum target = static_cast<GLenum>(c.target); |
1850 GLenum pname = static_cast<GLenum>(c.pname); | 1861 GLenum pname = static_cast<GLenum>(c.pname); |
1851 GLint param = static_cast<GLint>(c.param); | 1862 GLint param = static_cast<GLint>(c.param); |
1852 if (!validators_->texture_bind_target.IsValid(target)) { | 1863 if (!validators_->texture_bind_target.IsValid(target)) { |
1853 SetGLErrorInvalidEnum("glTexParameteri", target, "target"); | 1864 SetGLErrorInvalidEnum("glTexParameteri", target, "target"); |
1854 return error::kNoError; | 1865 return error::kNoError; |
1855 } | 1866 } |
1856 if (!validators_->texture_parameter.IsValid(pname)) { | 1867 if (!validators_->texture_parameter.IsValid(pname)) { |
1857 SetGLErrorInvalidEnum("glTexParameteri", pname, "pname"); | 1868 SetGLErrorInvalidEnum("glTexParameteri", pname, "pname"); |
1858 return error::kNoError; | 1869 return error::kNoError; |
1859 } | 1870 } |
1860 DoTexParameteri(target, pname, param); | 1871 DoTexParameteri(target, pname, param); |
1861 return error::kNoError; | 1872 return error::kNoError; |
1862 } | 1873 } |
1863 | 1874 |
1864 error::Error GLES2DecoderImpl::HandleTexParameteriv( | 1875 error::Error GLES2DecoderImpl::HandleTexParameteriv( |
1865 uint32 immediate_data_size, const gles2::TexParameteriv& c) { | 1876 uint32 immediate_data_size, const gles2::cmds::TexParameteriv& c) { |
1866 GLenum target = static_cast<GLenum>(c.target); | 1877 GLenum target = static_cast<GLenum>(c.target); |
1867 GLenum pname = static_cast<GLenum>(c.pname); | 1878 GLenum pname = static_cast<GLenum>(c.pname); |
1868 uint32 data_size; | 1879 uint32 data_size; |
1869 if (!ComputeDataSize(1, sizeof(GLint), 1, &data_size)) { | 1880 if (!ComputeDataSize(1, sizeof(GLint), 1, &data_size)) { |
1870 return error::kOutOfBounds; | 1881 return error::kOutOfBounds; |
1871 } | 1882 } |
1872 const GLint* params = GetSharedMemoryAs<const GLint*>( | 1883 const GLint* params = GetSharedMemoryAs<const GLint*>( |
1873 c.params_shm_id, c.params_shm_offset, data_size); | 1884 c.params_shm_id, c.params_shm_offset, data_size); |
1874 if (!validators_->texture_bind_target.IsValid(target)) { | 1885 if (!validators_->texture_bind_target.IsValid(target)) { |
1875 SetGLErrorInvalidEnum("glTexParameteriv", target, "target"); | 1886 SetGLErrorInvalidEnum("glTexParameteriv", target, "target"); |
1876 return error::kNoError; | 1887 return error::kNoError; |
1877 } | 1888 } |
1878 if (!validators_->texture_parameter.IsValid(pname)) { | 1889 if (!validators_->texture_parameter.IsValid(pname)) { |
1879 SetGLErrorInvalidEnum("glTexParameteriv", pname, "pname"); | 1890 SetGLErrorInvalidEnum("glTexParameteriv", pname, "pname"); |
1880 return error::kNoError; | 1891 return error::kNoError; |
1881 } | 1892 } |
1882 if (params == NULL) { | 1893 if (params == NULL) { |
1883 return error::kOutOfBounds; | 1894 return error::kOutOfBounds; |
1884 } | 1895 } |
1885 DoTexParameteriv(target, pname, params); | 1896 DoTexParameteriv(target, pname, params); |
1886 return error::kNoError; | 1897 return error::kNoError; |
1887 } | 1898 } |
1888 | 1899 |
1889 error::Error GLES2DecoderImpl::HandleTexParameterivImmediate( | 1900 error::Error GLES2DecoderImpl::HandleTexParameterivImmediate( |
1890 uint32 immediate_data_size, const gles2::TexParameterivImmediate& c) { | 1901 uint32 immediate_data_size, |
| 1902 const gles2::cmds::TexParameterivImmediate& c) { |
1891 GLenum target = static_cast<GLenum>(c.target); | 1903 GLenum target = static_cast<GLenum>(c.target); |
1892 GLenum pname = static_cast<GLenum>(c.pname); | 1904 GLenum pname = static_cast<GLenum>(c.pname); |
1893 uint32 data_size; | 1905 uint32 data_size; |
1894 if (!ComputeDataSize(1, sizeof(GLint), 1, &data_size)) { | 1906 if (!ComputeDataSize(1, sizeof(GLint), 1, &data_size)) { |
1895 return error::kOutOfBounds; | 1907 return error::kOutOfBounds; |
1896 } | 1908 } |
1897 if (data_size > immediate_data_size) { | 1909 if (data_size > immediate_data_size) { |
1898 return error::kOutOfBounds; | 1910 return error::kOutOfBounds; |
1899 } | 1911 } |
1900 const GLint* params = GetImmediateDataAs<const GLint*>( | 1912 const GLint* params = GetImmediateDataAs<const GLint*>( |
1901 c, data_size, immediate_data_size); | 1913 c, data_size, immediate_data_size); |
1902 if (!validators_->texture_bind_target.IsValid(target)) { | 1914 if (!validators_->texture_bind_target.IsValid(target)) { |
1903 SetGLErrorInvalidEnum("glTexParameteriv", target, "target"); | 1915 SetGLErrorInvalidEnum("glTexParameteriv", target, "target"); |
1904 return error::kNoError; | 1916 return error::kNoError; |
1905 } | 1917 } |
1906 if (!validators_->texture_parameter.IsValid(pname)) { | 1918 if (!validators_->texture_parameter.IsValid(pname)) { |
1907 SetGLErrorInvalidEnum("glTexParameteriv", pname, "pname"); | 1919 SetGLErrorInvalidEnum("glTexParameteriv", pname, "pname"); |
1908 return error::kNoError; | 1920 return error::kNoError; |
1909 } | 1921 } |
1910 if (params == NULL) { | 1922 if (params == NULL) { |
1911 return error::kOutOfBounds; | 1923 return error::kOutOfBounds; |
1912 } | 1924 } |
1913 DoTexParameteriv(target, pname, params); | 1925 DoTexParameteriv(target, pname, params); |
1914 return error::kNoError; | 1926 return error::kNoError; |
1915 } | 1927 } |
1916 | 1928 |
1917 error::Error GLES2DecoderImpl::HandleUniform1f( | 1929 error::Error GLES2DecoderImpl::HandleUniform1f( |
1918 uint32 immediate_data_size, const gles2::Uniform1f& c) { | 1930 uint32 immediate_data_size, const gles2::cmds::Uniform1f& c) { |
1919 GLint location = static_cast<GLint>(c.location); | 1931 GLint location = static_cast<GLint>(c.location); |
1920 GLfloat x = static_cast<GLfloat>(c.x); | 1932 GLfloat x = static_cast<GLfloat>(c.x); |
1921 GLfloat temp[1] = { x, }; | 1933 GLfloat temp[1] = { x, }; |
1922 DoUniform1fv(location, 1, &temp[0]); | 1934 DoUniform1fv(location, 1, &temp[0]); |
1923 return error::kNoError; | 1935 return error::kNoError; |
1924 } | 1936 } |
1925 | 1937 |
1926 error::Error GLES2DecoderImpl::HandleUniform1fv( | 1938 error::Error GLES2DecoderImpl::HandleUniform1fv( |
1927 uint32 immediate_data_size, const gles2::Uniform1fv& c) { | 1939 uint32 immediate_data_size, const gles2::cmds::Uniform1fv& c) { |
1928 GLint location = static_cast<GLint>(c.location); | 1940 GLint location = static_cast<GLint>(c.location); |
1929 GLsizei count = static_cast<GLsizei>(c.count); | 1941 GLsizei count = static_cast<GLsizei>(c.count); |
1930 uint32 data_size; | 1942 uint32 data_size; |
1931 if (!ComputeDataSize(count, sizeof(GLfloat), 1, &data_size)) { | 1943 if (!ComputeDataSize(count, sizeof(GLfloat), 1, &data_size)) { |
1932 return error::kOutOfBounds; | 1944 return error::kOutOfBounds; |
1933 } | 1945 } |
1934 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 1946 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
1935 c.v_shm_id, c.v_shm_offset, data_size); | 1947 c.v_shm_id, c.v_shm_offset, data_size); |
1936 if (v == NULL) { | 1948 if (v == NULL) { |
1937 return error::kOutOfBounds; | 1949 return error::kOutOfBounds; |
1938 } | 1950 } |
1939 DoUniform1fv(location, count, v); | 1951 DoUniform1fv(location, count, v); |
1940 return error::kNoError; | 1952 return error::kNoError; |
1941 } | 1953 } |
1942 | 1954 |
1943 error::Error GLES2DecoderImpl::HandleUniform1fvImmediate( | 1955 error::Error GLES2DecoderImpl::HandleUniform1fvImmediate( |
1944 uint32 immediate_data_size, const gles2::Uniform1fvImmediate& c) { | 1956 uint32 immediate_data_size, const gles2::cmds::Uniform1fvImmediate& c) { |
1945 GLint location = static_cast<GLint>(c.location); | 1957 GLint location = static_cast<GLint>(c.location); |
1946 GLsizei count = static_cast<GLsizei>(c.count); | 1958 GLsizei count = static_cast<GLsizei>(c.count); |
1947 uint32 data_size; | 1959 uint32 data_size; |
1948 if (!ComputeDataSize(count, sizeof(GLfloat), 1, &data_size)) { | 1960 if (!ComputeDataSize(count, sizeof(GLfloat), 1, &data_size)) { |
1949 return error::kOutOfBounds; | 1961 return error::kOutOfBounds; |
1950 } | 1962 } |
1951 if (data_size > immediate_data_size) { | 1963 if (data_size > immediate_data_size) { |
1952 return error::kOutOfBounds; | 1964 return error::kOutOfBounds; |
1953 } | 1965 } |
1954 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( | 1966 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
1955 c, data_size, immediate_data_size); | 1967 c, data_size, immediate_data_size); |
1956 if (v == NULL) { | 1968 if (v == NULL) { |
1957 return error::kOutOfBounds; | 1969 return error::kOutOfBounds; |
1958 } | 1970 } |
1959 DoUniform1fv(location, count, v); | 1971 DoUniform1fv(location, count, v); |
1960 return error::kNoError; | 1972 return error::kNoError; |
1961 } | 1973 } |
1962 | 1974 |
1963 error::Error GLES2DecoderImpl::HandleUniform1i( | 1975 error::Error GLES2DecoderImpl::HandleUniform1i( |
1964 uint32 immediate_data_size, const gles2::Uniform1i& c) { | 1976 uint32 immediate_data_size, const gles2::cmds::Uniform1i& c) { |
1965 GLint location = static_cast<GLint>(c.location); | 1977 GLint location = static_cast<GLint>(c.location); |
1966 GLint x = static_cast<GLint>(c.x); | 1978 GLint x = static_cast<GLint>(c.x); |
1967 DoUniform1i(location, x); | 1979 DoUniform1i(location, x); |
1968 return error::kNoError; | 1980 return error::kNoError; |
1969 } | 1981 } |
1970 | 1982 |
1971 error::Error GLES2DecoderImpl::HandleUniform1iv( | 1983 error::Error GLES2DecoderImpl::HandleUniform1iv( |
1972 uint32 immediate_data_size, const gles2::Uniform1iv& c) { | 1984 uint32 immediate_data_size, const gles2::cmds::Uniform1iv& c) { |
1973 GLint location = static_cast<GLint>(c.location); | 1985 GLint location = static_cast<GLint>(c.location); |
1974 GLsizei count = static_cast<GLsizei>(c.count); | 1986 GLsizei count = static_cast<GLsizei>(c.count); |
1975 uint32 data_size; | 1987 uint32 data_size; |
1976 if (!ComputeDataSize(count, sizeof(GLint), 1, &data_size)) { | 1988 if (!ComputeDataSize(count, sizeof(GLint), 1, &data_size)) { |
1977 return error::kOutOfBounds; | 1989 return error::kOutOfBounds; |
1978 } | 1990 } |
1979 const GLint* v = GetSharedMemoryAs<const GLint*>( | 1991 const GLint* v = GetSharedMemoryAs<const GLint*>( |
1980 c.v_shm_id, c.v_shm_offset, data_size); | 1992 c.v_shm_id, c.v_shm_offset, data_size); |
1981 if (v == NULL) { | 1993 if (v == NULL) { |
1982 return error::kOutOfBounds; | 1994 return error::kOutOfBounds; |
1983 } | 1995 } |
1984 DoUniform1iv(location, count, v); | 1996 DoUniform1iv(location, count, v); |
1985 return error::kNoError; | 1997 return error::kNoError; |
1986 } | 1998 } |
1987 | 1999 |
1988 error::Error GLES2DecoderImpl::HandleUniform1ivImmediate( | 2000 error::Error GLES2DecoderImpl::HandleUniform1ivImmediate( |
1989 uint32 immediate_data_size, const gles2::Uniform1ivImmediate& c) { | 2001 uint32 immediate_data_size, const gles2::cmds::Uniform1ivImmediate& c) { |
1990 GLint location = static_cast<GLint>(c.location); | 2002 GLint location = static_cast<GLint>(c.location); |
1991 GLsizei count = static_cast<GLsizei>(c.count); | 2003 GLsizei count = static_cast<GLsizei>(c.count); |
1992 uint32 data_size; | 2004 uint32 data_size; |
1993 if (!ComputeDataSize(count, sizeof(GLint), 1, &data_size)) { | 2005 if (!ComputeDataSize(count, sizeof(GLint), 1, &data_size)) { |
1994 return error::kOutOfBounds; | 2006 return error::kOutOfBounds; |
1995 } | 2007 } |
1996 if (data_size > immediate_data_size) { | 2008 if (data_size > immediate_data_size) { |
1997 return error::kOutOfBounds; | 2009 return error::kOutOfBounds; |
1998 } | 2010 } |
1999 const GLint* v = GetImmediateDataAs<const GLint*>( | 2011 const GLint* v = GetImmediateDataAs<const GLint*>( |
2000 c, data_size, immediate_data_size); | 2012 c, data_size, immediate_data_size); |
2001 if (v == NULL) { | 2013 if (v == NULL) { |
2002 return error::kOutOfBounds; | 2014 return error::kOutOfBounds; |
2003 } | 2015 } |
2004 DoUniform1iv(location, count, v); | 2016 DoUniform1iv(location, count, v); |
2005 return error::kNoError; | 2017 return error::kNoError; |
2006 } | 2018 } |
2007 | 2019 |
2008 error::Error GLES2DecoderImpl::HandleUniform2f( | 2020 error::Error GLES2DecoderImpl::HandleUniform2f( |
2009 uint32 immediate_data_size, const gles2::Uniform2f& c) { | 2021 uint32 immediate_data_size, const gles2::cmds::Uniform2f& c) { |
2010 GLint location = static_cast<GLint>(c.location); | 2022 GLint location = static_cast<GLint>(c.location); |
2011 GLfloat x = static_cast<GLfloat>(c.x); | 2023 GLfloat x = static_cast<GLfloat>(c.x); |
2012 GLfloat y = static_cast<GLfloat>(c.y); | 2024 GLfloat y = static_cast<GLfloat>(c.y); |
2013 GLfloat temp[2] = { x, y, }; | 2025 GLfloat temp[2] = { x, y, }; |
2014 DoUniform2fv(location, 1, &temp[0]); | 2026 DoUniform2fv(location, 1, &temp[0]); |
2015 return error::kNoError; | 2027 return error::kNoError; |
2016 } | 2028 } |
2017 | 2029 |
2018 error::Error GLES2DecoderImpl::HandleUniform2fv( | 2030 error::Error GLES2DecoderImpl::HandleUniform2fv( |
2019 uint32 immediate_data_size, const gles2::Uniform2fv& c) { | 2031 uint32 immediate_data_size, const gles2::cmds::Uniform2fv& c) { |
2020 GLint location = static_cast<GLint>(c.location); | 2032 GLint location = static_cast<GLint>(c.location); |
2021 GLsizei count = static_cast<GLsizei>(c.count); | 2033 GLsizei count = static_cast<GLsizei>(c.count); |
2022 uint32 data_size; | 2034 uint32 data_size; |
2023 if (!ComputeDataSize(count, sizeof(GLfloat), 2, &data_size)) { | 2035 if (!ComputeDataSize(count, sizeof(GLfloat), 2, &data_size)) { |
2024 return error::kOutOfBounds; | 2036 return error::kOutOfBounds; |
2025 } | 2037 } |
2026 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 2038 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
2027 c.v_shm_id, c.v_shm_offset, data_size); | 2039 c.v_shm_id, c.v_shm_offset, data_size); |
2028 if (v == NULL) { | 2040 if (v == NULL) { |
2029 return error::kOutOfBounds; | 2041 return error::kOutOfBounds; |
2030 } | 2042 } |
2031 DoUniform2fv(location, count, v); | 2043 DoUniform2fv(location, count, v); |
2032 return error::kNoError; | 2044 return error::kNoError; |
2033 } | 2045 } |
2034 | 2046 |
2035 error::Error GLES2DecoderImpl::HandleUniform2fvImmediate( | 2047 error::Error GLES2DecoderImpl::HandleUniform2fvImmediate( |
2036 uint32 immediate_data_size, const gles2::Uniform2fvImmediate& c) { | 2048 uint32 immediate_data_size, const gles2::cmds::Uniform2fvImmediate& c) { |
2037 GLint location = static_cast<GLint>(c.location); | 2049 GLint location = static_cast<GLint>(c.location); |
2038 GLsizei count = static_cast<GLsizei>(c.count); | 2050 GLsizei count = static_cast<GLsizei>(c.count); |
2039 uint32 data_size; | 2051 uint32 data_size; |
2040 if (!ComputeDataSize(count, sizeof(GLfloat), 2, &data_size)) { | 2052 if (!ComputeDataSize(count, sizeof(GLfloat), 2, &data_size)) { |
2041 return error::kOutOfBounds; | 2053 return error::kOutOfBounds; |
2042 } | 2054 } |
2043 if (data_size > immediate_data_size) { | 2055 if (data_size > immediate_data_size) { |
2044 return error::kOutOfBounds; | 2056 return error::kOutOfBounds; |
2045 } | 2057 } |
2046 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( | 2058 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
2047 c, data_size, immediate_data_size); | 2059 c, data_size, immediate_data_size); |
2048 if (v == NULL) { | 2060 if (v == NULL) { |
2049 return error::kOutOfBounds; | 2061 return error::kOutOfBounds; |
2050 } | 2062 } |
2051 DoUniform2fv(location, count, v); | 2063 DoUniform2fv(location, count, v); |
2052 return error::kNoError; | 2064 return error::kNoError; |
2053 } | 2065 } |
2054 | 2066 |
2055 error::Error GLES2DecoderImpl::HandleUniform2i( | 2067 error::Error GLES2DecoderImpl::HandleUniform2i( |
2056 uint32 immediate_data_size, const gles2::Uniform2i& c) { | 2068 uint32 immediate_data_size, const gles2::cmds::Uniform2i& c) { |
2057 GLint location = static_cast<GLint>(c.location); | 2069 GLint location = static_cast<GLint>(c.location); |
2058 GLint x = static_cast<GLint>(c.x); | 2070 GLint x = static_cast<GLint>(c.x); |
2059 GLint y = static_cast<GLint>(c.y); | 2071 GLint y = static_cast<GLint>(c.y); |
2060 GLint temp[2] = { x, y, }; | 2072 GLint temp[2] = { x, y, }; |
2061 DoUniform2iv(location, 1, &temp[0]); | 2073 DoUniform2iv(location, 1, &temp[0]); |
2062 return error::kNoError; | 2074 return error::kNoError; |
2063 } | 2075 } |
2064 | 2076 |
2065 error::Error GLES2DecoderImpl::HandleUniform2iv( | 2077 error::Error GLES2DecoderImpl::HandleUniform2iv( |
2066 uint32 immediate_data_size, const gles2::Uniform2iv& c) { | 2078 uint32 immediate_data_size, const gles2::cmds::Uniform2iv& c) { |
2067 GLint location = static_cast<GLint>(c.location); | 2079 GLint location = static_cast<GLint>(c.location); |
2068 GLsizei count = static_cast<GLsizei>(c.count); | 2080 GLsizei count = static_cast<GLsizei>(c.count); |
2069 uint32 data_size; | 2081 uint32 data_size; |
2070 if (!ComputeDataSize(count, sizeof(GLint), 2, &data_size)) { | 2082 if (!ComputeDataSize(count, sizeof(GLint), 2, &data_size)) { |
2071 return error::kOutOfBounds; | 2083 return error::kOutOfBounds; |
2072 } | 2084 } |
2073 const GLint* v = GetSharedMemoryAs<const GLint*>( | 2085 const GLint* v = GetSharedMemoryAs<const GLint*>( |
2074 c.v_shm_id, c.v_shm_offset, data_size); | 2086 c.v_shm_id, c.v_shm_offset, data_size); |
2075 if (v == NULL) { | 2087 if (v == NULL) { |
2076 return error::kOutOfBounds; | 2088 return error::kOutOfBounds; |
2077 } | 2089 } |
2078 DoUniform2iv(location, count, v); | 2090 DoUniform2iv(location, count, v); |
2079 return error::kNoError; | 2091 return error::kNoError; |
2080 } | 2092 } |
2081 | 2093 |
2082 error::Error GLES2DecoderImpl::HandleUniform2ivImmediate( | 2094 error::Error GLES2DecoderImpl::HandleUniform2ivImmediate( |
2083 uint32 immediate_data_size, const gles2::Uniform2ivImmediate& c) { | 2095 uint32 immediate_data_size, const gles2::cmds::Uniform2ivImmediate& c) { |
2084 GLint location = static_cast<GLint>(c.location); | 2096 GLint location = static_cast<GLint>(c.location); |
2085 GLsizei count = static_cast<GLsizei>(c.count); | 2097 GLsizei count = static_cast<GLsizei>(c.count); |
2086 uint32 data_size; | 2098 uint32 data_size; |
2087 if (!ComputeDataSize(count, sizeof(GLint), 2, &data_size)) { | 2099 if (!ComputeDataSize(count, sizeof(GLint), 2, &data_size)) { |
2088 return error::kOutOfBounds; | 2100 return error::kOutOfBounds; |
2089 } | 2101 } |
2090 if (data_size > immediate_data_size) { | 2102 if (data_size > immediate_data_size) { |
2091 return error::kOutOfBounds; | 2103 return error::kOutOfBounds; |
2092 } | 2104 } |
2093 const GLint* v = GetImmediateDataAs<const GLint*>( | 2105 const GLint* v = GetImmediateDataAs<const GLint*>( |
2094 c, data_size, immediate_data_size); | 2106 c, data_size, immediate_data_size); |
2095 if (v == NULL) { | 2107 if (v == NULL) { |
2096 return error::kOutOfBounds; | 2108 return error::kOutOfBounds; |
2097 } | 2109 } |
2098 DoUniform2iv(location, count, v); | 2110 DoUniform2iv(location, count, v); |
2099 return error::kNoError; | 2111 return error::kNoError; |
2100 } | 2112 } |
2101 | 2113 |
2102 error::Error GLES2DecoderImpl::HandleUniform3f( | 2114 error::Error GLES2DecoderImpl::HandleUniform3f( |
2103 uint32 immediate_data_size, const gles2::Uniform3f& c) { | 2115 uint32 immediate_data_size, const gles2::cmds::Uniform3f& c) { |
2104 GLint location = static_cast<GLint>(c.location); | 2116 GLint location = static_cast<GLint>(c.location); |
2105 GLfloat x = static_cast<GLfloat>(c.x); | 2117 GLfloat x = static_cast<GLfloat>(c.x); |
2106 GLfloat y = static_cast<GLfloat>(c.y); | 2118 GLfloat y = static_cast<GLfloat>(c.y); |
2107 GLfloat z = static_cast<GLfloat>(c.z); | 2119 GLfloat z = static_cast<GLfloat>(c.z); |
2108 GLfloat temp[3] = { x, y, z, }; | 2120 GLfloat temp[3] = { x, y, z, }; |
2109 DoUniform3fv(location, 1, &temp[0]); | 2121 DoUniform3fv(location, 1, &temp[0]); |
2110 return error::kNoError; | 2122 return error::kNoError; |
2111 } | 2123 } |
2112 | 2124 |
2113 error::Error GLES2DecoderImpl::HandleUniform3fv( | 2125 error::Error GLES2DecoderImpl::HandleUniform3fv( |
2114 uint32 immediate_data_size, const gles2::Uniform3fv& c) { | 2126 uint32 immediate_data_size, const gles2::cmds::Uniform3fv& c) { |
2115 GLint location = static_cast<GLint>(c.location); | 2127 GLint location = static_cast<GLint>(c.location); |
2116 GLsizei count = static_cast<GLsizei>(c.count); | 2128 GLsizei count = static_cast<GLsizei>(c.count); |
2117 uint32 data_size; | 2129 uint32 data_size; |
2118 if (!ComputeDataSize(count, sizeof(GLfloat), 3, &data_size)) { | 2130 if (!ComputeDataSize(count, sizeof(GLfloat), 3, &data_size)) { |
2119 return error::kOutOfBounds; | 2131 return error::kOutOfBounds; |
2120 } | 2132 } |
2121 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 2133 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
2122 c.v_shm_id, c.v_shm_offset, data_size); | 2134 c.v_shm_id, c.v_shm_offset, data_size); |
2123 if (v == NULL) { | 2135 if (v == NULL) { |
2124 return error::kOutOfBounds; | 2136 return error::kOutOfBounds; |
2125 } | 2137 } |
2126 DoUniform3fv(location, count, v); | 2138 DoUniform3fv(location, count, v); |
2127 return error::kNoError; | 2139 return error::kNoError; |
2128 } | 2140 } |
2129 | 2141 |
2130 error::Error GLES2DecoderImpl::HandleUniform3fvImmediate( | 2142 error::Error GLES2DecoderImpl::HandleUniform3fvImmediate( |
2131 uint32 immediate_data_size, const gles2::Uniform3fvImmediate& c) { | 2143 uint32 immediate_data_size, const gles2::cmds::Uniform3fvImmediate& c) { |
2132 GLint location = static_cast<GLint>(c.location); | 2144 GLint location = static_cast<GLint>(c.location); |
2133 GLsizei count = static_cast<GLsizei>(c.count); | 2145 GLsizei count = static_cast<GLsizei>(c.count); |
2134 uint32 data_size; | 2146 uint32 data_size; |
2135 if (!ComputeDataSize(count, sizeof(GLfloat), 3, &data_size)) { | 2147 if (!ComputeDataSize(count, sizeof(GLfloat), 3, &data_size)) { |
2136 return error::kOutOfBounds; | 2148 return error::kOutOfBounds; |
2137 } | 2149 } |
2138 if (data_size > immediate_data_size) { | 2150 if (data_size > immediate_data_size) { |
2139 return error::kOutOfBounds; | 2151 return error::kOutOfBounds; |
2140 } | 2152 } |
2141 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( | 2153 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
2142 c, data_size, immediate_data_size); | 2154 c, data_size, immediate_data_size); |
2143 if (v == NULL) { | 2155 if (v == NULL) { |
2144 return error::kOutOfBounds; | 2156 return error::kOutOfBounds; |
2145 } | 2157 } |
2146 DoUniform3fv(location, count, v); | 2158 DoUniform3fv(location, count, v); |
2147 return error::kNoError; | 2159 return error::kNoError; |
2148 } | 2160 } |
2149 | 2161 |
2150 error::Error GLES2DecoderImpl::HandleUniform3i( | 2162 error::Error GLES2DecoderImpl::HandleUniform3i( |
2151 uint32 immediate_data_size, const gles2::Uniform3i& c) { | 2163 uint32 immediate_data_size, const gles2::cmds::Uniform3i& c) { |
2152 GLint location = static_cast<GLint>(c.location); | 2164 GLint location = static_cast<GLint>(c.location); |
2153 GLint x = static_cast<GLint>(c.x); | 2165 GLint x = static_cast<GLint>(c.x); |
2154 GLint y = static_cast<GLint>(c.y); | 2166 GLint y = static_cast<GLint>(c.y); |
2155 GLint z = static_cast<GLint>(c.z); | 2167 GLint z = static_cast<GLint>(c.z); |
2156 GLint temp[3] = { x, y, z, }; | 2168 GLint temp[3] = { x, y, z, }; |
2157 DoUniform3iv(location, 1, &temp[0]); | 2169 DoUniform3iv(location, 1, &temp[0]); |
2158 return error::kNoError; | 2170 return error::kNoError; |
2159 } | 2171 } |
2160 | 2172 |
2161 error::Error GLES2DecoderImpl::HandleUniform3iv( | 2173 error::Error GLES2DecoderImpl::HandleUniform3iv( |
2162 uint32 immediate_data_size, const gles2::Uniform3iv& c) { | 2174 uint32 immediate_data_size, const gles2::cmds::Uniform3iv& c) { |
2163 GLint location = static_cast<GLint>(c.location); | 2175 GLint location = static_cast<GLint>(c.location); |
2164 GLsizei count = static_cast<GLsizei>(c.count); | 2176 GLsizei count = static_cast<GLsizei>(c.count); |
2165 uint32 data_size; | 2177 uint32 data_size; |
2166 if (!ComputeDataSize(count, sizeof(GLint), 3, &data_size)) { | 2178 if (!ComputeDataSize(count, sizeof(GLint), 3, &data_size)) { |
2167 return error::kOutOfBounds; | 2179 return error::kOutOfBounds; |
2168 } | 2180 } |
2169 const GLint* v = GetSharedMemoryAs<const GLint*>( | 2181 const GLint* v = GetSharedMemoryAs<const GLint*>( |
2170 c.v_shm_id, c.v_shm_offset, data_size); | 2182 c.v_shm_id, c.v_shm_offset, data_size); |
2171 if (v == NULL) { | 2183 if (v == NULL) { |
2172 return error::kOutOfBounds; | 2184 return error::kOutOfBounds; |
2173 } | 2185 } |
2174 DoUniform3iv(location, count, v); | 2186 DoUniform3iv(location, count, v); |
2175 return error::kNoError; | 2187 return error::kNoError; |
2176 } | 2188 } |
2177 | 2189 |
2178 error::Error GLES2DecoderImpl::HandleUniform3ivImmediate( | 2190 error::Error GLES2DecoderImpl::HandleUniform3ivImmediate( |
2179 uint32 immediate_data_size, const gles2::Uniform3ivImmediate& c) { | 2191 uint32 immediate_data_size, const gles2::cmds::Uniform3ivImmediate& c) { |
2180 GLint location = static_cast<GLint>(c.location); | 2192 GLint location = static_cast<GLint>(c.location); |
2181 GLsizei count = static_cast<GLsizei>(c.count); | 2193 GLsizei count = static_cast<GLsizei>(c.count); |
2182 uint32 data_size; | 2194 uint32 data_size; |
2183 if (!ComputeDataSize(count, sizeof(GLint), 3, &data_size)) { | 2195 if (!ComputeDataSize(count, sizeof(GLint), 3, &data_size)) { |
2184 return error::kOutOfBounds; | 2196 return error::kOutOfBounds; |
2185 } | 2197 } |
2186 if (data_size > immediate_data_size) { | 2198 if (data_size > immediate_data_size) { |
2187 return error::kOutOfBounds; | 2199 return error::kOutOfBounds; |
2188 } | 2200 } |
2189 const GLint* v = GetImmediateDataAs<const GLint*>( | 2201 const GLint* v = GetImmediateDataAs<const GLint*>( |
2190 c, data_size, immediate_data_size); | 2202 c, data_size, immediate_data_size); |
2191 if (v == NULL) { | 2203 if (v == NULL) { |
2192 return error::kOutOfBounds; | 2204 return error::kOutOfBounds; |
2193 } | 2205 } |
2194 DoUniform3iv(location, count, v); | 2206 DoUniform3iv(location, count, v); |
2195 return error::kNoError; | 2207 return error::kNoError; |
2196 } | 2208 } |
2197 | 2209 |
2198 error::Error GLES2DecoderImpl::HandleUniform4f( | 2210 error::Error GLES2DecoderImpl::HandleUniform4f( |
2199 uint32 immediate_data_size, const gles2::Uniform4f& c) { | 2211 uint32 immediate_data_size, const gles2::cmds::Uniform4f& c) { |
2200 GLint location = static_cast<GLint>(c.location); | 2212 GLint location = static_cast<GLint>(c.location); |
2201 GLfloat x = static_cast<GLfloat>(c.x); | 2213 GLfloat x = static_cast<GLfloat>(c.x); |
2202 GLfloat y = static_cast<GLfloat>(c.y); | 2214 GLfloat y = static_cast<GLfloat>(c.y); |
2203 GLfloat z = static_cast<GLfloat>(c.z); | 2215 GLfloat z = static_cast<GLfloat>(c.z); |
2204 GLfloat w = static_cast<GLfloat>(c.w); | 2216 GLfloat w = static_cast<GLfloat>(c.w); |
2205 GLfloat temp[4] = { x, y, z, w, }; | 2217 GLfloat temp[4] = { x, y, z, w, }; |
2206 DoUniform4fv(location, 1, &temp[0]); | 2218 DoUniform4fv(location, 1, &temp[0]); |
2207 return error::kNoError; | 2219 return error::kNoError; |
2208 } | 2220 } |
2209 | 2221 |
2210 error::Error GLES2DecoderImpl::HandleUniform4fv( | 2222 error::Error GLES2DecoderImpl::HandleUniform4fv( |
2211 uint32 immediate_data_size, const gles2::Uniform4fv& c) { | 2223 uint32 immediate_data_size, const gles2::cmds::Uniform4fv& c) { |
2212 GLint location = static_cast<GLint>(c.location); | 2224 GLint location = static_cast<GLint>(c.location); |
2213 GLsizei count = static_cast<GLsizei>(c.count); | 2225 GLsizei count = static_cast<GLsizei>(c.count); |
2214 uint32 data_size; | 2226 uint32 data_size; |
2215 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { | 2227 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { |
2216 return error::kOutOfBounds; | 2228 return error::kOutOfBounds; |
2217 } | 2229 } |
2218 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 2230 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
2219 c.v_shm_id, c.v_shm_offset, data_size); | 2231 c.v_shm_id, c.v_shm_offset, data_size); |
2220 if (v == NULL) { | 2232 if (v == NULL) { |
2221 return error::kOutOfBounds; | 2233 return error::kOutOfBounds; |
2222 } | 2234 } |
2223 DoUniform4fv(location, count, v); | 2235 DoUniform4fv(location, count, v); |
2224 return error::kNoError; | 2236 return error::kNoError; |
2225 } | 2237 } |
2226 | 2238 |
2227 error::Error GLES2DecoderImpl::HandleUniform4fvImmediate( | 2239 error::Error GLES2DecoderImpl::HandleUniform4fvImmediate( |
2228 uint32 immediate_data_size, const gles2::Uniform4fvImmediate& c) { | 2240 uint32 immediate_data_size, const gles2::cmds::Uniform4fvImmediate& c) { |
2229 GLint location = static_cast<GLint>(c.location); | 2241 GLint location = static_cast<GLint>(c.location); |
2230 GLsizei count = static_cast<GLsizei>(c.count); | 2242 GLsizei count = static_cast<GLsizei>(c.count); |
2231 uint32 data_size; | 2243 uint32 data_size; |
2232 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { | 2244 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { |
2233 return error::kOutOfBounds; | 2245 return error::kOutOfBounds; |
2234 } | 2246 } |
2235 if (data_size > immediate_data_size) { | 2247 if (data_size > immediate_data_size) { |
2236 return error::kOutOfBounds; | 2248 return error::kOutOfBounds; |
2237 } | 2249 } |
2238 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( | 2250 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
2239 c, data_size, immediate_data_size); | 2251 c, data_size, immediate_data_size); |
2240 if (v == NULL) { | 2252 if (v == NULL) { |
2241 return error::kOutOfBounds; | 2253 return error::kOutOfBounds; |
2242 } | 2254 } |
2243 DoUniform4fv(location, count, v); | 2255 DoUniform4fv(location, count, v); |
2244 return error::kNoError; | 2256 return error::kNoError; |
2245 } | 2257 } |
2246 | 2258 |
2247 error::Error GLES2DecoderImpl::HandleUniform4i( | 2259 error::Error GLES2DecoderImpl::HandleUniform4i( |
2248 uint32 immediate_data_size, const gles2::Uniform4i& c) { | 2260 uint32 immediate_data_size, const gles2::cmds::Uniform4i& c) { |
2249 GLint location = static_cast<GLint>(c.location); | 2261 GLint location = static_cast<GLint>(c.location); |
2250 GLint x = static_cast<GLint>(c.x); | 2262 GLint x = static_cast<GLint>(c.x); |
2251 GLint y = static_cast<GLint>(c.y); | 2263 GLint y = static_cast<GLint>(c.y); |
2252 GLint z = static_cast<GLint>(c.z); | 2264 GLint z = static_cast<GLint>(c.z); |
2253 GLint w = static_cast<GLint>(c.w); | 2265 GLint w = static_cast<GLint>(c.w); |
2254 GLint temp[4] = { x, y, z, w, }; | 2266 GLint temp[4] = { x, y, z, w, }; |
2255 DoUniform4iv(location, 1, &temp[0]); | 2267 DoUniform4iv(location, 1, &temp[0]); |
2256 return error::kNoError; | 2268 return error::kNoError; |
2257 } | 2269 } |
2258 | 2270 |
2259 error::Error GLES2DecoderImpl::HandleUniform4iv( | 2271 error::Error GLES2DecoderImpl::HandleUniform4iv( |
2260 uint32 immediate_data_size, const gles2::Uniform4iv& c) { | 2272 uint32 immediate_data_size, const gles2::cmds::Uniform4iv& c) { |
2261 GLint location = static_cast<GLint>(c.location); | 2273 GLint location = static_cast<GLint>(c.location); |
2262 GLsizei count = static_cast<GLsizei>(c.count); | 2274 GLsizei count = static_cast<GLsizei>(c.count); |
2263 uint32 data_size; | 2275 uint32 data_size; |
2264 if (!ComputeDataSize(count, sizeof(GLint), 4, &data_size)) { | 2276 if (!ComputeDataSize(count, sizeof(GLint), 4, &data_size)) { |
2265 return error::kOutOfBounds; | 2277 return error::kOutOfBounds; |
2266 } | 2278 } |
2267 const GLint* v = GetSharedMemoryAs<const GLint*>( | 2279 const GLint* v = GetSharedMemoryAs<const GLint*>( |
2268 c.v_shm_id, c.v_shm_offset, data_size); | 2280 c.v_shm_id, c.v_shm_offset, data_size); |
2269 if (v == NULL) { | 2281 if (v == NULL) { |
2270 return error::kOutOfBounds; | 2282 return error::kOutOfBounds; |
2271 } | 2283 } |
2272 DoUniform4iv(location, count, v); | 2284 DoUniform4iv(location, count, v); |
2273 return error::kNoError; | 2285 return error::kNoError; |
2274 } | 2286 } |
2275 | 2287 |
2276 error::Error GLES2DecoderImpl::HandleUniform4ivImmediate( | 2288 error::Error GLES2DecoderImpl::HandleUniform4ivImmediate( |
2277 uint32 immediate_data_size, const gles2::Uniform4ivImmediate& c) { | 2289 uint32 immediate_data_size, const gles2::cmds::Uniform4ivImmediate& c) { |
2278 GLint location = static_cast<GLint>(c.location); | 2290 GLint location = static_cast<GLint>(c.location); |
2279 GLsizei count = static_cast<GLsizei>(c.count); | 2291 GLsizei count = static_cast<GLsizei>(c.count); |
2280 uint32 data_size; | 2292 uint32 data_size; |
2281 if (!ComputeDataSize(count, sizeof(GLint), 4, &data_size)) { | 2293 if (!ComputeDataSize(count, sizeof(GLint), 4, &data_size)) { |
2282 return error::kOutOfBounds; | 2294 return error::kOutOfBounds; |
2283 } | 2295 } |
2284 if (data_size > immediate_data_size) { | 2296 if (data_size > immediate_data_size) { |
2285 return error::kOutOfBounds; | 2297 return error::kOutOfBounds; |
2286 } | 2298 } |
2287 const GLint* v = GetImmediateDataAs<const GLint*>( | 2299 const GLint* v = GetImmediateDataAs<const GLint*>( |
2288 c, data_size, immediate_data_size); | 2300 c, data_size, immediate_data_size); |
2289 if (v == NULL) { | 2301 if (v == NULL) { |
2290 return error::kOutOfBounds; | 2302 return error::kOutOfBounds; |
2291 } | 2303 } |
2292 DoUniform4iv(location, count, v); | 2304 DoUniform4iv(location, count, v); |
2293 return error::kNoError; | 2305 return error::kNoError; |
2294 } | 2306 } |
2295 | 2307 |
2296 error::Error GLES2DecoderImpl::HandleUniformMatrix2fv( | 2308 error::Error GLES2DecoderImpl::HandleUniformMatrix2fv( |
2297 uint32 immediate_data_size, const gles2::UniformMatrix2fv& c) { | 2309 uint32 immediate_data_size, const gles2::cmds::UniformMatrix2fv& c) { |
2298 GLint location = static_cast<GLint>(c.location); | 2310 GLint location = static_cast<GLint>(c.location); |
2299 GLsizei count = static_cast<GLsizei>(c.count); | 2311 GLsizei count = static_cast<GLsizei>(c.count); |
2300 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2312 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
2301 uint32 data_size; | 2313 uint32 data_size; |
2302 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { | 2314 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { |
2303 return error::kOutOfBounds; | 2315 return error::kOutOfBounds; |
2304 } | 2316 } |
2305 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( | 2317 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
2306 c.value_shm_id, c.value_shm_offset, data_size); | 2318 c.value_shm_id, c.value_shm_offset, data_size); |
2307 if (!validators_->false_only.IsValid(transpose)) { | 2319 if (!validators_->false_only.IsValid(transpose)) { |
2308 SetGLError( | 2320 SetGLError( |
2309 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose GL_INVALID_VALUE"); | 2321 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose GL_INVALID_VALUE"); |
2310 return error::kNoError; | 2322 return error::kNoError; |
2311 } | 2323 } |
2312 if (value == NULL) { | 2324 if (value == NULL) { |
2313 return error::kOutOfBounds; | 2325 return error::kOutOfBounds; |
2314 } | 2326 } |
2315 DoUniformMatrix2fv(location, count, transpose, value); | 2327 DoUniformMatrix2fv(location, count, transpose, value); |
2316 return error::kNoError; | 2328 return error::kNoError; |
2317 } | 2329 } |
2318 | 2330 |
2319 error::Error GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( | 2331 error::Error GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( |
2320 uint32 immediate_data_size, const gles2::UniformMatrix2fvImmediate& c) { | 2332 uint32 immediate_data_size, |
| 2333 const gles2::cmds::UniformMatrix2fvImmediate& c) { |
2321 GLint location = static_cast<GLint>(c.location); | 2334 GLint location = static_cast<GLint>(c.location); |
2322 GLsizei count = static_cast<GLsizei>(c.count); | 2335 GLsizei count = static_cast<GLsizei>(c.count); |
2323 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2336 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
2324 uint32 data_size; | 2337 uint32 data_size; |
2325 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { | 2338 if (!ComputeDataSize(count, sizeof(GLfloat), 4, &data_size)) { |
2326 return error::kOutOfBounds; | 2339 return error::kOutOfBounds; |
2327 } | 2340 } |
2328 if (data_size > immediate_data_size) { | 2341 if (data_size > immediate_data_size) { |
2329 return error::kOutOfBounds; | 2342 return error::kOutOfBounds; |
2330 } | 2343 } |
2331 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( | 2344 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( |
2332 c, data_size, immediate_data_size); | 2345 c, data_size, immediate_data_size); |
2333 if (!validators_->false_only.IsValid(transpose)) { | 2346 if (!validators_->false_only.IsValid(transpose)) { |
2334 SetGLError( | 2347 SetGLError( |
2335 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose GL_INVALID_VALUE"); | 2348 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose GL_INVALID_VALUE"); |
2336 return error::kNoError; | 2349 return error::kNoError; |
2337 } | 2350 } |
2338 if (value == NULL) { | 2351 if (value == NULL) { |
2339 return error::kOutOfBounds; | 2352 return error::kOutOfBounds; |
2340 } | 2353 } |
2341 DoUniformMatrix2fv(location, count, transpose, value); | 2354 DoUniformMatrix2fv(location, count, transpose, value); |
2342 return error::kNoError; | 2355 return error::kNoError; |
2343 } | 2356 } |
2344 | 2357 |
2345 error::Error GLES2DecoderImpl::HandleUniformMatrix3fv( | 2358 error::Error GLES2DecoderImpl::HandleUniformMatrix3fv( |
2346 uint32 immediate_data_size, const gles2::UniformMatrix3fv& c) { | 2359 uint32 immediate_data_size, const gles2::cmds::UniformMatrix3fv& c) { |
2347 GLint location = static_cast<GLint>(c.location); | 2360 GLint location = static_cast<GLint>(c.location); |
2348 GLsizei count = static_cast<GLsizei>(c.count); | 2361 GLsizei count = static_cast<GLsizei>(c.count); |
2349 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2362 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
2350 uint32 data_size; | 2363 uint32 data_size; |
2351 if (!ComputeDataSize(count, sizeof(GLfloat), 9, &data_size)) { | 2364 if (!ComputeDataSize(count, sizeof(GLfloat), 9, &data_size)) { |
2352 return error::kOutOfBounds; | 2365 return error::kOutOfBounds; |
2353 } | 2366 } |
2354 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( | 2367 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
2355 c.value_shm_id, c.value_shm_offset, data_size); | 2368 c.value_shm_id, c.value_shm_offset, data_size); |
2356 if (!validators_->false_only.IsValid(transpose)) { | 2369 if (!validators_->false_only.IsValid(transpose)) { |
2357 SetGLError( | 2370 SetGLError( |
2358 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose GL_INVALID_VALUE"); | 2371 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose GL_INVALID_VALUE"); |
2359 return error::kNoError; | 2372 return error::kNoError; |
2360 } | 2373 } |
2361 if (value == NULL) { | 2374 if (value == NULL) { |
2362 return error::kOutOfBounds; | 2375 return error::kOutOfBounds; |
2363 } | 2376 } |
2364 DoUniformMatrix3fv(location, count, transpose, value); | 2377 DoUniformMatrix3fv(location, count, transpose, value); |
2365 return error::kNoError; | 2378 return error::kNoError; |
2366 } | 2379 } |
2367 | 2380 |
2368 error::Error GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( | 2381 error::Error GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( |
2369 uint32 immediate_data_size, const gles2::UniformMatrix3fvImmediate& c) { | 2382 uint32 immediate_data_size, |
| 2383 const gles2::cmds::UniformMatrix3fvImmediate& c) { |
2370 GLint location = static_cast<GLint>(c.location); | 2384 GLint location = static_cast<GLint>(c.location); |
2371 GLsizei count = static_cast<GLsizei>(c.count); | 2385 GLsizei count = static_cast<GLsizei>(c.count); |
2372 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2386 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
2373 uint32 data_size; | 2387 uint32 data_size; |
2374 if (!ComputeDataSize(count, sizeof(GLfloat), 9, &data_size)) { | 2388 if (!ComputeDataSize(count, sizeof(GLfloat), 9, &data_size)) { |
2375 return error::kOutOfBounds; | 2389 return error::kOutOfBounds; |
2376 } | 2390 } |
2377 if (data_size > immediate_data_size) { | 2391 if (data_size > immediate_data_size) { |
2378 return error::kOutOfBounds; | 2392 return error::kOutOfBounds; |
2379 } | 2393 } |
2380 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( | 2394 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( |
2381 c, data_size, immediate_data_size); | 2395 c, data_size, immediate_data_size); |
2382 if (!validators_->false_only.IsValid(transpose)) { | 2396 if (!validators_->false_only.IsValid(transpose)) { |
2383 SetGLError( | 2397 SetGLError( |
2384 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose GL_INVALID_VALUE"); | 2398 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose GL_INVALID_VALUE"); |
2385 return error::kNoError; | 2399 return error::kNoError; |
2386 } | 2400 } |
2387 if (value == NULL) { | 2401 if (value == NULL) { |
2388 return error::kOutOfBounds; | 2402 return error::kOutOfBounds; |
2389 } | 2403 } |
2390 DoUniformMatrix3fv(location, count, transpose, value); | 2404 DoUniformMatrix3fv(location, count, transpose, value); |
2391 return error::kNoError; | 2405 return error::kNoError; |
2392 } | 2406 } |
2393 | 2407 |
2394 error::Error GLES2DecoderImpl::HandleUniformMatrix4fv( | 2408 error::Error GLES2DecoderImpl::HandleUniformMatrix4fv( |
2395 uint32 immediate_data_size, const gles2::UniformMatrix4fv& c) { | 2409 uint32 immediate_data_size, const gles2::cmds::UniformMatrix4fv& c) { |
2396 GLint location = static_cast<GLint>(c.location); | 2410 GLint location = static_cast<GLint>(c.location); |
2397 GLsizei count = static_cast<GLsizei>(c.count); | 2411 GLsizei count = static_cast<GLsizei>(c.count); |
2398 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2412 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
2399 uint32 data_size; | 2413 uint32 data_size; |
2400 if (!ComputeDataSize(count, sizeof(GLfloat), 16, &data_size)) { | 2414 if (!ComputeDataSize(count, sizeof(GLfloat), 16, &data_size)) { |
2401 return error::kOutOfBounds; | 2415 return error::kOutOfBounds; |
2402 } | 2416 } |
2403 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( | 2417 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
2404 c.value_shm_id, c.value_shm_offset, data_size); | 2418 c.value_shm_id, c.value_shm_offset, data_size); |
2405 if (!validators_->false_only.IsValid(transpose)) { | 2419 if (!validators_->false_only.IsValid(transpose)) { |
2406 SetGLError( | 2420 SetGLError( |
2407 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose GL_INVALID_VALUE"); | 2421 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose GL_INVALID_VALUE"); |
2408 return error::kNoError; | 2422 return error::kNoError; |
2409 } | 2423 } |
2410 if (value == NULL) { | 2424 if (value == NULL) { |
2411 return error::kOutOfBounds; | 2425 return error::kOutOfBounds; |
2412 } | 2426 } |
2413 DoUniformMatrix4fv(location, count, transpose, value); | 2427 DoUniformMatrix4fv(location, count, transpose, value); |
2414 return error::kNoError; | 2428 return error::kNoError; |
2415 } | 2429 } |
2416 | 2430 |
2417 error::Error GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( | 2431 error::Error GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( |
2418 uint32 immediate_data_size, const gles2::UniformMatrix4fvImmediate& c) { | 2432 uint32 immediate_data_size, |
| 2433 const gles2::cmds::UniformMatrix4fvImmediate& c) { |
2419 GLint location = static_cast<GLint>(c.location); | 2434 GLint location = static_cast<GLint>(c.location); |
2420 GLsizei count = static_cast<GLsizei>(c.count); | 2435 GLsizei count = static_cast<GLsizei>(c.count); |
2421 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2436 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
2422 uint32 data_size; | 2437 uint32 data_size; |
2423 if (!ComputeDataSize(count, sizeof(GLfloat), 16, &data_size)) { | 2438 if (!ComputeDataSize(count, sizeof(GLfloat), 16, &data_size)) { |
2424 return error::kOutOfBounds; | 2439 return error::kOutOfBounds; |
2425 } | 2440 } |
2426 if (data_size > immediate_data_size) { | 2441 if (data_size > immediate_data_size) { |
2427 return error::kOutOfBounds; | 2442 return error::kOutOfBounds; |
2428 } | 2443 } |
2429 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( | 2444 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( |
2430 c, data_size, immediate_data_size); | 2445 c, data_size, immediate_data_size); |
2431 if (!validators_->false_only.IsValid(transpose)) { | 2446 if (!validators_->false_only.IsValid(transpose)) { |
2432 SetGLError( | 2447 SetGLError( |
2433 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose GL_INVALID_VALUE"); | 2448 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose GL_INVALID_VALUE"); |
2434 return error::kNoError; | 2449 return error::kNoError; |
2435 } | 2450 } |
2436 if (value == NULL) { | 2451 if (value == NULL) { |
2437 return error::kOutOfBounds; | 2452 return error::kOutOfBounds; |
2438 } | 2453 } |
2439 DoUniformMatrix4fv(location, count, transpose, value); | 2454 DoUniformMatrix4fv(location, count, transpose, value); |
2440 return error::kNoError; | 2455 return error::kNoError; |
2441 } | 2456 } |
2442 | 2457 |
2443 error::Error GLES2DecoderImpl::HandleUseProgram( | 2458 error::Error GLES2DecoderImpl::HandleUseProgram( |
2444 uint32 immediate_data_size, const gles2::UseProgram& c) { | 2459 uint32 immediate_data_size, const gles2::cmds::UseProgram& c) { |
2445 GLuint program = c.program; | 2460 GLuint program = c.program; |
2446 DoUseProgram(program); | 2461 DoUseProgram(program); |
2447 return error::kNoError; | 2462 return error::kNoError; |
2448 } | 2463 } |
2449 | 2464 |
2450 error::Error GLES2DecoderImpl::HandleValidateProgram( | 2465 error::Error GLES2DecoderImpl::HandleValidateProgram( |
2451 uint32 immediate_data_size, const gles2::ValidateProgram& c) { | 2466 uint32 immediate_data_size, const gles2::cmds::ValidateProgram& c) { |
2452 GLuint program = c.program; | 2467 GLuint program = c.program; |
2453 DoValidateProgram(program); | 2468 DoValidateProgram(program); |
2454 return error::kNoError; | 2469 return error::kNoError; |
2455 } | 2470 } |
2456 | 2471 |
2457 error::Error GLES2DecoderImpl::HandleVertexAttrib1f( | 2472 error::Error GLES2DecoderImpl::HandleVertexAttrib1f( |
2458 uint32 immediate_data_size, const gles2::VertexAttrib1f& c) { | 2473 uint32 immediate_data_size, const gles2::cmds::VertexAttrib1f& c) { |
2459 GLuint indx = static_cast<GLuint>(c.indx); | 2474 GLuint indx = static_cast<GLuint>(c.indx); |
2460 GLfloat x = static_cast<GLfloat>(c.x); | 2475 GLfloat x = static_cast<GLfloat>(c.x); |
2461 DoVertexAttrib1f(indx, x); | 2476 DoVertexAttrib1f(indx, x); |
2462 return error::kNoError; | 2477 return error::kNoError; |
2463 } | 2478 } |
2464 | 2479 |
2465 error::Error GLES2DecoderImpl::HandleVertexAttrib1fv( | 2480 error::Error GLES2DecoderImpl::HandleVertexAttrib1fv( |
2466 uint32 immediate_data_size, const gles2::VertexAttrib1fv& c) { | 2481 uint32 immediate_data_size, const gles2::cmds::VertexAttrib1fv& c) { |
2467 GLuint indx = static_cast<GLuint>(c.indx); | 2482 GLuint indx = static_cast<GLuint>(c.indx); |
2468 uint32 data_size; | 2483 uint32 data_size; |
2469 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { | 2484 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { |
2470 return error::kOutOfBounds; | 2485 return error::kOutOfBounds; |
2471 } | 2486 } |
2472 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2487 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
2473 c.values_shm_id, c.values_shm_offset, data_size); | 2488 c.values_shm_id, c.values_shm_offset, data_size); |
2474 if (values == NULL) { | 2489 if (values == NULL) { |
2475 return error::kOutOfBounds; | 2490 return error::kOutOfBounds; |
2476 } | 2491 } |
2477 DoVertexAttrib1fv(indx, values); | 2492 DoVertexAttrib1fv(indx, values); |
2478 return error::kNoError; | 2493 return error::kNoError; |
2479 } | 2494 } |
2480 | 2495 |
2481 error::Error GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( | 2496 error::Error GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( |
2482 uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) { | 2497 uint32 immediate_data_size, |
| 2498 const gles2::cmds::VertexAttrib1fvImmediate& c) { |
2483 GLuint indx = static_cast<GLuint>(c.indx); | 2499 GLuint indx = static_cast<GLuint>(c.indx); |
2484 uint32 data_size; | 2500 uint32 data_size; |
2485 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { | 2501 if (!ComputeDataSize(1, sizeof(GLfloat), 1, &data_size)) { |
2486 return error::kOutOfBounds; | 2502 return error::kOutOfBounds; |
2487 } | 2503 } |
2488 if (data_size > immediate_data_size) { | 2504 if (data_size > immediate_data_size) { |
2489 return error::kOutOfBounds; | 2505 return error::kOutOfBounds; |
2490 } | 2506 } |
2491 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( | 2507 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
2492 c, data_size, immediate_data_size); | 2508 c, data_size, immediate_data_size); |
2493 if (values == NULL) { | 2509 if (values == NULL) { |
2494 return error::kOutOfBounds; | 2510 return error::kOutOfBounds; |
2495 } | 2511 } |
2496 DoVertexAttrib1fv(indx, values); | 2512 DoVertexAttrib1fv(indx, values); |
2497 return error::kNoError; | 2513 return error::kNoError; |
2498 } | 2514 } |
2499 | 2515 |
2500 error::Error GLES2DecoderImpl::HandleVertexAttrib2f( | 2516 error::Error GLES2DecoderImpl::HandleVertexAttrib2f( |
2501 uint32 immediate_data_size, const gles2::VertexAttrib2f& c) { | 2517 uint32 immediate_data_size, const gles2::cmds::VertexAttrib2f& c) { |
2502 GLuint indx = static_cast<GLuint>(c.indx); | 2518 GLuint indx = static_cast<GLuint>(c.indx); |
2503 GLfloat x = static_cast<GLfloat>(c.x); | 2519 GLfloat x = static_cast<GLfloat>(c.x); |
2504 GLfloat y = static_cast<GLfloat>(c.y); | 2520 GLfloat y = static_cast<GLfloat>(c.y); |
2505 DoVertexAttrib2f(indx, x, y); | 2521 DoVertexAttrib2f(indx, x, y); |
2506 return error::kNoError; | 2522 return error::kNoError; |
2507 } | 2523 } |
2508 | 2524 |
2509 error::Error GLES2DecoderImpl::HandleVertexAttrib2fv( | 2525 error::Error GLES2DecoderImpl::HandleVertexAttrib2fv( |
2510 uint32 immediate_data_size, const gles2::VertexAttrib2fv& c) { | 2526 uint32 immediate_data_size, const gles2::cmds::VertexAttrib2fv& c) { |
2511 GLuint indx = static_cast<GLuint>(c.indx); | 2527 GLuint indx = static_cast<GLuint>(c.indx); |
2512 uint32 data_size; | 2528 uint32 data_size; |
2513 if (!ComputeDataSize(1, sizeof(GLfloat), 2, &data_size)) { | 2529 if (!ComputeDataSize(1, sizeof(GLfloat), 2, &data_size)) { |
2514 return error::kOutOfBounds; | 2530 return error::kOutOfBounds; |
2515 } | 2531 } |
2516 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2532 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
2517 c.values_shm_id, c.values_shm_offset, data_size); | 2533 c.values_shm_id, c.values_shm_offset, data_size); |
2518 if (values == NULL) { | 2534 if (values == NULL) { |
2519 return error::kOutOfBounds; | 2535 return error::kOutOfBounds; |
2520 } | 2536 } |
2521 DoVertexAttrib2fv(indx, values); | 2537 DoVertexAttrib2fv(indx, values); |
2522 return error::kNoError; | 2538 return error::kNoError; |
2523 } | 2539 } |
2524 | 2540 |
2525 error::Error GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( | 2541 error::Error GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( |
2526 uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) { | 2542 uint32 immediate_data_size, |
| 2543 const gles2::cmds::VertexAttrib2fvImmediate& c) { |
2527 GLuint indx = static_cast<GLuint>(c.indx); | 2544 GLuint indx = static_cast<GLuint>(c.indx); |
2528 uint32 data_size; | 2545 uint32 data_size; |
2529 if (!ComputeDataSize(1, sizeof(GLfloat), 2, &data_size)) { | 2546 if (!ComputeDataSize(1, sizeof(GLfloat), 2, &data_size)) { |
2530 return error::kOutOfBounds; | 2547 return error::kOutOfBounds; |
2531 } | 2548 } |
2532 if (data_size > immediate_data_size) { | 2549 if (data_size > immediate_data_size) { |
2533 return error::kOutOfBounds; | 2550 return error::kOutOfBounds; |
2534 } | 2551 } |
2535 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( | 2552 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
2536 c, data_size, immediate_data_size); | 2553 c, data_size, immediate_data_size); |
2537 if (values == NULL) { | 2554 if (values == NULL) { |
2538 return error::kOutOfBounds; | 2555 return error::kOutOfBounds; |
2539 } | 2556 } |
2540 DoVertexAttrib2fv(indx, values); | 2557 DoVertexAttrib2fv(indx, values); |
2541 return error::kNoError; | 2558 return error::kNoError; |
2542 } | 2559 } |
2543 | 2560 |
2544 error::Error GLES2DecoderImpl::HandleVertexAttrib3f( | 2561 error::Error GLES2DecoderImpl::HandleVertexAttrib3f( |
2545 uint32 immediate_data_size, const gles2::VertexAttrib3f& c) { | 2562 uint32 immediate_data_size, const gles2::cmds::VertexAttrib3f& c) { |
2546 GLuint indx = static_cast<GLuint>(c.indx); | 2563 GLuint indx = static_cast<GLuint>(c.indx); |
2547 GLfloat x = static_cast<GLfloat>(c.x); | 2564 GLfloat x = static_cast<GLfloat>(c.x); |
2548 GLfloat y = static_cast<GLfloat>(c.y); | 2565 GLfloat y = static_cast<GLfloat>(c.y); |
2549 GLfloat z = static_cast<GLfloat>(c.z); | 2566 GLfloat z = static_cast<GLfloat>(c.z); |
2550 DoVertexAttrib3f(indx, x, y, z); | 2567 DoVertexAttrib3f(indx, x, y, z); |
2551 return error::kNoError; | 2568 return error::kNoError; |
2552 } | 2569 } |
2553 | 2570 |
2554 error::Error GLES2DecoderImpl::HandleVertexAttrib3fv( | 2571 error::Error GLES2DecoderImpl::HandleVertexAttrib3fv( |
2555 uint32 immediate_data_size, const gles2::VertexAttrib3fv& c) { | 2572 uint32 immediate_data_size, const gles2::cmds::VertexAttrib3fv& c) { |
2556 GLuint indx = static_cast<GLuint>(c.indx); | 2573 GLuint indx = static_cast<GLuint>(c.indx); |
2557 uint32 data_size; | 2574 uint32 data_size; |
2558 if (!ComputeDataSize(1, sizeof(GLfloat), 3, &data_size)) { | 2575 if (!ComputeDataSize(1, sizeof(GLfloat), 3, &data_size)) { |
2559 return error::kOutOfBounds; | 2576 return error::kOutOfBounds; |
2560 } | 2577 } |
2561 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2578 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
2562 c.values_shm_id, c.values_shm_offset, data_size); | 2579 c.values_shm_id, c.values_shm_offset, data_size); |
2563 if (values == NULL) { | 2580 if (values == NULL) { |
2564 return error::kOutOfBounds; | 2581 return error::kOutOfBounds; |
2565 } | 2582 } |
2566 DoVertexAttrib3fv(indx, values); | 2583 DoVertexAttrib3fv(indx, values); |
2567 return error::kNoError; | 2584 return error::kNoError; |
2568 } | 2585 } |
2569 | 2586 |
2570 error::Error GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( | 2587 error::Error GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( |
2571 uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) { | 2588 uint32 immediate_data_size, |
| 2589 const gles2::cmds::VertexAttrib3fvImmediate& c) { |
2572 GLuint indx = static_cast<GLuint>(c.indx); | 2590 GLuint indx = static_cast<GLuint>(c.indx); |
2573 uint32 data_size; | 2591 uint32 data_size; |
2574 if (!ComputeDataSize(1, sizeof(GLfloat), 3, &data_size)) { | 2592 if (!ComputeDataSize(1, sizeof(GLfloat), 3, &data_size)) { |
2575 return error::kOutOfBounds; | 2593 return error::kOutOfBounds; |
2576 } | 2594 } |
2577 if (data_size > immediate_data_size) { | 2595 if (data_size > immediate_data_size) { |
2578 return error::kOutOfBounds; | 2596 return error::kOutOfBounds; |
2579 } | 2597 } |
2580 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( | 2598 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
2581 c, data_size, immediate_data_size); | 2599 c, data_size, immediate_data_size); |
2582 if (values == NULL) { | 2600 if (values == NULL) { |
2583 return error::kOutOfBounds; | 2601 return error::kOutOfBounds; |
2584 } | 2602 } |
2585 DoVertexAttrib3fv(indx, values); | 2603 DoVertexAttrib3fv(indx, values); |
2586 return error::kNoError; | 2604 return error::kNoError; |
2587 } | 2605 } |
2588 | 2606 |
2589 error::Error GLES2DecoderImpl::HandleVertexAttrib4f( | 2607 error::Error GLES2DecoderImpl::HandleVertexAttrib4f( |
2590 uint32 immediate_data_size, const gles2::VertexAttrib4f& c) { | 2608 uint32 immediate_data_size, const gles2::cmds::VertexAttrib4f& c) { |
2591 GLuint indx = static_cast<GLuint>(c.indx); | 2609 GLuint indx = static_cast<GLuint>(c.indx); |
2592 GLfloat x = static_cast<GLfloat>(c.x); | 2610 GLfloat x = static_cast<GLfloat>(c.x); |
2593 GLfloat y = static_cast<GLfloat>(c.y); | 2611 GLfloat y = static_cast<GLfloat>(c.y); |
2594 GLfloat z = static_cast<GLfloat>(c.z); | 2612 GLfloat z = static_cast<GLfloat>(c.z); |
2595 GLfloat w = static_cast<GLfloat>(c.w); | 2613 GLfloat w = static_cast<GLfloat>(c.w); |
2596 DoVertexAttrib4f(indx, x, y, z, w); | 2614 DoVertexAttrib4f(indx, x, y, z, w); |
2597 return error::kNoError; | 2615 return error::kNoError; |
2598 } | 2616 } |
2599 | 2617 |
2600 error::Error GLES2DecoderImpl::HandleVertexAttrib4fv( | 2618 error::Error GLES2DecoderImpl::HandleVertexAttrib4fv( |
2601 uint32 immediate_data_size, const gles2::VertexAttrib4fv& c) { | 2619 uint32 immediate_data_size, const gles2::cmds::VertexAttrib4fv& c) { |
2602 GLuint indx = static_cast<GLuint>(c.indx); | 2620 GLuint indx = static_cast<GLuint>(c.indx); |
2603 uint32 data_size; | 2621 uint32 data_size; |
2604 if (!ComputeDataSize(1, sizeof(GLfloat), 4, &data_size)) { | 2622 if (!ComputeDataSize(1, sizeof(GLfloat), 4, &data_size)) { |
2605 return error::kOutOfBounds; | 2623 return error::kOutOfBounds; |
2606 } | 2624 } |
2607 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2625 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
2608 c.values_shm_id, c.values_shm_offset, data_size); | 2626 c.values_shm_id, c.values_shm_offset, data_size); |
2609 if (values == NULL) { | 2627 if (values == NULL) { |
2610 return error::kOutOfBounds; | 2628 return error::kOutOfBounds; |
2611 } | 2629 } |
2612 DoVertexAttrib4fv(indx, values); | 2630 DoVertexAttrib4fv(indx, values); |
2613 return error::kNoError; | 2631 return error::kNoError; |
2614 } | 2632 } |
2615 | 2633 |
2616 error::Error GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( | 2634 error::Error GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( |
2617 uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) { | 2635 uint32 immediate_data_size, |
| 2636 const gles2::cmds::VertexAttrib4fvImmediate& c) { |
2618 GLuint indx = static_cast<GLuint>(c.indx); | 2637 GLuint indx = static_cast<GLuint>(c.indx); |
2619 uint32 data_size; | 2638 uint32 data_size; |
2620 if (!ComputeDataSize(1, sizeof(GLfloat), 4, &data_size)) { | 2639 if (!ComputeDataSize(1, sizeof(GLfloat), 4, &data_size)) { |
2621 return error::kOutOfBounds; | 2640 return error::kOutOfBounds; |
2622 } | 2641 } |
2623 if (data_size > immediate_data_size) { | 2642 if (data_size > immediate_data_size) { |
2624 return error::kOutOfBounds; | 2643 return error::kOutOfBounds; |
2625 } | 2644 } |
2626 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( | 2645 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
2627 c, data_size, immediate_data_size); | 2646 c, data_size, immediate_data_size); |
2628 if (values == NULL) { | 2647 if (values == NULL) { |
2629 return error::kOutOfBounds; | 2648 return error::kOutOfBounds; |
2630 } | 2649 } |
2631 DoVertexAttrib4fv(indx, values); | 2650 DoVertexAttrib4fv(indx, values); |
2632 return error::kNoError; | 2651 return error::kNoError; |
2633 } | 2652 } |
2634 | 2653 |
2635 error::Error GLES2DecoderImpl::HandleViewport( | 2654 error::Error GLES2DecoderImpl::HandleViewport( |
2636 uint32 immediate_data_size, const gles2::Viewport& c) { | 2655 uint32 immediate_data_size, const gles2::cmds::Viewport& c) { |
2637 GLint x = static_cast<GLint>(c.x); | 2656 GLint x = static_cast<GLint>(c.x); |
2638 GLint y = static_cast<GLint>(c.y); | 2657 GLint y = static_cast<GLint>(c.y); |
2639 GLsizei width = static_cast<GLsizei>(c.width); | 2658 GLsizei width = static_cast<GLsizei>(c.width); |
2640 GLsizei height = static_cast<GLsizei>(c.height); | 2659 GLsizei height = static_cast<GLsizei>(c.height); |
2641 if (width < 0) { | 2660 if (width < 0) { |
2642 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0"); | 2661 SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0"); |
2643 return error::kNoError; | 2662 return error::kNoError; |
2644 } | 2663 } |
2645 if (height < 0) { | 2664 if (height < 0) { |
2646 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0"); | 2665 SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0"); |
2647 return error::kNoError; | 2666 return error::kNoError; |
2648 } | 2667 } |
2649 DoViewport(x, y, width, height); | 2668 DoViewport(x, y, width, height); |
2650 return error::kNoError; | 2669 return error::kNoError; |
2651 } | 2670 } |
2652 | 2671 |
2653 error::Error GLES2DecoderImpl::HandleBlitFramebufferEXT( | 2672 error::Error GLES2DecoderImpl::HandleBlitFramebufferEXT( |
2654 uint32 immediate_data_size, const gles2::BlitFramebufferEXT& c) { | 2673 uint32 immediate_data_size, const gles2::cmds::BlitFramebufferEXT& c) { |
2655 if (ShouldDeferDraws() || ShouldDeferReads()) | 2674 if (ShouldDeferDraws() || ShouldDeferReads()) |
2656 return error::kDeferCommandUntilLater; | 2675 return error::kDeferCommandUntilLater; |
2657 GLint srcX0 = static_cast<GLint>(c.srcX0); | 2676 GLint srcX0 = static_cast<GLint>(c.srcX0); |
2658 GLint srcY0 = static_cast<GLint>(c.srcY0); | 2677 GLint srcY0 = static_cast<GLint>(c.srcY0); |
2659 GLint srcX1 = static_cast<GLint>(c.srcX1); | 2678 GLint srcX1 = static_cast<GLint>(c.srcX1); |
2660 GLint srcY1 = static_cast<GLint>(c.srcY1); | 2679 GLint srcY1 = static_cast<GLint>(c.srcY1); |
2661 GLint dstX0 = static_cast<GLint>(c.dstX0); | 2680 GLint dstX0 = static_cast<GLint>(c.dstX0); |
2662 GLint dstY0 = static_cast<GLint>(c.dstY0); | 2681 GLint dstY0 = static_cast<GLint>(c.dstY0); |
2663 GLint dstX1 = static_cast<GLint>(c.dstX1); | 2682 GLint dstX1 = static_cast<GLint>(c.dstX1); |
2664 GLint dstY1 = static_cast<GLint>(c.dstY1); | 2683 GLint dstY1 = static_cast<GLint>(c.dstY1); |
2665 GLbitfield mask = static_cast<GLbitfield>(c.mask); | 2684 GLbitfield mask = static_cast<GLbitfield>(c.mask); |
2666 GLenum filter = static_cast<GLenum>(c.filter); | 2685 GLenum filter = static_cast<GLenum>(c.filter); |
2667 if (!validators_->blit_filter.IsValid(filter)) { | 2686 if (!validators_->blit_filter.IsValid(filter)) { |
2668 SetGLErrorInvalidEnum("glBlitFramebufferEXT", filter, "filter"); | 2687 SetGLErrorInvalidEnum("glBlitFramebufferEXT", filter, "filter"); |
2669 return error::kNoError; | 2688 return error::kNoError; |
2670 } | 2689 } |
2671 DoBlitFramebufferEXT( | 2690 DoBlitFramebufferEXT( |
2672 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 2691 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
2673 return error::kNoError; | 2692 return error::kNoError; |
2674 } | 2693 } |
2675 | 2694 |
2676 error::Error GLES2DecoderImpl::HandleRenderbufferStorageMultisampleEXT( | 2695 error::Error GLES2DecoderImpl::HandleRenderbufferStorageMultisampleEXT( |
2677 uint32 immediate_data_size, | 2696 uint32 immediate_data_size, |
2678 const gles2::RenderbufferStorageMultisampleEXT& c) { | 2697 const gles2::cmds::RenderbufferStorageMultisampleEXT& c) { |
2679 GLenum target = static_cast<GLenum>(c.target); | 2698 GLenum target = static_cast<GLenum>(c.target); |
2680 GLsizei samples = static_cast<GLsizei>(c.samples); | 2699 GLsizei samples = static_cast<GLsizei>(c.samples); |
2681 GLenum internalformat = static_cast<GLenum>(c.internalformat); | 2700 GLenum internalformat = static_cast<GLenum>(c.internalformat); |
2682 GLsizei width = static_cast<GLsizei>(c.width); | 2701 GLsizei width = static_cast<GLsizei>(c.width); |
2683 GLsizei height = static_cast<GLsizei>(c.height); | 2702 GLsizei height = static_cast<GLsizei>(c.height); |
2684 if (!validators_->render_buffer_target.IsValid(target)) { | 2703 if (!validators_->render_buffer_target.IsValid(target)) { |
2685 SetGLErrorInvalidEnum("glRenderbufferStorageMultisampleEXT", target, | 2704 SetGLErrorInvalidEnum("glRenderbufferStorageMultisampleEXT", target, |
2686 "target"); | 2705 "target"); |
2687 return error::kNoError; | 2706 return error::kNoError; |
2688 } | 2707 } |
(...skipping 16 matching lines...) Expand all Loading... |
2705 SetGLError( | 2724 SetGLError( |
2706 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT", "height < 0"); | 2725 GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT", "height < 0"); |
2707 return error::kNoError; | 2726 return error::kNoError; |
2708 } | 2727 } |
2709 DoRenderbufferStorageMultisample( | 2728 DoRenderbufferStorageMultisample( |
2710 target, samples, internalformat, width, height); | 2729 target, samples, internalformat, width, height); |
2711 return error::kNoError; | 2730 return error::kNoError; |
2712 } | 2731 } |
2713 | 2732 |
2714 error::Error GLES2DecoderImpl::HandleTexStorage2DEXT( | 2733 error::Error GLES2DecoderImpl::HandleTexStorage2DEXT( |
2715 uint32 immediate_data_size, const gles2::TexStorage2DEXT& c) { | 2734 uint32 immediate_data_size, const gles2::cmds::TexStorage2DEXT& c) { |
2716 GLenum target = static_cast<GLenum>(c.target); | 2735 GLenum target = static_cast<GLenum>(c.target); |
2717 GLsizei levels = static_cast<GLsizei>(c.levels); | 2736 GLsizei levels = static_cast<GLsizei>(c.levels); |
2718 GLenum internalFormat = static_cast<GLenum>(c.internalFormat); | 2737 GLenum internalFormat = static_cast<GLenum>(c.internalFormat); |
2719 GLsizei width = static_cast<GLsizei>(c.width); | 2738 GLsizei width = static_cast<GLsizei>(c.width); |
2720 GLsizei height = static_cast<GLsizei>(c.height); | 2739 GLsizei height = static_cast<GLsizei>(c.height); |
2721 if (!validators_->texture_target.IsValid(target)) { | 2740 if (!validators_->texture_target.IsValid(target)) { |
2722 SetGLErrorInvalidEnum("glTexStorage2DEXT", target, "target"); | 2741 SetGLErrorInvalidEnum("glTexStorage2DEXT", target, "target"); |
2723 return error::kNoError; | 2742 return error::kNoError; |
2724 } | 2743 } |
2725 if (levels < 0) { | 2744 if (levels < 0) { |
(...skipping 11 matching lines...) Expand all Loading... |
2737 } | 2756 } |
2738 if (height < 0) { | 2757 if (height < 0) { |
2739 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0"); | 2758 SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "height < 0"); |
2740 return error::kNoError; | 2759 return error::kNoError; |
2741 } | 2760 } |
2742 DoTexStorage2DEXT(target, levels, internalFormat, width, height); | 2761 DoTexStorage2DEXT(target, levels, internalFormat, width, height); |
2743 return error::kNoError; | 2762 return error::kNoError; |
2744 } | 2763 } |
2745 | 2764 |
2746 error::Error GLES2DecoderImpl::HandleGenQueriesEXT( | 2765 error::Error GLES2DecoderImpl::HandleGenQueriesEXT( |
2747 uint32 immediate_data_size, const gles2::GenQueriesEXT& c) { | 2766 uint32 immediate_data_size, const gles2::cmds::GenQueriesEXT& c) { |
2748 GLsizei n = static_cast<GLsizei>(c.n); | 2767 GLsizei n = static_cast<GLsizei>(c.n); |
2749 uint32 data_size; | 2768 uint32 data_size; |
2750 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2769 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2751 return error::kOutOfBounds; | 2770 return error::kOutOfBounds; |
2752 } | 2771 } |
2753 GLuint* queries = GetSharedMemoryAs<GLuint*>( | 2772 GLuint* queries = GetSharedMemoryAs<GLuint*>( |
2754 c.queries_shm_id, c.queries_shm_offset, data_size); | 2773 c.queries_shm_id, c.queries_shm_offset, data_size); |
2755 if (queries == NULL) { | 2774 if (queries == NULL) { |
2756 return error::kOutOfBounds; | 2775 return error::kOutOfBounds; |
2757 } | 2776 } |
2758 if (!GenQueriesEXTHelper(n, queries)) { | 2777 if (!GenQueriesEXTHelper(n, queries)) { |
2759 return error::kInvalidArguments; | 2778 return error::kInvalidArguments; |
2760 } | 2779 } |
2761 return error::kNoError; | 2780 return error::kNoError; |
2762 } | 2781 } |
2763 | 2782 |
2764 error::Error GLES2DecoderImpl::HandleGenQueriesEXTImmediate( | 2783 error::Error GLES2DecoderImpl::HandleGenQueriesEXTImmediate( |
2765 uint32 immediate_data_size, const gles2::GenQueriesEXTImmediate& c) { | 2784 uint32 immediate_data_size, const gles2::cmds::GenQueriesEXTImmediate& c) { |
2766 GLsizei n = static_cast<GLsizei>(c.n); | 2785 GLsizei n = static_cast<GLsizei>(c.n); |
2767 uint32 data_size; | 2786 uint32 data_size; |
2768 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2787 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2769 return error::kOutOfBounds; | 2788 return error::kOutOfBounds; |
2770 } | 2789 } |
2771 GLuint* queries = GetImmediateDataAs<GLuint*>( | 2790 GLuint* queries = GetImmediateDataAs<GLuint*>( |
2772 c, data_size, immediate_data_size); | 2791 c, data_size, immediate_data_size); |
2773 if (queries == NULL) { | 2792 if (queries == NULL) { |
2774 return error::kOutOfBounds; | 2793 return error::kOutOfBounds; |
2775 } | 2794 } |
2776 if (!GenQueriesEXTHelper(n, queries)) { | 2795 if (!GenQueriesEXTHelper(n, queries)) { |
2777 return error::kInvalidArguments; | 2796 return error::kInvalidArguments; |
2778 } | 2797 } |
2779 return error::kNoError; | 2798 return error::kNoError; |
2780 } | 2799 } |
2781 | 2800 |
2782 error::Error GLES2DecoderImpl::HandleDeleteQueriesEXT( | 2801 error::Error GLES2DecoderImpl::HandleDeleteQueriesEXT( |
2783 uint32 immediate_data_size, const gles2::DeleteQueriesEXT& c) { | 2802 uint32 immediate_data_size, const gles2::cmds::DeleteQueriesEXT& c) { |
2784 GLsizei n = static_cast<GLsizei>(c.n); | 2803 GLsizei n = static_cast<GLsizei>(c.n); |
2785 uint32 data_size; | 2804 uint32 data_size; |
2786 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2805 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2787 return error::kOutOfBounds; | 2806 return error::kOutOfBounds; |
2788 } | 2807 } |
2789 const GLuint* queries = GetSharedMemoryAs<const GLuint*>( | 2808 const GLuint* queries = GetSharedMemoryAs<const GLuint*>( |
2790 c.queries_shm_id, c.queries_shm_offset, data_size); | 2809 c.queries_shm_id, c.queries_shm_offset, data_size); |
2791 if (queries == NULL) { | 2810 if (queries == NULL) { |
2792 return error::kOutOfBounds; | 2811 return error::kOutOfBounds; |
2793 } | 2812 } |
2794 DeleteQueriesEXTHelper(n, queries); | 2813 DeleteQueriesEXTHelper(n, queries); |
2795 return error::kNoError; | 2814 return error::kNoError; |
2796 } | 2815 } |
2797 | 2816 |
2798 error::Error GLES2DecoderImpl::HandleDeleteQueriesEXTImmediate( | 2817 error::Error GLES2DecoderImpl::HandleDeleteQueriesEXTImmediate( |
2799 uint32 immediate_data_size, const gles2::DeleteQueriesEXTImmediate& c) { | 2818 uint32 immediate_data_size, |
| 2819 const gles2::cmds::DeleteQueriesEXTImmediate& c) { |
2800 GLsizei n = static_cast<GLsizei>(c.n); | 2820 GLsizei n = static_cast<GLsizei>(c.n); |
2801 uint32 data_size; | 2821 uint32 data_size; |
2802 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2822 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2803 return error::kOutOfBounds; | 2823 return error::kOutOfBounds; |
2804 } | 2824 } |
2805 const GLuint* queries = GetImmediateDataAs<const GLuint*>( | 2825 const GLuint* queries = GetImmediateDataAs<const GLuint*>( |
2806 c, data_size, immediate_data_size); | 2826 c, data_size, immediate_data_size); |
2807 if (queries == NULL) { | 2827 if (queries == NULL) { |
2808 return error::kOutOfBounds; | 2828 return error::kOutOfBounds; |
2809 } | 2829 } |
2810 DeleteQueriesEXTHelper(n, queries); | 2830 DeleteQueriesEXTHelper(n, queries); |
2811 return error::kNoError; | 2831 return error::kNoError; |
2812 } | 2832 } |
2813 | 2833 |
2814 error::Error GLES2DecoderImpl::HandleInsertEventMarkerEXT( | 2834 error::Error GLES2DecoderImpl::HandleInsertEventMarkerEXT( |
2815 uint32 immediate_data_size, const gles2::InsertEventMarkerEXT& c) { | 2835 uint32 immediate_data_size, const gles2::cmds::InsertEventMarkerEXT& c) { |
2816 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2836 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
2817 Bucket* bucket = GetBucket(bucket_id); | 2837 Bucket* bucket = GetBucket(bucket_id); |
2818 if (!bucket || bucket->size() == 0) { | 2838 if (!bucket || bucket->size() == 0) { |
2819 return error::kInvalidArguments; | 2839 return error::kInvalidArguments; |
2820 } | 2840 } |
2821 std::string str; | 2841 std::string str; |
2822 if (!bucket->GetAsString(&str)) { | 2842 if (!bucket->GetAsString(&str)) { |
2823 return error::kInvalidArguments; | 2843 return error::kInvalidArguments; |
2824 } | 2844 } |
2825 DoInsertEventMarkerEXT(0, str.c_str()); | 2845 DoInsertEventMarkerEXT(0, str.c_str()); |
2826 return error::kNoError; | 2846 return error::kNoError; |
2827 } | 2847 } |
2828 | 2848 |
2829 error::Error GLES2DecoderImpl::HandlePushGroupMarkerEXT( | 2849 error::Error GLES2DecoderImpl::HandlePushGroupMarkerEXT( |
2830 uint32 immediate_data_size, const gles2::PushGroupMarkerEXT& c) { | 2850 uint32 immediate_data_size, const gles2::cmds::PushGroupMarkerEXT& c) { |
2831 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2851 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
2832 Bucket* bucket = GetBucket(bucket_id); | 2852 Bucket* bucket = GetBucket(bucket_id); |
2833 if (!bucket || bucket->size() == 0) { | 2853 if (!bucket || bucket->size() == 0) { |
2834 return error::kInvalidArguments; | 2854 return error::kInvalidArguments; |
2835 } | 2855 } |
2836 std::string str; | 2856 std::string str; |
2837 if (!bucket->GetAsString(&str)) { | 2857 if (!bucket->GetAsString(&str)) { |
2838 return error::kInvalidArguments; | 2858 return error::kInvalidArguments; |
2839 } | 2859 } |
2840 DoPushGroupMarkerEXT(0, str.c_str()); | 2860 DoPushGroupMarkerEXT(0, str.c_str()); |
2841 return error::kNoError; | 2861 return error::kNoError; |
2842 } | 2862 } |
2843 | 2863 |
2844 error::Error GLES2DecoderImpl::HandlePopGroupMarkerEXT( | 2864 error::Error GLES2DecoderImpl::HandlePopGroupMarkerEXT( |
2845 uint32 immediate_data_size, const gles2::PopGroupMarkerEXT& c) { | 2865 uint32 immediate_data_size, const gles2::cmds::PopGroupMarkerEXT& c) { |
2846 DoPopGroupMarkerEXT(); | 2866 DoPopGroupMarkerEXT(); |
2847 return error::kNoError; | 2867 return error::kNoError; |
2848 } | 2868 } |
2849 | 2869 |
2850 error::Error GLES2DecoderImpl::HandleGenVertexArraysOES( | 2870 error::Error GLES2DecoderImpl::HandleGenVertexArraysOES( |
2851 uint32 immediate_data_size, const gles2::GenVertexArraysOES& c) { | 2871 uint32 immediate_data_size, const gles2::cmds::GenVertexArraysOES& c) { |
2852 GLsizei n = static_cast<GLsizei>(c.n); | 2872 GLsizei n = static_cast<GLsizei>(c.n); |
2853 uint32 data_size; | 2873 uint32 data_size; |
2854 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2874 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2855 return error::kOutOfBounds; | 2875 return error::kOutOfBounds; |
2856 } | 2876 } |
2857 GLuint* arrays = GetSharedMemoryAs<GLuint*>( | 2877 GLuint* arrays = GetSharedMemoryAs<GLuint*>( |
2858 c.arrays_shm_id, c.arrays_shm_offset, data_size); | 2878 c.arrays_shm_id, c.arrays_shm_offset, data_size); |
2859 if (arrays == NULL) { | 2879 if (arrays == NULL) { |
2860 return error::kOutOfBounds; | 2880 return error::kOutOfBounds; |
2861 } | 2881 } |
2862 if (!GenVertexArraysOESHelper(n, arrays)) { | 2882 if (!GenVertexArraysOESHelper(n, arrays)) { |
2863 return error::kInvalidArguments; | 2883 return error::kInvalidArguments; |
2864 } | 2884 } |
2865 return error::kNoError; | 2885 return error::kNoError; |
2866 } | 2886 } |
2867 | 2887 |
2868 error::Error GLES2DecoderImpl::HandleGenVertexArraysOESImmediate( | 2888 error::Error GLES2DecoderImpl::HandleGenVertexArraysOESImmediate( |
2869 uint32 immediate_data_size, const gles2::GenVertexArraysOESImmediate& c) { | 2889 uint32 immediate_data_size, |
| 2890 const gles2::cmds::GenVertexArraysOESImmediate& c) { |
2870 GLsizei n = static_cast<GLsizei>(c.n); | 2891 GLsizei n = static_cast<GLsizei>(c.n); |
2871 uint32 data_size; | 2892 uint32 data_size; |
2872 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2893 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2873 return error::kOutOfBounds; | 2894 return error::kOutOfBounds; |
2874 } | 2895 } |
2875 GLuint* arrays = GetImmediateDataAs<GLuint*>( | 2896 GLuint* arrays = GetImmediateDataAs<GLuint*>( |
2876 c, data_size, immediate_data_size); | 2897 c, data_size, immediate_data_size); |
2877 if (arrays == NULL) { | 2898 if (arrays == NULL) { |
2878 return error::kOutOfBounds; | 2899 return error::kOutOfBounds; |
2879 } | 2900 } |
2880 if (!GenVertexArraysOESHelper(n, arrays)) { | 2901 if (!GenVertexArraysOESHelper(n, arrays)) { |
2881 return error::kInvalidArguments; | 2902 return error::kInvalidArguments; |
2882 } | 2903 } |
2883 return error::kNoError; | 2904 return error::kNoError; |
2884 } | 2905 } |
2885 | 2906 |
2886 error::Error GLES2DecoderImpl::HandleDeleteVertexArraysOES( | 2907 error::Error GLES2DecoderImpl::HandleDeleteVertexArraysOES( |
2887 uint32 immediate_data_size, const gles2::DeleteVertexArraysOES& c) { | 2908 uint32 immediate_data_size, const gles2::cmds::DeleteVertexArraysOES& c) { |
2888 GLsizei n = static_cast<GLsizei>(c.n); | 2909 GLsizei n = static_cast<GLsizei>(c.n); |
2889 uint32 data_size; | 2910 uint32 data_size; |
2890 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2911 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2891 return error::kOutOfBounds; | 2912 return error::kOutOfBounds; |
2892 } | 2913 } |
2893 const GLuint* arrays = GetSharedMemoryAs<const GLuint*>( | 2914 const GLuint* arrays = GetSharedMemoryAs<const GLuint*>( |
2894 c.arrays_shm_id, c.arrays_shm_offset, data_size); | 2915 c.arrays_shm_id, c.arrays_shm_offset, data_size); |
2895 if (arrays == NULL) { | 2916 if (arrays == NULL) { |
2896 return error::kOutOfBounds; | 2917 return error::kOutOfBounds; |
2897 } | 2918 } |
2898 DeleteVertexArraysOESHelper(n, arrays); | 2919 DeleteVertexArraysOESHelper(n, arrays); |
2899 return error::kNoError; | 2920 return error::kNoError; |
2900 } | 2921 } |
2901 | 2922 |
2902 error::Error GLES2DecoderImpl::HandleDeleteVertexArraysOESImmediate( | 2923 error::Error GLES2DecoderImpl::HandleDeleteVertexArraysOESImmediate( |
2903 uint32 immediate_data_size, | 2924 uint32 immediate_data_size, |
2904 const gles2::DeleteVertexArraysOESImmediate& c) { | 2925 const gles2::cmds::DeleteVertexArraysOESImmediate& c) { |
2905 GLsizei n = static_cast<GLsizei>(c.n); | 2926 GLsizei n = static_cast<GLsizei>(c.n); |
2906 uint32 data_size; | 2927 uint32 data_size; |
2907 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 2928 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
2908 return error::kOutOfBounds; | 2929 return error::kOutOfBounds; |
2909 } | 2930 } |
2910 const GLuint* arrays = GetImmediateDataAs<const GLuint*>( | 2931 const GLuint* arrays = GetImmediateDataAs<const GLuint*>( |
2911 c, data_size, immediate_data_size); | 2932 c, data_size, immediate_data_size); |
2912 if (arrays == NULL) { | 2933 if (arrays == NULL) { |
2913 return error::kOutOfBounds; | 2934 return error::kOutOfBounds; |
2914 } | 2935 } |
2915 DeleteVertexArraysOESHelper(n, arrays); | 2936 DeleteVertexArraysOESHelper(n, arrays); |
2916 return error::kNoError; | 2937 return error::kNoError; |
2917 } | 2938 } |
2918 | 2939 |
2919 error::Error GLES2DecoderImpl::HandleIsVertexArrayOES( | 2940 error::Error GLES2DecoderImpl::HandleIsVertexArrayOES( |
2920 uint32 immediate_data_size, const gles2::IsVertexArrayOES& c) { | 2941 uint32 immediate_data_size, const gles2::cmds::IsVertexArrayOES& c) { |
2921 GLuint array = c.array; | 2942 GLuint array = c.array; |
2922 typedef IsVertexArrayOES::Result Result; | 2943 typedef cmds::IsVertexArrayOES::Result Result; |
2923 Result* result_dst = GetSharedMemoryAs<Result*>( | 2944 Result* result_dst = GetSharedMemoryAs<Result*>( |
2924 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 2945 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
2925 if (!result_dst) { | 2946 if (!result_dst) { |
2926 return error::kOutOfBounds; | 2947 return error::kOutOfBounds; |
2927 } | 2948 } |
2928 *result_dst = DoIsVertexArrayOES(array); | 2949 *result_dst = DoIsVertexArrayOES(array); |
2929 return error::kNoError; | 2950 return error::kNoError; |
2930 } | 2951 } |
2931 | 2952 |
2932 error::Error GLES2DecoderImpl::HandleBindVertexArrayOES( | 2953 error::Error GLES2DecoderImpl::HandleBindVertexArrayOES( |
2933 uint32 immediate_data_size, const gles2::BindVertexArrayOES& c) { | 2954 uint32 immediate_data_size, const gles2::cmds::BindVertexArrayOES& c) { |
2934 GLuint array = c.array; | 2955 GLuint array = c.array; |
2935 DoBindVertexArrayOES(array); | 2956 DoBindVertexArrayOES(array); |
2936 return error::kNoError; | 2957 return error::kNoError; |
2937 } | 2958 } |
2938 | 2959 |
2939 error::Error GLES2DecoderImpl::HandleGetMaxValueInBufferCHROMIUM( | 2960 error::Error GLES2DecoderImpl::HandleGetMaxValueInBufferCHROMIUM( |
2940 uint32 immediate_data_size, const gles2::GetMaxValueInBufferCHROMIUM& c) { | 2961 uint32 immediate_data_size, |
| 2962 const gles2::cmds::GetMaxValueInBufferCHROMIUM& c) { |
2941 GLuint buffer_id = c.buffer_id; | 2963 GLuint buffer_id = c.buffer_id; |
2942 GLsizei count = static_cast<GLsizei>(c.count); | 2964 GLsizei count = static_cast<GLsizei>(c.count); |
2943 GLenum type = static_cast<GLenum>(c.type); | 2965 GLenum type = static_cast<GLenum>(c.type); |
2944 GLuint offset = static_cast<GLuint>(c.offset); | 2966 GLuint offset = static_cast<GLuint>(c.offset); |
2945 typedef GetMaxValueInBufferCHROMIUM::Result Result; | 2967 typedef cmds::GetMaxValueInBufferCHROMIUM::Result Result; |
2946 Result* result_dst = GetSharedMemoryAs<Result*>( | 2968 Result* result_dst = GetSharedMemoryAs<Result*>( |
2947 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | 2969 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
2948 if (!result_dst) { | 2970 if (!result_dst) { |
2949 return error::kOutOfBounds; | 2971 return error::kOutOfBounds; |
2950 } | 2972 } |
2951 if (count < 0) { | 2973 if (count < 0) { |
2952 SetGLError(GL_INVALID_VALUE, "glGetMaxValueInBufferCHROMIUM", "count < 0"); | 2974 SetGLError(GL_INVALID_VALUE, "glGetMaxValueInBufferCHROMIUM", "count < 0"); |
2953 return error::kNoError; | 2975 return error::kNoError; |
2954 } | 2976 } |
2955 if (!validators_->get_max_index_type.IsValid(type)) { | 2977 if (!validators_->get_max_index_type.IsValid(type)) { |
2956 SetGLErrorInvalidEnum("glGetMaxValueInBufferCHROMIUM", type, "type"); | 2978 SetGLErrorInvalidEnum("glGetMaxValueInBufferCHROMIUM", type, "type"); |
2957 return error::kNoError; | 2979 return error::kNoError; |
2958 } | 2980 } |
2959 *result_dst = DoGetMaxValueInBufferCHROMIUM(buffer_id, count, type, offset); | 2981 *result_dst = DoGetMaxValueInBufferCHROMIUM(buffer_id, count, type, offset); |
2960 return error::kNoError; | 2982 return error::kNoError; |
2961 } | 2983 } |
2962 | 2984 |
2963 error::Error GLES2DecoderImpl::HandleTexImageIOSurface2DCHROMIUM( | 2985 error::Error GLES2DecoderImpl::HandleTexImageIOSurface2DCHROMIUM( |
2964 uint32 immediate_data_size, const gles2::TexImageIOSurface2DCHROMIUM& c) { | 2986 uint32 immediate_data_size, |
| 2987 const gles2::cmds::TexImageIOSurface2DCHROMIUM& c) { |
2965 GLenum target = static_cast<GLenum>(c.target); | 2988 GLenum target = static_cast<GLenum>(c.target); |
2966 GLsizei width = static_cast<GLsizei>(c.width); | 2989 GLsizei width = static_cast<GLsizei>(c.width); |
2967 GLsizei height = static_cast<GLsizei>(c.height); | 2990 GLsizei height = static_cast<GLsizei>(c.height); |
2968 GLuint ioSurfaceId = static_cast<GLuint>(c.ioSurfaceId); | 2991 GLuint ioSurfaceId = static_cast<GLuint>(c.ioSurfaceId); |
2969 GLuint plane = static_cast<GLuint>(c.plane); | 2992 GLuint plane = static_cast<GLuint>(c.plane); |
2970 if (!validators_->texture_bind_target.IsValid(target)) { | 2993 if (!validators_->texture_bind_target.IsValid(target)) { |
2971 SetGLErrorInvalidEnum("glTexImageIOSurface2DCHROMIUM", target, "target"); | 2994 SetGLErrorInvalidEnum("glTexImageIOSurface2DCHROMIUM", target, "target"); |
2972 return error::kNoError; | 2995 return error::kNoError; |
2973 } | 2996 } |
2974 if (width < 0) { | 2997 if (width < 0) { |
2975 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0"); | 2998 SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0"); |
2976 return error::kNoError; | 2999 return error::kNoError; |
2977 } | 3000 } |
2978 if (height < 0) { | 3001 if (height < 0) { |
2979 SetGLError( | 3002 SetGLError( |
2980 GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0"); | 3003 GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0"); |
2981 return error::kNoError; | 3004 return error::kNoError; |
2982 } | 3005 } |
2983 DoTexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId, plane); | 3006 DoTexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId, plane); |
2984 return error::kNoError; | 3007 return error::kNoError; |
2985 } | 3008 } |
2986 | 3009 |
2987 error::Error GLES2DecoderImpl::HandleCopyTextureCHROMIUM( | 3010 error::Error GLES2DecoderImpl::HandleCopyTextureCHROMIUM( |
2988 uint32 immediate_data_size, const gles2::CopyTextureCHROMIUM& c) { | 3011 uint32 immediate_data_size, const gles2::cmds::CopyTextureCHROMIUM& c) { |
2989 GLenum target = static_cast<GLenum>(c.target); | 3012 GLenum target = static_cast<GLenum>(c.target); |
2990 GLenum source_id = static_cast<GLenum>(c.source_id); | 3013 GLenum source_id = static_cast<GLenum>(c.source_id); |
2991 GLenum dest_id = static_cast<GLenum>(c.dest_id); | 3014 GLenum dest_id = static_cast<GLenum>(c.dest_id); |
2992 GLint level = static_cast<GLint>(c.level); | 3015 GLint level = static_cast<GLint>(c.level); |
2993 GLint internalformat = static_cast<GLint>(c.internalformat); | 3016 GLint internalformat = static_cast<GLint>(c.internalformat); |
2994 if (!validators_->texture_internal_format.IsValid(internalformat)) { | 3017 if (!validators_->texture_internal_format.IsValid(internalformat)) { |
2995 SetGLError( | 3018 SetGLError( |
2996 GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "internalformat GL_INVALID_VA
LUE"); // NOLINT | 3019 GL_INVALID_VALUE, "glCopyTextureCHROMIUM", "internalformat GL_INVALID_VA
LUE"); // NOLINT |
2997 return error::kNoError; | 3020 return error::kNoError; |
2998 } | 3021 } |
2999 DoCopyTextureCHROMIUM(target, source_id, dest_id, level, internalformat); | 3022 DoCopyTextureCHROMIUM(target, source_id, dest_id, level, internalformat); |
3000 return error::kNoError; | 3023 return error::kNoError; |
3001 } | 3024 } |
3002 | 3025 |
3003 error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUM( | 3026 error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUM( |
3004 uint32 immediate_data_size, const gles2::ProduceTextureCHROMIUM& c) { | 3027 uint32 immediate_data_size, const gles2::cmds::ProduceTextureCHROMIUM& c) { |
3005 GLenum target = static_cast<GLenum>(c.target); | 3028 GLenum target = static_cast<GLenum>(c.target); |
3006 uint32 data_size; | 3029 uint32 data_size; |
3007 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | 3030 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { |
3008 return error::kOutOfBounds; | 3031 return error::kOutOfBounds; |
3009 } | 3032 } |
3010 const GLbyte* mailbox = GetSharedMemoryAs<const GLbyte*>( | 3033 const GLbyte* mailbox = GetSharedMemoryAs<const GLbyte*>( |
3011 c.mailbox_shm_id, c.mailbox_shm_offset, data_size); | 3034 c.mailbox_shm_id, c.mailbox_shm_offset, data_size); |
3012 if (!validators_->texture_target.IsValid(target)) { | 3035 if (!validators_->texture_target.IsValid(target)) { |
3013 SetGLErrorInvalidEnum("glProduceTextureCHROMIUM", target, "target"); | 3036 SetGLErrorInvalidEnum("glProduceTextureCHROMIUM", target, "target"); |
3014 return error::kNoError; | 3037 return error::kNoError; |
3015 } | 3038 } |
3016 if (mailbox == NULL) { | 3039 if (mailbox == NULL) { |
3017 return error::kOutOfBounds; | 3040 return error::kOutOfBounds; |
3018 } | 3041 } |
3019 DoProduceTextureCHROMIUM(target, mailbox); | 3042 DoProduceTextureCHROMIUM(target, mailbox); |
3020 return error::kNoError; | 3043 return error::kNoError; |
3021 } | 3044 } |
3022 | 3045 |
3023 error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUMImmediate( | 3046 error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUMImmediate( |
3024 uint32 immediate_data_size, | 3047 uint32 immediate_data_size, |
3025 const gles2::ProduceTextureCHROMIUMImmediate& c) { | 3048 const gles2::cmds::ProduceTextureCHROMIUMImmediate& c) { |
3026 GLenum target = static_cast<GLenum>(c.target); | 3049 GLenum target = static_cast<GLenum>(c.target); |
3027 uint32 data_size; | 3050 uint32 data_size; |
3028 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | 3051 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { |
3029 return error::kOutOfBounds; | 3052 return error::kOutOfBounds; |
3030 } | 3053 } |
3031 if (data_size > immediate_data_size) { | 3054 if (data_size > immediate_data_size) { |
3032 return error::kOutOfBounds; | 3055 return error::kOutOfBounds; |
3033 } | 3056 } |
3034 const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>( | 3057 const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>( |
3035 c, data_size, immediate_data_size); | 3058 c, data_size, immediate_data_size); |
3036 if (!validators_->texture_target.IsValid(target)) { | 3059 if (!validators_->texture_target.IsValid(target)) { |
3037 SetGLErrorInvalidEnum("glProduceTextureCHROMIUM", target, "target"); | 3060 SetGLErrorInvalidEnum("glProduceTextureCHROMIUM", target, "target"); |
3038 return error::kNoError; | 3061 return error::kNoError; |
3039 } | 3062 } |
3040 if (mailbox == NULL) { | 3063 if (mailbox == NULL) { |
3041 return error::kOutOfBounds; | 3064 return error::kOutOfBounds; |
3042 } | 3065 } |
3043 DoProduceTextureCHROMIUM(target, mailbox); | 3066 DoProduceTextureCHROMIUM(target, mailbox); |
3044 return error::kNoError; | 3067 return error::kNoError; |
3045 } | 3068 } |
3046 | 3069 |
3047 error::Error GLES2DecoderImpl::HandleConsumeTextureCHROMIUM( | 3070 error::Error GLES2DecoderImpl::HandleConsumeTextureCHROMIUM( |
3048 uint32 immediate_data_size, const gles2::ConsumeTextureCHROMIUM& c) { | 3071 uint32 immediate_data_size, const gles2::cmds::ConsumeTextureCHROMIUM& c) { |
3049 GLenum target = static_cast<GLenum>(c.target); | 3072 GLenum target = static_cast<GLenum>(c.target); |
3050 uint32 data_size; | 3073 uint32 data_size; |
3051 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | 3074 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { |
3052 return error::kOutOfBounds; | 3075 return error::kOutOfBounds; |
3053 } | 3076 } |
3054 const GLbyte* mailbox = GetSharedMemoryAs<const GLbyte*>( | 3077 const GLbyte* mailbox = GetSharedMemoryAs<const GLbyte*>( |
3055 c.mailbox_shm_id, c.mailbox_shm_offset, data_size); | 3078 c.mailbox_shm_id, c.mailbox_shm_offset, data_size); |
3056 if (!validators_->texture_target.IsValid(target)) { | 3079 if (!validators_->texture_target.IsValid(target)) { |
3057 SetGLErrorInvalidEnum("glConsumeTextureCHROMIUM", target, "target"); | 3080 SetGLErrorInvalidEnum("glConsumeTextureCHROMIUM", target, "target"); |
3058 return error::kNoError; | 3081 return error::kNoError; |
3059 } | 3082 } |
3060 if (mailbox == NULL) { | 3083 if (mailbox == NULL) { |
3061 return error::kOutOfBounds; | 3084 return error::kOutOfBounds; |
3062 } | 3085 } |
3063 DoConsumeTextureCHROMIUM(target, mailbox); | 3086 DoConsumeTextureCHROMIUM(target, mailbox); |
3064 return error::kNoError; | 3087 return error::kNoError; |
3065 } | 3088 } |
3066 | 3089 |
3067 error::Error GLES2DecoderImpl::HandleConsumeTextureCHROMIUMImmediate( | 3090 error::Error GLES2DecoderImpl::HandleConsumeTextureCHROMIUMImmediate( |
3068 uint32 immediate_data_size, | 3091 uint32 immediate_data_size, |
3069 const gles2::ConsumeTextureCHROMIUMImmediate& c) { | 3092 const gles2::cmds::ConsumeTextureCHROMIUMImmediate& c) { |
3070 GLenum target = static_cast<GLenum>(c.target); | 3093 GLenum target = static_cast<GLenum>(c.target); |
3071 uint32 data_size; | 3094 uint32 data_size; |
3072 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | 3095 if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { |
3073 return error::kOutOfBounds; | 3096 return error::kOutOfBounds; |
3074 } | 3097 } |
3075 if (data_size > immediate_data_size) { | 3098 if (data_size > immediate_data_size) { |
3076 return error::kOutOfBounds; | 3099 return error::kOutOfBounds; |
3077 } | 3100 } |
3078 const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>( | 3101 const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>( |
3079 c, data_size, immediate_data_size); | 3102 c, data_size, immediate_data_size); |
3080 if (!validators_->texture_target.IsValid(target)) { | 3103 if (!validators_->texture_target.IsValid(target)) { |
3081 SetGLErrorInvalidEnum("glConsumeTextureCHROMIUM", target, "target"); | 3104 SetGLErrorInvalidEnum("glConsumeTextureCHROMIUM", target, "target"); |
3082 return error::kNoError; | 3105 return error::kNoError; |
3083 } | 3106 } |
3084 if (mailbox == NULL) { | 3107 if (mailbox == NULL) { |
3085 return error::kOutOfBounds; | 3108 return error::kOutOfBounds; |
3086 } | 3109 } |
3087 DoConsumeTextureCHROMIUM(target, mailbox); | 3110 DoConsumeTextureCHROMIUM(target, mailbox); |
3088 return error::kNoError; | 3111 return error::kNoError; |
3089 } | 3112 } |
3090 | 3113 |
3091 error::Error GLES2DecoderImpl::HandleBindTexImage2DCHROMIUM( | 3114 error::Error GLES2DecoderImpl::HandleBindTexImage2DCHROMIUM( |
3092 uint32 immediate_data_size, const gles2::BindTexImage2DCHROMIUM& c) { | 3115 uint32 immediate_data_size, const gles2::cmds::BindTexImage2DCHROMIUM& c) { |
3093 GLenum target = static_cast<GLenum>(c.target); | 3116 GLenum target = static_cast<GLenum>(c.target); |
3094 GLint imageId = static_cast<GLint>(c.imageId); | 3117 GLint imageId = static_cast<GLint>(c.imageId); |
3095 if (!validators_->texture_bind_target.IsValid(target)) { | 3118 if (!validators_->texture_bind_target.IsValid(target)) { |
3096 SetGLErrorInvalidEnum("glBindTexImage2DCHROMIUM", target, "target"); | 3119 SetGLErrorInvalidEnum("glBindTexImage2DCHROMIUM", target, "target"); |
3097 return error::kNoError; | 3120 return error::kNoError; |
3098 } | 3121 } |
3099 DoBindTexImage2DCHROMIUM(target, imageId); | 3122 DoBindTexImage2DCHROMIUM(target, imageId); |
3100 return error::kNoError; | 3123 return error::kNoError; |
3101 } | 3124 } |
3102 | 3125 |
3103 error::Error GLES2DecoderImpl::HandleReleaseTexImage2DCHROMIUM( | 3126 error::Error GLES2DecoderImpl::HandleReleaseTexImage2DCHROMIUM( |
3104 uint32 immediate_data_size, const gles2::ReleaseTexImage2DCHROMIUM& c) { | 3127 uint32 immediate_data_size, |
| 3128 const gles2::cmds::ReleaseTexImage2DCHROMIUM& c) { |
3105 GLenum target = static_cast<GLenum>(c.target); | 3129 GLenum target = static_cast<GLenum>(c.target); |
3106 GLint imageId = static_cast<GLint>(c.imageId); | 3130 GLint imageId = static_cast<GLint>(c.imageId); |
3107 if (!validators_->texture_bind_target.IsValid(target)) { | 3131 if (!validators_->texture_bind_target.IsValid(target)) { |
3108 SetGLErrorInvalidEnum("glReleaseTexImage2DCHROMIUM", target, "target"); | 3132 SetGLErrorInvalidEnum("glReleaseTexImage2DCHROMIUM", target, "target"); |
3109 return error::kNoError; | 3133 return error::kNoError; |
3110 } | 3134 } |
3111 DoReleaseTexImage2DCHROMIUM(target, imageId); | 3135 DoReleaseTexImage2DCHROMIUM(target, imageId); |
3112 return error::kNoError; | 3136 return error::kNoError; |
3113 } | 3137 } |
3114 | 3138 |
3115 error::Error GLES2DecoderImpl::HandleTraceEndCHROMIUM( | 3139 error::Error GLES2DecoderImpl::HandleTraceEndCHROMIUM( |
3116 uint32 immediate_data_size, const gles2::TraceEndCHROMIUM& c) { | 3140 uint32 immediate_data_size, const gles2::cmds::TraceEndCHROMIUM& c) { |
3117 DoTraceEndCHROMIUM(); | 3141 DoTraceEndCHROMIUM(); |
3118 return error::kNoError; | 3142 return error::kNoError; |
3119 } | 3143 } |
3120 | 3144 |
3121 error::Error GLES2DecoderImpl::HandleDiscardFramebufferEXT( | 3145 error::Error GLES2DecoderImpl::HandleDiscardFramebufferEXT( |
3122 uint32 immediate_data_size, const gles2::DiscardFramebufferEXT& c) { | 3146 uint32 immediate_data_size, const gles2::cmds::DiscardFramebufferEXT& c) { |
3123 GLenum target = static_cast<GLenum>(c.target); | 3147 GLenum target = static_cast<GLenum>(c.target); |
3124 GLsizei count = static_cast<GLsizei>(c.count); | 3148 GLsizei count = static_cast<GLsizei>(c.count); |
3125 uint32 data_size; | 3149 uint32 data_size; |
3126 if (!ComputeDataSize(count, sizeof(GLenum), 1, &data_size)) { | 3150 if (!ComputeDataSize(count, sizeof(GLenum), 1, &data_size)) { |
3127 return error::kOutOfBounds; | 3151 return error::kOutOfBounds; |
3128 } | 3152 } |
3129 const GLenum* attachments = GetSharedMemoryAs<const GLenum*>( | 3153 const GLenum* attachments = GetSharedMemoryAs<const GLenum*>( |
3130 c.attachments_shm_id, c.attachments_shm_offset, data_size); | 3154 c.attachments_shm_id, c.attachments_shm_offset, data_size); |
3131 if (count < 0) { | 3155 if (count < 0) { |
3132 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0"); | 3156 SetGLError(GL_INVALID_VALUE, "glDiscardFramebufferEXT", "count < 0"); |
3133 return error::kNoError; | 3157 return error::kNoError; |
3134 } | 3158 } |
3135 if (attachments == NULL) { | 3159 if (attachments == NULL) { |
3136 return error::kOutOfBounds; | 3160 return error::kOutOfBounds; |
3137 } | 3161 } |
3138 DoDiscardFramebufferEXT(target, count, attachments); | 3162 DoDiscardFramebufferEXT(target, count, attachments); |
3139 return error::kNoError; | 3163 return error::kNoError; |
3140 } | 3164 } |
3141 | 3165 |
3142 error::Error GLES2DecoderImpl::HandleDiscardFramebufferEXTImmediate( | 3166 error::Error GLES2DecoderImpl::HandleDiscardFramebufferEXTImmediate( |
3143 uint32 immediate_data_size, | 3167 uint32 immediate_data_size, |
3144 const gles2::DiscardFramebufferEXTImmediate& c) { | 3168 const gles2::cmds::DiscardFramebufferEXTImmediate& c) { |
3145 GLenum target = static_cast<GLenum>(c.target); | 3169 GLenum target = static_cast<GLenum>(c.target); |
3146 GLsizei count = static_cast<GLsizei>(c.count); | 3170 GLsizei count = static_cast<GLsizei>(c.count); |
3147 uint32 data_size; | 3171 uint32 data_size; |
3148 if (!ComputeDataSize(count, sizeof(GLenum), 1, &data_size)) { | 3172 if (!ComputeDataSize(count, sizeof(GLenum), 1, &data_size)) { |
3149 return error::kOutOfBounds; | 3173 return error::kOutOfBounds; |
3150 } | 3174 } |
3151 if (data_size > immediate_data_size) { | 3175 if (data_size > immediate_data_size) { |
3152 return error::kOutOfBounds; | 3176 return error::kOutOfBounds; |
3153 } | 3177 } |
3154 const GLenum* attachments = GetImmediateDataAs<const GLenum*>( | 3178 const GLenum* attachments = GetImmediateDataAs<const GLenum*>( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3203 clear_state_dirty_ = true; | 3227 clear_state_dirty_ = true; |
3204 } | 3228 } |
3205 return false; | 3229 return false; |
3206 default: | 3230 default: |
3207 NOTREACHED(); | 3231 NOTREACHED(); |
3208 return false; | 3232 return false; |
3209 } | 3233 } |
3210 } | 3234 } |
3211 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ | 3235 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ |
3212 | 3236 |
OLD | NEW |