mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Melhorias em GraphicsAdapter
This commit is contained in:
parent
f084bf54f9
commit
fae2a4e28f
@ -1,6 +1,3 @@
|
||||
#include "xna/graphics/adapter.hpp"
|
||||
#include "xna/graphics/displaymode.hpp"
|
||||
#include "xna/game/gdevicemanager.hpp"
|
||||
#include "xna/xna-dx.hpp"
|
||||
|
||||
namespace xna {
|
||||
@ -92,6 +89,10 @@ namespace xna {
|
||||
SurfaceFormat& selectedFormat, DepthFormat& selectedDepthFormat,
|
||||
Int& selectedMultiSampleCount) const
|
||||
{
|
||||
selectedFormat = format;
|
||||
selectedDepthFormat = depthFormat;
|
||||
selectedMultiSampleCount = multiSampleCount;
|
||||
|
||||
comptr<IDXGIOutput> pOutput = nullptr;
|
||||
|
||||
if (impl->dxAdapter->EnumOutputs(0, pOutput.GetAddressOf()) != DXGI_ERROR_NOT_FOUND){
|
||||
@ -100,14 +101,19 @@ namespace xna {
|
||||
pOutput->QueryInterface(IID_IDXGIOutput1, (void**)pOutput1.GetAddressOf());
|
||||
|
||||
DXGI_MODE_DESC1 modeToMath{};
|
||||
modeToMath.Format = DxHelpers::SurfaceFormatToDx(format);
|
||||
modeToMath.Format = DxHelpers::SurfaceFormatToDx(format);
|
||||
|
||||
//If pConcernedDevice is NULL, the Format member of DXGI_MODE_DESC1 cannot be DXGI_FORMAT_UNKNOWN.
|
||||
if (modeToMath.Format == DXGI_FORMAT_UNKNOWN)
|
||||
return false;
|
||||
|
||||
DXGI_MODE_DESC1 closestMath;
|
||||
pOutput1->FindClosestMatchingMode1(&modeToMath, &closestMath, nullptr);
|
||||
const auto hresult = pOutput1->FindClosestMatchingMode1(&modeToMath, &closestMath, nullptr);
|
||||
|
||||
if FAILED(hresult)
|
||||
return false;
|
||||
|
||||
selectedFormat = DxHelpers::SurfaceFormatToXna(closestMath.Format);
|
||||
selectedDepthFormat = depthFormat;
|
||||
selectedMultiSampleCount = multiSampleCount;
|
||||
|
||||
return selectedFormat == format;
|
||||
}
|
||||
|
@ -73,21 +73,7 @@ namespace xna {
|
||||
SurfaceFormat& selectedFormat,
|
||||
DepthFormat& selectedDepthFormat,
|
||||
Int& selectedMultiSampleCount
|
||||
) const;
|
||||
|
||||
//Queries the adapter for support for the requested render target format.
|
||||
bool QueryRenderTargetFormat(
|
||||
GraphicsProfile graphicsProfile,
|
||||
SurfaceFormat format,
|
||||
DepthFormat depthFormat,
|
||||
Int multiSampleCount,
|
||||
SurfaceFormat& selectedFormat,
|
||||
DepthFormat& selectedDepthFormat,
|
||||
Int& selectedMultiSampleCount
|
||||
) const {
|
||||
return QueryBackBufferFormat(graphicsProfile, format, depthFormat, multiSampleCount,
|
||||
selectedFormat, selectedDepthFormat, selectedMultiSampleCount);
|
||||
}
|
||||
) const;
|
||||
|
||||
private:
|
||||
String description;
|
||||
|
@ -362,7 +362,8 @@ namespace xna {
|
||||
|
||||
static constexpr TextureAddressMode TextureAddresModeToXna(D3D11_TEXTURE_ADDRESS_MODE value) {
|
||||
return static_cast<TextureAddressMode>(value - 1);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct PlatformInit {
|
||||
|
Loading…
x
Reference in New Issue
Block a user