Windows Mobile 10 D3D11 fixes

This commit is contained in:
Henrik Rydgard 2017-03-04 12:39:07 +01:00
parent 91ebdf0213
commit e9f2f82863

View File

@ -428,7 +428,8 @@ BlendState *D3D11DrawContext::CreateBlendState(const BlendStateDesc &desc) {
class D3D11RasterState : public RasterState { class D3D11RasterState : public RasterState {
public: public:
~D3D11RasterState() { ~D3D11RasterState() {
rs->Release(); if (rs)
rs->Release();
} }
ID3D11RasterizerState *rs; ID3D11RasterizerState *rs;
}; };
@ -445,6 +446,7 @@ RasterState *D3D11DrawContext::CreateRasterState(const RasterStateDesc &desc) {
} }
d3ddesc.FrontCounterClockwise = desc.frontFace == Facing::CCW; d3ddesc.FrontCounterClockwise = desc.frontFace == Facing::CCW;
d3ddesc.ScissorEnable = true; // We always run with scissor enabled d3ddesc.ScissorEnable = true; // We always run with scissor enabled
d3ddesc.DepthClipEnable = true;
if (SUCCEEDED(device_->CreateRasterizerState(&d3ddesc, &rs->rs))) if (SUCCEEDED(device_->CreateRasterizerState(&d3ddesc, &rs->rs)))
return rs; return rs;
delete rs; delete rs;
@ -454,9 +456,10 @@ RasterState *D3D11DrawContext::CreateRasterState(const RasterStateDesc &desc) {
class D3D11SamplerState : public SamplerState { class D3D11SamplerState : public SamplerState {
public: public:
~D3D11SamplerState() { ~D3D11SamplerState() {
ss->Release(); if (ss)
ss->Release();
} }
ID3D11SamplerState *ss; ID3D11SamplerState *ss = nullptr;
}; };
static const D3D11_TEXTURE_ADDRESS_MODE taddrToD3D11[] = { static const D3D11_TEXTURE_ADDRESS_MODE taddrToD3D11[] = {
@ -474,8 +477,13 @@ SamplerState *D3D11DrawContext::CreateSamplerState(const SamplerStateDesc &desc)
d3ddesc.AddressW = taddrToD3D11[(int)desc.wrapW]; d3ddesc.AddressW = taddrToD3D11[(int)desc.wrapW];
// TODO: Needs improvement // TODO: Needs improvement
d3ddesc.Filter = desc.magFilter == TextureFilter::LINEAR ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT; d3ddesc.Filter = desc.magFilter == TextureFilter::LINEAR ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT;
d3ddesc.MaxAnisotropy = (UINT)desc.maxAniso; d3ddesc.MaxAnisotropy = 1.0f; // (UINT)desc.maxAniso;
d3ddesc.MinLOD = -FLT_MAX;
d3ddesc.MaxLOD = FLT_MAX;
d3ddesc.ComparisonFunc = compareToD3D11[(int)desc.shadowCompareFunc]; d3ddesc.ComparisonFunc = compareToD3D11[(int)desc.shadowCompareFunc];
for (int i = 0; i < 4; i++) {
d3ddesc.BorderColor[i] = 1.0f;
}
if (SUCCEEDED(device_->CreateSamplerState(&d3ddesc, &ss->ss))) if (SUCCEEDED(device_->CreateSamplerState(&d3ddesc, &ss->ss)))
return ss; return ss;
delete ss; delete ss;
@ -660,14 +668,21 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
if (language == ShaderLanguage::HLSL_D3D11) { if (language == ShaderLanguage::HLSL_D3D11) {
const char *target = nullptr; const char *target = nullptr;
switch (stage) { switch (stage) {
case ShaderStage::FRAGMENT: target = "ps_5_0"; break; #if PPSSPP_PLATFORM(UWP) && PPSSPP_ARCH(ARM)
case ShaderStage::GEOMETRY: target = "gs_5_0"; break; case ShaderStage::FRAGMENT: target = "ps_4_0_level_9_1"; break;
case ShaderStage::VERTEX: target = "vs_5_0"; break; case ShaderStage::VERTEX: target = "vs_4_0_level_9_1"; break;
break; break;
#else
case ShaderStage::FRAGMENT: target = "ps_4_0"; break;
case ShaderStage::GEOMETRY: target = "gs_4_0"; break;
case ShaderStage::VERTEX: target = "vs_4_0"; break;
break;
#endif
case ShaderStage::COMPUTE: case ShaderStage::COMPUTE:
case ShaderStage::CONTROL: case ShaderStage::CONTROL:
case ShaderStage::EVALUATION: case ShaderStage::EVALUATION:
default: default:
Crash();
break; break;
} }
if (!target) { if (!target) {