Merge pull request #8349 from unknownbrackets/d3d9-minor

Fix some Direct3D 9 validation errors
This commit is contained in:
Henrik Rydgård
2016-01-01 11:14:23 +01:00
2 changed files with 9 additions and 2 deletions
+3 -1
View File
@@ -587,7 +587,9 @@ namespace DX9 {
if (!fbo)
return fbo;
fbo_bind_as_render_target(fbo);
dxstate.viewport.force(0, 0, w, h);
ClearBuffer(true);
dxstate.viewport.restore();
const TempFBO info = {fbo, gpuStats.numFlips};
tempFBOs_[key] = info;
return fbo;
@@ -793,7 +795,7 @@ namespace DX9 {
const u32 rw = PSP_CoreParameter().pixelWidth;
const u32 rh = PSP_CoreParameter().pixelHeight;
const RECT srcRect = {(LONG)(u0 * vfb->renderWidth), (LONG)(v0 * vfb->renderHeight), (LONG)(u1 * vfb->renderWidth), (LONG)(v1 * vfb->renderHeight)};
const RECT dstRect = {(LONG)(x * rw / w, y * rh / h), (LONG)((x + w) * rw / w, (y + h) * rh / h)};
const RECT dstRect = {(LONG)(x * rw / w), (LONG)(y * rh / h), (LONG)((x + w) * rw / w), (LONG)((y + h) * rh / h)};
HRESULT hr = fbo_blit_color(vfb->fbo_dx9, &srcRect, nullptr, &dstRect, g_Config.iBufFilter == SCALE_LINEAR ? D3DTEXF_LINEAR : D3DTEXF_POINT);
if (FAILED(hr)) {
ERROR_LOG_REPORT_ONCE(blit_fail, G3D, "fbo_blit_color failed on display: %08x", hr);
+6 -1
View File
@@ -349,7 +349,12 @@ private:
class StateVp {
D3DVIEWPORT9 viewport;
public:
StateVp() { memset(&viewport, 0, sizeof(viewport)); }
StateVp() {
memset(&viewport, 0, sizeof(viewport));
// It's an error if w/h is zero, so let's start with something that can work.
viewport.Width = 1;
viewport.Height = 1;
}
inline void set(int x, int y, int w, int h, float n = 0.f, float f = 1.f) {
D3DVIEWPORT9 newviewport;
newviewport.X = x;