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

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

Issue 2770713005: Implement most of the remaining entry points in the passthrough cmd decoder. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 #include "ui/gl/gl_version_info.h" 8 #include "ui/gl/gl_version_info.h"
9 9
10 namespace gpu { 10 namespace gpu {
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 GLint* params) { 1008 GLint* params) {
1009 glGetActiveUniformBlockivRobustANGLE(GetProgramServiceID(program, resources_), 1009 glGetActiveUniformBlockivRobustANGLE(GetProgramServiceID(program, resources_),
1010 index, pname, bufSize, length, params); 1010 index, pname, bufSize, length, params);
1011 return error::kNoError; 1011 return error::kNoError;
1012 } 1012 }
1013 1013
1014 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockName( 1014 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformBlockName(
1015 GLuint program, 1015 GLuint program,
1016 GLuint index, 1016 GLuint index,
1017 std::string* name) { 1017 std::string* name) {
1018 NOTIMPLEMENTED(); 1018 FlushErrors();
1019
1020 GLint active_uniform_block_max_length = 0;
Zhenyao Mo 2017/03/23 17:02:46 nit: should be *max_name_length.
Geoff Lang 2017/03/23 17:39:44 Done.
1021 glGetProgramiv(GetProgramServiceID(program, resources_),
1022 GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
1023 &active_uniform_block_max_length);
1024
1025 if (FlushErrors() || active_uniform_block_max_length) {
1026 return error::kNoError;
1027 }
1028
1029 std::vector<GLchar> buffer(active_uniform_block_max_length, 0);
1030 GLsizei length = 0;
1031 glGetActiveUniformBlockName(GetProgramServiceID(program, resources_), index,
Zhenyao Mo 2017/03/23 17:02:46 Can we cache the service_id above so we don't have
Geoff Lang 2017/03/23 17:39:44 Done.
1032 active_uniform_block_max_length, &length,
1033 buffer.data());
1034 *name = length > 0 ? std::string(buffer.data()) : std::string();
Zhenyao Mo 2017/03/23 17:02:46 To be on the safe side, can we DCHECK length < act
Zhenyao Mo 2017/03/23 17:02:46 nit: can we DCHECK(name) before using it?
Geoff Lang 2017/03/23 17:39:43 name is safe to use, it is a local variable from t
Geoff Lang 2017/03/23 17:39:44 Done.
1035
1019 return error::kNoError; 1036 return error::kNoError;
1020 } 1037 }
1021 1038
1022 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformsiv( 1039 error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformsiv(
1023 GLuint program, 1040 GLuint program,
1024 GLsizei count, 1041 GLsizei count,
1025 const GLuint* indices, 1042 const GLuint* indices,
1026 GLenum pname, 1043 GLenum pname,
1027 GLsizei bufSize,
1028 GLsizei* length,
1029 GLint* params) { 1044 GLint* params) {
1030 NOTIMPLEMENTED(); 1045 glGetActiveUniformsiv(GetProgramServiceID(program, resources_), count,
1046 indices, pname, params);
1031 return error::kNoError; 1047 return error::kNoError;
1032 } 1048 }
1033 1049
1034 error::Error GLES2DecoderPassthroughImpl::DoGetAttachedShaders( 1050 error::Error GLES2DecoderPassthroughImpl::DoGetAttachedShaders(
1035 GLuint program, 1051 GLuint program,
1036 GLsizei maxcount, 1052 GLsizei maxcount,
1037 GLsizei* count, 1053 GLsizei* count,
1038 GLuint* shaders) { 1054 GLuint* shaders) {
1039 NOTIMPLEMENTED(); 1055 glGetAttachedShaders(GetProgramServiceID(program, resources_), maxcount,
1056 count, shaders);
1040 return error::kNoError; 1057 return error::kNoError;
1041 } 1058 }
1042 1059
1043 error::Error GLES2DecoderPassthroughImpl::DoGetAttribLocation(GLuint program, 1060 error::Error GLES2DecoderPassthroughImpl::DoGetAttribLocation(GLuint program,
1044 const char* name, 1061 const char* name,
1045 GLint* result) { 1062 GLint* result) {
1046 *result = glGetAttribLocation(GetProgramServiceID(program, resources_), name); 1063 *result = glGetAttribLocation(GetProgramServiceID(program, resources_), name);
1047 return error::kNoError; 1064 return error::kNoError;
1048 } 1065 }
1049 1066
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 GLsizei* length, 1224 GLsizei* length,
1208 GLint* params) { 1225 GLint* params) {
1209 glGetProgramivRobustANGLE(GetProgramServiceID(program, resources_), pname, 1226 glGetProgramivRobustANGLE(GetProgramServiceID(program, resources_), pname,
1210 bufsize, length, params); 1227 bufsize, length, params);
1211 return error::kNoError; 1228 return error::kNoError;
1212 } 1229 }
1213 1230
1214 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog( 1231 error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog(
1215 GLuint program, 1232 GLuint program,
1216 std::string* infolog) { 1233 std::string* infolog) {
1234 FlushErrors();
1217 GLint info_log_len = 0; 1235 GLint info_log_len = 0;
1218 glGetProgramiv(GetProgramServiceID(program, resources_), GL_INFO_LOG_LENGTH, 1236 glGetProgramiv(GetProgramServiceID(program, resources_), GL_INFO_LOG_LENGTH,
1219 &info_log_len); 1237 &info_log_len);
1220 1238
1239 if (FlushErrors()) {
1240 return error::kNoError;
1241 }
1242
1221 std::vector<char> buffer(info_log_len, 0); 1243 std::vector<char> buffer(info_log_len, 0);
1222 glGetProgramInfoLog(GetProgramServiceID(program, resources_), info_log_len, 1244 glGetProgramInfoLog(GetProgramServiceID(program, resources_), info_log_len,
1223 nullptr, buffer.data()); 1245 nullptr, buffer.data());
1224 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string(); 1246 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string();
1225 return error::kNoError; 1247 return error::kNoError;
1226 } 1248 }
1227 1249
1228 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv( 1250 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv(
1229 GLenum target, 1251 GLenum target,
1230 GLenum pname, 1252 GLenum pname,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 GLsizei* length, 1285 GLsizei* length,
1264 GLint* params) { 1286 GLint* params) {
1265 glGetShaderivRobustANGLE(GetShaderServiceID(shader, resources_), pname, 1287 glGetShaderivRobustANGLE(GetShaderServiceID(shader, resources_), pname,
1266 bufsize, length, params); 1288 bufsize, length, params);
1267 return error::kNoError; 1289 return error::kNoError;
1268 } 1290 }
1269 1291
1270 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog( 1292 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog(
1271 GLuint shader, 1293 GLuint shader,
1272 std::string* infolog) { 1294 std::string* infolog) {
1295 FlushErrors();
1296
1273 GLuint service_id = GetShaderServiceID(shader, resources_); 1297 GLuint service_id = GetShaderServiceID(shader, resources_);
1274 GLint info_log_len = 0; 1298 GLint info_log_len = 0;
1275 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len); 1299 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len);
1300 if (FlushErrors()) {
1301 return error::kNoError;
1302 }
1303
1276 std::vector<char> buffer(info_log_len, 0); 1304 std::vector<char> buffer(info_log_len, 0);
1277 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data()); 1305 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data());
1278 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string(); 1306 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string();
1279 return error::kNoError; 1307 return error::kNoError;
1280 } 1308 }
1281 1309
1282 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat( 1310 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat(
1283 GLenum shadertype, 1311 GLenum shadertype,
1284 GLenum precisiontype, 1312 GLenum precisiontype,
1285 GLint* range, 1313 GLint* range,
1286 GLint* precision, 1314 GLint* precision,
1287 int32_t* success) { 1315 int32_t* success) {
1288 FlushErrors(); 1316 FlushErrors();
1289 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); 1317 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1290 *success = FlushErrors() ? 0 : 1; 1318 *success = FlushErrors() ? 0 : 1;
1291 return error::kNoError; 1319 return error::kNoError;
1292 } 1320 }
1293 1321
1294 error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource( 1322 error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource(
1295 GLuint shader, 1323 GLuint shader,
1296 std::string* source) { 1324 std::string* source) {
1297 NOTIMPLEMENTED(); 1325 FlushErrors();
1326
1327 GLint shader_source_length = 0;
1328 glGetShaderiv(GetShaderServiceID(shader, resources_), GL_SHADER_SOURCE_LENGTH,
1329 &shader_source_length);
1330 if (FlushErrors()) {
1331 return error::kNoError;
1332 }
1333
1334 std::vector<char> buffer(shader_source_length, 0);
1335 glGetShaderSource(GetShaderServiceID(shader, resources_),
1336 shader_source_length, nullptr, buffer.data());
1337 *source =
1338 shader_source_length > 0 ? std::string(buffer.data()) : std::string();
Zhenyao Mo 2017/03/23 17:02:46 Same suggestions here.
Geoff Lang 2017/03/23 17:39:44 Done.
1298 return error::kNoError; 1339 return error::kNoError;
1299 } 1340 }
1300 1341
1301 error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name, 1342 error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name,
1302 const char** result) { 1343 const char** result) {
1303 switch (name) { 1344 switch (name) {
1304 case GL_VERSION: 1345 case GL_VERSION:
1305 *result = GetServiceVersionString(feature_info_.get()); 1346 *result = GetServiceVersionString(feature_info_.get());
1306 break; 1347 break;
1307 case GL_SHADING_LANGUAGE_VERSION: 1348 case GL_SHADING_LANGUAGE_VERSION:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 size, type, name_buffer.data()); 1410 size, type, name_buffer.data());
1370 *name = std::string(name_buffer.data()); 1411 *name = std::string(name_buffer.data());
1371 *success = FlushErrors() ? 0 : 1; 1412 *success = FlushErrors() ? 0 : 1;
1372 return error::kNoError; 1413 return error::kNoError;
1373 } 1414 }
1374 1415
1375 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex( 1416 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex(
1376 GLuint program, 1417 GLuint program,
1377 const char* name, 1418 const char* name,
1378 GLint* index) { 1419 GLint* index) {
1379 NOTIMPLEMENTED(); 1420 *index =
1421 glGetUniformBlockIndex(GetProgramServiceID(program, resources_), name);
1380 return error::kNoError; 1422 return error::kNoError;
1381 } 1423 }
1382 1424
1383 error::Error GLES2DecoderPassthroughImpl::DoGetUniformfv(GLuint program, 1425 error::Error GLES2DecoderPassthroughImpl::DoGetUniformfv(GLuint program,
1384 GLint location, 1426 GLint location,
1385 GLsizei bufsize, 1427 GLsizei bufsize,
1386 GLsizei* length, 1428 GLsizei* length,
1387 GLfloat* params) { 1429 GLfloat* params) {
1388 // GetUniform*RobustANGLE entry points expect bufsize in bytes like the entry 1430 // GetUniform*RobustANGLE entry points expect bufsize in bytes like the entry
1389 // points in GL_EXT_robustness 1431 // points in GL_EXT_robustness
(...skipping 24 matching lines...) Expand all
1414 glGetUniformuivRobustANGLE(GetProgramServiceID(program, resources_), location, 1456 glGetUniformuivRobustANGLE(GetProgramServiceID(program, resources_), location,
1415 bufsize * sizeof(*params), length, params); 1457 bufsize * sizeof(*params), length, params);
1416 return error::kNoError; 1458 return error::kNoError;
1417 } 1459 }
1418 1460
1419 error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices( 1461 error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices(
1420 GLuint program, 1462 GLuint program,
1421 GLsizei count, 1463 GLsizei count,
1422 const char* const* names, 1464 const char* const* names,
1423 GLsizei bufSize, 1465 GLsizei bufSize,
1424 GLsizei* length,
1425 GLuint* indices) { 1466 GLuint* indices) {
1426 NOTIMPLEMENTED(); 1467 glGetUniformIndices(GetProgramServiceID(program, resources_), count, names,
1468 indices);
1427 return error::kNoError; 1469 return error::kNoError;
1428 } 1470 }
1429 1471
1430 error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation( 1472 error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation(
1431 GLuint program, 1473 GLuint program,
1432 const char* name, 1474 const char* name,
1433 GLint* location) { 1475 GLint* location) {
1434 *location = 1476 *location =
1435 glGetUniformLocation(GetProgramServiceID(program, resources_), name); 1477 glGetUniformLocation(GetProgramServiceID(program, resources_), name);
1436 return error::kNoError; 1478 return error::kNoError;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 return error::kNoError; 1570 return error::kNoError;
1529 } 1571 }
1530 std::vector<GLenum> attachments_copy(attachments, attachments + count); 1572 std::vector<GLenum> attachments_copy(attachments, attachments + count);
1531 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y, 1573 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y,
1532 width, height); 1574 width, height);
1533 return error::kNoError; 1575 return error::kNoError;
1534 } 1576 }
1535 1577
1536 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, 1578 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer,
1537 uint32_t* result) { 1579 uint32_t* result) {
1538 NOTIMPLEMENTED();
1539 *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false)); 1580 *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false));
1540 return error::kNoError; 1581 return error::kNoError;
1541 } 1582 }
1542 1583
1543 error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap, 1584 error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap,
1544 uint32_t* result) { 1585 uint32_t* result) {
1545 *result = glIsEnabled(cap); 1586 *result = glIsEnabled(cap);
1546 return error::kNoError; 1587 return error::kNoError;
1547 } 1588 }
1548 1589
1549 error::Error GLES2DecoderPassthroughImpl::DoIsFramebuffer(GLuint framebuffer, 1590 error::Error GLES2DecoderPassthroughImpl::DoIsFramebuffer(GLuint framebuffer,
1550 uint32_t* result) { 1591 uint32_t* result) {
1551 *result = glIsFramebufferEXT( 1592 *result = glIsFramebufferEXT(
1552 GetFramebufferServiceID(framebuffer, &framebuffer_id_map_, false)); 1593 GetFramebufferServiceID(framebuffer, &framebuffer_id_map_, false));
1553 return error::kNoError; 1594 return error::kNoError;
1554 } 1595 }
1555 1596
1556 error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program, 1597 error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program,
1557 uint32_t* result) { 1598 uint32_t* result) {
1558 *result = glIsProgram(GetProgramServiceID(program, resources_)); 1599 *result = glIsProgram(GetProgramServiceID(program, resources_));
1559 return error::kNoError; 1600 return error::kNoError;
1560 } 1601 }
1561 1602
1562 error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer, 1603 error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer,
1563 uint32_t* result) { 1604 uint32_t* result) {
1564 NOTIMPLEMENTED();
1565 *result = glIsRenderbufferEXT( 1605 *result = glIsRenderbufferEXT(
1566 GetRenderbufferServiceID(renderbuffer, resources_, false)); 1606 GetRenderbufferServiceID(renderbuffer, resources_, false));
1567 return error::kNoError; 1607 return error::kNoError;
1568 } 1608 }
1569 1609
1570 error::Error GLES2DecoderPassthroughImpl::DoIsSampler(GLuint sampler, 1610 error::Error GLES2DecoderPassthroughImpl::DoIsSampler(GLuint sampler,
1571 uint32_t* result) { 1611 uint32_t* result) {
1572 *result = glIsSampler(GetSamplerServiceID(sampler, resources_)); 1612 *result = glIsSampler(GetSamplerServiceID(sampler, resources_));
1573 return error::kNoError; 1613 return error::kNoError;
1574 } 1614 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 GLsizei height) { 1755 GLsizei height) {
1716 glScissor(x, y, width, height); 1756 glScissor(x, y, width, height);
1717 return error::kNoError; 1757 return error::kNoError;
1718 } 1758 }
1719 1759
1720 error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n, 1760 error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n,
1721 const GLuint* shaders, 1761 const GLuint* shaders,
1722 GLenum binaryformat, 1762 GLenum binaryformat,
1723 const void* binary, 1763 const void* binary,
1724 GLsizei length) { 1764 GLsizei length) {
1725 NOTIMPLEMENTED(); 1765 std::vector<GLuint> service_shaders(n, 0);
1766 for (GLsizei i = 0; i < n; i++) {
1767 service_shaders[i] = GetShaderServiceID(shaders[i], resources_);
1768 }
1769 glShaderBinary(n, service_shaders.data(), binaryformat, binary, length);
1726 return error::kNoError; 1770 return error::kNoError;
1727 } 1771 }
1728 1772
1729 error::Error GLES2DecoderPassthroughImpl::DoShaderSource(GLuint shader, 1773 error::Error GLES2DecoderPassthroughImpl::DoShaderSource(GLuint shader,
1730 GLsizei count, 1774 GLsizei count,
1731 const char** string, 1775 const char** string,
1732 const GLint* length) { 1776 const GLint* length) {
1733 glShaderSource(GetShaderServiceID(shader, resources_), count, string, length); 1777 glShaderSource(GetShaderServiceID(shader, resources_), count, string, length);
1734 return error::kNoError; 1778 return error::kNoError;
1735 } 1779 }
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 return error::kNoError; 2417 return error::kNoError;
2374 } 2418 }
2375 2419
2376 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT( 2420 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT(
2377 GLenum target, 2421 GLenum target,
2378 GLenum attachment, 2422 GLenum attachment,
2379 GLenum textarget, 2423 GLenum textarget,
2380 GLuint texture, 2424 GLuint texture,
2381 GLint level, 2425 GLint level,
2382 GLsizei samples) { 2426 GLsizei samples) {
2383 NOTIMPLEMENTED(); 2427 glFramebufferTexture2DMultisampleEXT(
2428 target, attachment, textarget,
2429 GetTextureServiceID(texture, resources_, false), level, samples);
2384 return error::kNoError; 2430 return error::kNoError;
2385 } 2431 }
2386 2432
2387 error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT( 2433 error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT(
2388 GLenum target, 2434 GLenum target,
2389 GLsizei levels, 2435 GLsizei levels,
2390 GLenum internalFormat, 2436 GLenum internalFormat,
2391 GLsizei width, 2437 GLsizei width,
2392 GLsizei height) { 2438 GLsizei height) {
2393 glTexStorage2DEXT(target, levels, internalFormat, width, height); 2439 glTexStorage2DEXT(target, levels, internalFormat, width, height);
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 } 3954 }
3909 3955
3910 error::Error GLES2DecoderPassthroughImpl::DoSetEnableDCLayersCHROMIUM( 3956 error::Error GLES2DecoderPassthroughImpl::DoSetEnableDCLayersCHROMIUM(
3911 GLboolean enable) { 3957 GLboolean enable) {
3912 NOTIMPLEMENTED(); 3958 NOTIMPLEMENTED();
3913 return error::kNoError; 3959 return error::kNoError;
3914 } 3960 }
3915 3961
3916 } // namespace gles2 3962 } // namespace gles2
3917 } // namespace gpu 3963 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698