Direct3D11 Engine/source changes

This commit is contained in:
rextimmy 2016-03-20 21:52:11 +10:00
parent 3a9b50f702
commit 41e5caf22b
81 changed files with 1291 additions and 617 deletions

View file

@ -77,8 +77,8 @@ inline static void _GFXInitReportAdapters(Vector<GFXAdapter*> &adapters)
case NullDevice:
Con::printf(" Null device found");
break;
case Direct3D8:
Con::printf(" Direct 3D (version 8.1) device found");
case Direct3D11:
Con::printf(" Direct 3D (version 11.x) device found");
break;
default :
Con::printf(" Unknown device found");
@ -221,7 +221,8 @@ GFXAdapter* GFXInit::chooseAdapter( GFXAdapterType type, const char* outputDevic
const char* GFXInit::getAdapterNameFromType(GFXAdapterType type)
{
static const char* _names[] = { "OpenGL", "D3D9", "D3D8", "NullDevice", "Xenon" };
// must match GFXAdapterType order
static const char* _names[] = { "OpenGL", "D3D11", "D3D9", "NullDevice", "Xenon" };
if( type < 0 || type >= GFXAdapterType_Count )
{
@ -268,51 +269,53 @@ GFXAdapter *GFXInit::getBestAdapterChoice()
//
// If D3D is unavailable, we're not on windows, so GL is de facto the
// best choice!
F32 highestSM9 = 0.f, highestSMGL = 0.f;
GFXAdapter *foundAdapter8 = NULL, *foundAdapter9 = NULL,
*foundAdapterGL = NULL;
F32 highestSMDX = 0.f, highestSMGL = 0.f;
GFXAdapter *foundAdapter9 = NULL, *foundAdapterGL = NULL, *foundAdapter11 = NULL;
for(S32 i=0; i<smAdapters.size(); i++)
for (S32 i = 0; i<smAdapters.size(); i++)
{
GFXAdapter *currAdapter = smAdapters[i];
switch(currAdapter->mType)
switch (currAdapter->mType)
{
case Direct3D9:
if(currAdapter->mShaderModel > highestSM9)
case Direct3D11:
if (currAdapter->mShaderModel > highestSMDX)
{
highestSM9 = currAdapter->mShaderModel;
highestSMDX = currAdapter->mShaderModel;
foundAdapter11 = currAdapter;
}
break;
case Direct3D9:
if (currAdapter->mShaderModel > highestSMDX)
{
highestSMDX = currAdapter->mShaderModel;
foundAdapter9 = currAdapter;
}
break;
case OpenGL:
if(currAdapter->mShaderModel > highestSMGL)
if (currAdapter->mShaderModel > highestSMGL)
{
highestSMGL = currAdapter->mShaderModel;
foundAdapterGL = currAdapter;
}
break;
case Direct3D8:
if(!foundAdapter8)
foundAdapter8 = currAdapter;
break;
default:
break;
}
}
// Return best found in order DX9, GL, DX8.
if(foundAdapter9)
// Return best found in order DX11,DX9, GL
if (foundAdapter11)
return foundAdapter11;
if (foundAdapter9)
return foundAdapter9;
if(foundAdapterGL)
if (foundAdapterGL)
return foundAdapterGL;
if(foundAdapter8)
return foundAdapter8;
// Uh oh - we didn't find anything. Grab whatever we can that's not Null...
for(S32 i=0; i<smAdapters.size(); i++)
if(smAdapters[i]->mType != NullDevice)