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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc

Issue 2497503004: Revert of Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 8
9 namespace gpu { 9 namespace gpu {
10 namespace gles2 { 10 namespace gles2 {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ClientServiceMap<GLuint, GLuint>* id_map, 129 ClientServiceMap<GLuint, GLuint>* id_map,
130 bool create_if_missing) { 130 bool create_if_missing) {
131 return GetServiceID(client_id, id_map, create_if_missing, []() { 131 return GetServiceID(client_id, id_map, create_if_missing, []() {
132 GLuint service_id = 0; 132 GLuint service_id = 0;
133 glGenFramebuffersEXT(1, &service_id); 133 glGenFramebuffersEXT(1, &service_id);
134 return service_id; 134 return service_id;
135 }); 135 });
136 } 136 }
137 137
138 GLuint GetTransformFeedbackServiceID(GLuint client_id, 138 GLuint GetTransformFeedbackServiceID(GLuint client_id,
139 ClientServiceMap<GLuint, GLuint>* id_map) { 139 ClientServiceMap<GLuint, GLuint>* id_map,
140 return id_map->GetServiceIDOrInvalid(client_id); 140 bool create_if_missing) {
141 return GetServiceID(client_id, id_map, create_if_missing, []() {
142 GLuint service_id = 0;
143 glGenTransformFeedbacks(1, &service_id);
144 return service_id;
145 });
141 } 146 }
142 147
143 GLuint GetVertexArrayServiceID(GLuint client_id, 148 GLuint GetVertexArrayServiceID(GLuint client_id,
144 ClientServiceMap<GLuint, GLuint>* id_map) { 149 ClientServiceMap<GLuint, GLuint>* id_map,
145 return id_map->GetServiceIDOrInvalid(client_id); 150 bool create_if_missing) {
151 return GetServiceID(client_id, id_map, create_if_missing, []() {
152 GLuint service_id = 0;
153 glGenVertexArraysOES(1, &service_id);
154 return service_id;
155 });
146 } 156 }
147 157
148 GLuint GetProgramServiceID(GLuint client_id, PassthroughResources* resources) { 158 GLuint GetProgramServiceID(GLuint client_id, PassthroughResources* resources) {
149 return resources->program_id_map.GetServiceIDOrInvalid(client_id); 159 return resources->program_id_map.GetServiceIDOrInvalid(client_id);
150 } 160 }
151 161
152 GLuint GetShaderServiceID(GLuint client_id, PassthroughResources* resources) { 162 GLuint GetShaderServiceID(GLuint client_id, PassthroughResources* resources) {
153 return resources->shader_id_map.GetServiceIDOrInvalid(client_id); 163 return resources->shader_id_map.GetServiceIDOrInvalid(client_id);
154 } 164 }
155 165
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 bound_textures_[active_texture_unit_] = texture; 283 bound_textures_[active_texture_unit_] = texture;
274 } 284 }
275 return error::kNoError; 285 return error::kNoError;
276 } 286 }
277 287
278 error::Error GLES2DecoderPassthroughImpl::DoBindTransformFeedback( 288 error::Error GLES2DecoderPassthroughImpl::DoBindTransformFeedback(
279 GLenum target, 289 GLenum target,
280 GLuint transformfeedback) { 290 GLuint transformfeedback) {
281 glBindTransformFeedback( 291 glBindTransformFeedback(
282 target, GetTransformFeedbackServiceID(transformfeedback, 292 target, GetTransformFeedbackServiceID(transformfeedback,
283 &transform_feedback_id_map_)); 293 &transform_feedback_id_map_,
294 bind_generates_resource_));
284 return error::kNoError; 295 return error::kNoError;
285 } 296 }
286 297
287 error::Error GLES2DecoderPassthroughImpl::DoBlendColor(GLclampf red, 298 error::Error GLES2DecoderPassthroughImpl::DoBlendColor(GLclampf red,
288 GLclampf green, 299 GLclampf green,
289 GLclampf blue, 300 GLclampf blue,
290 GLclampf alpha) { 301 GLclampf alpha) {
291 glBlendColor(red, green, blue, alpha); 302 glBlendColor(red, green, blue, alpha);
292 return error::kNoError; 303 return error::kNoError;
293 } 304 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 GLintptr offset, 716 GLintptr offset,
706 GLsizeiptr size) { 717 GLsizeiptr size) {
707 return error::kNoError; 718 return error::kNoError;
708 } 719 }
709 720
710 error::Error GLES2DecoderPassthroughImpl::DoFramebufferRenderbuffer( 721 error::Error GLES2DecoderPassthroughImpl::DoFramebufferRenderbuffer(
711 GLenum target, 722 GLenum target,
712 GLenum attachment, 723 GLenum attachment,
713 GLenum renderbuffertarget, 724 GLenum renderbuffertarget,
714 GLuint renderbuffer) { 725 GLuint renderbuffer) {
715 glFramebufferRenderbufferEXT( 726 // TODO(geofflang): Handle this case in ANGLE by adding a WebGL validation
716 target, attachment, renderbuffertarget, 727 // mode.
717 GetRenderbufferServiceID(renderbuffer, resources_, false)); 728 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
729 glFramebufferRenderbufferEXT(
730 target, GL_DEPTH_ATTACHMENT, renderbuffertarget,
731 GetRenderbufferServiceID(renderbuffer, resources_, false));
732 glFramebufferRenderbufferEXT(
733 target, GL_STENCIL_ATTACHMENT, renderbuffertarget,
734 GetRenderbufferServiceID(renderbuffer, resources_, false));
735 } else {
736 glFramebufferRenderbufferEXT(
737 target, attachment, renderbuffertarget,
738 GetRenderbufferServiceID(renderbuffer, resources_, false));
739 }
718 return error::kNoError; 740 return error::kNoError;
719 } 741 }
720 742
721 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2D( 743 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2D(
722 GLenum target, 744 GLenum target,
723 GLenum attachment, 745 GLenum attachment,
724 GLenum textarget, 746 GLenum textarget,
725 GLuint texture, 747 GLuint texture,
726 GLint level) { 748 GLint level) {
727 glFramebufferTexture2DEXT(target, attachment, textarget, 749 glFramebufferTexture2DEXT(target, attachment, textarget,
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 error::Error GLES2DecoderPassthroughImpl::DoIsTexture(GLuint texture, 1337 error::Error GLES2DecoderPassthroughImpl::DoIsTexture(GLuint texture,
1316 uint32_t* result) { 1338 uint32_t* result) {
1317 *result = glIsTexture(GetTextureServiceID(texture, resources_, false)); 1339 *result = glIsTexture(GetTextureServiceID(texture, resources_, false));
1318 return error::kNoError; 1340 return error::kNoError;
1319 } 1341 }
1320 1342
1321 error::Error GLES2DecoderPassthroughImpl::DoIsTransformFeedback( 1343 error::Error GLES2DecoderPassthroughImpl::DoIsTransformFeedback(
1322 GLuint transformfeedback, 1344 GLuint transformfeedback,
1323 uint32_t* result) { 1345 uint32_t* result) {
1324 *result = glIsTransformFeedback(GetTransformFeedbackServiceID( 1346 *result = glIsTransformFeedback(GetTransformFeedbackServiceID(
1325 transformfeedback, &transform_feedback_id_map_)); 1347 transformfeedback, &transform_feedback_id_map_, false));
1326 return error::kNoError; 1348 return error::kNoError;
1327 } 1349 }
1328 1350
1329 error::Error GLES2DecoderPassthroughImpl::DoLineWidth(GLfloat width) { 1351 error::Error GLES2DecoderPassthroughImpl::DoLineWidth(GLfloat width) {
1330 glLineWidth(width); 1352 glLineWidth(width);
1331 return error::kNoError; 1353 return error::kNoError;
1332 } 1354 }
1333 1355
1334 error::Error GLES2DecoderPassthroughImpl::DoLinkProgram(GLuint program) { 1356 error::Error GLES2DecoderPassthroughImpl::DoLinkProgram(GLuint program) {
1335 glLinkProgram(GetProgramServiceID(program, resources_)); 1357 glLinkProgram(GetProgramServiceID(program, resources_));
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 error::Error GLES2DecoderPassthroughImpl::DoDeleteVertexArraysOES( 2202 error::Error GLES2DecoderPassthroughImpl::DoDeleteVertexArraysOES(
2181 GLsizei n, 2203 GLsizei n,
2182 const volatile GLuint* arrays) { 2204 const volatile GLuint* arrays) {
2183 return DeleteHelper( 2205 return DeleteHelper(
2184 n, arrays, &vertex_array_id_map_, 2206 n, arrays, &vertex_array_id_map_,
2185 [](GLsizei n, GLuint* arrays) { glDeleteVertexArraysOES(n, arrays); }); 2207 [](GLsizei n, GLuint* arrays) { glDeleteVertexArraysOES(n, arrays); });
2186 } 2208 }
2187 2209
2188 error::Error GLES2DecoderPassthroughImpl::DoIsVertexArrayOES(GLuint array, 2210 error::Error GLES2DecoderPassthroughImpl::DoIsVertexArrayOES(GLuint array,
2189 uint32_t* result) { 2211 uint32_t* result) {
2190 *result = 2212 *result = glIsVertexArrayOES(
2191 glIsVertexArrayOES(GetVertexArrayServiceID(array, &vertex_array_id_map_)); 2213 GetVertexArrayServiceID(array, &vertex_array_id_map_, false));
2192 return error::kNoError; 2214 return error::kNoError;
2193 } 2215 }
2194 2216
2195 error::Error GLES2DecoderPassthroughImpl::DoBindVertexArrayOES(GLuint array) { 2217 error::Error GLES2DecoderPassthroughImpl::DoBindVertexArrayOES(GLuint array) {
2196 glBindVertexArrayOES(GetVertexArrayServiceID(array, &vertex_array_id_map_)); 2218 glBindVertexArrayOES(GetVertexArrayServiceID(array, &vertex_array_id_map_,
2219 bind_generates_resource_));
2197 return error::kNoError; 2220 return error::kNoError;
2198 } 2221 }
2199 2222
2200 error::Error GLES2DecoderPassthroughImpl::DoSwapBuffers() { 2223 error::Error GLES2DecoderPassthroughImpl::DoSwapBuffers() {
2201 gfx::SwapResult result = surface_->SwapBuffers(); 2224 gfx::SwapResult result = surface_->SwapBuffers();
2202 if (result == gfx::SwapResult::SWAP_FAILED) { 2225 if (result == gfx::SwapResult::SWAP_FAILED) {
2203 LOG(ERROR) << "Context lost because SwapBuffers failed."; 2226 LOG(ERROR) << "Context lost because SwapBuffers failed.";
2204 } 2227 }
2205 // TODO(geofflang): force the context loss? 2228 // TODO(geofflang): force the context loss?
2206 return error::kNoError; 2229 return error::kNoError;
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 GLES2DecoderPassthroughImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( 3023 GLES2DecoderPassthroughImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
3001 GLint location, 3024 GLint location,
3002 GLboolean transpose, 3025 GLboolean transpose,
3003 const volatile GLfloat* defaultValue) { 3026 const volatile GLfloat* defaultValue) {
3004 NOTIMPLEMENTED(); 3027 NOTIMPLEMENTED();
3005 return error::kNoError; 3028 return error::kNoError;
3006 } 3029 }
3007 3030
3008 } // namespace gles2 3031 } // namespace gles2
3009 } // namespace gpu 3032 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc ('k') | gpu/command_buffer/service/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698