| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 ~ScopedFramebufferRestorer() | 508 ~ScopedFramebufferRestorer() |
| 509 { | 509 { |
| 510 m_context->restoreCurrentFramebuffer(); | 510 m_context->restoreCurrentFramebuffer(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 private: | 513 private: |
| 514 Member<WebGLRenderingContextBase> m_context; | 514 Member<WebGLRenderingContextBase> m_context; |
| 515 }; | 515 }; |
| 516 | 516 |
| 517 static void formatWebGLStatusString(const String& glInfo, const String& infostri
ng, String& statusMessage) | 517 static void formatWebGLStatusString(const StringView& glInfo, const StringView&
infoString, StringBuilder& builder) |
| 518 { | 518 { |
| 519 if (!infostring.isEmpty()) | 519 if (infoString.isEmpty()) |
| 520 statusMessage.append(", " + glInfo + " = " + infostring); | 520 return; |
| 521 builder.append(", "); |
| 522 builder.append(glInfo); |
| 523 builder.append(" = "); |
| 524 builder.append(infoString); |
| 521 } | 525 } |
| 522 | 526 |
| 523 static String extractWebGLContextCreationError(const Platform::GraphicsInfo& inf
o) | 527 static String extractWebGLContextCreationError(const Platform::GraphicsInfo& inf
o) |
| 524 { | 528 { |
| 525 String statusMessage("Could not create a WebGL context"); | 529 StringBuilder builder; |
| 526 formatWebGLStatusString("VENDOR", info.vendorId ? String::format("0x%04x", i
nfo.vendorId).utf8().data() : "0xffff", statusMessage); | 530 builder.append("Could not create a WebGL context"); |
| 527 formatWebGLStatusString("DEVICE", info.deviceId ? String::format("0x%04x", i
nfo.deviceId).utf8().data() : "0xffff", statusMessage); | 531 formatWebGLStatusString("VENDOR", info.vendorId ? String::format("0x%04x", i
nfo.vendorId) : "0xffff", builder); |
| 528 formatWebGLStatusString("GL_VENDOR", info.vendorInfo.utf8().data(), statusMe
ssage); | 532 formatWebGLStatusString("DEVICE", info.deviceId ? String::format("0x%04x", i
nfo.deviceId) : "0xffff", builder); |
| 529 formatWebGLStatusString("GL_RENDERER", info.rendererInfo.utf8().data(), stat
usMessage); | 533 formatWebGLStatusString("GL_VENDOR", info.vendorInfo, builder); |
| 530 formatWebGLStatusString("GL_VERSION", info.driverVersion.utf8().data(), stat
usMessage); | 534 formatWebGLStatusString("GL_RENDERER", info.rendererInfo, builder); |
| 531 formatWebGLStatusString("Sandboxed", info.sandboxed ? "yes" : "no", statusMe
ssage); | 535 formatWebGLStatusString("GL_VERSION", info.driverVersion, builder); |
| 532 formatWebGLStatusString("Optimus", info.optimus ? "yes" : "no", statusMessag
e); | 536 formatWebGLStatusString("Sandboxed", info.sandboxed ? "yes" : "no", builder)
; |
| 533 formatWebGLStatusString("AMD switchable", info.amdSwitchable ? "yes" : "no",
statusMessage); | 537 formatWebGLStatusString("Optimus", info.optimus ? "yes" : "no", builder); |
| 534 formatWebGLStatusString("Reset notification strategy", String::format("0x%04
x", info.resetNotificationStrategy).utf8().data(), statusMessage); | 538 formatWebGLStatusString("AMD switchable", info.amdSwitchable ? "yes" : "no",
builder); |
| 535 formatWebGLStatusString("GPU process crash count", String::number(info.proce
ssCrashCount).utf8().data(), statusMessage); | 539 formatWebGLStatusString("Reset notification strategy", String::format("0x%04
x", info.resetNotificationStrategy).utf8().data(), builder); |
| 536 formatWebGLStatusString("ErrorMessage", info.errorMessage.utf8().data(), sta
tusMessage); | 540 formatWebGLStatusString("GPU process crash count", String::number(info.proce
ssCrashCount), builder); |
| 537 statusMessage.append('.'); | 541 formatWebGLStatusString("ErrorMessage", info.errorMessage.utf8().data(), bui
lder); |
| 538 return statusMessage; | 542 builder.append('.'); |
| 543 return builder.toString(); |
| 539 } | 544 } |
| 540 | 545 |
| 541 struct ContextProviderCreationInfo { | 546 struct ContextProviderCreationInfo { |
| 542 // Inputs. | 547 // Inputs. |
| 543 Platform::ContextAttributes contextAttributes; | 548 Platform::ContextAttributes contextAttributes; |
| 544 Platform::GraphicsInfo* glInfo; | 549 Platform::GraphicsInfo* glInfo; |
| 545 ScriptState* scriptState; | 550 ScriptState* scriptState; |
| 546 // Outputs. | 551 // Outputs. |
| 547 std::unique_ptr<WebGraphicsContext3DProvider> createdContextProvider; | 552 std::unique_ptr<WebGraphicsContext3DProvider> createdContextProvider; |
| 548 }; | 553 }; |
| (...skipping 5941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6490 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6495 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6491 } | 6496 } |
| 6492 | 6497 |
| 6493 void WebGLRenderingContextBase::restoreUnpackParameters() | 6498 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6494 { | 6499 { |
| 6495 if (m_unpackAlignment != 1) | 6500 if (m_unpackAlignment != 1) |
| 6496 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6501 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6497 } | 6502 } |
| 6498 | 6503 |
| 6499 } // namespace blink | 6504 } // namespace blink |
| OLD | NEW |