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 #include "gpu/command_buffer/client/gl_in_process_context.h" | 5 #include "gpu/command_buffer/client/gl_in_process_context.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 const int32 ALPHA_SIZE = 0x3021; | 131 const int32 ALPHA_SIZE = 0x3021; |
132 const int32 BLUE_SIZE = 0x3022; | 132 const int32 BLUE_SIZE = 0x3022; |
133 const int32 GREEN_SIZE = 0x3023; | 133 const int32 GREEN_SIZE = 0x3023; |
134 const int32 RED_SIZE = 0x3024; | 134 const int32 RED_SIZE = 0x3024; |
135 const int32 DEPTH_SIZE = 0x3025; | 135 const int32 DEPTH_SIZE = 0x3025; |
136 const int32 STENCIL_SIZE = 0x3026; | 136 const int32 STENCIL_SIZE = 0x3026; |
137 const int32 SAMPLES = 0x3031; | 137 const int32 SAMPLES = 0x3031; |
138 const int32 SAMPLE_BUFFERS = 0x3032; | 138 const int32 SAMPLE_BUFFERS = 0x3032; |
139 const int32 NONE = 0x3038; | 139 const int32 NONE = 0x3038; |
140 | 140 |
141 // Chromium-specific attributes | |
142 const int32 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002; | |
Ken Russell (switch to Gerrit)
2013/11/23 03:07:04
Please add a comment about dependencies between th
| |
143 | |
141 std::vector<int32> attrib_vector; | 144 std::vector<int32> attrib_vector; |
142 if (attribs.alpha_size >= 0) { | 145 if (attribs.alpha_size >= 0) { |
143 attrib_vector.push_back(ALPHA_SIZE); | 146 attrib_vector.push_back(ALPHA_SIZE); |
144 attrib_vector.push_back(attribs.alpha_size); | 147 attrib_vector.push_back(attribs.alpha_size); |
145 } | 148 } |
146 if (attribs.blue_size >= 0) { | 149 if (attribs.blue_size >= 0) { |
147 attrib_vector.push_back(BLUE_SIZE); | 150 attrib_vector.push_back(BLUE_SIZE); |
148 attrib_vector.push_back(attribs.blue_size); | 151 attrib_vector.push_back(attribs.blue_size); |
149 } | 152 } |
150 if (attribs.green_size >= 0) { | 153 if (attribs.green_size >= 0) { |
(...skipping 13 matching lines...) Expand all Loading... | |
164 attrib_vector.push_back(attribs.stencil_size); | 167 attrib_vector.push_back(attribs.stencil_size); |
165 } | 168 } |
166 if (attribs.samples >= 0) { | 169 if (attribs.samples >= 0) { |
167 attrib_vector.push_back(SAMPLES); | 170 attrib_vector.push_back(SAMPLES); |
168 attrib_vector.push_back(attribs.samples); | 171 attrib_vector.push_back(attribs.samples); |
169 } | 172 } |
170 if (attribs.sample_buffers >= 0) { | 173 if (attribs.sample_buffers >= 0) { |
171 attrib_vector.push_back(SAMPLE_BUFFERS); | 174 attrib_vector.push_back(SAMPLE_BUFFERS); |
172 attrib_vector.push_back(attribs.sample_buffers); | 175 attrib_vector.push_back(attribs.sample_buffers); |
173 } | 176 } |
177 if (attribs.fail_if_major_perf_caveat > 0) { | |
178 attrib_vector.push_back(FAIL_IF_MAJOR_PERF_CAVEAT); | |
179 attrib_vector.push_back(attribs.fail_if_major_perf_caveat); | |
180 } | |
174 attrib_vector.push_back(NONE); | 181 attrib_vector.push_back(NONE); |
175 | 182 |
176 base::Closure wrapped_callback = | 183 base::Closure wrapped_callback = |
177 base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr()); | 184 base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr()); |
178 command_buffer_.reset(new InProcessCommandBuffer()); | 185 command_buffer_.reset(new InProcessCommandBuffer()); |
179 | 186 |
180 scoped_ptr<base::AutoLock> scoped_shared_context_lock; | 187 scoped_ptr<base::AutoLock> scoped_shared_context_lock; |
181 scoped_refptr<gles2::ShareGroup> share_group; | 188 scoped_refptr<gles2::ShareGroup> share_group; |
182 if (share_resources) { | 189 if (share_resources) { |
183 scoped_shared_context_lock.reset( | 190 scoped_shared_context_lock.reset( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 gfx::kNullAcceleratedWidget, | 327 gfx::kNullAcceleratedWidget, |
321 surface->GetSize(), | 328 surface->GetSize(), |
322 attribs, | 329 attribs, |
323 gpu_preference)) | 330 gpu_preference)) |
324 return NULL; | 331 return NULL; |
325 | 332 |
326 return context.release(); | 333 return context.release(); |
327 } | 334 } |
328 | 335 |
329 } // namespace gpu | 336 } // namespace gpu |
OLD | NEW |