mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-03 12:37:36 +01:00
Windows: cefclient: Create a new D3D11 device for each browser (issue #2538)
This fixes a texture resizing issue when creating multiple windows with OSR and shared textures enabled.
This commit is contained in:
parent
3e06fa8271
commit
91a1286d52
@ -14,12 +14,6 @@
|
|||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
namespace d3d11 {
|
|
||||||
class Device;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class RootWindowManager;
|
class RootWindowManager;
|
||||||
|
|
||||||
// Used to store global context in the browser process. The methods of this
|
// Used to store global context in the browser process. The methods of this
|
||||||
@ -58,10 +52,6 @@ class MainContext {
|
|||||||
// Returns the object used to create/manage RootWindow instances.
|
// Returns the object used to create/manage RootWindow instances.
|
||||||
virtual RootWindowManager* GetRootWindowManager() = 0;
|
virtual RootWindowManager* GetRootWindowManager() = 0;
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
virtual std::shared_ptr<d3d11::Device> GetD3D11Device() = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MainContext();
|
MainContext();
|
||||||
virtual ~MainContext();
|
virtual ~MainContext();
|
||||||
|
@ -34,10 +34,6 @@ class MainContextImpl : public MainContext {
|
|||||||
void PopulateOsrSettings(OsrRendererSettings* settings) OVERRIDE;
|
void PopulateOsrSettings(OsrRendererSettings* settings) OVERRIDE;
|
||||||
RootWindowManager* GetRootWindowManager() OVERRIDE;
|
RootWindowManager* GetRootWindowManager() OVERRIDE;
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
std::shared_ptr<d3d11::Device> GetD3D11Device() OVERRIDE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialize CEF and associated main context state. This method must be
|
// Initialize CEF and associated main context state. This method must be
|
||||||
// called on the same thread that created this object.
|
// called on the same thread that created this object.
|
||||||
bool Initialize(const CefMainArgs& args,
|
bool Initialize(const CefMainArgs& args,
|
||||||
@ -79,7 +75,6 @@ class MainContextImpl : public MainContext {
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
bool shared_texture_enabled_;
|
bool shared_texture_enabled_;
|
||||||
std::shared_ptr<d3d11::Device> d3d11_device_;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool external_begin_frame_enabled_;
|
bool external_begin_frame_enabled_;
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
#include "tests/cefclient/browser/osr_d3d11_win.h"
|
|
||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
|
|
||||||
std::string MainContextImpl::GetDownloadPath(const std::string& file_name) {
|
std::string MainContextImpl::GetDownloadPath(const std::string& file_name) {
|
||||||
@ -38,11 +36,4 @@ std::string MainContextImpl::GetAppWorkingDirectory() {
|
|||||||
return szWorkingDir;
|
return szWorkingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<d3d11::Device> MainContextImpl::GetD3D11Device() {
|
|
||||||
CEF_REQUIRE_UI_THREAD();
|
|
||||||
if (!d3d11_device_)
|
|
||||||
d3d11_device_ = d3d11::Device::create();
|
|
||||||
return d3d11_device_;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace client
|
} // namespace client
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "include/base/cef_bind.h"
|
#include "include/base/cef_bind.h"
|
||||||
#include "include/wrapper/cef_closure_task.h"
|
#include "include/wrapper/cef_closure_task.h"
|
||||||
#include "include/wrapper/cef_helpers.h"
|
#include "include/wrapper/cef_helpers.h"
|
||||||
#include "tests/cefclient/browser/main_context.h"
|
|
||||||
#include "tests/shared/browser/util_win.h"
|
#include "tests/shared/browser/util_win.h"
|
||||||
|
|
||||||
namespace client {
|
namespace client {
|
||||||
@ -80,8 +79,8 @@ bool OsrRenderHandlerWinD3D11::Initialize(CefRefPtr<CefBrowser> browser,
|
|||||||
int height) {
|
int height) {
|
||||||
CEF_REQUIRE_UI_THREAD();
|
CEF_REQUIRE_UI_THREAD();
|
||||||
|
|
||||||
// Retrieve the shared D3D11 device instance.
|
// Create a D3D11 device instance.
|
||||||
device_ = MainContext::Get()->GetD3D11Device();
|
device_ = d3d11::Device::create();
|
||||||
DCHECK(device_);
|
DCHECK(device_);
|
||||||
if (!device_)
|
if (!device_)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user