Browse Source

Direct3D11 Updates

JoshEngebretson 10 years ago
parent
commit
0a0e7b02b7

+ 4 - 3
Source/Atomic/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -58,9 +58,10 @@
 #pragma warning(disable:4355)
 #pragma warning(disable:4355)
 #endif
 #endif
 
 
-// On Intel / NVIDIA setups prefer the NVIDIA GPU
+// Prefer the high-performance GPU on switchable GPU systems
 extern "C" {
 extern "C" {
-    __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
+    __declspec(dllexport) DWORD NvOptimusEnablement = 1;
+    __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
 }
 }
 
 
 namespace Atomic
 namespace Atomic
@@ -2194,7 +2195,7 @@ bool Graphics::OpenWindow(int width, int height, bool resizable, bool borderless
 
 
     if (!impl_->window_)
     if (!impl_->window_)
     {
     {
-        LOGERROR("Could not create window");
+        LOGERRORF("Could not create window, root cause: '%s'", SDL_GetError());
         return false;
         return false;
     }
     }
 
 

+ 8 - 0
Source/Atomic/Graphics/Direct3D11/D3D11Texture.cpp

@@ -248,6 +248,14 @@ unsigned Texture::GetRowDataSize(int width) const
     }
     }
 }
 }
 
 
+unsigned Texture::GetComponents() const
+{
+    if (!width_ || IsCompressed())
+        return 0;
+    else
+        return GetRowDataSize(width_) / width_;
+}
+
 void Texture::SetParameters(XMLFile* file)
 void Texture::SetParameters(XMLFile* file)
 {
 {
     if (!file)
     if (!file)

+ 2 - 0
Source/Atomic/Graphics/Direct3D11/D3D11Texture.h

@@ -102,6 +102,8 @@ public:
     unsigned GetDataSize(int width, int height, int depth) const;
     unsigned GetDataSize(int width, int height, int depth) const;
     /// Return data size in bytes for a pixel or block row.
     /// Return data size in bytes for a pixel or block row.
     unsigned GetRowDataSize(int width) const;
     unsigned GetRowDataSize(int width) const;
+    /// Return number of image components required to receive pixel data from GetData(), or 0 for compressed images.
+    unsigned GetComponents() const;
     /// Return whether the parameters are dirty.
     /// Return whether the parameters are dirty.
     bool GetParametersDirty() const { return parametersDirty_ || !sampler_; }
     bool GetParametersDirty() const { return parametersDirty_ || !sampler_; }