| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file is here so other GLES2 related files can have a common set of | 5 // This file is here so other GLES2 related files can have a common set of |
| 6 // includes where appropriate. | 6 // includes where appropriate. |
| 7 | 7 |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 const int32_t kSamples = 0x3031; // EGL_SAMPLES | 1776 const int32_t kSamples = 0x3031; // EGL_SAMPLES |
| 1777 const int32_t kSampleBuffers = 0x3032; // EGL_SAMPLE_BUFFERS | 1777 const int32_t kSampleBuffers = 0x3032; // EGL_SAMPLE_BUFFERS |
| 1778 const int32_t kNone = 0x3038; // EGL_NONE | 1778 const int32_t kNone = 0x3038; // EGL_NONE |
| 1779 const int32_t kSwapBehavior = 0x3093; // EGL_SWAP_BEHAVIOR | 1779 const int32_t kSwapBehavior = 0x3093; // EGL_SWAP_BEHAVIOR |
| 1780 const int32_t kBufferPreserved = 0x3094; // EGL_BUFFER_PRESERVED | 1780 const int32_t kBufferPreserved = 0x3094; // EGL_BUFFER_PRESERVED |
| 1781 | 1781 |
| 1782 // Chromium only. | 1782 // Chromium only. |
| 1783 const int32_t kBindGeneratesResource = 0x10000; | 1783 const int32_t kBindGeneratesResource = 0x10000; |
| 1784 const int32_t kFailIfMajorPerfCaveat = 0x10001; | 1784 const int32_t kFailIfMajorPerfCaveat = 0x10001; |
| 1785 const int32_t kLoseContextWhenOutOfMemory = 0x10002; | 1785 const int32_t kLoseContextWhenOutOfMemory = 0x10002; |
| 1786 const int32_t kContextType = 0x10003; | 1786 const int32_t kShouldUseNativeGMBForBackbuffer = 0x10003; |
| 1787 const int32_t kContextType = 0x10004; |
| 1787 | 1788 |
| 1788 } // namespace | 1789 } // namespace |
| 1789 | 1790 |
| 1790 ContextCreationAttribHelper::ContextCreationAttribHelper() | 1791 ContextCreationAttribHelper::ContextCreationAttribHelper() |
| 1791 : alpha_size(-1), | 1792 : alpha_size(-1), |
| 1792 blue_size(-1), | 1793 blue_size(-1), |
| 1793 green_size(-1), | 1794 green_size(-1), |
| 1794 red_size(-1), | 1795 red_size(-1), |
| 1795 depth_size(-1), | 1796 depth_size(-1), |
| 1796 stencil_size(-1), | 1797 stencil_size(-1), |
| 1797 samples(-1), | 1798 samples(-1), |
| 1798 sample_buffers(-1), | 1799 sample_buffers(-1), |
| 1799 buffer_preserved(true), | 1800 buffer_preserved(true), |
| 1800 bind_generates_resource(true), | 1801 bind_generates_resource(true), |
| 1801 fail_if_major_perf_caveat(false), | 1802 fail_if_major_perf_caveat(false), |
| 1802 lose_context_when_out_of_memory(false), | 1803 lose_context_when_out_of_memory(false), |
| 1804 should_use_native_gmb_for_backbuffer(false), |
| 1803 context_type(CONTEXT_TYPE_OPENGLES2) {} | 1805 context_type(CONTEXT_TYPE_OPENGLES2) {} |
| 1804 | 1806 |
| 1805 ContextCreationAttribHelper::ContextCreationAttribHelper( | 1807 ContextCreationAttribHelper::ContextCreationAttribHelper( |
| 1806 const ContextCreationAttribHelper& other) = default; | 1808 const ContextCreationAttribHelper& other) = default; |
| 1807 | 1809 |
| 1808 bool ContextCreationAttribHelper::Parse(const std::vector<int32_t>& attribs) { | 1810 bool ContextCreationAttribHelper::Parse(const std::vector<int32_t>& attribs) { |
| 1809 for (size_t i = 0; i < attribs.size(); i += 2) { | 1811 for (size_t i = 0; i < attribs.size(); i += 2) { |
| 1810 const int32_t attrib = attribs[i]; | 1812 const int32_t attrib = attribs[i]; |
| 1811 if (i + 1 >= attribs.size()) { | 1813 if (i + 1 >= attribs.size()) { |
| 1812 if (attrib == kNone) { | 1814 if (attrib == kNone) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 break; | 1851 break; |
| 1850 case kBindGeneratesResource: | 1852 case kBindGeneratesResource: |
| 1851 bind_generates_resource = value != 0; | 1853 bind_generates_resource = value != 0; |
| 1852 break; | 1854 break; |
| 1853 case kFailIfMajorPerfCaveat: | 1855 case kFailIfMajorPerfCaveat: |
| 1854 fail_if_major_perf_caveat = value != 0; | 1856 fail_if_major_perf_caveat = value != 0; |
| 1855 break; | 1857 break; |
| 1856 case kLoseContextWhenOutOfMemory: | 1858 case kLoseContextWhenOutOfMemory: |
| 1857 lose_context_when_out_of_memory = value != 0; | 1859 lose_context_when_out_of_memory = value != 0; |
| 1858 break; | 1860 break; |
| 1861 case kShouldUseNativeGMBForBackbuffer: |
| 1862 should_use_native_gmb_for_backbuffer = value != 0; |
| 1863 break; |
| 1859 case kContextType: | 1864 case kContextType: |
| 1860 context_type = static_cast<ContextType>(value); | 1865 context_type = static_cast<ContextType>(value); |
| 1861 break; | 1866 break; |
| 1862 case kNone: | 1867 case kNone: |
| 1863 // Terminate list, even if more attributes. | 1868 // Terminate list, even if more attributes. |
| 1864 return true; | 1869 return true; |
| 1865 default: | 1870 default: |
| 1866 DLOG(ERROR) << "Invalid context creation attribute: " << attrib; | 1871 DLOG(ERROR) << "Invalid context creation attribute: " << attrib; |
| 1867 return false; | 1872 return false; |
| 1868 } | 1873 } |
| 1869 } | 1874 } |
| 1870 | 1875 |
| 1871 return true; | 1876 return true; |
| 1872 } | 1877 } |
| 1873 | 1878 |
| 1874 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" | 1879 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" |
| 1875 | 1880 |
| 1876 } // namespace gles2 | 1881 } // namespace gles2 |
| 1877 } // namespace gpu | 1882 } // namespace gpu |
| 1878 | 1883 |
| OLD | NEW |