Do a similar thing for D3D (let the backend handle the dirtying).
This commit is contained in:
parent
bebf649705
commit
370678c498
14 changed files with 71 additions and 21 deletions
|
@ -547,8 +547,6 @@ void FramebufferManagerCommon::NotifyRenderFramebufferSwitched(VirtualFramebuffe
|
||||||
// This should only happen very briefly when toggling useBufferedRendering_.
|
// This should only happen very briefly when toggling useBufferedRendering_.
|
||||||
ResizeFramebufFBO(vfb, vfb->width, vfb->height, true);
|
ResizeFramebufFBO(vfb, vfb->width, vfb->height, true);
|
||||||
}
|
}
|
||||||
// Since we switched target, we need to redo viewportscissorstate.
|
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
|
||||||
} else {
|
} else {
|
||||||
if (vfb->fbo) {
|
if (vfb->fbo) {
|
||||||
// This should only happen very briefly when toggling useBufferedRendering_.
|
// This should only happen very briefly when toggling useBufferedRendering_.
|
||||||
|
@ -566,7 +564,7 @@ void FramebufferManagerCommon::NotifyRenderFramebufferSwitched(VirtualFramebuffe
|
||||||
}
|
}
|
||||||
textureCache_->NotifyFramebuffer(vfb->fb_address, vfb, NOTIFY_FB_UPDATED);
|
textureCache_->NotifyFramebuffer(vfb->fb_address, vfb, NOTIFY_FB_UPDATED);
|
||||||
|
|
||||||
// ugly...
|
// ugly... is all this needed?
|
||||||
if (gstate_c.curRTWidth != vfb->width || gstate_c.curRTHeight != vfb->height) {
|
if (gstate_c.curRTWidth != vfb->width || gstate_c.curRTHeight != vfb->height) {
|
||||||
gstate_c.Dirty(DIRTY_PROJTHROUGHMATRIX | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_CULLRANGE);
|
gstate_c.Dirty(DIRTY_PROJTHROUGHMATRIX | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_CULLRANGE);
|
||||||
}
|
}
|
||||||
|
@ -1064,7 +1062,6 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w,
|
||||||
INFO_LOG(FRAMEBUF, "Resizing FBO for %08x : %d x %d x %d", vfb->fb_address, w, h, vfb->format);
|
INFO_LOG(FRAMEBUF, "Resizing FBO for %08x : %d x %d x %d", vfb->fb_address, w, h, vfb->format);
|
||||||
if (vfb->fbo) {
|
if (vfb->fbo) {
|
||||||
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "ResizeFramebufFBO");
|
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "ResizeFramebufFBO");
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
|
||||||
if (!skipCopy) {
|
if (!skipCopy) {
|
||||||
BlitFramebuffer(vfb, 0, 0, &old, 0, 0, std::min((u16)oldWidth, std::min(vfb->bufferWidth, vfb->width)), std::min((u16)oldHeight, std::min(vfb->height, vfb->bufferHeight)), 0);
|
BlitFramebuffer(vfb, 0, 0, &old, 0, 0, std::min((u16)oldWidth, std::min(vfb->bufferWidth, vfb->width)), std::min((u16)oldHeight, std::min(vfb->height, vfb->bufferHeight)), 0);
|
||||||
}
|
}
|
||||||
|
@ -1075,7 +1072,6 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "ResizeFramebufFBO");
|
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "ResizeFramebufFBO");
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vfb->fbo) {
|
if (!vfb->fbo) {
|
||||||
|
@ -1845,7 +1841,7 @@ bool FramebufferManagerCommon::GetFramebuffer(u32 fb_address, int fb_stride, GEB
|
||||||
bool retval = draw_->CopyFramebufferToMemorySync(bound, Draw::FB_COLOR_BIT, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), w, "GetFramebuffer");
|
bool retval = draw_->CopyFramebufferToMemorySync(bound, Draw::FB_COLOR_BIT, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, buffer.GetData(), w, "GetFramebuffer");
|
||||||
gpuStats.numReadbacks++;
|
gpuStats.numReadbacks++;
|
||||||
// After a readback we'll have flushed and started over, need to dirty a bunch of things to be safe.
|
// After a readback we'll have flushed and started over, need to dirty a bunch of things to be safe.
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
|
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
|
||||||
// We may have blitted to a temp FBO.
|
// We may have blitted to a temp FBO.
|
||||||
RebindFramebuffer();
|
RebindFramebuffer();
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -1880,7 +1876,7 @@ bool FramebufferManagerCommon::GetDepthbuffer(u32 fb_address, int fb_stride, u32
|
||||||
// No need to free on failure, that's the caller's job (it likely will reuse a buffer.)
|
// No need to free on failure, that's the caller's job (it likely will reuse a buffer.)
|
||||||
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_DEPTH_BIT, 0, 0, w, h, Draw::DataFormat::D32F, buffer.GetData(), w, "GetDepthBuffer");
|
bool retval = draw_->CopyFramebufferToMemorySync(vfb->fbo, Draw::FB_DEPTH_BIT, 0, 0, w, h, Draw::DataFormat::D32F, buffer.GetData(), w, "GetDepthBuffer");
|
||||||
// After a readback we'll have flushed and started over, need to dirty a bunch of things to be safe.
|
// After a readback we'll have flushed and started over, need to dirty a bunch of things to be safe.
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE | DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
|
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
|
||||||
// That may have unbound the framebuffer, rebind to avoid crashes when debugging.
|
// That may have unbound the framebuffer, rebind to avoid crashes when debugging.
|
||||||
RebindFramebuffer();
|
RebindFramebuffer();
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -1971,9 +1967,6 @@ void FramebufferManagerCommon::PackFramebufferSync_(VirtualFramebuffer *vfb, int
|
||||||
ERROR_LOG(G3D, "PackFramebufferSync_: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride);
|
ERROR_LOG(G3D, "PackFramebufferSync_: Tried to readback to bad address %08x (stride = %d)", fb_address + dstByteOffset, vfb->fb_stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A new command buffer will begin after CopyFrameBufferToMemorySync, so we need to trigger
|
|
||||||
// updates of any dynamic command buffer state by dirtying some stuff.
|
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_BLEND_STATE | DIRTY_DEPTHSTENCIL_STATE | DIRTY_RASTER_STATE);
|
|
||||||
gpuStats.numReadbacks++;
|
gpuStats.numReadbacks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2056,7 +2049,6 @@ void FramebufferManagerCommon::RebindFramebuffer() {
|
||||||
// Should this even happen? It could while debugging, but maybe we can just skip binding at all.
|
// Should this even happen? It could while debugging, but maybe we can just skip binding at all.
|
||||||
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP }, "RebindFramebuffer_Bad");
|
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP }, "RebindFramebuffer_Bad");
|
||||||
}
|
}
|
||||||
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FramebufferInfo> FramebufferManagerCommon::GetFramebufferList() {
|
std::vector<FramebufferInfo> FramebufferManagerCommon::GetFramebufferList() {
|
||||||
|
|
|
@ -307,6 +307,8 @@ void DrawEngineD3D11::BeginFrame() {
|
||||||
NOTICE_LOG(G3D, buffer);
|
NOTICE_LOG(G3D, buffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
lastRenderStepId_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VertexArrayInfoD3D11::~VertexArrayInfoD3D11() {
|
VertexArrayInfoD3D11::~VertexArrayInfoD3D11() {
|
||||||
|
@ -325,6 +327,14 @@ void DrawEngineD3D11::DoFlush() {
|
||||||
gpuStats.numFlushes++;
|
gpuStats.numFlushes++;
|
||||||
gpuStats.numTrackedVertexArrays = (int)vai_.size();
|
gpuStats.numTrackedVertexArrays = (int)vai_.size();
|
||||||
|
|
||||||
|
// In D3D, we're synchronous and state carries over so all we reset here on a new step is the viewport/scissor.
|
||||||
|
int curRenderStepId = draw_->GetCurrentStepId();
|
||||||
|
if (lastRenderStepId_ != curRenderStepId) {
|
||||||
|
// Dirty everything that has dynamic state that will need re-recording.
|
||||||
|
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
||||||
|
lastRenderStepId_ = curRenderStepId;
|
||||||
|
}
|
||||||
|
|
||||||
// This is not done on every drawcall, we collect vertex data
|
// This is not done on every drawcall, we collect vertex data
|
||||||
// until critical state changes. That's when we draw (flush).
|
// until critical state changes. That's when we draw (flush).
|
||||||
|
|
||||||
|
|
|
@ -216,4 +216,6 @@ private:
|
||||||
|
|
||||||
// Hardware tessellation
|
// Hardware tessellation
|
||||||
TessellationDataTransferD3D11 *tessDataTransferD3D11;
|
TessellationDataTransferD3D11 *tessDataTransferD3D11;
|
||||||
|
|
||||||
|
int lastRenderStepId_ = -1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -83,7 +83,7 @@ static const D3DVERTEXELEMENT9 TransformedVertexElements[] = {
|
||||||
D3DDECL_END()
|
D3DDECL_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
DrawEngineDX9::DrawEngineDX9(Draw::DrawContext *draw) : vai_(256), vertexDeclMap_(64) {
|
DrawEngineDX9::DrawEngineDX9(Draw::DrawContext *draw) : draw_(draw), vai_(256), vertexDeclMap_(64) {
|
||||||
device_ = (LPDIRECT3DDEVICE9)draw->GetNativeObject(Draw::NativeObject::DEVICE);
|
device_ = (LPDIRECT3DDEVICE9)draw->GetNativeObject(Draw::NativeObject::DEVICE);
|
||||||
decOptions_.expandAllWeightsToFloat = true;
|
decOptions_.expandAllWeightsToFloat = true;
|
||||||
decOptions_.expand8BitNormalsToFloat = true;
|
decOptions_.expand8BitNormalsToFloat = true;
|
||||||
|
@ -299,14 +299,27 @@ static uint32_t SwapRB(uint32_t c) {
|
||||||
return (c & 0xFF00FF00) | ((c >> 16) & 0xFF) | ((c << 16) & 0xFF0000);
|
return (c & 0xFF00FF00) | ((c >> 16) & 0xFF) | ((c << 16) & 0xFF0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawEngineDX9::BeginFrame() {
|
||||||
|
DecimateTrackedVertexArrays();
|
||||||
|
|
||||||
|
lastRenderStepId_ = -1;
|
||||||
|
}
|
||||||
|
|
||||||
// The inline wrapper in the header checks for numDrawCalls == 0
|
// The inline wrapper in the header checks for numDrawCalls == 0
|
||||||
void DrawEngineDX9::DoFlush() {
|
void DrawEngineDX9::DoFlush() {
|
||||||
gpuStats.numFlushes++;
|
gpuStats.numFlushes++;
|
||||||
gpuStats.numTrackedVertexArrays = (int)vai_.size();
|
gpuStats.numTrackedVertexArrays = (int)vai_.size();
|
||||||
|
|
||||||
|
// In D3D, we're synchronous and state carries over so all we reset here on a new step is the viewport/scissor.
|
||||||
|
int curRenderStepId = draw_->GetCurrentStepId();
|
||||||
|
if (lastRenderStepId_ != curRenderStepId) {
|
||||||
|
// Dirty everything that has dynamic state that will need re-recording.
|
||||||
|
gstate_c.Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
||||||
|
lastRenderStepId_ = curRenderStepId;
|
||||||
|
}
|
||||||
|
|
||||||
// This is not done on every drawcall, we should collect vertex data
|
// This is not done on every drawcall, we should collect vertex data
|
||||||
// until critical state changes. That's when we draw (flush).
|
// until critical state changes. That's when we draw (flush).
|
||||||
|
|
||||||
GEPrimitiveType prim = prevPrim_;
|
GEPrimitiveType prim = prevPrim_;
|
||||||
ApplyDrawState(prim);
|
ApplyDrawState(prim);
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,8 @@ public:
|
||||||
void DestroyDeviceObjects();
|
void DestroyDeviceObjects();
|
||||||
|
|
||||||
void ClearTrackedVertexArrays() override;
|
void ClearTrackedVertexArrays() override;
|
||||||
void DecimateTrackedVertexArrays();
|
|
||||||
|
void BeginFrame();
|
||||||
|
|
||||||
// So that this can be inlined
|
// So that this can be inlined
|
||||||
void Flush() {
|
void Flush() {
|
||||||
|
@ -143,6 +144,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
// Not currently supported.
|
// Not currently supported.
|
||||||
bool UpdateUseHWTessellation(bool enable) override { return false; }
|
bool UpdateUseHWTessellation(bool enable) override { return false; }
|
||||||
|
void DecimateTrackedVertexArrays();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoFlush();
|
void DoFlush();
|
||||||
|
@ -156,6 +158,7 @@ private:
|
||||||
void MarkUnreliable(VertexArrayInfoDX9 *vai);
|
void MarkUnreliable(VertexArrayInfoDX9 *vai);
|
||||||
|
|
||||||
LPDIRECT3DDEVICE9 device_ = nullptr;
|
LPDIRECT3DDEVICE9 device_ = nullptr;
|
||||||
|
Draw::DrawContext *draw_;
|
||||||
|
|
||||||
PrehashMap<VertexArrayInfoDX9 *, nullptr> vai_;
|
PrehashMap<VertexArrayInfoDX9 *, nullptr> vai_;
|
||||||
DenseHashMap<u32, IDirect3DVertexDeclaration9 *, nullptr> vertexDeclMap_;
|
DenseHashMap<u32, IDirect3DVertexDeclaration9 *, nullptr> vertexDeclMap_;
|
||||||
|
@ -170,6 +173,8 @@ private:
|
||||||
|
|
||||||
// Hardware tessellation
|
// Hardware tessellation
|
||||||
TessellationDataTransferDX9 *tessDataTransferDX9;
|
TessellationDataTransferDX9 *tessDataTransferDX9;
|
||||||
|
|
||||||
|
int lastRenderStepId_ = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -282,7 +282,7 @@ void GPU_DX9::ReapplyGfxState() {
|
||||||
|
|
||||||
void GPU_DX9::BeginFrame() {
|
void GPU_DX9::BeginFrame() {
|
||||||
textureCacheDX9_->StartFrame();
|
textureCacheDX9_->StartFrame();
|
||||||
drawEngine_.DecimateTrackedVertexArrays();
|
drawEngine_.BeginFrame();
|
||||||
depalShaderCache_.Decimate();
|
depalShaderCache_.Decimate();
|
||||||
// fragmentTestCache_.Decimate();
|
// fragmentTestCache_.Decimate();
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,8 @@ void DrawEngineGLES::ClearInputLayoutMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawEngineGLES::BeginFrame() {
|
void DrawEngineGLES::BeginFrame() {
|
||||||
|
DecimateTrackedVertexArrays();
|
||||||
|
|
||||||
FrameData &frameData = frameData_[render_->GetCurFrame()];
|
FrameData &frameData = frameData_[render_->GetCurFrame()];
|
||||||
render_->BeginPushBuffer(frameData.pushIndex);
|
render_->BeginPushBuffer(frameData.pushIndex);
|
||||||
render_->BeginPushBuffer(frameData.pushVertex);
|
render_->BeginPushBuffer(frameData.pushVertex);
|
||||||
|
|
|
@ -150,7 +150,6 @@ public:
|
||||||
void DeviceRestore(Draw::DrawContext *draw);
|
void DeviceRestore(Draw::DrawContext *draw);
|
||||||
|
|
||||||
void ClearTrackedVertexArrays() override;
|
void ClearTrackedVertexArrays() override;
|
||||||
void DecimateTrackedVertexArrays();
|
|
||||||
|
|
||||||
void BeginFrame();
|
void BeginFrame();
|
||||||
void EndFrame();
|
void EndFrame();
|
||||||
|
@ -186,6 +185,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool UpdateUseHWTessellation(bool enable) override;
|
bool UpdateUseHWTessellation(bool enable) override;
|
||||||
|
void DecimateTrackedVertexArrays();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitDeviceObjects();
|
void InitDeviceObjects();
|
||||||
|
|
|
@ -373,7 +373,6 @@ void GPU_GLES::ReapplyGfxState() {
|
||||||
|
|
||||||
void GPU_GLES::BeginFrame() {
|
void GPU_GLES::BeginFrame() {
|
||||||
textureCacheGL_->StartFrame();
|
textureCacheGL_->StartFrame();
|
||||||
drawEngine_.DecimateTrackedVertexArrays();
|
|
||||||
depalShaderCache_.Decimate();
|
depalShaderCache_.Decimate();
|
||||||
fragmentTestCache_.Decimate();
|
fragmentTestCache_.Decimate();
|
||||||
|
|
||||||
|
|
|
@ -673,6 +673,8 @@ public:
|
||||||
// Flush state like scissors etc so the caller can do its own custom drawing.
|
// Flush state like scissors etc so the caller can do its own custom drawing.
|
||||||
virtual void FlushState() {}
|
virtual void FlushState() {}
|
||||||
|
|
||||||
|
virtual int GetCurrentStepId() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ShaderModule *vsPresets_[VS_MAX_PRESET];
|
ShaderModule *vsPresets_[VS_MAX_PRESET];
|
||||||
ShaderModule *fsPresets_[FS_MAX_PRESET];
|
ShaderModule *fsPresets_[FS_MAX_PRESET];
|
||||||
|
|
|
@ -158,6 +158,10 @@ public:
|
||||||
|
|
||||||
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override;
|
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override;
|
||||||
|
|
||||||
|
int GetCurrentStepId() const override {
|
||||||
|
return stepId_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ApplyCurrentState();
|
void ApplyCurrentState();
|
||||||
|
|
||||||
|
@ -166,6 +170,7 @@ private:
|
||||||
ID3D11DeviceContext *context_;
|
ID3D11DeviceContext *context_;
|
||||||
ID3D11Device1 *device1_;
|
ID3D11Device1 *device1_;
|
||||||
ID3D11DeviceContext1 *context1_;
|
ID3D11DeviceContext1 *context1_;
|
||||||
|
int stepId_ = -1;
|
||||||
|
|
||||||
ID3D11Texture2D *bbRenderTargetTex_ = nullptr; // NOT OWNED
|
ID3D11Texture2D *bbRenderTargetTex_ = nullptr; // NOT OWNED
|
||||||
ID3D11RenderTargetView *bbRenderTargetView_ = nullptr;
|
ID3D11RenderTargetView *bbRenderTargetView_ = nullptr;
|
||||||
|
@ -353,6 +358,7 @@ void D3D11DrawContext::HandleEvent(Event ev, int width, int height, void *param1
|
||||||
// Make sure that we don't eliminate the next time the render target is set.
|
// Make sure that we don't eliminate the next time the render target is set.
|
||||||
curRenderTargetView_ = nullptr;
|
curRenderTargetView_ = nullptr;
|
||||||
curDepthStencilView_ = nullptr;
|
curDepthStencilView_ = nullptr;
|
||||||
|
stepId_ = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1394,11 +1400,13 @@ void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x
|
||||||
D3D11_BOX srcBox{ (UINT)x, (UINT)y, (UINT)z, (UINT)(x + width), (UINT)(y + height), (UINT)(z + depth) };
|
D3D11_BOX srcBox{ (UINT)x, (UINT)y, (UINT)z, (UINT)(x + width), (UINT)(y + height), (UINT)(z + depth) };
|
||||||
context_->CopySubresourceRegion(dstTex, dstLevel, dstX, dstY, dstZ, srcTex, level, &srcBox);
|
context_->CopySubresourceRegion(dstTex, dstLevel, dstX, dstY, dstZ, srcTex, level, &srcBox);
|
||||||
}
|
}
|
||||||
|
stepId_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool D3D11DrawContext::BlitFramebuffer(Framebuffer *srcfb, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dstfb, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter, const char *tag) {
|
bool D3D11DrawContext::BlitFramebuffer(Framebuffer *srcfb, int srcX1, int srcY1, int srcX2, int srcY2, Framebuffer *dstfb, int dstX1, int dstY1, int dstX2, int dstY2, int channelBits, FBBlitFilter filter, const char *tag) {
|
||||||
// Unfortunately D3D11 has no equivalent to this, gotta render a quad. Well, in some cases we can issue a copy instead.
|
// Unfortunately D3D11 has no equivalent to this, gotta render a quad. Well, in some cases we can issue a copy instead.
|
||||||
Crash();
|
Crash();
|
||||||
|
stepId_++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1519,6 +1527,7 @@ bool D3D11DrawContext::CopyFramebufferToMemorySync(Framebuffer *src, int channel
|
||||||
if (!useGlobalPacktex) {
|
if (!useGlobalPacktex) {
|
||||||
packTex->Release();
|
packTex->Release();
|
||||||
}
|
}
|
||||||
|
stepId_++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1562,6 +1571,8 @@ void D3D11DrawContext::BindFramebufferAsRenderTarget(Framebuffer *fbo, const Ren
|
||||||
if (mask && curDepthStencilView_) {
|
if (mask && curDepthStencilView_) {
|
||||||
context_->ClearDepthStencilView(curDepthStencilView_, mask, rp.clearDepth, rp.clearStencil);
|
context_->ClearDepthStencilView(curDepthStencilView_, mask, rp.clearDepth, rp.clearStencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stepId_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// color must be 0, for now.
|
// color must be 0, for now.
|
||||||
|
|
|
@ -599,11 +599,16 @@ public:
|
||||||
|
|
||||||
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override;
|
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override;
|
||||||
|
|
||||||
|
int GetCurrentStepId() const override {
|
||||||
|
return stepId_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LPDIRECT3D9 d3d_;
|
LPDIRECT3D9 d3d_;
|
||||||
LPDIRECT3D9EX d3dEx_;
|
LPDIRECT3D9EX d3dEx_;
|
||||||
LPDIRECT3DDEVICE9 device_;
|
LPDIRECT3DDEVICE9 device_;
|
||||||
LPDIRECT3DDEVICE9EX deviceEx_;
|
LPDIRECT3DDEVICE9EX deviceEx_;
|
||||||
|
int stepId_ = -1;
|
||||||
int adapterId_ = -1;
|
int adapterId_ = -1;
|
||||||
D3DADAPTER_IDENTIFIER9 identifier_{};
|
D3DADAPTER_IDENTIFIER9 identifier_{};
|
||||||
D3DCAPS9 d3dCaps_;
|
D3DCAPS9 d3dCaps_;
|
||||||
|
@ -1160,6 +1165,7 @@ void D3D9Context::BindFramebufferAsRenderTarget(Framebuffer *fbo, const RenderPa
|
||||||
|
|
||||||
dxstate.scissorRect.restore();
|
dxstate.scissorRect.restore();
|
||||||
dxstate.viewport.restore();
|
dxstate.viewport.restore();
|
||||||
|
stepId_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t D3D9Context::GetFramebufferAPITexture(Framebuffer *fbo, int channelBits, int attachment) {
|
uintptr_t D3D9Context::GetFramebufferAPITexture(Framebuffer *fbo, int channelBits, int attachment) {
|
||||||
|
@ -1187,10 +1193,6 @@ uintptr_t D3D9Context::GetFramebufferAPITexture(Framebuffer *fbo, int channelBit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LPDIRECT3DSURFACE9 fbo_get_color_for_read(D3D9Framebuffer *fbo) {
|
|
||||||
return fbo->surf;
|
|
||||||
}
|
|
||||||
|
|
||||||
void D3D9Context::BindFramebufferAsTexture(Framebuffer *fbo, int binding, FBChannel channelBit, int color) {
|
void D3D9Context::BindFramebufferAsTexture(Framebuffer *fbo, int binding, FBChannel channelBit, int color) {
|
||||||
D3D9Framebuffer *fb = (D3D9Framebuffer *)fbo;
|
D3D9Framebuffer *fb = (D3D9Framebuffer *)fbo;
|
||||||
switch (channelBit) {
|
switch (channelBit) {
|
||||||
|
@ -1228,6 +1230,7 @@ bool D3D9Context::BlitFramebuffer(Framebuffer *srcfb, int srcX1, int srcY1, int
|
||||||
RECT dstRect{ (LONG)dstX1, (LONG)dstY1, (LONG)dstX2, (LONG)dstY2 };
|
RECT dstRect{ (LONG)dstX1, (LONG)dstY1, (LONG)dstX2, (LONG)dstY2 };
|
||||||
LPDIRECT3DSURFACE9 srcSurf = src ? src->surf : deviceRTsurf;
|
LPDIRECT3DSURFACE9 srcSurf = src ? src->surf : deviceRTsurf;
|
||||||
LPDIRECT3DSURFACE9 dstSurf = dst ? dst->surf : deviceRTsurf;
|
LPDIRECT3DSURFACE9 dstSurf = dst ? dst->surf : deviceRTsurf;
|
||||||
|
stepId_++;
|
||||||
return SUCCEEDED(device_->StretchRect(srcSurf, &srcRect, dstSurf, &dstRect, filter == FB_BLIT_LINEAR ? D3DTEXF_LINEAR : D3DTEXF_POINT));
|
return SUCCEEDED(device_->StretchRect(srcSurf, &srcRect, dstSurf, &dstRect, filter == FB_BLIT_LINEAR ? D3DTEXF_LINEAR : D3DTEXF_POINT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,6 +1248,9 @@ void D3D9Context::HandleEvent(Event ev, int width, int height, void *param1, voi
|
||||||
device_->GetRenderTarget(0, &deviceRTsurf);
|
device_->GetRenderTarget(0, &deviceRTsurf);
|
||||||
device_->GetDepthStencilSurface(&deviceDSsurf);
|
device_->GetDepthStencilSurface(&deviceDSsurf);
|
||||||
break;
|
break;
|
||||||
|
case Event::PRESENTED:
|
||||||
|
stepId_ = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,6 +478,10 @@ public:
|
||||||
|
|
||||||
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override {}
|
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override {}
|
||||||
|
|
||||||
|
int GetCurrentStepId() const {
|
||||||
|
return renderManager_.GetCurrentStepId();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ApplySamplers();
|
void ApplySamplers();
|
||||||
|
|
||||||
|
|
|
@ -482,6 +482,10 @@ public:
|
||||||
|
|
||||||
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override;
|
void HandleEvent(Event ev, int width, int height, void *param1, void *param2) override;
|
||||||
|
|
||||||
|
int GetCurrentStepId() const {
|
||||||
|
return renderManager_.GetCurrentStepId();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VulkanTexture *GetNullTexture();
|
VulkanTexture *GetNullTexture();
|
||||||
VulkanContext *vulkan_ = nullptr;
|
VulkanContext *vulkan_ = nullptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue