Assorted D3D11 fixes

This commit is contained in:
Henrik Rydgård 2017-02-12 12:02:13 +01:00
parent abbd6cb1d1
commit 4fbb537c92
3 changed files with 9 additions and 3 deletions

View File

@ -15,7 +15,7 @@ static void ConvertProjMatrixToVulkan(Matrix4x4 &in) {
static void ConvertProjMatrixToD3D11(Matrix4x4 &in) {
const Vec3 trans(0, 0, gstate_c.vpZOffset * 0.5f + 0.5f);
const Vec3 scale(gstate_c.vpWidthScale, gstate_c.vpHeightScale, gstate_c.vpDepthScale * 0.5f);
const Vec3 scale(gstate_c.vpWidthScale, -gstate_c.vpHeightScale, gstate_c.vpDepthScale * 0.5f);
in.translateAndScale(trans, scale);
}

View File

@ -772,6 +772,8 @@ rotateVBO:
ID3D11InputLayout *inputLayout = SetupDecFmtForDraw(vshader, dec_->GetDecVtxFmt(), dec_->VertexType());
context_->PSSetShader(fshader->GetShader(), nullptr, 0);
context_->VSSetShader(vshader->GetShader(), nullptr, 0);
shaderManager_->UpdateUniforms();
shaderManager_->BindUniforms();
context_->IASetInputLayout(inputLayout);
UINT stride = dec_->GetDecVtxFmt().stride;

View File

@ -1137,10 +1137,12 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &
gpuStats.numTexturesDecoded++;
// For UpdateSubresource, we can't decode directly into the texture so we allocate a buffer :(
u32 *mapData = new u32[w * h]{};
int mapRowPitch = w * 4;
u32 *mapData;
int mapRowPitch;
if (replaced.GetSize(level, w, h)) {
mapData = new u32[w * h]{};
mapRowPitch = w * 4;
replaced.Load(level, mapData, mapRowPitch);
dstFmt = ToDXGIFormat(replaced.Format(level));
} else {
@ -1149,6 +1151,8 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &
u32 texaddr = gstate.getTextureAddress(level);
int bufw = GetTextureBufw(level, texaddr, tfmt);
int bpp = dstFmt == DXGI_FORMAT_R8G8B8A8_UNORM ? 4 : 2;
mapRowPitch = std::max(bufw, w) * 4;
mapData = new u32[mapRowPitch / 4 * h]{};
u32 *pixelData = (u32 *)mapData;
int decPitch = mapRowPitch;