| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/gl/gl_angle_util_win.h" | 5 #include "ui/gl/gl_angle_util_win.h" |
| 6 | 6 |
| 7 #include <objbase.h> |
| 8 |
| 7 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 8 #include "third_party/angle/include/EGL/egl.h" | 10 #include "third_party/angle/include/EGL/egl.h" |
| 9 #include "third_party/angle/include/EGL/eglext.h" | 11 #include "third_party/angle/include/EGL/eglext.h" |
| 10 #include "ui/gl/gl_surface_egl.h" | 12 #include "ui/gl/gl_surface_egl.h" |
| 11 | 13 |
| 12 namespace gl { | 14 namespace gl { |
| 13 | 15 |
| 14 void* QueryDeviceObjectFromANGLE(int object_type) { | 16 void* QueryDeviceObjectFromANGLE(int object_type) { |
| 15 EGLDisplay egl_display = nullptr; | 17 EGLDisplay egl_display = nullptr; |
| 16 intptr_t egl_device = 0; | 18 intptr_t egl_device = 0; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 0x8d30, | 94 0x8d30, |
| 93 0x4769, | 95 0x4769, |
| 94 {0x85, 0x9, 0xb9, 0xd7, 0x38, 0x98, 0xd8, 0x70}}; | 96 {0x85, 0x9, 0xb9, 0xd7, 0x38, 0x98, 0xd8, 0x70}}; |
| 95 | 97 |
| 96 base::win::ScopedComPtr<IDCompositionDevice2> dcomp_device; | 98 base::win::ScopedComPtr<IDCompositionDevice2> dcomp_device; |
| 97 if (!d3d11_device) | 99 if (!d3d11_device) |
| 98 return dcomp_device; | 100 return dcomp_device; |
| 99 | 101 |
| 100 UINT data_size = sizeof(dcomp_device.Get()); | 102 UINT data_size = sizeof(dcomp_device.Get()); |
| 101 HRESULT hr = d3d11_device->GetPrivateData(kDirectCompositionGUID, &data_size, | 103 HRESULT hr = d3d11_device->GetPrivateData(kDirectCompositionGUID, &data_size, |
| 102 dcomp_device.ReceiveVoid()); | 104 &dcomp_device); |
| 103 if (SUCCEEDED(hr) && dcomp_device) | 105 if (SUCCEEDED(hr) && dcomp_device) |
| 104 return dcomp_device; | 106 return dcomp_device; |
| 105 | 107 |
| 106 // Allocate a new DirectComposition device if none currently exists. | 108 // Allocate a new DirectComposition device if none currently exists. |
| 107 HMODULE dcomp_module = ::GetModuleHandle(L"dcomp.dll"); | 109 HMODULE dcomp_module = ::GetModuleHandle(L"dcomp.dll"); |
| 108 if (!dcomp_module) | 110 if (!dcomp_module) |
| 109 return dcomp_device; | 111 return dcomp_device; |
| 110 | 112 |
| 111 using PFN_DCOMPOSITION_CREATE_DEVICE2 = HRESULT(WINAPI*)( | 113 using PFN_DCOMPOSITION_CREATE_DEVICE2 = HRESULT(WINAPI*)( |
| 112 IUnknown * renderingDevice, REFIID iid, void** dcompositionDevice); | 114 IUnknown * renderingDevice, REFIID iid, void** dcompositionDevice); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 126 | 128 |
| 127 hr = desktop_device.QueryInterface(dcomp_device.Receive()); | 129 hr = desktop_device.QueryInterface(dcomp_device.Receive()); |
| 128 CHECK(SUCCEEDED(hr)); | 130 CHECK(SUCCEEDED(hr)); |
| 129 d3d11_device->SetPrivateDataInterface(kDirectCompositionGUID, | 131 d3d11_device->SetPrivateDataInterface(kDirectCompositionGUID, |
| 130 dcomp_device.Get()); | 132 dcomp_device.Get()); |
| 131 | 133 |
| 132 return dcomp_device; | 134 return dcomp_device; |
| 133 } | 135 } |
| 134 | 136 |
| 135 } // namespace gl | 137 } // namespace gl |
| OLD | NEW |