Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1304)

Unified Diff: webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc

Issue 2468083002: Remove the requirement of D3D_FEATURE_LEVEL_11_0, but export the D3D_FEATURE_LEVEL through APIs (Closed)
Patch Set: Resolve review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc
diff --git a/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc b/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc
index 03dc15aa07f2a28d7da40f33a896a6be44ad872c..975d7e47709f42d43284f77e75dd8495486018d3 100644
--- a/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc
+++ b/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc
@@ -44,6 +44,15 @@ bool DxgiDuplicatorController::IsSupported() {
return Initialize();
}
+bool DxgiDuplicatorController::RetrieveD3dInfo(D3dInfo* info) {
+ rtc::CritScope lock(&lock_);
+ if (!Initialize()) {
+ return false;
+ }
+ *info = d3d_info_;
+ return true;
+}
+
DesktopVector DxgiDuplicatorController::dpi() {
rtc::CritScope lock(&lock_);
if (Initialize()) {
@@ -121,6 +130,9 @@ bool DxgiDuplicatorController::DoInitialize() {
RTC_DCHECK(desktop_rect_.is_empty());
RTC_DCHECK(duplicators_.empty());
+ d3d_info_.min_feature_level = static_cast<D3D_FEATURE_LEVEL>(0);
+ d3d_info_.max_feature_level = static_cast<D3D_FEATURE_LEVEL>(0);
+
std::vector<D3dDevice> devices = D3dDevice::EnumDevices();
if (devices.empty()) {
return false;
@@ -131,6 +143,18 @@ bool DxgiDuplicatorController::DoInitialize() {
if (!duplicators_.back().Initialize()) {
return false;
}
+
+ D3D_FEATURE_LEVEL feature_level =
+ devices[i].d3d_device()->GetFeatureLevel();
+ if (d3d_info_.max_feature_level == 0 ||
+ feature_level > d3d_info_.max_feature_level) {
+ d3d_info_.max_feature_level = feature_level;
+ }
+ if (d3d_info_.min_feature_level == 0 ||
+ feature_level < d3d_info_.min_feature_level) {
+ d3d_info_.min_feature_level = feature_level;
+ }
+
if (desktop_rect_.is_empty()) {
desktop_rect_ = duplicators_.back().desktop_rect();
} else {

Powered by Google App Engine
This is Rietveld 408576698