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

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: 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..114053cfe91035930471ae99a76ea0203763bff2 100644
--- a/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc
+++ b/webrtc/modules/desktop_capture/win/dxgi_duplicator_controller.cc
@@ -44,6 +44,22 @@ bool DxgiDuplicatorController::IsSupported() {
return Initialize();
}
+bool DxgiDuplicatorController::SupportedFeatureLevels(
+ D3D_FEATURE_LEVEL* min_feature_level,
+ D3D_FEATURE_LEVEL* max_feature_level) {
+ rtc::CritScope lock(&lock_);
+ if (!Initialize()) {
+ return false;
+ }
+ if (min_feature_level != nullptr) {
Sergey Ulanov 2016/11/07 19:37:16 nit: remove "!=nullptr" part.
Hzj_jie 2016/11/08 01:25:40 Done.
+ *min_feature_level = min_feature_level_;
+ }
+ if (max_feature_level != nullptr) {
+ *max_feature_level = max_feature_level_;
+ }
+ return true;
+}
+
DesktopVector DxgiDuplicatorController::dpi() {
rtc::CritScope lock(&lock_);
if (Initialize()) {
@@ -121,6 +137,11 @@ bool DxgiDuplicatorController::DoInitialize() {
RTC_DCHECK(desktop_rect_.is_empty());
RTC_DCHECK(duplicators_.empty());
+ // The maximum and minimum D3D_FEATURE_LEVEL supported by D3D11CreateDevice by
+ // default.
+ min_feature_level_ = D3D_FEATURE_LEVEL_11_0;
+ max_feature_level_ = D3D_FEATURE_LEVEL_9_1;
Sergey Ulanov 2016/11/07 19:37:16 Maybe set these to -1 for initialization. Otherwis
Hzj_jie 2016/11/08 01:25:39 In D3dDevice::EnumDevices(), since we do not provi
+
std::vector<D3dDevice> devices = D3dDevice::EnumDevices();
if (devices.empty()) {
return false;
@@ -131,6 +152,16 @@ bool DxgiDuplicatorController::DoInitialize() {
if (!duplicators_.back().Initialize()) {
return false;
}
+
+ D3D_FEATURE_LEVEL feature_level =
+ devices[i].d3d_device()->GetFeatureLevel();
+ if (feature_level > max_feature_level_) {
+ max_feature_level_ = feature_level;
+ }
+ if (feature_level < min_feature_level_) {
+ 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