| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 GR_GL_TRIANGLE_STRIP, | 1597 GR_GL_TRIANGLE_STRIP, |
| 1598 GR_GL_TRIANGLE_FAN, | 1598 GR_GL_TRIANGLE_FAN, |
| 1599 GR_GL_POINTS, | 1599 GR_GL_POINTS, |
| 1600 GR_GL_LINES, | 1600 GR_GL_LINES, |
| 1601 GR_GL_LINE_STRIP | 1601 GR_GL_LINE_STRIP |
| 1602 }; | 1602 }; |
| 1603 | 1603 |
| 1604 #define SWAP_PER_DRAW 0 | 1604 #define SWAP_PER_DRAW 0 |
| 1605 | 1605 |
| 1606 #if SWAP_PER_DRAW | 1606 #if SWAP_PER_DRAW |
| 1607 #if GR_MAC_BUILD | 1607 #if defined(SK_BUILD_FOR_MAC) |
| 1608 #include <AGL/agl.h> | 1608 #include <AGL/agl.h> |
| 1609 #elif GR_WIN32_BUILD | 1609 #elif defined(SK_BUILD_FOR_WIN32) |
| 1610 #include <gl/GL.h> | 1610 #include <gl/GL.h> |
| 1611 void SwapBuf() { | 1611 void SwapBuf() { |
| 1612 DWORD procID = GetCurrentProcessId(); | 1612 DWORD procID = GetCurrentProcessId(); |
| 1613 HWND hwnd = GetTopWindow(GetDesktopWindow()); | 1613 HWND hwnd = GetTopWindow(GetDesktopWindow()); |
| 1614 while(hwnd) { | 1614 while(hwnd) { |
| 1615 DWORD wndProcID = 0; | 1615 DWORD wndProcID = 0; |
| 1616 GetWindowThreadProcessId(hwnd, &wndProcID); | 1616 GetWindowThreadProcessId(hwnd, &wndProcID); |
| 1617 if(wndProcID == procID) { | 1617 if(wndProcID == procID) { |
| 1618 SwapBuffers(GetDC(hwnd)); | 1618 SwapBuffers(GetDC(hwnd)); |
| 1619 } | 1619 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1638 GR_GL_UNSIGNED_SHORT, | 1638 GR_GL_UNSIGNED_SHORT, |
| 1639 indices)); | 1639 indices)); |
| 1640 } else { | 1640 } else { |
| 1641 // Pass 0 for parameter first. We have to adjust glVertexAttribPointer()
to account for | 1641 // Pass 0 for parameter first. We have to adjust glVertexAttribPointer()
to account for |
| 1642 // startVertex in the DrawElements case. So we always rely on setupGeome
try to have | 1642 // startVertex in the DrawElements case. So we always rely on setupGeome
try to have |
| 1643 // accounted for startVertex. | 1643 // accounted for startVertex. |
| 1644 GL_CALL(DrawArrays(gPrimitiveType2GLMode[info.primitiveType()], 0, info.
vertexCount())); | 1644 GL_CALL(DrawArrays(gPrimitiveType2GLMode[info.primitiveType()], 0, info.
vertexCount())); |
| 1645 } | 1645 } |
| 1646 #if SWAP_PER_DRAW | 1646 #if SWAP_PER_DRAW |
| 1647 glFlush(); | 1647 glFlush(); |
| 1648 #if GR_MAC_BUILD | 1648 #if defined(SK_BUILD_FOR_MAC) |
| 1649 aglSwapBuffers(aglGetCurrentContext()); | 1649 aglSwapBuffers(aglGetCurrentContext()); |
| 1650 int set_a_break_pt_here = 9; | 1650 int set_a_break_pt_here = 9; |
| 1651 aglSwapBuffers(aglGetCurrentContext()); | 1651 aglSwapBuffers(aglGetCurrentContext()); |
| 1652 #elif GR_WIN32_BUILD | 1652 #elif defined(SK_BUILD_FOR_WIN32) |
| 1653 SwapBuf(); | 1653 SwapBuf(); |
| 1654 int set_a_break_pt_here = 9; | 1654 int set_a_break_pt_here = 9; |
| 1655 SwapBuf(); | 1655 SwapBuf(); |
| 1656 #endif | 1656 #endif |
| 1657 #endif | 1657 #endif |
| 1658 } | 1658 } |
| 1659 | 1659 |
| 1660 namespace { | 1660 namespace { |
| 1661 | 1661 |
| 1662 static const uint16_t kOnes16 = static_cast<uint16_t>(~0); | 1662 static const uint16_t kOnes16 = static_cast<uint16_t>(~0); |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2588 this->setVertexArrayID(gpu, 0); | 2588 this->setVertexArrayID(gpu, 0); |
| 2589 } | 2589 } |
| 2590 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2590 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2591 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2591 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2592 fDefaultVertexArrayAttribState.resize(attrCount); | 2592 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2593 } | 2593 } |
| 2594 attribState = &fDefaultVertexArrayAttribState; | 2594 attribState = &fDefaultVertexArrayAttribState; |
| 2595 } | 2595 } |
| 2596 return attribState; | 2596 return attribState; |
| 2597 } | 2597 } |
| OLD | NEW |