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

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: Address zmo's comments 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 GLuint program_service_id = GetProgramServiceID(program, resources_);
1021 GLint max_name_length = 0;
1022 glGetProgramiv(program_service_id, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH,
1023 &max_name_length);
1024
1025 if (FlushErrors()) {
1026 return error::kNoError;
1027 }
1028
1029 std::vector<GLchar> buffer(max_name_length, 0);
1030 GLsizei length = 0;
1031 glGetActiveUniformBlockName(program_service_id, index, max_name_length,
1032 &length, buffer.data());
1033 DCHECK(length <= max_name_length);
1034 *name = length > 0 ? std::string(buffer.data(), length) : std::string();
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(), info_log_len)
Zhenyao Mo 2017/03/23 17:45:56 I mean the same with std::string(buffer.data(), le
1247 : std::string();
1225 return error::kNoError; 1248 return error::kNoError;
1226 } 1249 }
1227 1250
1228 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv( 1251 error::Error GLES2DecoderPassthroughImpl::DoGetRenderbufferParameteriv(
1229 GLenum target, 1252 GLenum target,
1230 GLenum pname, 1253 GLenum pname,
1231 GLsizei bufsize, 1254 GLsizei bufsize,
1232 GLsizei* length, 1255 GLsizei* length,
1233 GLint* params) { 1256 GLint* params) {
1234 glGetRenderbufferParameterivRobustANGLE(target, pname, bufsize, length, 1257 glGetRenderbufferParameterivRobustANGLE(target, pname, bufsize, length,
(...skipping 28 matching lines...) Expand all
1263 GLsizei* length, 1286 GLsizei* length,
1264 GLint* params) { 1287 GLint* params) {
1265 glGetShaderivRobustANGLE(GetShaderServiceID(shader, resources_), pname, 1288 glGetShaderivRobustANGLE(GetShaderServiceID(shader, resources_), pname,
1266 bufsize, length, params); 1289 bufsize, length, params);
1267 return error::kNoError; 1290 return error::kNoError;
1268 } 1291 }
1269 1292
1270 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog( 1293 error::Error GLES2DecoderPassthroughImpl::DoGetShaderInfoLog(
1271 GLuint shader, 1294 GLuint shader,
1272 std::string* infolog) { 1295 std::string* infolog) {
1296 FlushErrors();
1297
1273 GLuint service_id = GetShaderServiceID(shader, resources_); 1298 GLuint service_id = GetShaderServiceID(shader, resources_);
1274 GLint info_log_len = 0; 1299 GLint info_log_len = 0;
1275 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len); 1300 glGetShaderiv(service_id, GL_INFO_LOG_LENGTH, &info_log_len);
1301 if (FlushErrors()) {
1302 return error::kNoError;
1303 }
1304
1276 std::vector<char> buffer(info_log_len, 0); 1305 std::vector<char> buffer(info_log_len, 0);
1277 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data()); 1306 glGetShaderInfoLog(service_id, info_log_len, nullptr, buffer.data());
1278 *infolog = info_log_len > 0 ? std::string(buffer.data()) : std::string(); 1307 *infolog = info_log_len > 0 ? std::string(buffer.data(), info_log_len)
1308 : std::string();
1279 return error::kNoError; 1309 return error::kNoError;
1280 } 1310 }
1281 1311
1282 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat( 1312 error::Error GLES2DecoderPassthroughImpl::DoGetShaderPrecisionFormat(
1283 GLenum shadertype, 1313 GLenum shadertype,
1284 GLenum precisiontype, 1314 GLenum precisiontype,
1285 GLint* range, 1315 GLint* range,
1286 GLint* precision, 1316 GLint* precision,
1287 int32_t* success) { 1317 int32_t* success) {
1288 FlushErrors(); 1318 FlushErrors();
1289 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision); 1319 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
1290 *success = FlushErrors() ? 0 : 1; 1320 *success = FlushErrors() ? 0 : 1;
1291 return error::kNoError; 1321 return error::kNoError;
1292 } 1322 }
1293 1323
1294 error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource( 1324 error::Error GLES2DecoderPassthroughImpl::DoGetShaderSource(
1295 GLuint shader, 1325 GLuint shader,
1296 std::string* source) { 1326 std::string* source) {
1297 NOTIMPLEMENTED(); 1327 FlushErrors();
1328
1329 GLuint shader_service_id = GetShaderServiceID(shader, resources_);
1330 GLint shader_source_length = 0;
1331 glGetShaderiv(shader_service_id, GL_SHADER_SOURCE_LENGTH,
1332 &shader_source_length);
1333 if (FlushErrors()) {
1334 return error::kNoError;
1335 }
1336
1337 std::vector<char> buffer(shader_source_length, 0);
1338 glGetShaderSource(shader_service_id, shader_source_length, nullptr,
1339 buffer.data());
1340 *source = shader_source_length > 0
1341 ? std::string(buffer.data(), shader_source_length)
Zhenyao Mo 2017/03/23 17:45:56 The same with std::string(buffer.data(), len).
Geoff Lang 2017/03/23 17:50:17 For this one, the length should be exact but I can
1342 : std::string();
1298 return error::kNoError; 1343 return error::kNoError;
1299 } 1344 }
1300 1345
1301 error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name, 1346 error::Error GLES2DecoderPassthroughImpl::DoGetString(GLenum name,
1302 const char** result) { 1347 const char** result) {
1303 switch (name) { 1348 switch (name) {
1304 case GL_VERSION: 1349 case GL_VERSION:
1305 *result = GetServiceVersionString(feature_info_.get()); 1350 *result = GetServiceVersionString(feature_info_.get());
1306 break; 1351 break;
1307 case GL_SHADING_LANGUAGE_VERSION: 1352 case GL_SHADING_LANGUAGE_VERSION:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 size, type, name_buffer.data()); 1414 size, type, name_buffer.data());
1370 *name = std::string(name_buffer.data()); 1415 *name = std::string(name_buffer.data());
1371 *success = FlushErrors() ? 0 : 1; 1416 *success = FlushErrors() ? 0 : 1;
1372 return error::kNoError; 1417 return error::kNoError;
1373 } 1418 }
1374 1419
1375 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex( 1420 error::Error GLES2DecoderPassthroughImpl::DoGetUniformBlockIndex(
1376 GLuint program, 1421 GLuint program,
1377 const char* name, 1422 const char* name,
1378 GLint* index) { 1423 GLint* index) {
1379 NOTIMPLEMENTED(); 1424 *index =
1425 glGetUniformBlockIndex(GetProgramServiceID(program, resources_), name);
1380 return error::kNoError; 1426 return error::kNoError;
1381 } 1427 }
1382 1428
1383 error::Error GLES2DecoderPassthroughImpl::DoGetUniformfv(GLuint program, 1429 error::Error GLES2DecoderPassthroughImpl::DoGetUniformfv(GLuint program,
1384 GLint location, 1430 GLint location,
1385 GLsizei bufsize, 1431 GLsizei bufsize,
1386 GLsizei* length, 1432 GLsizei* length,
1387 GLfloat* params) { 1433 GLfloat* params) {
1388 // GetUniform*RobustANGLE entry points expect bufsize in bytes like the entry 1434 // GetUniform*RobustANGLE entry points expect bufsize in bytes like the entry
1389 // points in GL_EXT_robustness 1435 // points in GL_EXT_robustness
(...skipping 24 matching lines...) Expand all
1414 glGetUniformuivRobustANGLE(GetProgramServiceID(program, resources_), location, 1460 glGetUniformuivRobustANGLE(GetProgramServiceID(program, resources_), location,
1415 bufsize * sizeof(*params), length, params); 1461 bufsize * sizeof(*params), length, params);
1416 return error::kNoError; 1462 return error::kNoError;
1417 } 1463 }
1418 1464
1419 error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices( 1465 error::Error GLES2DecoderPassthroughImpl::DoGetUniformIndices(
1420 GLuint program, 1466 GLuint program,
1421 GLsizei count, 1467 GLsizei count,
1422 const char* const* names, 1468 const char* const* names,
1423 GLsizei bufSize, 1469 GLsizei bufSize,
1424 GLsizei* length,
1425 GLuint* indices) { 1470 GLuint* indices) {
1426 NOTIMPLEMENTED(); 1471 glGetUniformIndices(GetProgramServiceID(program, resources_), count, names,
1472 indices);
1427 return error::kNoError; 1473 return error::kNoError;
1428 } 1474 }
1429 1475
1430 error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation( 1476 error::Error GLES2DecoderPassthroughImpl::DoGetUniformLocation(
1431 GLuint program, 1477 GLuint program,
1432 const char* name, 1478 const char* name,
1433 GLint* location) { 1479 GLint* location) {
1434 *location = 1480 *location =
1435 glGetUniformLocation(GetProgramServiceID(program, resources_), name); 1481 glGetUniformLocation(GetProgramServiceID(program, resources_), name);
1436 return error::kNoError; 1482 return error::kNoError;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 return error::kNoError; 1574 return error::kNoError;
1529 } 1575 }
1530 std::vector<GLenum> attachments_copy(attachments, attachments + count); 1576 std::vector<GLenum> attachments_copy(attachments, attachments + count);
1531 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y, 1577 glInvalidateSubFramebuffer(target, count, attachments_copy.data(), x, y,
1532 width, height); 1578 width, height);
1533 return error::kNoError; 1579 return error::kNoError;
1534 } 1580 }
1535 1581
1536 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, 1582 error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer,
1537 uint32_t* result) { 1583 uint32_t* result) {
1538 NOTIMPLEMENTED();
1539 *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false)); 1584 *result = glIsBuffer(GetBufferServiceID(buffer, resources_, false));
1540 return error::kNoError; 1585 return error::kNoError;
1541 } 1586 }
1542 1587
1543 error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap, 1588 error::Error GLES2DecoderPassthroughImpl::DoIsEnabled(GLenum cap,
1544 uint32_t* result) { 1589 uint32_t* result) {
1545 *result = glIsEnabled(cap); 1590 *result = glIsEnabled(cap);
1546 return error::kNoError; 1591 return error::kNoError;
1547 } 1592 }
1548 1593
1549 error::Error GLES2DecoderPassthroughImpl::DoIsFramebuffer(GLuint framebuffer, 1594 error::Error GLES2DecoderPassthroughImpl::DoIsFramebuffer(GLuint framebuffer,
1550 uint32_t* result) { 1595 uint32_t* result) {
1551 *result = glIsFramebufferEXT( 1596 *result = glIsFramebufferEXT(
1552 GetFramebufferServiceID(framebuffer, &framebuffer_id_map_, false)); 1597 GetFramebufferServiceID(framebuffer, &framebuffer_id_map_, false));
1553 return error::kNoError; 1598 return error::kNoError;
1554 } 1599 }
1555 1600
1556 error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program, 1601 error::Error GLES2DecoderPassthroughImpl::DoIsProgram(GLuint program,
1557 uint32_t* result) { 1602 uint32_t* result) {
1558 *result = glIsProgram(GetProgramServiceID(program, resources_)); 1603 *result = glIsProgram(GetProgramServiceID(program, resources_));
1559 return error::kNoError; 1604 return error::kNoError;
1560 } 1605 }
1561 1606
1562 error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer, 1607 error::Error GLES2DecoderPassthroughImpl::DoIsRenderbuffer(GLuint renderbuffer,
1563 uint32_t* result) { 1608 uint32_t* result) {
1564 NOTIMPLEMENTED();
1565 *result = glIsRenderbufferEXT( 1609 *result = glIsRenderbufferEXT(
1566 GetRenderbufferServiceID(renderbuffer, resources_, false)); 1610 GetRenderbufferServiceID(renderbuffer, resources_, false));
1567 return error::kNoError; 1611 return error::kNoError;
1568 } 1612 }
1569 1613
1570 error::Error GLES2DecoderPassthroughImpl::DoIsSampler(GLuint sampler, 1614 error::Error GLES2DecoderPassthroughImpl::DoIsSampler(GLuint sampler,
1571 uint32_t* result) { 1615 uint32_t* result) {
1572 *result = glIsSampler(GetSamplerServiceID(sampler, resources_)); 1616 *result = glIsSampler(GetSamplerServiceID(sampler, resources_));
1573 return error::kNoError; 1617 return error::kNoError;
1574 } 1618 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 GLsizei height) { 1759 GLsizei height) {
1716 glScissor(x, y, width, height); 1760 glScissor(x, y, width, height);
1717 return error::kNoError; 1761 return error::kNoError;
1718 } 1762 }
1719 1763
1720 error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n, 1764 error::Error GLES2DecoderPassthroughImpl::DoShaderBinary(GLsizei n,
1721 const GLuint* shaders, 1765 const GLuint* shaders,
1722 GLenum binaryformat, 1766 GLenum binaryformat,
1723 const void* binary, 1767 const void* binary,
1724 GLsizei length) { 1768 GLsizei length) {
1725 NOTIMPLEMENTED(); 1769 std::vector<GLuint> service_shaders(n, 0);
1770 for (GLsizei i = 0; i < n; i++) {
1771 service_shaders[i] = GetShaderServiceID(shaders[i], resources_);
1772 }
1773 glShaderBinary(n, service_shaders.data(), binaryformat, binary, length);
1726 return error::kNoError; 1774 return error::kNoError;
1727 } 1775 }
1728 1776
1729 error::Error GLES2DecoderPassthroughImpl::DoShaderSource(GLuint shader, 1777 error::Error GLES2DecoderPassthroughImpl::DoShaderSource(GLuint shader,
1730 GLsizei count, 1778 GLsizei count,
1731 const char** string, 1779 const char** string,
1732 const GLint* length) { 1780 const GLint* length) {
1733 glShaderSource(GetShaderServiceID(shader, resources_), count, string, length); 1781 glShaderSource(GetShaderServiceID(shader, resources_), count, string, length);
1734 return error::kNoError; 1782 return error::kNoError;
1735 } 1783 }
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 return error::kNoError; 2421 return error::kNoError;
2374 } 2422 }
2375 2423
2376 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT( 2424 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT(
2377 GLenum target, 2425 GLenum target,
2378 GLenum attachment, 2426 GLenum attachment,
2379 GLenum textarget, 2427 GLenum textarget,
2380 GLuint texture, 2428 GLuint texture,
2381 GLint level, 2429 GLint level,
2382 GLsizei samples) { 2430 GLsizei samples) {
2383 NOTIMPLEMENTED(); 2431 glFramebufferTexture2DMultisampleEXT(
2432 target, attachment, textarget,
2433 GetTextureServiceID(texture, resources_, false), level, samples);
2384 return error::kNoError; 2434 return error::kNoError;
2385 } 2435 }
2386 2436
2387 error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT( 2437 error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT(
2388 GLenum target, 2438 GLenum target,
2389 GLsizei levels, 2439 GLsizei levels,
2390 GLenum internalFormat, 2440 GLenum internalFormat,
2391 GLsizei width, 2441 GLsizei width,
2392 GLsizei height) { 2442 GLsizei height) {
2393 glTexStorage2DEXT(target, levels, internalFormat, width, height); 2443 glTexStorage2DEXT(target, levels, internalFormat, width, height);
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 } 3958 }
3909 3959
3910 error::Error GLES2DecoderPassthroughImpl::DoSetEnableDCLayersCHROMIUM( 3960 error::Error GLES2DecoderPassthroughImpl::DoSetEnableDCLayersCHROMIUM(
3911 GLboolean enable) { 3961 GLboolean enable) {
3912 NOTIMPLEMENTED(); 3962 NOTIMPLEMENTED();
3913 return error::kNoError; 3963 return error::kNoError;
3914 } 3964 }
3915 3965
3916 } // namespace gles2 3966 } // namespace gles2
3917 } // namespace gpu 3967 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698